/* 1. Friend or Foe script.
2. This script will make an NPC check the PC to make sure they are carrying a
certain item. If they aren't then the NPC will turn hostile and attack them.
3. To make this work just place this script in the NPC's "on percieved" script
slot. Make the item ring and test with and without the PC carrying the ring.
Obviously make sure the Item anme matches the one in the script itself.
*/
// Friend or Foe Script: tm_guard_op
// This should be placed in the OnPerceived handle of a guard.
//
// The guard will check to see if a PC has a passring, and if not, attack.
#include "NW_I0_GENERIC"
object oSeen = GetLastPerceived();
object oRing = GetItemPossessedBy(oSeen, "RING_01");
void main()
{
// If it isn’t a PC that the guard sees, it won’t do anything.
if (GetIsPC(oSeen))
{
if (oRing == OBJECT_INVALID)
{
// If the PC doesn’t have the ring, attack the PC.
ActionSpeakString("You should not be here, DIE!");
ActionDoCommand (AdjustReputation(oSeen, OBJECT_SELF, -100));
ActionDoCommand (DetermineCombatRound());
}
else
{
// Otherwise the PC does have the ring. Be friendly.
ActionPlayAnimation(ANIMATION_FIREFORGET_GREETING);
ActionSpeakString("You hold the amulet, pass FRIEND!.");
}
}
}
/* Just edit the RING_01 and the speakstring to suit your needs and item name.
Thanks to David for fixing the one line I couldn't work out myself.
Michael */