![]() |
Things that stop NPCs
Zodiac's inventory has a major bug.
It randomly stops. By stopping, I mean it doesn't carry out any functions or catch any events. I have no idea what causes it. The only thing I can think of that stops an NPC like this is when a script exceeds the loop limit. The console log doesn't give a loop limit exceeded error. I can't fully debug the problem, because I can't make the bug happen to myself. However, a majority of Zodiac has it. These bugged players all seem to have the Stealth skill, but I also have it and I'm not experiencing the bug. PHP Code:
PHP Code:
|
temp.modz = clientr.mods;
while (temp.modz.index("stealthup") >= 0) { temp.stealthtime += temp.modz[temp.modz.index("stealthup")+1]; temp.modz.delete(temp.modz.index("stealthup")+1); temp.modz.delete(temp.modz.index("stealthup")); } if the last member of temp.modz is "stealthup" and you do temp.modz.delete(temp.modz.index("stealthup")+1); why delete the member after "stealthup" if that was the last member? correct me if I am wrong and why you have two temp.modz.delete(temp.modz.index("stealthup")+1); temp.modz.delete(temp.modz.index("stealthup")); ? or secret? oh and also, if last member is "stealthup" (again) why use temp.stealthtime += temp.modz[temp.modz.index("stealthup")+1];? (not sure if this would do something that I can't see in the script) and again, correct me if I am wrong |
Quote:
The mod that increases stealth time takes the form of 'stealthup,time' so it deletes both the time and the stealthup |
ah, just wondered :D
but I was thinking of something, doesn't temp. variables get deleted after the ending bracet? if (clientr.element == "Dark") { temp.stealthtime = clientr.levels.Thief * 1.5; } else if (clientr.element == "Light") { temp.stealthtime = clientr.levels.Thief * .5; } else { or..? And again (and again xD) correct me if I am wrong :) but, do the function onCast() check if it allready has the buff (can't see the ckecking stuff in the script) and is onCast() done outside the same script? if so; sleep(this.ftime); if you cast the function from outside the script while the script has sleep wouldn't it stop the script? That happened too one of my scripts (everytime it added an showani of players head and used sleep then hide it, but when player died (or have been hitted many times) the script stopped and I have to update the script) Well that problem is gone now, but I dunno if you should use sleep there :O Correct me if I am wrong, but I am guessing its wrong but I am trying atleast ^^ |
Sleep sometimes breaks timeout.
|
ah
|
Quote:
|
hmm, not weird my script stopped, well I made an count variable and when it went under 0 it hided the showani.. xD
oh well ^^ |
Where is the timer started? A common error in scripts is to start the timer in onCreated(), but the timer is stopped in various situations when switching levels, so you need to start the timer in onPlayerEnters, on clientside, always.
|
I have experienced this error alot while scripting the Malorian baddy.
NOTE FOR SENSITIVE READERS: GS1 PHP Code:
Another example: PHP Code:
|
I remember such problems with GS1 on serverside yes (sleep is using a timeout event internally), that's not happening with new scripting engine though.
|
It doesn't seem to be timer related. I don't see how the Stealth NPC can cause it to bug, either, because nothing Stealth does is related to the Inventory.
The +Inventory NPC stops responding, like when an NPC exceeds the loop limit. It can't catch any events, such as onPlayerChats, and it can't do anything. |
When I was first learning to script I realized that whenever I used a while() command without making it a continuous loop my script and game would freeze. Just on the off-chance that it does this maybe you'd want to try using something other than while()?
|
while () causes it to freeze when you don't have a limiter on it. In my case, it deletes each instance of 'stealthup' it finds, so it can't be go on forever.
A lot of other NPCs use while() as well, but only Stealth seems to cause the problem. :( |
Normally the only thing that can stop the script completely from running is to do "this.ispaused = true" (or destroy() of course).
An exceeded loop-limited is just ending the current script execution, but other events are still working. Other than that, most of the time when a clientside script is not doing anything it is because of the timer is not set. |
Hmm, that's weird.
I can't see why the NPC would do this.. I had thought maybe it was breaking out of the timer or the on/off variable was getting stuck, but then I added a function to echo when the player chats. When the inventory broke, it stopped echoing. |
*shrug*
Maybe its not the Stealth NPC that these players all have in common? If it is something relating to Stealth, maybe there's something in the Inventory NPC? If neither of those two then it has to be something else, if all of this stuff is wrong... *puffs pipe and plays violin* |
| All times are GMT +2. The time now is 09:18 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.