Embedding a script into normal spawns

  • Thread starter Thread starter Axiom
  • Start date Start date
A

Axiom

Guest
Hey, so I built this quest for Novices where they kill a specific kind of Poring that spawns regularly around town. My first approach was to only have the mobs spawn upon activating the quest like so:

monster prontera,0,0,"Pesky Poring",1002,20,"Sari#Elmina::OnPeskyDeath";

The embedded behavior is to keep track of how many have been killed using a variable. This approach is problematic though, firstly because spawns are at a set number and if any other player kills the marks, whoever is performing the quest is screwed. Instead, I planned on making the Porings spawn automatically like so:

prontera,0,0,0,0 monster Pesky Poring 1002,30,0,0,0,"Sari#Elmina::OnPeskyDeath";

... I'm actually not sure it's possible to embed a behavior into naturally spawning mobs. Is there a better way to handle this, or did I not format this behavior properly?

 
You could probabbly do something like

OnNPCKillEvent:if (custom_quest == 1) {if (killerrid == custom_mob_id_for_quest) killed_mob += 1;mes "You killed "+killed_mob+" so far";} 
Its a really cheap-basic code, but should be able to get the job done. 

I just thought of another possible approach. 

Say the monsters spawn in a specific map with a function triggered on their death.Assuming each character who beings the quest spawns X set of monster, in the OnPeskyDeath event, you could check wether or not the character has the quest enabled. If the quest has not been taken/enabled/isnt active/whatever. Respawn another mob. Otherwise add the points. (This could probabbly be a lot healthier than the suggestion I posted above
default_tongue.png
)
 
Last edited by a moderator:
One thing about the first suggestion:

I didn't set these as custom mobs, just Porings renamed to something else because I also have normal Porings spawning with them. Is there any way to distinguish between the two using OnNPCKillEvent?

Also, I'm now testing the second solution. Seems like a smarter way to handle it than the first anyway. Thank you!

 
Last edited:
Right. I didnt notice the IDs thing. As far as I know no, since the rid only returns the Class/ID of the killed mob. Which again, proves the second suggestion is far better
default_tongue.png


 
It is, and it's so simple I feel stupid for not figuring it out myself. Thank you!

 
Back
Top