C_SCAN help please

Posted By: Romin

C_SCAN help please - 01/20/13 13:48

Hello,

I think i am stuck badly with c_scan, i need your help please.
I can't find a way to scan all the entities in a given range and turn their certain flags on if detected.
The problem with c_scan is that it always return when detected the first nearest entity and wouldn't continue scanning for others???

What is the solution for this problem please?
Posted By: MasterQ32

Re: C_SCAN help please - 01/20/13 13:51

you can use ent_next to go trough all entities
Code:
for(you = ent_next(NULL); you; you = ent_next(you))
{
if(vec_dist(my.x, you.x) > myDistance)
continue; // Skip unwanted entities
// DO stuff here :

set(you, FLAG1);

}

Posted By: Romin

Re: C_SCAN help please - 01/20/13 14:08

Originally Posted By: MasterQ32
you can use ent_next to go trough all entities
Code:
for(you = ent_next(NULL); you; you = ent_next(you))
{
if(vec_dist(my.x, you.x) > myDistance)
continue; // Skip unwanted entities
// DO stuff here :

set(you, FLAG1);

}



It is very costly if you have lots of entities in your level. specially in my case where all enemy entities would be using this function frequently.
I don't want to go through all the entities in my level to find who is in the range i am already using cpu power with c_scan.
Posted By: MasterQ32

Re: C_SCAN help please - 01/20/13 14:23

yeah, but c_scan uses much more code (and also loops through all entities...)
Posted By: Romin

Re: C_SCAN help please - 01/20/13 15:53

any other solutions please?
Posted By: Superku

Re: C_SCAN help please - 01/20/13 16:36

c_scan probably skips most of the entities because it has access to the ABT, like c_move and c_trace do.

The solution is (like almost always) included in the manual below the instruction, you just have to use ENABLE/EVENT_SCAN and event.
Posted By: rayp

Re: C_SCAN help please - 01/20/13 20:02

modify the function you found here.

http://www.opserver.de/ubb7/ubbthreads.p...true#Post405495

greets
Posted By: Abarudra

Re: C_SCAN help please - 01/21/13 21:11

if you use c_scan inside an action, you can try event_detect in its event function. I think it should be the behavior you are looking for.

regards
Posted By: Redoine

Re: C_SCAN help please - 01/22/13 03:24

sometimes my antivirus delete some compiled projects or dimos
(*.exe)files is it right !!
can we make viruses with lite c
Posted By: rayp

Re: C_SCAN help please - 01/22/13 05:25

wtf ? Who the hell writes a virus with lite-c ? How senseless
Posted By: Redoine

Re: C_SCAN help please - 01/24/13 12:29

thanks
i must change the antivirus
its not reliable any more
© 2024 lite-C Forums