Aller au contenu

Photo

Scripted Wayponts


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
andysks

andysks
  • Members
  • 1 660 messages
Hi all fellow builders.Here is a problem I have with scripted waypoints.

I am able to do everything I want with an NPC walking any route or patrol.I only have a problem when it comes to animations.What I mean : I read on the sticky thread about scripted waypoints, the script uses lopping animations.Somebody replies and says that we should use custom animations, and my problem is I don't know how to do this.Here is the exact situation I want to give.

There is an NPC...say a gardener.He walks to a point and kneels down seeming that he picks something.Then walks to a crate or something and pausing for a bit seeming he left something.
Is this even possible to do, and if yes how ?

Another animation question...on the OC in the Old Owl Well module there is a greyclock that is hammering the wall.The script that is used is an  OC script and I'm not quite sure if it will work.Is there a way to do something like that?

Thanks a lot for the possible answers :).

#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
PlayCustomAnimation is explained here.  Click through to fnd the list of animations you can use.

Basically, OEI wrote a new set of functions to handle animation when they felt that BioWare's originals were too buggy, and left the originals in.  The oringinal functions only work when the action queue is set up just right, whereas PlayCustomAnimation disregards the action queue altogether.

#3
andysks

andysks
  • Members
  • 1 660 messages
I know the wiki link you posted, however I dont really understand how to use it.

#include "ginc_wp"

void main()
{
int iCurrentWP = GetCurrentWaypoint();
int iNextWP;
switch (iCurrentWP)
{
case 1:
iNextWP = Random(GetNumWaypoints()-1) + 2;
SetNextWaypoint(iNextWP);
ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0, 7.0);
break;
case 2:
SetNextWaypoint(1);
ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0, 4.0);
break;
case 3:
SetNextWaypoint(1);
break;
}
}

This is the script with the looping animations.How do you make it using custom animations instead ?Do I just have to replace the looping animation line with the custom one ?I'm really sorry if I sound too noobish but I'm no scripter so I just try to give it my best.

#4
rjshae

rjshae
  • Members
  • 4 509 messages
I think
ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0, 7.0);
becomes
PlayCustomAnimation(OBJECT_SELF,"animation_name", 1.0, 7.0);
where "animation_name" is the name of the ANIMATION_LOOPING_SIT_CROSS animation file. "sitgroundidle" maybe?

Modifié par rjshae, 30 mai 2013 - 07:57 .


#5
andysks

andysks
  • Members
  • 1 660 messages
I have tried that solution already and it gives me a VARIABLE DEFINED WITHOUT TYPE on the compile.I'm really confused because it shouldn't be so hard...should it ?

#6
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
The parameters are different, should be like

PlayCustomAnimation(OBJECT_SELF,"sitgroundidle", TRUE, 1.0);

make sure to include the ""s, as this is a string, not a constant.

#7
andysks

andysks
  • Members
  • 1 660 messages
Thanks both of you.That did the job half way.What I mean is that the NPC when he reaches the WP sits but only for 1 second no matter how many seconds I set him to.Does he need a defined pause after that to stay there and then get up to continue his route ?
In any case thanks, I guess from this point my problem is pretty solved.

#8
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
You need to pause the walking, IIRC there's an example of how to do that in the walkwaypoints script template - FaceAndPause.