Author Sticky: Post Working Scripts Here
Phalzyr Posted: Thursday, 04 July 08:05PM
After only finding two ways to make npcs protect their stuff in this thread, and 1 too hard to implement easiely and both relying on special TAG names I thought I'd post this one for you all.

1. attackondisturbe or somesuch

2. What it does: A simple non-TAG related way to get FActions to protect their valuables. -20 from rep each event. The guarding faction doesn't need to see the event, in fact if some other alert member of society is closest to you when doing the ill deed and they see you, both his/her faction and the faction the object belongs to will be lowered.

3. Notes: This is a universal script and can be put in any scipt slot of the object except ondisturbed(I guess i don't know how to disturb somethign to fire this or at least it didn't work on the chest I put it on). Though attacked,open,used,unlock etc work for me. I didn't try on heartbeat (that'd be sily) Don't forget to include "nw_i0_generic".

4. The Script itself

NWScript:
#include "nw_i0_generic"

void main()

{

    object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC,OBJECT_SELF);

    object oNPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_NOT_PC,oPC,0);

    if (GetObjectSeen(oPC,oNPC)) {

      if (!GetFactionEqual(oPC,OBJECT_SELF)) {

        AdjustReputation(oPC, OBJECT_SELF, -20);

        if (!GetFactionEqual(oNPC,OBJECT_SELF)) {

          AdjustReputation(oPC, oNPC, -20);

        }

        AssignCommand(oNPC,ActionAttack(oPC));

      }

    }

}



_________________
Phalzyr
--------------------------------------
Insanity Is Just A Matter Of Opinion!