EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::General Support (https://www.eqemulator.org/forums/forumdisplay.php?f=598)
-   -   Question about npc pl files (https://www.eqemulator.org/forums/showthread.php?t=38553)

noudess 07-31-2014 12:26 PM

Question about npc pl files and NPC movement.
 
Ok, I'm basically rewriting this question.. Ignore the previous version if you read it.

I have the following pl file.

The intent of personalpause for each instance of this mob (there are 6) to spawn and pick one of the points on his grid waypoints (0-42) as his "hangout"

The intent of delay is so each instance starts the grid at a different time after he spawns.

I added the write() stuff, as it seemed to do what I expected while I was in the zone to observe, but when I left and came back a day later, the NPCs are all bundled up.

What i noticed from my write() calls, is that the event spawn stuff spits out as soon as I boot the zone, but I don't see any WP arrivals until I zone in. Then they start coming out.

So my question: Is no npc movement happening while no one is in the zone?

Code:

my  $personalpause=0;

sub EVENT_SPAWN
    {
    $personalpause=plugin::RandomRange(0,42);
    $delay=plugin::RandomRange(0,300);
    quest::write("/tmp/madmen", "spawned pause($personalpause) delay($delay)");
    quest::settimer("movetimer",$delay);
    }

sub EVENT_WAYPOINT_ARRIVE
    {
    quest::write("/tmp/madmen", "arrived pause($personalpause) delay($delay)");
    if ($wp == $personalpause)
        {
        $pauselen=plugin::RandomRange(60,150);
        quest::pause($pauselen);
        }
    }

sub EVENT_TIMER
    {
    if ($timer eq "movetimer")
        {
        quest::stoptimer("movetimer");
        quest::start(62);
        }
    }


noudess 07-31-2014 02:16 PM

Added $mobid to the output...

Now it seems obvious that variables are crossing instances. mob 126 is using mob 128's random values...

id(125) spawned pause(3) delay(119)
id(126) spawned pause(38) delay(4)
id(127) spawned pause(15) delay(67)
id(128) spawned pause(17) delay(217)
id(129) spawned pause(35) delay(174)
id(130) spawned pause(33) delay(125)



id(126) arrived pause(17) delay(217)
id(126) arrived pause(17) delay(217)
id(126) arrived pause(17) delay(217)
id(126) arrived pause(17) delay(217)

noudess 07-31-2014 02:36 PM

So it looks like the variables are scoped to the npc_types id. I have 6 instances of mobname in the zone, using a spawngroup that chooses from a group of 4 various level versions. So, we end up with at least 2 identical npc_types spawning at diff spots. These duplicates share variables,

I can and have fixed it using variable arrays with $mobid as the index in the .pl file.

My questions that remain:

- I still see no wp arrivals until I zone in. Is that normal? They ARE NOT moving?

- It seems to me that the variables in a quest should scope to $mobid. It is illegal to have multiple instances of the same npc_type? I sure didnt think so.

- Can someone point me at the code that scopes these variables? I haven't been able tp parse through how that all happens yet. Maybe I can find a change so each instance of an NPC has its own variables.

vsab 08-01-2014 06:50 AM

IIRC the zone will "sleep" if there is no one in there, to conserve server resources.

Anyhoo, this may help explain the shared variable issue you had:-

http://wiki.eqemulator.org/p?The_Pow...Perl_Reference


All times are GMT -4. The time now is 01:24 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.