Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
1 registered members (Grant), 999 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to tell an entity to trace around itself #268036
05/27/09 09:50
05/27/09 09:50
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I've been fooling around at this for to long...

I require my enemy to check around him self, so that he can alert other troops.

This would be simple, but I just can't get my enemies to trace around themselves...

All I require is the math envolved, so that I can learn from it. Once I have "vec_set(temp,my.x) ->->-> if(result!=0){".... I can take it from there...


if you need more info, please ask. This is very important, as ill be sharing this project on my website wink and is also important to my ready to blow up brain laugh



thanks.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: how to tell an entity to trace around itself [Re: DLively] #268040
05/27/09 09:58
05/27/09 09:58
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
You could either use the sinus function
http://www.conitec.net/beta/avar-sin.htm

or you can do it without any math - for this you would need
some vertices around the model or a dummy model which contains the vertices and does move with the parent entity.
You could get the position of them and do traces from
the origin to the vertices.


no science involved
Re: how to tell an entity to trace around itself [Re: fogman] #268073
05/27/09 12:15
05/27/09 12:15
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Thank you sooo much! I prefer the no math method. Im going to give it a try. Im currently working on the cargo carrier :P


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: how to tell an entity to trace around itself [Re: DLively] #268123
05/27/09 14:15
05/27/09 14:15
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Why not use c_scan?

Re: how to tell an entity to trace around itself [Re: the_clown] #268136
05/27/09 15:28
05/27/09 15:28
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
never heard of it :P

ill look into it now. Thanks smile


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: how to tell an entity to trace around itself [Re: DLively] #268145
05/27/09 16:13
05/27/09 16:13
Joined: Jun 2008
Posts: 428
Rasch Offline
Senior Member
Rasch  Offline
Senior Member

Joined: Jun 2008
Posts: 428
c_scan is great but its very slow or better only a few entities with c_scan and the fps will crash ^^

Re: how to tell an entity to trace around itself [Re: Rasch] #268149
05/27/09 17:01
05/27/09 17:01
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
One Scan per second should be enough.
Even one scan per entity could be eventually enough, it depends on the situation.
Why should they retrigger and retrigger the alert again?
Insteat of that, I would try to "pass" the alert through the enemies.
One enemy alerts another and so forth. If an enemy is alerted, set a flag of this enemy
and exclude him from scanning.

But - a scan goes through walls. Maybe you donŽt want this.
In this case, a scanned entity should trace back to the scanning entity.
When the trace can reach (hit) the scanning entity, youŽll know that they can "see" each other.


no science involved
Re: how to tell an entity to trace around itself [Re: fogman] #268156
05/27/09 17:39
05/27/09 17:39
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I wish i could pull of the second senerio, fogman laugh but I dont have that knowledge yet.


accually, my enemy is currently set up, so that hes in "unaware" mode, and when I shoot him, he points to where I am, where it creates the sphere, and if there is another enemy around, its asks if its in alert mode already, and if not, then he will be. Then if he is a certain distance close, he will shoot. and if you run, he will chase, but only if you get far enough away laugh


I've figured it out btw laugh laugh I used the entity idea.

Code:

action distchecker{
	
	my.alpha = 0;
	my.transparent = on;
	my.passable = on;
	my.distslotno = 1;
	
	while(1){wait(1);
		
		vec_for_vertex(my.dist_main, me, 13);
		vec_for_vertex(my.dist_spot, me, my.distslotno);
		c_trace(my.dist_spot,my.dist_main,ignore_me + use_box);
		if(result!=0){
			if(you!=null){
				if(you.state==unaware||you.state==hurt){you.state = point;}
			}
		}
		my.distslotno += 1;
		if(my.distslotno >= 37){break;}
		
	}
	ent_remove(me);
	
}




and then when the next one makes a sphere, the others around him will activate.

Ill be putting out this resource file when im finished with it.


Thanks for all your help.

Last edited by DevoN; 05/27/09 17:40.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: how to tell an entity to trace around itself [Re: DLively] #268495
05/29/09 16:54
05/29/09 16:54
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
it could be even more cheap :P

instead of tracing to vertices or doing c_scan, you could vec_dist...
use that between the enemies, and if they are below a certain threshold away from each other, do a single trace, if the trace hits, they can "see" each other.

vec_dist is lots faster then c_scan, only thing you're left with is a single trace, doing that once in a while shouldnt matter at all wink

good luck,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/

Moderated by  adoado, checkbutton, mk_1, Perro 

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