Jump to content
Oliver Hope

Detecting throwing or holding

Recommended Posts

Hey all

I'm trying to find an efficent way of detecting when a player throws a grenade, preferably with an events listener, If this is not possible then id  like to detect when they are holding one.

i need to know when they are holding it at any given time not just when they say walk in a trigger zone

thanks

Edited by Oliver Hope_P1

Share this post


Link to post
Share on other sites

Why not detect damage where it lands? Give everything 999999 health, make the nade do 0.1 damage, on damage do __. 

Share this post


Link to post
Share on other sites
4 hours ago, RedEagle_P1. said:

Why not detect damage where it lands? Give everything 999999 health, make the nade do 0.1 damage, on damage do __. 

several reasons:

You wouldnt be able to detect if the grenade landed on terrain 

you cant set the price damage grenades do

checking for damage on every game object probably isnt too efficent

Share this post


Link to post
Share on other sites

Okay I can't seem to recreate my trigger from before but this following code should be good enough for all intents and purposes.

1) Create a Entity Label and set it to contain a Grenade.

2) Create a Entity Template and set it to contain the same grenade.

3) In your Entity Label script  On Entity Removed Entity Spawn Entity Template

the system registers that when your grenade gets removed from the game this event triggers. The game "deletes" the grenade when item is thrown, not when it explodes.  This means the trigger won't activate if you drop it on the ground, but will activate if you dismantle/break it.

4) In your Entity Template script On Entity Spawn Entity Attach Label Entity Entity Label Entity Label

 

Ylands grenade.png

Edited by Igor Quintero

Share this post


Link to post
Share on other sites
13 hours ago, Igor Quintero said:

Okay I can't seem to recreate my trigger from before but this following code should be good enough for all intents and purposes.

1) Create a Entity Label and set it to contain a Grenade.

2) Create a Entity Template and set it to contain the same grenade.

3) In your Entity Label script  On Entity Removed Entity Spawn Entity Template

the system registers that when your grenade gets removed from the game this event triggers. The game "deletes" the grenade when item is thrown, not when it explodes.  This means the trigger won't activate if you drop it on the ground, but will activate if you dismantle/break it.

4) In your Entity Template script On Entity Spawn Entity Attach Label Entity Entity Label Entity Label

 

Ylands grenade.png

Great idea thanks, i simplified it slightly and just used an event listener listening on type grenade.

Share this post


Link to post
Share on other sites
1 hour ago, Oliver Hope_P1 said:

Great idea thanks, i simplified it slightly and just used an event listener listening on type grenade.

I tried using the event listener on "Ignite" but for some reason it did not produce consistent results. What did you use?

Share this post


Link to post
Share on other sites
23 hours ago, Igor Quintero said:

I tried using the event listener on "Ignite" but for some reason it did not produce consistent results. What did you use?

i used the on entity removed from inventory, I painted and renamed a vacuum tube to a smoke bomb and you just press x  to use it 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×