Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, VoroneTZ, Quad), 901 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
patroll path #425186
06/28/13 15:58
06/28/13 15:58
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
I noticed that you can set paths (nodes) in wed.
I wondered how I can use them.
I thought about something like:

If the destination and an target cannot be traced
Code:
if(my.target == 0 && my.goal == 0)



then somehow patrol the nearest path I laid in WED.

Can anybody explain what the commends are?
I couldn`t find anything like "find_path" in the manual.

Thanks fururemore.

Last edited by Random; 06/28/13 15:59.


Re: patroll path [Re: Random] #425187
06/28/13 16:04
06/28/13 16:04
Joined: May 2010
Posts: 117
Germany , Dortmund
B
Bone Offline
Member
Bone  Offline
Member
B

Joined: May 2010
Posts: 117
Germany , Dortmund
Take a look at path_scan in the manual

Re: patroll path [Re: Bone] #425188
06/28/13 16:08
06/28/13 16:08
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
what about path_next?


Visit my site: www.masterq32.de
Re: patroll path [Re: MasterQ32] #425193
06/28/13 17:23
06/28/13 17:23
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
The manual doesn`t explain how to get the entity patrol the path.

Code:
if(my.target == 0 && my.goal == 0)
	{
		result = path_next(my);//find nearest path
		// 
		var speed;
		path_spline(me,my.x,speed);//follow the path?
		speed += 3*time_step;
	}



Nothing happens with this code.
Aren`t there any examples somewhere?



Re: patroll path [Re: Random] #425196
06/28/13 17:51
06/28/13 17:51
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Manual: path_spline example
Code:
//call camera_path(""); to let the camera run along a path in the level
function camera_path(pathname)
{
// create a dummy path entity
	me = ent_create(NULL,nullvector,NULL);
	path_set(me,pathname);
	var dist = 0;
	var vLastPos[3];
	var vDir[3];
	while(1) 
	{
// place the camera on the path
		path_spline(me,camera.x,dist);
		dist += 5*time_step;
// let the camera look ahead	
		vec_diff(vDir,camera.x,vLastPos);
		vec_to_angle(camera.pan,vDir);
		vec_set(vLastPos,camera.x);
		wait(1);
	}
}



Visit my site: www.masterq32.de
Re: patroll path [Re: MasterQ32] #425197
06/28/13 18:01
06/28/13 18:01
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
Ok I got it working now.

Code:
move_ent = ent_create(NULL,nullvector,NULL);
...
				result = path_next(move_ent);
		if (result) 
		{
			ANGLE offset_angle;	
			VECTOR AI_vec, temp_dir, pos_node;
			//////////
			path_getnode(move_ent, 1, pos_node, NULL);
			//
			vec_set(AI_vec, vector(4,0,0));
			c_move(move_ent,AI_vec,nullvector,IGNORE_PASSABLE | GLIDE);
			//
			vec_diff(temp_dir, pos_node, move_ent.x);
			vec_to_angle(offset_angle, temp_dir);
			move_ent.pan += ang(offset_angle.pan - move_ent.pan) * 0.2 * time_step; 
			//
			my.x = move_ent.x;my.y = move_ent.y;
		}



Thanks!
But there is one big problem, it is slow as hell...

Last edited by Random; 06/28/13 18:18.


Re: patroll path [Re: Random] #425449
07/05/13 10:30
07/05/13 10:30
Joined: Dec 2000
Posts: 4,608
mk_1 Offline

Expert
mk_1  Offline

Expert

Joined: Dec 2000
Posts: 4,608
Probably because you create a new entity each time you call that code


Follow me on twitter
Re: patroll path [Re: mk_1] #425453
07/05/13 11:43
07/05/13 11:43
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
nop
Code:
move_ent = ent_create(NULL,nullvector,NULL);


is not in a while loop. I just checked it again.




Moderated by  HeelX, Spirit 

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