script/misc/candead.src or hook event "dead"
-
innominabile
- Adept Poster
- Posts: 85
- Joined: Wed Aug 30, 2006 5:24 pm
script/misc/candead.src or hook event "dead"
An hook decide when a mobile die?
A default hook with default code:
if (GetVital(who, VITALID_LIFE) < 1)
return 1; //DIED
else
return 0; //not died
endif
A default hook with default code:
if (GetVital(who, VITALID_LIFE) < 1)
return 1; //DIED
else
return 0; //not died
endif
-
Marilla
I'm not sure of the practicality of such a hook, and here's why:
First, I'm assuming the reason to ask for this is to implement custom death conditions, beyond your health falling to 0. The problem, then, is this: This hook would have to be triggerred at every possible time someone might ever possibly want to have death triggerred. For instance, maybe you want the player to die when their stamina reaches 0, too. In order for that to really be possible, the POL core would need to trigger the hook on stamina changes, in addition to hit point changes. Of course, it would make sense to also have it triggerred on mana changes.
But the thing is, where would they stop in implementing it? What's to say someone would not want to have death occur under... who knows what conditions? The problem is: If this new hook does not trigger under possible conditions related to how you want to do it, it's not useful at all to you.
And then, of course, would be the fact of having this extra hook script getting triggerred on all these various events occurring, the vast majority of which will never trigger actual death. (it needs to hook ALL stamina changes, for instance - because unless it hooks and tests that change, you can't know whether the change resulted in death). Essentially, even if it were somehow possible for the POL folks to predict what all ways people would want to hook this, it would be a problem similar to trying to hook the 'walk request' packet; A lot of extra work on the server to handle in scripts (though likely not quite as much extra effort).
Though I wouldn't use it for this, the only way I can see it being useful and not going crazy as noted above would be if it ONLY hooked hit point changes. Say you want people to die if they reach 5 HP or below, or some dynamic value based on other factors. But I'm just not sure how useful that would be (and it seems to me it could be handled more gracefully and intuitively simply be adjusting their hit points in the first place)
For all other uses, it just seems to me that when something happens that you want to cause death for a player, why not simply do Damage() to them enough to kill them?
First, I'm assuming the reason to ask for this is to implement custom death conditions, beyond your health falling to 0. The problem, then, is this: This hook would have to be triggerred at every possible time someone might ever possibly want to have death triggerred. For instance, maybe you want the player to die when their stamina reaches 0, too. In order for that to really be possible, the POL core would need to trigger the hook on stamina changes, in addition to hit point changes. Of course, it would make sense to also have it triggerred on mana changes.
But the thing is, where would they stop in implementing it? What's to say someone would not want to have death occur under... who knows what conditions? The problem is: If this new hook does not trigger under possible conditions related to how you want to do it, it's not useful at all to you.
And then, of course, would be the fact of having this extra hook script getting triggerred on all these various events occurring, the vast majority of which will never trigger actual death. (it needs to hook ALL stamina changes, for instance - because unless it hooks and tests that change, you can't know whether the change resulted in death). Essentially, even if it were somehow possible for the POL folks to predict what all ways people would want to hook this, it would be a problem similar to trying to hook the 'walk request' packet; A lot of extra work on the server to handle in scripts (though likely not quite as much extra effort).
Though I wouldn't use it for this, the only way I can see it being useful and not going crazy as noted above would be if it ONLY hooked hit point changes. Say you want people to die if they reach 5 HP or below, or some dynamic value based on other factors. But I'm just not sure how useful that would be (and it seems to me it could be handled more gracefully and intuitively simply be adjusting their hit points in the first place)
For all other uses, it just seems to me that when something happens that you want to cause death for a player, why not simply do Damage() to them enough to kill them?
When I first saw this I thought it had some potential.
The way I immediately envisioned it was that if the core detected it needed to process the core death stuff (prior to running chrdeath) then the hook could simply override it and in effect deny the mobile a decent burial.
There have been some situations recently that I could have used that if only to record some information before allowing the death.
The way I immediately envisioned it was that if the core detected it needed to process the core death stuff (prior to running chrdeath) then the hook could simply override it and in effect deny the mobile a decent burial.
There have been some situations recently that I could have used that if only to record some information before allowing the death.
-
innominabile
- Adept Poster
- Posts: 85
- Joined: Wed Aug 30, 2006 5:24 pm
A simplier solution could be:
a flag in pol.cfg or combat.cfg to disable automatic death when life reach zero.
a core command KillMobile() so in scripts I can decide when to kill a mobile.
Already now I can kill someone in scripts but now I can't be sure my script only kill someone.
Another mode could be a candeadh hook in which a parameter permit me to know if death come from scripts or core...
a flag in pol.cfg or combat.cfg to disable automatic death when life reach zero.
a core command KillMobile() so in scripts I can decide when to kill a mobile.
Already now I can kill someone in scripts but now I can't be sure my script only kill someone.
Another mode could be a candeadh hook in which a parameter permit me to know if death come from scripts or core...
It's a pity this thread has died. The more I think about it, the more I think it could be useful to me.
Hooking mobile death to me simply means being able to script whether to deny the core its right to process death. This is even before death.ecl and chrdeath.ecl are run so we could in fact change how we die if we wanted to.
I don't think it would be too hard to put this is, surely! (standard bribery fee - beer) What does it take to get something done around here?
Barring that, is there any other way to insert a script between getting to 0hp and dying?
Hooking mobile death to me simply means being able to script whether to deny the core its right to process death. This is even before death.ecl and chrdeath.ecl are run so we could in fact change how we die if we wanted to.
I don't think it would be too hard to put this is, surely! (standard bribery fee - beer) What does it take to get something done around here?
Barring that, is there any other way to insert a script between getting to 0hp and dying?
-
Marilla
Now that, I do very much like! I'm just not 100% sure that's what was being requested, due to my (possibly faulty) memory about other things the OP has spoken of; My impression was they wanted a way to determine if death was going to happen at all, which could be triggerred on other events than hit points reaching 0. But I could be all wet! in fact, the more I think of it, maybe I am all wet! (though the example hook script posted would not seem to make sense in a "CanDie" type of script, where the core is already trying to trigger death based on 0 hit points, and it's just asking you to confim if they can die)..OldnGrey wrote: Hooking mobile death to me simply means being able to script whether to deny the core its right to process death. This is even before death.ecl and chrdeath.ecl are run so we could in fact change how we die if we wanted to.
But it would be nice to be able to 'hook' that, and allow the hook script to be able to re-set their hit points and indicate not to kill the character. My guess would be that the return values would probably be opposite of what innominable's example hook script shows, as the typical way hooks are handled is you return 1 to say "This has been handled by script - the core can ignore it" or you return 0 to say "The script isn't handling this - the core needs to do what it would have done otherwise". So if you want them to go ahead and die, you'd need to return 0. But of course, such semantics would be up to the dev peeps!... but I do see some use for being able to cancel a death!
OldnGrey wrote:I have no clue as to whether I can persuade Austin to code this in.
Not in 097 is all he said - "it discriminates against dead people" I think were his words. Dammit, that's precisely what it does! And only a person in politically correct America would think of that as an excuse.
Code: Select all
<Austin> So im thinking
<Austin> the death hook... an instance is run for every mobile that exists and runs every 1 picosecond
<Austin> if it ever returns 1 that mobile dies
<OldnGrey> so, what's your beef with the death hook?
<Austin> its not so much beef
<Austin> as it is .. im a jew and its pork
<OldnGrey> ah, so I should have mentioned a generic meat substance in my metaphor
<Austin> ;]
<Austin> its all about political correctness
<OldnGrey> naturally.
<Austin> im more in favor of processed
<Austin> nautrally people would have opinion.. nautrally food has nutrients
<OldnGrey> as nelson mandella was obviously described as african american to avoid reference to his colour
<Austin> processed.. manufactured... people are politically correct and food contains ... uhm... ?
<OldnGrey> food?
<Austin> salt, fat and artificial coloring
<Austin> colors which we cant directly describe because thats profiling ;)
<OldnGrey> emulsified high fat offal tubes is a sausage
<OldnGrey> hmm, so I can't even call my daughter blond?
<Austin> correct
<Austin> you can call her a caucasian female or something
<Austin> calling her your daughter also offends orphans...
<OldnGrey> oh dear
<Austin> heh
<OldnGrey> she is a blond that dyed her hair blonder
<Austin> Lets refer to her as.. your offspring
<OldnGrey> I could not possibly explain that
<OldnGrey> estrogenical descendant?
<Austin> that works even better
<Austin> it shows that yes you took part in creating her..
<Austin> just like the orphans were created by parents at some point
<OldnGrey> of course. usually that is
<Austin> but you favor her no more than you favor them
<Austin> No feelings are hurt
<OldnGrey> so....
<OldnGrey> having established that, what was the issue with death hook?
<Austin> It offends the living
<Austin> definately not something thatll be seen in 097
<OldnGrey> yep, that definitely sounds more convincing than 'I can't be bothered'
Uhm... that leads to the question: Do NPC *live*?
Ever since a played "Little Computer People" I keep asking myself this question. I'm not really sure yet. That's also the reason why I changed from a player to an admin. I didn't want to keep klling them, not positively knowing if they live or are just existing in my fantasy. I instead wanted to create (aka spawn) them. I hope God isn't discriminated by me talking about myself as.. uhm kind of a creator.
Ever since a played "Little Computer People" I keep asking myself this question. I'm not really sure yet. That's also the reason why I changed from a player to an admin. I didn't want to keep klling them, not positively knowing if they live or are just existing in my fantasy. I instead wanted to create (aka spawn) them. I hope God isn't discriminated by me talking about myself as.. uhm kind of a creator.
-
Firedancer
- Grandmaster Poster
- Posts: 104
- Joined: Fri Feb 03, 2006 6:32 am
oh my!! *rolls eyes* Watch out what you're saying - you're definitely discriminating your NPC’s right now! They'll probably sue you and put you on trial, if they hear that....Bytehawk wrote:Uhm... that leads to the question: Do NPC *live*?
Ever since a played "Little Computer People" I keep asking myself this question. I'm not really sure yet. That's also the reason why I changed from a player to an admin. I didn't want to keep klling them, not positively knowing if they live or are just existing in my fantasy. I instead wanted to create (aka spawn) them. I hope God isn't discriminated by me talking about myself as.. uhm kind of a creator.
well having a script that runs before chrdeath has it uses
i want to implement self-looting the way it is on runnl, and i did it loot all the items from the corpse in a single double click (piss easy)
problem is, on runuo, when you loot yourself everything that was equiped when you died gets equiped automatically when you loot yourself.
an option is adding an onequip script for every single wearable item out there and setting a prop (equiped = 1), removing the prop on the unequip script.
other option would be the script that runs before the player corpse is created and before all the items are unequiped/moved to the corpse. then you list whats equiped, set a simple #prop to it and tada! yer done.
i want to implement self-looting the way it is on runnl, and i did it loot all the items from the corpse in a single double click (piss easy)
problem is, on runuo, when you loot yourself everything that was equiped when you died gets equiped automatically when you loot yourself.
an option is adding an onequip script for every single wearable item out there and setting a prop (equiped = 1), removing the prop on the unequip script.
other option would be the script that runs before the player corpse is created and before all the items are unequiped/moved to the corpse. then you list whats equiped, set a simple #prop to it and tada! yer done.