PDA

View Full Version : Get item when NPC kills another


Randymarsh9
05-09-2009, 05:37 PM
I am making a quest where you have to heal an NPC and keep it alive while it kill another npc. I want you to be able to get an item if the one npc kills the other, but I can't figure out how. I have already tried a ton of different things.

Randymarsh9
05-09-2009, 05:46 PM
and is there any way other than making the one NPC the persons pet to be able to heal him

joligario
05-09-2009, 07:41 PM
On this one, I would probably set up a script on the NPC you are supposed to keep alive to attack and wait for a signal. I would have the NPC that is supposed to die signal the NPC you are supposed to keep alive. Then the one you keep alive can give you the item. Not sure how you are going to keep any PC from helping to kill, though... unless you do an aggro check and check to see the npc type/id.

litlamzetiv
07-08-2009, 12:06 PM
Perhaps you could have the target walk a path, and when he gets to the end of the path, despawn and repop as a quest mob that hands out the item you want. Halfway down the path, the mob is attacked and defends itself, and that's when you want to heal it.

The thought is, if it doesn't make it to the end, then it can't give out the item, and it can't make it to the end without living through the attack?

Congdar
07-08-2009, 12:50 PM
joligario's solution is probably the best way to do it. In event_death on the other npc use quest::signal() to send a signal to the one you heal and have that event_signal code in the healed npc give you the item. not sure how to deal with the heal issue.

Yeormom
07-08-2009, 01:20 PM
I would add an entire new function to your zone server source code to put the item inputted through the new quest function directly on the corpse of other when desired and add the quester(s) as an authorized looter. It might be out of scope for you but if not, have fun!

Dibalamin
07-13-2009, 02:23 PM
You'll need a player.pl using the sub EVENT_CAST to check for all your heal spells, give you a global variable and then send a signal to the OTHER mob (the dying one) that will check all possible targets in range, reward the item to the PC that has the global variable upon his death, then clear the variable.

You can also use the sub EVENT_CAST_ON I believe.