Difference between revisions of "SurrenderToEnemies"

From NWN Lexicon
Jump to: navigation, search
(Example)
 
Line 1: Line 1:
 
+
{{DISPLAYTITLE:SurrenderToEnemies()}}__NOTOC__
 
+
Causes all creatures in a 50 meter (54.5 tile) radius to stop actions, improves the creature's reputation with nearby enemies for 3 minutes. Only works for NPCs.
 
 
 
 
=SurrenderToEnemies()=
 
 
 
Causes all creatures in a 10 meter (1 tile) radius to stop actions, improves the creature's reputation with nearby enemies for 3 minutes. Only works for NPCs.
 
 
 
 
<nwscript>
 
<nwscript>
 
void SurrenderToEnemies();
 
void SurrenderToEnemies();

Latest revision as of 16:34, 13 September 2020

Causes all creatures in a 50 meter (54.5 tile) radius to stop actions, improves the creature's reputation with nearby enemies for 3 minutes. Only works for NPCs.

Description

Use this on an NPC to cause all nearby creatures to stop what they are doing and sets the NPC's enemies within this range to be neutral towards the NPC for roughly 3 minutes. If this command is run on a PC or an object that is not a creature, nothing will happen.



Remarks

Very useful function. Can for instance be used to make an enemy surrender just before dying, to try and cut a deal with his attackers...

It applies to creatures in a radius of about 50m from the caller, which is sufficient for almost all purposes (the official Bioware description says 10m, but that seems to be out-of-date).

Note that the function applies to the caller. As always, if the creature due to surrender is not the caller of the current script, AssignCommand can be used. However, in that case, the function will not take effect immediately. Anything that needs to happen afterwards must be delayed (by assigning further commands to the same creature, for example).

The function adjusts personal reputation. Even members of global factions are affected.


Known Bugs

Previous bug about wounding fixed in 1.62, the function does remove wounding effects from creatures so you can talk to them.


Version

1.61

Example

//Cause an NPC to attack a player and then surrender so the player does not auto attack back at them.
void main()
{
     object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
     DelayCommand(2.0, SurrenderToEnemies()); 
     ActionAttack(oPC, TRUE);
}

It is possible to make the caller change sides during a battle:

// In this example, oNewEnemy is a creature previously on our side who we will now attack.
SurrenderToEnemies();
ClearPersonalReputation(OBJECT_SELF, oNewEnemy);
ClearPersonalReputation(oNewEnemy, OBJECT_SELF);
DetermineCombatRound();

See Also

functions: 

SurrenderAllToEnemies



 author: John Shuell, editor: Jasperre