DEATH HOOK
Moderator: POL Developer
DEATH HOOK
A while back I thought I had convinced the Devs that a death hook would be a useful thing.
And AUSTIN PROMISED..... "Oldngrey is SO getting his death hook".
/me sits and mentally lists all the cool things you can do with a death hook.
Re-graphic and undo mods. (A real pain currently)
Record their killer.
Refuse them death and do something else with the poor victim.
Do other things to them and THEN allow them death by core.
And AUSTIN PROMISED..... "Oldngrey is SO getting his death hook".
/me sits and mentally lists all the cool things you can do with a death hook.
Re-graphic and undo mods. (A real pain currently)
Record their killer.
Refuse them death and do something else with the poor victim.
Do other things to them and THEN allow them death by core.
Re: DEATH HOOK
Fine! I was aiming for retirement, though. I promised that... 2 years ago? Isn't there a statute of limitations on promises?
My ratio of fulfilled promises to unfulfilled was admirable.
Okay lay it out
Function arguments? Should receive the mobile dying?
Some way to make a corpse for the mobile?
Returns 1 the hook handled it. 0 the core uses the code first, then does the usual internal death code?
My ratio of fulfilled promises to unfulfilled was admirable.
Okay lay it out
Function arguments? Should receive the mobile dying?
Some way to make a corpse for the mobile?
Returns 1 the hook handled it. 0 the core uses the code first, then does the usual internal death code?
Re: DEATH HOOK
While I see the benefits of this one, I am forced to once again wonder...
Why wouldn't that work as a like?
I can think of couple of reasons why this would be more complex than a solution offered by core, but, it's still already existing solution, has been for years, to me, so I wonder, why the hassle.
Don't get me wrong, in the end I'm fine with all the new features that ease the scripting process.
Code: Select all
/*
DamageMobile
Function to use instead of the ApplyDamage-functions.
*/
function DamageMobile( mobile, damage )
// General checks for invulnerable etc.
...
if (GetVital(mobile, "Life") <= damage)
// Mobile is going to die.
// Do the death hook stuff:
// Cancel this if you wish to,
// amongst other options.
endif
...
// Apply damage as normal
endfunction
I can think of couple of reasons why this would be more complex than a solution offered by core, but, it's still already existing solution, has been for years, to me, so I wonder, why the hassle.
Don't get me wrong, in the end I'm fine with all the new features that ease the scripting process.
Re: DEATH HOOK
OldnGrey, you do the engineering
You want a CanDie hook to determine if the mobile can die when the hit points expire?
Or an OnDeath hook when the mobile is dead?
It could be possible to do both in a single one. Methods needed would be
1. A way to make a corpse and optionally equip the mobile's stuff onto the corpse.
2. A way to make a mobile 'dead' and run the death/chrdeath scripts (or make them be run manually..)
3. I need beer
You want a CanDie hook to determine if the mobile can die when the hit points expire?
Or an OnDeath hook when the mobile is dead?
It could be possible to do both in a single one. Methods needed would be
1. A way to make a corpse and optionally equip the mobile's stuff onto the corpse.
2. A way to make a mobile 'dead' and run the death/chrdeath scripts (or make them be run manually..)
3. I need beer
Re: DEATH HOOK
I will try.
define the hook in a cfg somewhere.... your call.
when a player is about to die ie hp == 0, the core function is called as it does now. If the hook is present the hook is called with only the mobileref. The player is NOT dead at this point.
If the hook exits with a 1, then the core continues to kill the player and do its thing.
If a 0 is returned, then the core exits and the player is not killed.
I can see we might need to have the mobile hp set to 1 to prevent this from looping forever?
define the hook in a cfg somewhere.... your call.
when a player is about to die ie hp == 0, the core function is called as it does now. If the hook is present the hook is called with only the mobileref. The player is NOT dead at this point.
If the hook exits with a 1, then the core continues to kill the player and do its thing.
If a 0 is returned, then the core exits and the player is not killed.
I can see we might need to have the mobile hp set to 1 to prevent this from looping forever?
Re: DEATH HOOK
Here is what I am thinking
What OldnGrey sorta wants would look like
Code: Select all
use uo;
exported function DeathHook(mobile)
// Mobile has reached 0 hit points, create a corpse where the mobile is.
// Strip the equipment from the mobile to the corpse.
var corpse := CreateCorpseForMobile(mobile, mobile.x, mobile.y, mobile.z, mobile.realm);
corpse.TakeContentsFromOwner(); // Uses corpse.ownerserial?
// Make the mobile officially dead (would run death.ecl / chrdeath.ecl scripts?)
mobile.SetDead(1);
// tell the core to not do anything else
return 1;
endfunction
Code: Select all
exported function DeathHook(mobile)
return 1;
endfunction
Re: DEATH HOOK
I can see the first being trememdously useful.
My needs were specific - ie I really did want to deal with graphics befor they died to stop problems with non-monochrome death screen and not getting priv to walkthrough closed gates etc. And I did want the chance to modify the player in other ways before they died. Then just return control to the core to process death OR simply exit back to the game and deny them death.
But...
Your ideas of being able to actually script the death 'process' ourselves before death/chrdeath is called now has a lot of appeal.
So it's no longer just my idea.... it's open for everyone to offer their thoughts now
All you ever promised was a death hook. This is a lot more.
And for all to witness this is Austin promising a death hook:
http://forums.polserver.com/viewtopic.p ... hook#p5639
My needs were specific - ie I really did want to deal with graphics befor they died to stop problems with non-monochrome death screen and not getting priv to walkthrough closed gates etc. And I did want the chance to modify the player in other ways before they died. Then just return control to the core to process death OR simply exit back to the game and deny them death.
But...
Your ideas of being able to actually script the death 'process' ourselves before death/chrdeath is called now has a lot of appeal.
So it's no longer just my idea.... it's open for everyone to offer their thoughts now
All you ever promised was a death hook. This is a lot more.
And for all to witness this is Austin promising a death hook:
http://forums.polserver.com/viewtopic.p ... hook#p5639
-
- Distro Developer
- Posts: 2825
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: DEATH HOOK
Yukiko Wrote:
*grins*
Keep up the good work Austin.
I have never seen a "statue of limitations" on anything however I will keep my eyes open for one carved or sculpted on top of a pile of promises.I don't get enough fiber in my diet.
*grins*
Keep up the good work Austin.
Re: DEATH HOOK
Note: Prune board posts more than a month old.
Call it the Espionage Protection Act. Promises lost.
Call it the Espionage Protection Act. Promises lost.
Re: DEATH HOOK
I have the sneaking suspicion Austin edits his posts to save his butt.
I am more than willing to let Austin mess with my Avatar if it means getting this hook.
I am more than willing to let Austin mess with my Avatar if it means getting this hook.
Re: DEATH HOOK
I'm not OldnGrey but I like this variant of hook.Austin wrote:You want a CanDie hook to determine if the mobile can die when the hit points expire?
-
- Distro Developer
- Posts: 2825
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: DEATH HOOK
Hey!
No fair editing posts Austin!
*sticks tongue out at you*
No fair editing posts Austin!
*sticks tongue out at you*