path following

Posted By: DAVIDMORETON

path following - 04/17/14 14:42

Sorry gamers – I’m here again.
I have at long last got my ‘rat’ to go through it’s animations and actually move – problem is, it won’t go along the path I have laid down from the object menu, although it is attached to the path – it just goes in a straight line until it hits the wall.(other models from the object menu follow the path) Also the legs still move thought! How do I stop the animation?.
Below is the code I’ve used – could someone PLEASE tell me where I have gone wrong.
Code:
var walk_percentage;
entity* rat;

define _path_node__01E, SKILL53;        // cur target node
define _path_vec__01E, SKILL54;         // cur target pos
define _path_vec_x__01E, SKILL54;
define _path_vec_y__01E, SKILL55;
define _path_vec_z__01E, SKILL56;
var  rat_path_skills[6];	// used to store the skills of the current path

action bone_anm
{
		// Check for path
	if(path_getnode(my,1,my._path_vec__rat_path_skills) != 0)
{
		my._path_node__01E = 1;		// start at first node
	           if(my._path_node__01E != 0) // we have a valid node in a path
{
			// move to start
			//path_nodepos(my,my._path_node__01E,my.x);
			vec_set(my.x,my._path_vec__01E);
                                    // mark this node as occuped
                                    // set this as the current waypoint
	path_setnode(my,my._path_node__01E,my._path_vec__rat_path_skills);
	}
               wait(1);	// we should wait at least one frame so other pathfollow entities                                           
                                    //can see that we own this node during setup
 	}
{
    while (1)
{
        rat=me;
        c_move (me, vector(5 * time_step, 0, 0), nullvector, GLIDE);
        ent_animate(me, "walk", walk_percentage, ANM_CYCLE); // "walk" animation loop              
                                                                                                                                                                                                             
        walk_percentage += 10 * time_step; // 3 = animation speed for "walk"
        wait (1);
    }}}


When I add the above ‘heavy’ to find the path, I get;-
(SORRY,THE HEAVY TYPE DOES NOT COME OUT IN THIS BOX-BUT THE RAT MOVES FROM 'WHILE(1)' DOWN.)


When I use all the code, I get this error
Parameter unknown_path_vec__rat_path_skills

This is really holding up the game – can someone please help?
As you can see, I’m not very good at coding !! –but I want to learn.

Yours hopefully David.







Posted By: DLively

Re: path following - 04/17/14 15:39

Quote:
This is really holding up the game


Possible. I dont see 'path_vec__rat_path_skills' defined anywhere laugh
Posted By: DLively

Re: path following - 04/17/14 15:42

Yep From my understanding, path_vec__rat_path_skills is actually two defines?

path_getnode(ENTITY*,var node,VECTOR* pos,var* skills)

You dont have enough perameters in your getnode wink
Posted By: DAVIDMORETON

Re: path following - 04/18/14 09:21

Just seen your tutorial DLively - very good - enjoyed going through it - covers things very well - but no mention of path finding - will this come later?
Thanks for your suggestions, but I'm still in the dark!!
Kind regards, David
Posted By: DLively

Re: path following - 04/21/14 18:23

Thank you laugh

Yes, I can add a path finding tutorial to my tutorial pages. It would require me to have added some scripting to the other tutorial, and I was really trying to avoid script - As it is a WED tutorial laugh

I will find some time to put that together for the community! Thanks for the suggestion!
Posted By: DAVIDMORETON

Re: path following - 04/23/14 08:20

Hi DLively - look forward to the 'path' script
Would it be possible to do it in c_script and lite_c so that all of us are covered?
All I want to do is have a four legged animal follow a path which has been set down using the 'path' from the object menu in Wed.
If you find the time to do this, could you please let me know by dropping me an e-mail at address below?
Kind regards, David

david@davidmoreton1.wanadoo.co.uk
Posted By: DLively

Re: path following - 04/27/14 14:15

I do know that the comunity likes to keep things up to date - keeps things less confusing for the rest of the users. However, if you have a look at Superku's Path finding http://opserver.de/pwik7/index.php?title=Pathfinding tip of the week article, and also have a look at:

http://www.conitec.net/beta/aAnhang_Syntax.htm

You can see what the older codes were used and replace them wink


My pathfinding will not be nearly as complex and well done as his until many years to come. However I do intend on continuing my tutorials page and this will be covered to some degree in my own tutorialized way.
© 2024 lite-C Forums