Posted By: June
How to scan for only specific entities? - 03/11/18 06:37
How do you scan for only specific entities?
This is for an exploding barrel code. Any barrel near an exploding one explodes too.
I added a c_scan instruction to the explosion sprite:
And a scan event for the barrel:
And it works perfectly. The only problem is that when the player walks near the barrels they explode because the player has ENABLE_SCAN applied.
How do you make it so that the barrel only reacts to other explosions and not the player too?
This is for an exploding barrel code. Any barrel near an exploding one explodes too.
I added a c_scan instruction to the explosion sprite:
Code:
c_scan(my.x,my.pan,vector(150,150,150),SCAN_ENTS | SCAN_LIMIT );
And a scan event for the barrel:
Code:
if (event_type == EVENT_SCAN) { wait(-0.15); set(my,INVISIBLE); ent_create (expl1_tga, my.x, fire_blast); effect(particle_explo, 9, my.x, vector(0, 0, -100)); effect(particle_explosm, 40, my.x, vector(0, 0,0)); ent_create (smoke_tga, my.x, smokeballs); ent_create (floor_scorch, my.x, floor_burn); ...........
And it works perfectly. The only problem is that when the player walks near the barrels they explode because the player has ENABLE_SCAN applied.
How do you make it so that the barrel only reacts to other explosions and not the player too?
Code:
action oil_barrel() { set (my, METAL | POLYGON); my.emask |= (ENABLE_SHOOT | ENABLE_SCAN ); my.event = oilexplosion_event; }