Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 840 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Junior Member
June  Offline 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:
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;
}


Re: How to scan for only specific entities? [Re: June] #471614
03/11/18 08:01
03/11/18 08:01
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Code:
var scan_indicator = 0;
#define SCAN_PLAYER 1
#define SCAN_EXPLOSION 2
...
scan_indicator = SCAN_EXPLOSION;
c_scan(my.x,my.pan,vector(150,150,150),SCAN_ENTS | SCAN_LIMIT );
...
if (event_type == EVENT_SCAN && scan_indicator == SCAN_EXPLOSION)



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
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 Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Hi!

I would do different kind of types for entities, like this:
Code:
#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:
Code:
if(you.obj_type == obj_player){ return; } // terminate the event
if(you.obj_type == obj_barrel){

       EXPLOSION HERE!

}



Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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 Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Assign each type of object to a different group.

Quote:
my.group = 2;



Then when you scan you can use c_ignore to designate the groups you do not want to scan.

Quote:
c_ignore(1,3,4,5,6,0);


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 Offline OP
Junior Member
June  Offline 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: June] #471633
03/12/18 09:15
03/12/18 09:15
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Never thought about using c_ignore with c_scan as well, interesting.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
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 Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Originally Posted By: Superku
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.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1