| Author: | WyrmSoul |
| Author Website: | http://ao.tripod.com/dungeonpager/dungeonpager.html |
| Script Name: | Bash & Attack (Placeables) |
| Description: | This script causes the closest 3 NPCs to a door to attack anyone that bashes the door. |
| Instructions on Use: | It goes in the OnDamaged script. The script was written to protect doors but could easily be used to protect other placeable containers as well. |
Script (OnDamaged):
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) ); } } |