2 registered members (AndrewAMD, 1 invisible),
583
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How to scan for only specific entities?
#471612
03/11/18 06:37
03/11/18 06:37
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
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:
c_scan(my.x,my.pan,vector(150,150,150),SCAN_ENTS | SCAN_LIMIT );
And a scan event for the barrel:
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?
action oil_barrel()
{
set (my, METAL | POLYGON);
my.emask |= (ENABLE_SHOOT | ENABLE_SCAN );
my.event = oilexplosion_event;
}
|
|
|
Re: How to scan for only specific entities?
[Re: Superku]
#471617
03/11/18 09:27
03/11/18 09:27
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Hi! I would do different kind of types for entities, like this:
#define obj_type skill40
#define obj_none 0
#define obj_player 1
#define obj_barrel 2
And then in the event (of the barrel, that got scaned), I would check for it via 'you' pointer, like this:
if(you.obj_type == obj_player){ return; } // terminate the event
if(you.obj_type == obj_barrel){
EXPLOSION HERE!
}
Best regards!
|
|
|
Re: How to scan for only specific entities?
[Re: 3run]
#471626
03/11/18 20:38
03/11/18 20:38
|
Joined: May 2005
Posts: 868 Chicago, IL
Dooley
User
|
User
Joined: May 2005
Posts: 868
Chicago, IL
|
Assign each type of object to a different group. Then when you scan you can use c_ignore to designate the groups you do not want to scan. This will ignore all groups except group 2 for instance.
Last edited by Dooley; 03/11/18 20:43.
|
|
|
Re: How to scan for only specific entities?
[Re: Dooley]
#471632
03/12/18 05:10
03/12/18 05:10
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
Its good to know there are many ways of going about the same thing. I will figure out which is the best option in good time.
Thank you guys for the advice, it is always helpful.
Last edited by June; 03/12/18 05:11.
June smooth-3d.com
|
|
|
Re: How to scan for only specific entities?
[Re: Superku]
#471657
03/12/18 20:55
03/12/18 20:55
|
Joined: May 2005
Posts: 868 Chicago, IL
Dooley
User
|
User
Joined: May 2005
Posts: 868
Chicago, IL
|
Never thought about using c_ignore with c_scan as well, interesting. You know, I have been using this, but it's actually not perfect. Sometimes it's hard to scan the things I want when other things are in the way ... maybe I'm doing it wrong.
|
|
|
|