Scripts / explosion activate

Author
Message
srun142
7
Years of Service
User Offline
Joined: 29th Dec 2016
Location:
Posted: 9th Mar 2018 13:56
How to make, so that when shot, in a red barrel, it explodes and activates the object. I need that after the shot, the barrel explodes and activates the NPC. In global.lua, I did not find the explosion
PM
srun142
7
Years of Service
User Offline
Joined: 29th Dec 2016
Location:
Posted: 9th Mar 2018 14:12
After the explosion, that would have epically appeared the boss

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Mar 2018 14:13
The explosion is simply triggered by the 'health' of an explodable entity dropping to zero.

Place a script on the barrel which checks the health, when it drops to zero do the activate bit.

i.e. if g_Entity[e].health == 0 then
Been there, done that, got all the T-Shirts!
PM
srun142
7
Years of Service
User Offline
Joined: 29th Dec 2016
Location:
Posted: 9th Mar 2018 14:41
does not want to activate. I have already tried everything
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Mar 2018 16:14 Edited at: 9th Mar 2018 17:33
Can you attach your script so I can see if I can get it working?

Edited to add:

This seems to work fine for me:

Been there, done that, got all the T-Shirts!
PM
srun142
7
Years of Service
User Offline
Joined: 29th Dec 2016
Location:
Posted: 9th Mar 2018 18:40
AmenMoses Many thanks for the help)) All earned here here my code

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Mar 2018 18:58
Very similar to mine except I'm allowing for the situation when the health may not be exactly 0! (Lua uses floating point math so it is unlikely to be exactly 0 if the engine is subtracting a variable amount of damage).

In fact I think the barrel starts off with 25 health (or 'strength' in the menu for some reason) and an explosion subtracts a huge number so it is probably going negative.
Been there, done that, got all the T-Shirts!
PM
srun142
7
Years of Service
User Offline
Joined: 29th Dec 2016
Location:
Posted: 10th Mar 2018 06:58
Works fine) When the shot explodes. Then things fly apart and the big boss runs out
PM

Login to post a reply

Server time is: 2024-12-22 19:34:40
Your offset time is: 2024-12-22 19:34:40