My first attempt at a "watcher" script
Here's what I've come up with. Any help in this would be greatly appreciated.
Background: Player finds item, and item gives him pvp status until he can take the item safely to his kingdom. Each time player zones, certain npcs look for him in an attempt to get the item (via an aggro object in player.pl). If one of those npcs catches up with him and kills him, the following script is triggered: Code:
#Slayer pl Code:
#Watcher pl -- watcher is on a 2-point stationary grid with a 5-sec delay Code:
#Lord pl -- spawned in slayer script |
Just to avoid wasting anyone's time, I've already caught SUB EVENT_WAYPOINT and changed it to sub EVENT_WAYPOINT.
I also placed . . . "quest::delglobal("king");" just above the "quest::setglobal("king", 4, 7, "F");" in the Slayer script. The script is still not working. |
Did you check for typos? again, this will help.
|
Might want to change timer to $timer
|
Quote:
|
The syntax of all three scripts checks out "ok"
|
Quote:
|
Script still does not work :(
|
Quote:
Code:
sub EVENT_WAYPOINT { |
I don't understand this;
Code:
if (defined($qglobals{king})) kingdomfaction = king1 you have to follow sequence to set a global; Code:
quest::delglobal("king1"); Code:
if (defined($qglobals{king})) |
Okay, I've narrowed down the problem to the watcher script. I sandwiched the "setglobal" in the slayer script between two shouts, like this:
Code:
quest::delglobal("king"); I also added some shouts to the watcher script, like this: Code:
sub EVENT_WAYPOINT |
Is your watcher set to have access to qglobals in the npc_types table?
|
Quote:
In the meantime . . . I have been playing with the watcher script and changed it from this: Code:
sub EVENT_WAYPOINT Code:
sub EVENT_WAYPOINT |
No it only looks like it's working, but it's not - set the flag
|
Just to clarify, the flags allows that particular NPC to view the globals. This is so they don't have to exported for every single NPC (which, as you can imagine, can be VERY resource intensive). Anyone can set a global, even without the flag set in npc_types. That's why you can set it in the player.pl file (which coincidentally has the globals accessable automatically), but can't read it in the watcher script.
This caused me a lot of headache with the PoJ Trial of Execution when it was first changed, but once I figured it out, it was easy enough to fix. |
All times are GMT -4. The time now is 12:45 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.