Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,731 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
C_scan problems #355088
01/24/11 15:40
01/24/11 15:40
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
Hi, i am using c_scan to search in a con for player but i encountered 2 problems. 1st c_scan goes through walls and i can't use c_trace coz c_trace can't search in a con so how to stop c_scan searching through walls?
2nd c_scan stops searching when found closest entity in it's way so how to find all entities in it's range?
Thank you

Re: C_scan problems [Re: romin2011] #355090
01/24/11 15:43
01/24/11 15:43
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
1st: trace back from the detected entity to the scanning entity to determine if there´s a wall.

2nd: Use EVENT_DETECT


no science involved
Re: C_scan problems [Re: fogman] #355094
01/24/11 15:49
01/24/11 15:49
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
Originally Posted By: fogman
1st: trace back from the detected entity to the scanning entity to determine if there´s a wall.


i will be very thanksfull if u provide an example thank you.

Re: C_scan problems [Re: romin2011] #355095
01/24/11 15:58
01/24/11 15:58
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I guess something like this:
if(c_scan(my.x,my.pan,vector(120,0,200),IGNORE_ME|SCAN_ENTS) != 0)
{
if(you!=NULL)
{
c_trace(you.x,my.x,IGNORE_ME|USE_BOX);
if(trace_hit){see_player = 0;}else{see_player = 1;}
}
}
Not sure that this will work (I can't think properly with my sick head grin ), but you can catch an idea...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: C_scan problems [Re: 3run] #355097
01/24/11 16:14
01/24/11 16:14
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
@3run i did the same but i don't want to use 2 slow funcs at same time.

@fogman reply please

Re: C_scan problems [Re: romin2011] #355098
01/24/11 16:22
01/24/11 16:22
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
This one works for sure! Even if it looks a bit weird (there is a better way to detect objects with C_SCAN).
Code:
result = c_scan(my.x,my.pan,vector(120,80,200),IGNORE_ME|SCAN_ENTS);
if(result > 0)
{
	if(you == player)
	{
		vec_set(aim_target.x,you.x);
		if(c_trace(my.x,aim_target.x,IGNORE_MODELS) == 0){got_target = 1;}else{got_target = 0;}
	}
}

You can download an example when I tried to make auto-aiming thing for FPS.
Here:
Download link


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: C_scan problems [Re: 3run] #355102
01/24/11 16:41
01/24/11 16:41
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
but you again used both c_scan and c_trace to acomplish it. I was wondering if it can be done with one of them only?

Re: C_scan problems [Re: romin2011] #355103
01/24/11 16:52
01/24/11 16:52
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Short answer - no. First use a scan, than do a trace to be on the safe side.
The example of 3run should get you started.


no science involved
Re: C_scan problems [Re: romin2011] #355104
01/24/11 16:58
01/24/11 16:58
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
you don't want to use 2 slow functions at one time....
they aren't that slow
also, the c_trace is only executed when an entity is found,
and you can have hunderds of c_traces in a ms.
also, you only use it for the player, not for many entities.

you could also run thourgh all entities manually, and compare their distance to the player. I don't know if that is faster....
I think you should go for the c_scan+c_trace combination. it can't be that bad!


Check out the throwing game here: The throwing game
Re: C_scan problems [Re: Roel] #355105
01/24/11 17:33
01/24/11 17:33
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
and what about the second issue? I have 2 enemies standing near each other and search nearest cover position 1st enemy go to nearest cover and i set cover's flag1 on to let others it is occupied but since the 2nd enemy is using c_scan which returns the already occupied cover though i told it not to look for flag1 ents. But it dont work.

Page 1 of 2 1 2

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

Gamestudio download | 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