[SOLVED] ondeathscript for holes

O Ilusionista

Captain 100K
I have an entity type none who can fall on holes, but I need to trigger its death to restore the nojoin back to normal.
I've added a code on a ondeathscript but seams that dying on a hole doesn't triggers ondeathscript.

How should I trigger it? onmoveascript? And why it doesn't triggers if the entity is dying?

Another question: when an entity is removed by the engine because it was stuck inside a wall, does ondeathscript triggers or not?
There is any way to trigger a script when the engine does it?

Solution:
Damon Caskey said:
Removal of an entity does not trigger a death event, since technically the entity is not dying. There is an onkillscript though - it runs immediately before the entity is destroyed.

DC
 
Holes kill entities by doing damage to them. It used to be normal damage, but some time back I created an ATK_HOLE type to make it easier to verify. Use ondamagescript - I know it works because I use it to change the randomized death screams to a hole specific "Ahhhhhhhhhh!".

https://www.youtube.com/watch?v=XWtCEdRZnJI
 
Removal of an entity does not trigger a death event, since technically the entity is not dying. There is an onkillscript though - it runs immediately before the entity is destroyed.

DC
 
onkillscript? Another undocumented thing :(

I tried ondamage, but nothing happens (take a look at PLEASE WAIT message)
u87aN2j.png


This is my deadscript code:

Code:
void main()
{
changeopenborvariant("nojoin", 0);
clearlocalvar();
}

Edit: The manual says that ondeathscript works for holes
ondeathscript {path}

~This command defines which script is run when entity dies
~Any cause of death will do including falling to holes
 
O Ilusionista said:
onkillscript? Another undocumented thing :(

I tried ondamage, but nothing happens (take a look at PLEASE WAIT message)
u87aN2j.png


This is my deadscript code:

Code:
void main()
{
changeopenborvariant("nojoin", 0);
clearlocalvar();
}

What exactly are you trying to do?
 
I have a helper, which jumps on screen, executes an attack and go away. But right when it is brought to the screen, it changes the openborvariant NOJOIN to prevent another player join the game (since I have helpers which are the same character of some players and I want to avoid to have two Captain America on the screen).

Some helpers, when called, are falling right on that pit (which is not a problem to me). But since they had changed the NOJOIN, nobody can join the game again and if you die, the game stucks. To prevent this, I've included a ondeathscript on players. But I want to include this on the helper too. This is what doesn't works. Got it?

The manual says that ondeathscript works for holes
ondeathscript {path}

~This command defines which script is run when entity dies
~Any cause of death will do including falling to holes

At the end, using onkillscript, it works! Thanks for that info.
 
O Ilusionista said:
...Got it?

Yep! I like it.

The manual says that ondeathscript works for holes

Yes, and it should - I'm the one who coded it in the first place. Not sure why it wasn't working for you.

At the end, using onkillscript, it works! Thanks for that info.

Also by yours truly. And probably a better solution - it covers ALL the circumstances that might destroy your helper (walls, moved off the screen, etc.) without any extra code, so it's more stable now anyway.

DC
 
O Ilusionista said:
@DC: I was digging into the source code and I found this:

Instead of "ATK_HOLE", its "ATK_PIT".

My bad. Was speaking from memory above and that was some time ago when I added it.
 
O Ilusionista said:
Just for curiosity sake: I watched the debug when an entity falls on a hole. The BASE value changed to -1000, I was expecting to see it geting lower than 0 progressively.

Nope, that's the way it's supposed to work. The base should change instantly when a new base is detected. Base is not where you are (that's Y of course), it's where the floor is under you. So unless you are on a platform that is moving up and down, base should never really increment smoothly the way Y will.

And as it happens, a base of -1000 is how OpenBOR knows you are "in" a pit. That used to be how you would verify being in or over a pit with script, but I prefer more concrete methods, like check_hole and ATK_PIT.
 
Back
Top Bottom