generated from Jaysyn/ModuleTemplate
52 lines
2.0 KiB
Plaintext
52 lines
2.0 KiB
Plaintext
//Draw nearest viewing guard to prevent door from being bashed.
|
|
//Take 15 gold from player
|
|
// by Jeff Narucki - July 2002 - based on code from NWN Boards @ Bioware - Author Unknown
|
|
// Description:
|
|
// This code is based upon something that I found on the Bioware
|
|
// boards. I thought it was a little harsh to throw someone in the brig
|
|
// damaging property, so I modified this to have the user fined.
|
|
// This does not check to see if they have no more money, so it is possible to
|
|
// take another action if that was the case. For a future revision, I'll probably
|
|
// just turn a flag on such as "crook" or "vagrant" on that user so that the
|
|
// next time they respawn they wind up in jail.
|
|
#include "NW_O2_CONINCLUDE"
|
|
#include "NW_I0_GENERIC"
|
|
void main()
|
|
{
|
|
int nGuardCounter = 0;
|
|
int nNth = 0;
|
|
object oPlayer = GetLastAttacker(OBJECT_SELF);
|
|
object oGuard;
|
|
|
|
//Do nothing if the basher is not a PC
|
|
if ( !GetIsPC(oPlayer) )
|
|
{return;}
|
|
|
|
//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, ActionMoveToLocation(GetLocation(oPlayer), TRUE));
|
|
AssignCommand( oGuard, TakeGoldFromCreature(15,oPlayer));
|
|
switch(d4()) {
|
|
case 1: AssignCommand( oGuard, SpeakString("There's a law against that..."));
|
|
break;
|
|
case 2: AssignCommand( oGuard, SpeakString("That's against the law..."));
|
|
break;
|
|
case 3:
|
|
case 4:
|
|
break;
|
|
}
|
|
// Decided not to have guards walk way points again since I
|
|
// wanted to give the feel that they were staying at the scene
|
|
// for a while. I turn back the WalkWayPoints if someone talks to them
|
|
// AssignCommand( oGuard, WalkWayPoints());
|
|
// AssignCommand( oGuard, ActionAttack(oPlayer) );
|
|
}
|
|
}
|
|
|