I've been having problems with scripted waypoints. I've read the tutuorial and even generated some good behavior with scripted waypoints, but I'm running into trouble now, even with basic scripts.
Right now, I'm just trying to debug and make a NPC go between 2 waypoints. At the first one, a "1" should appear over the PC's head and at the second one, a "2" should appear over the PC's head.
What actually happens is the NPC gets stuck at either waypoint and just keeps printing the number over the PC's head.
Here's the script:
#include "ginc_wp"
#include "x0_i0_walkway"
void main()
{
object oSelf=OBJECT_SELF;
object oNextWPT = GetNextWalkWayPoint();
object oSigurd = GetNearestObjectByTag("sigurd_ibsen");
object oHans = GetObjectByTag("hans");
object oFranz = GetObjectByTag("franz");
object oBearl = GetObjectByTag("bearl_albracht");
int nCurrentWPT = GetCurrentWaypoint();
FloatingTextStringOnCreature("worked",GetFirstPC());
//FloatingTextStringOnCreature(IntToString(nCurrentWPT),GetFirstPC());
//FloatingTextStringOnCreature(GetTag(GetNextWalkWayPoint()),GetFirstPC());
switch (nCurrentWPT)
{
case 1:
FloatingTextStringOnCreature("1",GetFirstPC());
DoWalkWayPointStandardActions(oSelf,TRUE);
break;
case 2:
FloatingTextStringOnCreature("2",GetFirstPC());
break;
}
}
Basic walkwaypoint scripting help
Débuté par
M. Rieder
, juin 15 2011 11:43
#1
Posté 15 juin 2011 - 11:43
#2
Posté 16 juin 2011 - 12:33
I tried your script above and got the same results you did. Oddly, I then tried the example script that Charles Mead gave, and it was all messed up as well. At WP#1 it was stuck in a continual loop of what was supposed to be happening at WP#2 (an animation in this case). Let me look around in my mod where I have them (seemingly) working and see if I can find the difference...
#3
Posté 16 juin 2011 - 01:17
I stripped your test script above down to a working example. The NPC just walks back and forth between the two WPs and at each says "Worked" and the WP number. However, in every test I did, he ALWAYS went to WP#2 first not WP#1. Also, in your script above I think OBJECT_SELF is the module since that is what is running the script.
Stripped down code (just commented out stuff):
#include "ginc_wp"
//#include "x0_i0_walkway"
void main()
{
//object oSelf=OBJECT_SELF;
//object oNextWPT = GetNextWalkWayPoint();
//object oSigurd = GetNearestObjectByTag("sigurd_ibsen");
//object oHans = GetObjectByTag("hans");
//object oFranz = GetObjectByTag("franz");
//object oBearl = GetObjectByTag("bearl_albracht");
int nCurrentWPT = GetCurrentWaypoint();
FloatingTextStringOnCreature("worked",GetFirstPC());
//FloatingTextStringOnCreature(IntToString(nCurrentWPT),GetFirstPC());
//FloatingTextStringOnCreature(GetTag(GetNextWalkWayPoint()),GetFirstPC());
switch (nCurrentWPT)
{
case 1 :
FloatingTextStringOnCreature("1",GetFirstPC());
//DoWalkWayPointStandardActions(oSelf,TRUE);
break;
case 2 :
FloatingTextStringOnCreature("2",GetFirstPC());
break;
}
}
Stripped down code (just commented out stuff):
#include "ginc_wp"
//#include "x0_i0_walkway"
void main()
{
//object oSelf=OBJECT_SELF;
//object oNextWPT = GetNextWalkWayPoint();
//object oSigurd = GetNearestObjectByTag("sigurd_ibsen");
//object oHans = GetObjectByTag("hans");
//object oFranz = GetObjectByTag("franz");
//object oBearl = GetObjectByTag("bearl_albracht");
int nCurrentWPT = GetCurrentWaypoint();
FloatingTextStringOnCreature("worked",GetFirstPC());
//FloatingTextStringOnCreature(IntToString(nCurrentWPT),GetFirstPC());
//FloatingTextStringOnCreature(GetTag(GetNextWalkWayPoint()),GetFirstPC());
switch (nCurrentWPT)
{
case 1 :
FloatingTextStringOnCreature("1",GetFirstPC());
//DoWalkWayPointStandardActions(oSelf,TRUE);
break;
case 2 :
FloatingTextStringOnCreature("2",GetFirstPC());
break;
}
}
#4
Posté 16 juin 2011 - 02:16
Thanks for your help KM. I'm going to start over and add stuff bit by bit to see where the problem starts.
#5
Posté 16 juin 2011 - 02:32
I'm really not sure exactly what I was doing wrong before, The OBJECT_SELF thing probably didn't help, but it seems like it is starting to work properly. Thanks for helping me work through this.
#6
Posté 16 juin 2011 - 02:58
I think I found out what broke it. As soon as I added the funtion PlayAnimation(), it stopped working. I think that is what broke it....
Yep, just put in PlayCustomAnimation() and it worked a treat!
Yep, just put in PlayCustomAnimation() and it worked a treat!
#7
Posté 16 juin 2011 - 04:31
NP, glad to hear things are working.
#8
Posté 16 juin 2011 - 09:36
Just wondering... but you didnt have PlayAnimation() in your script above.
Edit: That must be from the other post nvm.
Edit: That must be from the other post nvm.
Modifié par Morbane, 16 juin 2011 - 09:43 .





Retour en haut






