Jump to content
  • 0

While loop inside instance causes map error on destroy


bodibastos

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  45
  • Reputation:   0
  • Joined:  10/13/12
  • Last Seen:  

I've been working on a custom instance, and I use a while loop to keep spawning monsters at certain positions while the boss fight is ongoing. Basically, the code looks like this:

while ('alive){
	<stuff to spawn monsters>
	sleep 45000;
    }
end;
      
      

It's working fine, and if I defeat the boss and leave the instance everything is perfect.

However, if the instance is destroyed while the boss is still alive (such as by timeout or by players disbanding their party), the Map Server returns a RID error (player not attached), as per the screenshot below:

WPCs9Wm.png

 

Does anyone know how I could stop this from happening? It doesn't affect gameplay at all, but I'd hate having these erros clogging up the console every time someone fails the instance at the boss fight. I've tried using OnInstanceDestroy to disable the NPCs which are running these scripts, but it doesn't solve the issue. I also tried leaving everything inside the while loop blank except for the sleep command, so I know the mistake isn't on the script to spawn monsters but on the "while" itself.

I also checked if there's a player attached while the script is running and there isn't, which is why it strikes me as weird that the game would start complaining about that once the instance is destroyed.

 

 

 

 

Edited by bodibastos
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  665
  • Reputation:   673
  • Joined:  11/12/12
  • Last Seen:  

Did you update your sources to the latest revision? This commit should have fixed your issue : https://github.com/rathena/rathena/commit/afa880ebd6bd55c2ecaa479cf00697db568ab353

(I'm unable to reproduce your problem.)

If that didn't work or if you're already fully up to date, could you provide a bigger script sample?

Edited by Tokei
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  45
  • Reputation:   0
  • Joined:  10/13/12
  • Last Seen:  

6 hours ago, Tokei said:

Did you update your sources to the latest revision? This commit should have fixed your issue : https://github.com/rathena/rathena/commit/afa880ebd6bd55c2ecaa479cf00697db568ab353

(I'm unable to reproduce your problem.)

If that didn't work or if you're already fully up to date, could you provide a bigger script sample?

Thank you, Tokei. This fixed it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...