How can I keep a couple walking together on an assigned (waypointed) route?
I've tried using delays between paralleled walkway points but besides just being clunky... eventually, they will become unsynched anyway given enough time lapsed (not that they really ever were in the first place).
I've read about some like simulating dancing that seemed rather complex so I amhoping this relatively non-random scenario would be easier to control.
Any suggestions?
Synchronized Walking
Débuté par
HipMaestro
, oct. 13 2010 10:36
#1
Posté 13 octobre 2010 - 10:36
#2
Posté 14 octobre 2010 - 10:14
The first thing that comes to my mind, is to script a check at the way points to make sure both NPC have arrived at it, before letting them leave for the next one.
Modifié par Lightfoot8, 14 octobre 2010 - 10:15 .
#3
Posté 14 octobre 2010 - 01:19
I was thinking along that line, as well. I was figuring each NPC could set/increment an OnEnter variable at a trigger and then possibly set it back to a default value OnExit in anticipation of the next synch point.
Is there a single function that can be used to delay the autowalk feature? Since the actual action function is being controlled via the waypoint system, I'm confused as to how to interrupt and resume that action.
Is there a single function that can be used to delay the autowalk feature? Since the actual action function is being controlled via the waypoint system, I'm confused as to how to interrupt and resume that action.
#4
Posté 14 octobre 2010 - 04:04
I can not think of a single function that you could use. It would be more of adjusting the walk waypoint functions already in use.
A second thought. Would it work if you had just one NPC walking the waypoints and the other NPC following the fitst.
You could use ActionForceFollowObject() to do that.
A second thought. Would it work if you had just one NPC walking the waypoints and the other NPC following the fitst.
You could use ActionForceFollowObject() to do that.
#5
Posté 14 octobre 2010 - 04:29
Here is a way to do it by writing your own scripts for waypoint walkers. I'm not at the toolset so I haven't compiled it. There may be bugs but the idea is sound.
1) Make a Waypoint for each link in the walk circuit. These are not waypoints on the creature. These are independent waypoints. The should all have unique tags.
2) Use the Trigger Wizard to make a trigger called WalkTrigger that has the script below for the OnEnter script.
3) For each waypoint in the circuit set a WalkTrigger area around the Waypoint.
4) On the Trigger set a local string. The name is "NextWP" the value is the tag of the next waypoint in the circuit.
5) Create your walking NPCs. For each NPC set a local int called "isWalker" to 1.
6) Place or spawn the walking NPCs at one of the way points.
They should walk the circuit. The first one there waits for the second one. When the second one arrives they both start walking to the next waypoint and so on.
void main()
{
object walker = GetEnteringObject();
int isWalker = GetLocalInt(walker, "isWalker" );
if( isWalker )
{
int walkCnt = GetLocalInt(OBJECT_SELF, "WalkCnt");
if( walkCnt == 0 )
{
SetLocalInt( OBJECT_SELF, "WalkCnt", 1 );
SetLocalObject( OBJECT_SELF, "Walker", walker );
}
else
{
string wayPointTag = GetLocalString(OBJECT_SELF, "NextWP" );
object nextWP = GetWaypointByTag( OBJECT_SELF, wayPointTag );
AssignCommnand( walker, ActionMoveToObject( nextWP ) );
walker = GetLocalObject( OBJECT_SELF, "Walker" );
AssignCommnand( walker, ActionMoveToObject( nextWP ) );
SetLocalInt( OBJECT_SELF, "WalkCnt", 0 );
}
}
}
1) Make a Waypoint for each link in the walk circuit. These are not waypoints on the creature. These are independent waypoints. The should all have unique tags.
2) Use the Trigger Wizard to make a trigger called WalkTrigger that has the script below for the OnEnter script.
3) For each waypoint in the circuit set a WalkTrigger area around the Waypoint.
4) On the Trigger set a local string. The name is "NextWP" the value is the tag of the next waypoint in the circuit.
5) Create your walking NPCs. For each NPC set a local int called "isWalker" to 1.
6) Place or spawn the walking NPCs at one of the way points.
They should walk the circuit. The first one there waits for the second one. When the second one arrives they both start walking to the next waypoint and so on.
void main()
{
object walker = GetEnteringObject();
int isWalker = GetLocalInt(walker, "isWalker" );
if( isWalker )
{
int walkCnt = GetLocalInt(OBJECT_SELF, "WalkCnt");
if( walkCnt == 0 )
{
SetLocalInt( OBJECT_SELF, "WalkCnt", 1 );
SetLocalObject( OBJECT_SELF, "Walker", walker );
}
else
{
string wayPointTag = GetLocalString(OBJECT_SELF, "NextWP" );
object nextWP = GetWaypointByTag( OBJECT_SELF, wayPointTag );
AssignCommnand( walker, ActionMoveToObject( nextWP ) );
walker = GetLocalObject( OBJECT_SELF, "Walker" );
AssignCommnand( walker, ActionMoveToObject( nextWP ) );
SetLocalInt( OBJECT_SELF, "WalkCnt", 0 );
}
}
}
#6
Posté 14 octobre 2010 - 06:45
@ Lightfoot8: Actually, the follow option would be handy to have a pet tag along so I may still have use for the function you've suggested. But I was trying to graphically show a couple walking a perimeter side-by-side or as closely as possible even if one would occasionally lag. If there were a periodic synch up then the lagging could be kept at a minimum and when revisiting the same area a bit later, a PC would still see the same couple together.
I am assuming that each time an area reloads all the static, neutral NPCs return to their starting positions, but I'm not absolutely sure if that is how it is designed to work.
@Mudeye: Your code seems a solid strategy. I'll begin experimenting with it immediately. And thanks for the accompanying details with the script. Every little bit helps leaps and bounds.
I am assuming that each time an area reloads all the static, neutral NPCs return to their starting positions, but I'm not absolutely sure if that is how it is designed to work.
@Mudeye: Your code seems a solid strategy. I'll begin experimenting with it immediately. And thanks for the accompanying details with the script. Every little bit helps leaps and bounds.
#7
Posté 22 janvier 2011 - 08:59
Simple: Have them falling in love.
#8
Posté 23 janvier 2011 - 08:50
You can script their ohb to store an integer each one on the other when they reach a waypoint. And they follow the road only if they have the integer of their mate.
Like
when first NPC is at first waypoint, register on it and on the other "iFirstStep_1" and when the second reach the waypoint, register on both "iFirstStep_2". And in the ohb of both, if "iFirstStep_1" and "iFirstStep_2" are TRUE, they both walk to waypoint 2, deleting the 2 integers to remake then when they reach waypoint 2.
Like
when first NPC is at first waypoint, register on it and on the other "iFirstStep_1" and when the second reach the waypoint, register on both "iFirstStep_2". And in the ohb of both, if "iFirstStep_1" and "iFirstStep_2" are TRUE, they both walk to waypoint 2, deleting the 2 integers to remake then when they reach waypoint 2.





Retour en haut







