My guards do not

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
redmedal

My guards do not

Post by redmedal »

my guards do not defend ?
what i do

]
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

Always need to include the version of POL you are running and if you are running POL Distro or not.

In the POL 95 Distro script named "townguard.src" located in \pol\scripts\ai this segment from the function "lookiehere" is what determines how the guard reacts in the presence of criminals.

Code: Select all

function lookiehere()
  foreach npc in ListMobilesNearLocation(me.x, me.y, me.z, 15)
    foreach listing in keys
      var range := SplitWords(cfgfile[listing].range);
      if((npc.x >= CInt(range[1])) && (npc.x <= CInt(range[3])) && (npc.y >= CInt(range[2])) && (npc.y <= CInt(range[4])))
        var timer := Cint(GetObjProperty(npc, "guardstimer"));
      	if((npc.criminal) and (!npc.dead))
          if(timer < ReadGameClock())
            SetObjProperty(npc, "#guardstimer", ReadGameClock() + 15);
      	    Fight(npc);
          endif

The "if ((npc.criminal..." is where that check is done. If one of the mobiles nearby is a criminal then the Fight function is called.

Your scripts should have something similar else your guards will just stand there.
redmedal

Post by redmedal »

it is doesnt work. call this is not a guarded area (i am at britain)
Fistandantilus
New User
Posts: 3
Joined: Tue Mar 07, 2006 2:26 am

Post by Fistandantilus »

in pol/regions there is a cfg file that determines areas subject to guard protection. look what you screwed, there or in any other part referring to that file.
Post Reply