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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, 7th_zorro, 1 invisible), 887 guests, and 3 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
Page 2 of 3 1 2 3
Re: Path makes NPC disappear [Re: Ruben] #455789
10/30/15 03:43
10/30/15 03:43

M
Malice
Unregistered
Malice
Unregistered
M



It would seem the monster function crashes(clicking 'ok' you continue to run the program,however the bad function never runs again .i.e. monster_code)) , however the loop inside ent_movepath is still running. The ent_animate is in the monster loop that has crashed, so stops running.

Anyway good luck have fun. I got no answers for you, there is a reason that I don't use that function. Also i see the " ....." and there have been times your issues were with code inside the "...."
Track down you e1513, also that function - the monster will always "wrap" to the first node.

Last edited by Malice; 10/30/15 03:44.
Re: Path makes NPC disappear [Re: ] #455791
10/30/15 03:55
10/30/15 03:55

M
Malice
Unregistered
Malice
Unregistered
M



You can modify my basic path function found here
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=54661&Number=455425#Post455440

You my have add so math to smooth the between nodes like path_spline does.

By setting the node number closest to the monster here
my.NODE_NEXT=path_nextnode(my,1,1); // SET THE NODE
you can avoid the wrapping.

I am providing no more support for this, Unless I get bored when the weekend and drinks run out.
Mal

Last edited by Malice; 10/30/15 03:57. Reason: Correct link adress
Re: Path makes NPC disappear [Re: ] #455810
10/30/15 16:41
10/30/15 16:41
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
I have had my fill of ent_movepath(). It is not a user friendly function.

You mentioned you stay away from this function. Do you know of a better way to accomplish what I am trying to accomplish?

Re: Path makes NPC disappear [Re: Ruben] #455814
10/30/15 19:35
10/30/15 19:35

M
Malice
Unregistered
Malice
Unregistered
M



^ um see my post above ^ ????

Re: Path makes NPC disappear [Re: ] #455818
10/30/15 21:43
10/30/15 21:43
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Your function seems to partially work. I am still trying to adapt it to my code to possibly make it work.

In the meantime, I found another possible solution that seems to work mostly well. I am using ent_moveto() and ent_turnto() functions. They seem to be moving the monster down the staircase as needed. The only problem is that I am using a wait_for_my(ent_moveto) function that seems to prevent any animations from occurring, such as a running animation, until the ent_moveto() is finished.

Here is the code I am using to do this:

Code:
action monster_code()
{
   ...

   ent_animate(my, "run", anim_percentage, ANM_CYCLE); // This does not work 
                                       //    with the wait_for_my(ent_moveto)
                                       //    below.
   anim_percentage += 8 * time_step;

   ent_moveto(me, vector(322,555,196), 4); // 1st location down spiral staircase
   ent_turnto(me, vector(360,0,0), 4);
   wait_for_my(ent_moveto);
   ent_moveto(me, vector(617,37,120), 4); // 2nd location down spiral staircase
   ent_turnto(me, vector(300,0,0), 4);
   wait_for_my(ent_moveto);   // wait until target position reached        
   ent_moveto(me, vector(315,-442,49), 4); // 3rd location down spiral staircase
   ent_turnto(me, vector(240,0,0), 4);
   wait_for_my(ent_moveto);

   ...
}



If I take out all the wait_for_my() code, the running animation will happen, but the monster entity will move through the air directly from the 1st spiral staircase location to the 3rd location. The wait_for_my() functions make it so that the monster entity reaches the next location before turning and moving toward the next location given. The ent_turnto() seems to work with the wait_for_my() function calls, just not the running animation.

If I took out just the last wait_for_my() function call out of the above code, the monster would move and face the correct destinations while gliding with no animation. Once it got past the second destination though, it would start a running animation while it was being moved using ent_moveto(), so it is clear that the wait_for_my() function is what is causing the running animation to not occur.

Is there a way to allow the running animation to keep going even though the wait_for_my() function is being used?

This method seems to work perfectly, except for the fact that the monster does not appear to be running, only gliding toward the right directions with no animation.



Last edited by Ruben; 10/30/15 21:51.
Re: Path makes NPC disappear [Re: Ruben] #455820
10/30/15 21:59
10/30/15 21:59

M
Malice
Unregistered
Malice
Unregistered
M



At this time, I am evoking this -
Quote:
I am providing no more support for this, Unless I get bored when the weekend and drinks run out.


I'm a six-pack in already and it's a fun holiday weekend.

Best luck
Mal

Last edited by Malice; 10/30/15 22:00.
Re: Path makes NPC disappear [Re: ] #455825
10/31/15 00:24
10/31/15 00:24
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Originally Posted By: Malice
You can modify my basic path function found here
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=54661&Number=455425#Post455440

You my have add so math to smooth the between nodes like path_spline does.

By setting the node number closest to the monster here
my.NODE_NEXT=path_nextnode(my,1,1); // SET THE NODE
you can avoid the wrapping.

I am providing no more support for this, Unless I get bored when the weekend and drinks run out.
Mal

I tried using your function. The monster does run toward the first node, but does not go beyond the first node.

I am trying to figure out how to make it go to the second node.

Re: Path makes NPC disappear [Re: Ruben] #455826
10/31/15 00:47
10/31/15 00:47

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
At this time, I am evoking this -
Quote:
I am providing no more support for this, Unless I get bored when the weekend and drinks run out.


I'm a six-pack in already and it's a fun holiday weekend.

Best luck
Mal


You obviously do not read what I post. That function works. It was the core of my space race game. I can write it, rewrite, mod it and make it give birth to little 3d puppies.

Good NIGHT
Mal

Re: Path makes NPC disappear [Re: ] #455832
10/31/15 08:57
10/31/15 08:57
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Ruben if your character does not go past the first node you obviously have to check the code and the comparisons involved which handle getting new nodes. From a first glance this seems to be stuff like this:
Code:
if(vec_dist(my.x,vec_next_node.x) < my.max_x)


Use draw_point3d to display let's say my.x and vec_next_node.x. You can use draw_line3d too.
Then DEBUG_VAR or draw_num3d (http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=455738#Post455738) to check both the vec_dist and my.max_x values, and draw my.NODE_NEXT.
Oftentimes nodes and such can have different heights compared to where "my.z" is, let's say when the origin of your model is rather low and the path node z values at a too high position. Then xy-dist will get as close as it gets but the z-difference can, because of your gravity code and such, remain too big. If you only have one floor you can set the vec_next_node.z value always to my.z.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Path makes NPC disappear [Re: Superku] #455851
11/01/15 07:23
11/01/15 07:23

M
Malice
Unregistered
Malice
Unregistered
M



^ Of course Superku is correct. The code was write to in current form for 2d movement - no z changes. It's clear in the line Superku points out and the lack of a Z-axis in the c_move of the code.

This correct can help
Code:
action ....()
{
var fxd_car_length =2.5; // A factor for the mulling the length of the models d-plane, current setting will more then double, reduce or increase at 0.25 increments as needed.

//......................................................
// my.max_x-my.min_x == total length from back x bbox plane to front x bbox plane Mulled by a factor of 2.5 , should mean even if there is a z-axis drop, this abs dist-num should be long enough. 
// Note to add the my.min_x value always "-" sub it, it is stored a a negative number. 
if(vec_dist(my.x,vec_next_node.x) < (my.max_x-my.min_x) * fxd_car_length )    
		{



Happy Halloween, I've got a ghost in my bed and she wants to rattle the chain. So have fun and game-on
Mal

Last edited by Malice; 11/01/15 07:26.
Page 2 of 3 1 2 3

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