BioWare Forums: View Post For Code Display


You are viewing a single post. Please do not take this post out of context.
Read the full topic: Post Working Scripts Here

Author Sticky: Post Working Scripts Here
WyrmSoul Posted: Thursday, 11 July 06:49PM
Name: on_dam_att
Purpose: Attacks anybody who starts bashing a door by the closest 3 people in sight
Notes: it goes in the onDamaged script. Put on objects or NPCs that you don't want bashed or attacked. Was made for doors, to prevent bashing in public places but works for anybody.

NWScript:
void main()
{
int nGuardCounter = 0;
int nNth = 0;
object oPlayer = GetLastAttacker(OBJECT_SELF);
object oGuard;
//attack basher by the 3 closest NPCs in sight
while (nGuardCounter<3) {
    nNth++;
    oGuard = GetNearestCreature( CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_NOT_PC, OBJECT_SELF, nNth);
    if ( !GetIsObjectValid(oGuard) ) {return;}
    if ( !GetObjectSeen(oPlayer, oGuard) ) {continue;}
    nGuardCounter++;
    AssignCommand( oGuard, ClearAllActions() );
    AssignCommand( oGuard, ActionAttack(oPlayer) );
    }
}


Thank you Maalen. Thank you thank you thank you.
If that saves 1000 people one hour each, it's probably worth $10,000
A link in the NwN Vault at least!
_________________
Click Here okay so it's a joke to compared to NWN...

[ Edited By WyrmSoul: Thursday, 11 July 05:05PM (GMT) ]

This post taken from the BioWare Forums
Powered by BioBoards Version 2.05.008
Please read our Copyright and Trademark Information