Jump to content
  • 0

Avoid MVP to respawn on reload


Joshua93

Question


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.01
  • Content Count:  6
  • Reputation:   0
  • Joined:  09/11/23
  • Last Seen:  

Hello,
I'm trying to not respawn all MVPS that were killed (normal MVPS, no branches), so whenever I reload my scripts or restart the server, the tomb will remain there, and MVPS will be waiting the same respawn as they had when they were killed.
 
I've also used a top 3 of people with more damage on the tomb, maybe I could keep that too somehow?
 
I tried with some scripts (like spawning the MVP manually) but had no success at all because the convex mirror would not work as intended.
 
So I tried editing the source code manually (which I don't know would be correct for this scenario) - but I have something working like:
- Use the custom MVP logs to save in DB info about who did/how much damage, the killer, and some other info like the respawn time.
 
- Then when I spawn the mobs in mob.cpp I check only for bosses through SQL if the mob is in respawn or not, in case is in respawn -> spawn the tomb with the data I mentioned, if should be already out -> spawn the normal mvp.
 
For that, I had to use some customized functions based on the original ones, like adding more parameters or skipping some behavior on those ones (like unnecessary checks) + set the correct respawn timer.
The question is, is there any better approach to do this? - Is it fine the approach I did to update the source code?..
I checked many posts about it but I got no success with them yet.
 
Thank so much in advance!!
Edited by Joshua93
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  898
  • Reputation:   119
  • Joined:  05/23/12
  • Last Seen:  

I can't provide a script yet but a walkthrough

 

Create a script which loop throw a database table with mobs who should respawn etc. (MobID, Name, Map, X, Y boolean if it is MVP or not, respawn time in minutes)

Create a 2nd database with mobs and dead time in minutes

OnInit loop throw 1st table. Search in 2nd table and check if mob should respawn or not. If respawn change the dead time to -1. If -1 the mob is still alive. If the mob doesn't exist spawn it (for their first time). Add a timer to repeat or a event OnSecond59

OnPCKillMobEvent check if mob is on 1st table and if it is check if it is on 2nd table too. If not add it or else change the dead time to current Unix time devided by 1000.

It could be laggy therefore I recommend to use minutes or greater.

 

 

If convex mirror don't work u can create a custom function to check if monster is alive and use getunitdata to check position and add a blip on map like convex mirror.

 

Rynbef~

Edited by Rynbef
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.01
  • Content Count:  6
  • Reputation:   0
  • Joined:  09/11/23
  • Last Seen:  

Thank you, I tried this approach for some MVPs like bio/custom Nyd and works great.

However for the thing I mentioned, I could manage to spam the MVP/tomb through the source code using the current mvp_log.
Also the respawn will continue correctly, and convex is working with no issues after reload my server.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.01
  • Content Count:  39
  • Reputation:   30
  • Joined:  06/08/23
  • Last Seen:  

log detail of boss monster you need on function mob_setdelayspawn, do not forget to check if it boss monster (md->spawn->state.boss)

on where monster (in this case  boss monster) spawn script parsed (npc_parse_mob) before it spawned look up from sql table
detail that you saved and modify what you want it to be modified let's say the spawn time.

check if it greater or same or passed of current tick state where it should be still tomb or has been respawned.

if yet spawned copy or modify function of mob_setdelayspawn and spawn tomb (mvptomb_create) then if it should has been spawned
run as it should

the important part where the monster spawned is in function npc_parse_mob2, with this it would spawn like natural spawn

I didn't look deep enought to get working mod, but it should be close enough

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...