perplexed
I have been using the same global quest scripts for certain npcs since I figured out how to do them several years ago, But for some reason they are no longer working, and I am getting a lot of anomalies with their paired-down versions. One is for my wandering npc who travels from zone to zone; the other is for my global watcher npc who activates the spawn for the wanderer. The paired-down scripts are below:
Watcher Script (NPCID 999281 ) Code:
my $EventStart; Code:
sub EVENT_SPAWN First of all, the Watcher script is supposed to spawn the Wanderer right next to the Watcher. Instead, the Wanderer spawns at the zone entrance point, which is quite a distance from the Watcher. Second, once the Wanderer spawns, he is supposed to shout "Hi." Instead, it is the Watcher that ends up shouting "Hi." The chat box in game displays the following text: Quote:
|
The problem with the mob spawning in the wrong location is because you are setting your variables when the script is initialized(ie on spawn) so when it hits the waypoint the variables remain the same. To fix that you need to do it like this:
Code:
my $EventStart = 0; |
Even then, those variables don't need to be overridden. Those variables are passed with the waypoint event.
BTW: You should specify EVENT_WAYPOINT_ARRIVE or EVENT_WAYPOINT_DEPART. |
Below is the complete script for each NPC. I backed-up the originals and removed all but the relevant script from each to do this testing. I also rewrote the Watcher script per Caryatis:
Watcher Code:
## 999281, Watcher Quote:
Quote:
Code:
my $EventStart = 0; Code:
sub EVENT_SPAWN Quote:
By the way, both WAYPOINT_ARRIVE and WAYPOINT_DEPART (per joligario) break the script (I have an older version of the server code and it may not have the ability to do these functions). The larger question is, why would a commented-out line impact the script? I am using Notepad++, and I have ensured there are no extra spaces in the commented-out line nor in the blank line below it. This has never been an issue before. Any ideas why it would respond this way? |
Okay, I resolved that particular issue by enclosing the header in pound signs, like so . . .
## 999281, Watcher ## For some reason, this works whereas simply beginning the header line with pound signs does not . . . ## 999281, Watcher I don't know whether this is a bug but if anyone else is experiencing broken scripts that should otherwise work fine, you may want to add pound signs on both sides of comments and titles. Now the two scripts are working as they should I have noticed one other oddity; namely, that sometimes the Watcher script spawns the Wanderer when entering the zone and other times it requires that I do a #reloadquest command before it will work. the two scripts (in toto) are below: Watcher Code:
## 999281## Code:
## Wanderer, npcid 999228## As I said, everything works well except for the spawning of the Wanderer. Sometimes he spawns when I enter the zone in which the global is set and other time he does not, When he doesn't, I can simply do a #reloadquest command and a #depop, and all is well again (the Watcher spawns, then he spawns the Wanderer, and the Wanderer goes on his happy way along the grid to the designated waypoint, where he shouts an exit message, depops, and sets the qglobal to the next zone in the series). My question is, why does the Watcher not spawn the Wanderer without my having to do a #reloadquest? How can I fix this? |
Just some information I left out. Sometimes when the Wanderer does not spawn, if I exit the game and restart the Emulator, then go back in, it'll work without #reloadquest (not always, and never if I just exit to the character select screen before going back in). Also, once I do a #reloadquest command and the Wanderer spawns, if I zone out before the Wanderer has had a chance to complete the grid, then enter the zone again, the script always works correctly (the Watcher spawns and in turn always spawns the Wanderer without fail) no matter how many times I zone out and zone back in. But once the Wanderer completes the grid, sets the qglobal to the next zone in the series, then depops, the problem starts all over again.
|
All times are GMT -4. The time now is 10:54 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.