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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 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
Anyway to scan for a specific entity using c_scan? #336946
08/07/10 03:56
08/07/10 03:56
Joined: May 2010
Posts: 8
Singapore
C
CaedLucin Offline OP
Newbie
CaedLucin  Offline OP
Newbie
C

Joined: May 2010
Posts: 8
Singapore
Uhmmm i'm trying to write a RTS type of game for a school assignment and i'm trying to make a tank making it's way to a specified location by following through a calculated shortest path algorithm.

To do that, i got 3 target entities called the gStartNode, gGoalNode and gDestination.

When the player clicked on a specific unblocked grid on the map,
- The gStartNode entity basically get the tank's starting position.
- The gGoalNode entity will be the specified position goal for the tank.
- The gDestination entity will traverse along the calculated shortest path, grid by grid until it reaches the gGoalNode's location(goal destination).

So basically the tank will try to follow the gDestination entity which will be leading it grid by grid until it reaches the final grid.

I did the ENABLE_SCAN on the gDestination entity in which at each EVENT_SCAN it will move to the next intended grid. Therefore at each EVENT_FRAME of the tank entity, i do a c_scan to scan for all entities with the ENABLED_SCAN on.

This works fine if it's just a single tank. But with an array of tanks and gDestination entities, if i do group movement to a single point, once two gDestination e.g. destA and destB moves toward a single point, it will be scanned by the closest distance tank e.g. tankA and both destA and destB will move to the next grid. thus making tankB's path-following movement haywire!

Now the question is, is there any way i could make c_scan detect a specific ENABLE_SCAN enabled entity? or anyway i could check if a certain gDestination entity belongs to a specific tank in it's EVENT_SCAN function?

Sorry for the long explaintion but i just want to dish out as much information as possible and hope you guys can get a better understanding of the whole picture. :)) Thank you in advance!

Last edited by CaedLucin; 08/07/10 04:03.
Re: Anyway to scan for a specific entity using c_scan? [Re: CaedLucin] #336992
08/07/10 12:02
08/07/10 12:02
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
if(c_scan(blahblahblah)&&you==desired_entity)
{
instructions
{


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB

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