Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,295 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
C_scan #252524
02/18/09 19:05
02/18/09 19:05
Joined: Jan 2009
Posts: 57
Slovakia
wolodo87 Offline OP
Junior Member
wolodo87  Offline OP
Junior Member

Joined: Jan 2009
Posts: 57
Slovakia
Hello,
another probably stupid question (I am ashamed...)

I am using c_scan but it behaves quite odd...
I have empty wmb with just camera placed...no other objects.
When I push some button, a globe entity is created above the position of mouse pointer...that is ok...than I create another entity same way. My c_scan function should return distance of these globes if they are close enough...but it doesn´t. Instead of this, it returns distance from x-axis if it is within range of c_scan. Here is some code...
Code:
function odpud_x(var ENTpozitionX,var ENTpan)
{
	var dist=0;
	dist=c_scan(ENTpozitionX, ENTpan, vector(360,0,100),SCAN_ENTS);
	if(you != NULL)
	
	return dist;
	
}


it is called in action of every new enity in a loop:
Code:
sused_x=odpud_x(my.x,my.pan);


What am I doing wrong?

Re: C_scan [Re: wolodo87] #252527
02/18/09 19:27
02/18/09 19:27
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
- Try to set the mode IGNORE_ME also and ENABLE_SCAN on each of the entities.
- You scan only a 2D circle around the entity that depend on the entities pan, so the target have to be on the same layer. Maybe you should increase the second value in the vector to increase the scan area.
- Then note that the scan goes to a maximum range of 100q, this could be a littel to close. Experiment with some higher values.

hm, I don't konw if this make sense but to make sure that the you pointer is filled by the scan-funktion you could add this line before c_scan()
Code:
you = NULL;


hope this helps wink

Re: C_scan [Re: GorNaKosh] #252565
02/18/09 22:56
02/18/09 22:56
Joined: Jan 2009
Posts: 57
Slovakia
wolodo87 Offline OP
Junior Member
wolodo87  Offline OP
Junior Member

Joined: Jan 2009
Posts: 57
Slovakia
Yes, one issue was solved with IGNORE_ME but it still doesnt work properly...if you remember, we have spoken previously about array of entities...so now i have unknown number of agents and every one must behave like boid...that means...steer to goal, steer to average centre of flock and steer away from near neighbours...the last function uses this c_scan...

Re: C_scan [Re: wolodo87] #252592
02/19/09 06:35
02/19/09 06:35
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
oky, lets see
Code:
var scanDist = 500;

action boid() {
   set(my,ENABLE_SCAN);

   pAgents[countAgents] = create_agent(me); // or what funct you have implement
   
   var distToTarget;
   VECTOR meToTarget;

   while(me) {
      you = NULL;
      distToTarget = 0;
      distToTarget = c_scan(my.x,my.pan,vector(360,360,scanDist), IGNORE_ME|SCAN_ENTS);
   
      if(you != NULL) {
         vec_set(meToTarget,mx.x);
         vec_sub(meToTarget,you.x); // vector from my to you
         // in this direction the agendt have to be redirect
      } else {
         vec_fill(meToTarget,0);
      }

      // move with c_move
      wait(1);
   }
}


this snippet could be used... your problem is still that the ent don't seem to be scanned, right?

Re: C_scan [Re: GorNaKosh] #254377
03/02/09 21:24
03/02/09 21:24
Joined: Jan 2009
Posts: 57
Slovakia
wolodo87 Offline OP
Junior Member
wolodo87  Offline OP
Junior Member

Joined: Jan 2009
Posts: 57
Slovakia
yop, this looks and works quite fine...also not so difficult as my first solution, however i still dont know what was wrong smile
So the script is almost complete, it needs just some tuning and debuging.
Thanks again for your assistance.


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