NPC Movement scripting in MP -1 reply

Please wait...

Szico VII

We want FF7-2/remake!

50 XP

15th September 2003

0 Uploads

1,683 Posts

0 Threads

#1 12 years ago

I'm trying to get an NPC to move between three waypoints, and sit down at the bench at waypoint 1 for 7.5 seconds. For some reason this script only makes him sit down for about 2 seconds. Also, how do I get an NPC to turn around as he faces the wrong way when he gets to the bench.? Cheers for any help.

affect ( "jedi1", FLUSH ) { set ( "SET_MORELIGHT", "true" ); set ( "SET_WEAPON", "WP_NONE" ); set ( "SET_WALKSPEED", "200" ); set ( "SET_ANIM_BOTH", "BOTH_SIT5" ); set ( "SET_ANIM_HOLDTIME_BOTH", -1.000 );

task ( "nav1_sitdown" ) { rem ( "Jedi sits down" ); set ( "SET_ANIM_BOTH", "BOTH_SIT5" ); set ( "SET_ANIM_HOLDTIME_BOTH", -1.000 ); wait ( 7500.000 ); signal ( "gotonav2_garden" ); }

task ( "nav2_garden" ) { rem ( "Jedi gets up and walks to waypoint 2" ); set ( "SET_ANIM_BOTH", "BOTH_STAND1" ); set ( "SET_ANIM_HOLDTIME_BOTH", -1.000 ); set ( "SET_WALKING", "true" ); set ( "SET_NAVGOAL", "nav2_garden" ); wait ( 5000.000 ); signal ( "gotonav3_garden" ); }

task ( "nav3_garden" ) { rem ( "Jedi walks to waypoint 3" ); set ( "SET_NAVGOAL", "nav3_garden" ); wait ( 5000.000 ); signal ( "gotonav1_garden" ); }

task ( "nav1_garden" ) { rem ( "Jedi walks to bench" ); set ( "SET_NAVGOAL", "nav1_garden" ); wait ( 4000.000 ); signal ( "nav1_sitdown" ); }

loop ( -1 ) { do ( "nav1_sitdown" ); waitsignal ( "gotonav2_garden" ); do ( "nav2_garden" ); waitsignal ( "gotonav3_garden" ); do ( "nav3_garden" ); waitsignal ( "gotonav1_garden" ); do ( "nav1_garden" ); waitsignal ( "nav1_sitdown" ); }

}




lassev

Degenerate scripter

50 XP

21st June 2004

0 Uploads

847 Posts

0 Threads

#2 12 years ago

Hmm... It surely is an innovative script, no doubt. And so I must also say I have no idea why the wait isn't longer.

I haven't used signalling exactly like that, myself, from inside tasks, although I don't know why it wouldn't work just as well as signalling used inside the normal script flow. I follow the way of minimalist tasks, placing inside them no more than necessary, and thus it doesn't usually include waits, either, nor anims. Actually I use tasks for moving things (move, navgoaling) in case I need to wait("task") them and for the character lines for historical reasons.

Well, you might have already solved your problem in all this time, but since I can't spot an immediately obvious error, I can only suggest structural changes if you have postponed finding the solution. You might try to remove the signalling and wait for the nav_goals. Animations really don't need to be in tasks. Though I have a feeling you did that just to make the loop look tidier, and I can't say that would be a bad idea.

The facing before the animation can be handled with the SET_DYAW command. And you might also find "SET_ANIM_HOLDTIME_BOTH", 0 useful in certain situations, because after you have made an NPC to sit or do other such things, he might not walk properly unless you reset the animation by using the zero value for the holdtime.




Szico VII

We want FF7-2/remake!

50 XP

15th September 2003

0 Uploads

1,683 Posts

0 Threads

#3 12 years ago

Cheers lassev. Turns out the problem was the SET_ANIM_HOLDTIME_BOTH doesn't work in MP so you just have to loop each action based on the default holding time, which in this case is about 3 seconds. SET_DYAW didn't appear to work either, unfortunately.




lassev

Degenerate scripter

50 XP

21st June 2004

0 Uploads

847 Posts

0 Threads

#4 12 years ago

Heh. Well, I'm glad you found out the culprits. I'm unfortunately of little use if any causes of SP-MP incompatibilies are present.