Bioware Archive
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
SMF - Just Installed!
Home
Help
Login
Register
Bioware Archive
»
Bioware Archive V2
»
Builders - Scripting
»
Synchronized Walking
« previous
next »
Print
Pages: [
1
]
Author
Topic: Synchronized Walking (Read 342 times)
Legacy_HipMaestro
Hero Member
Posts: 2849
Karma: +0/-0
Synchronized Walking
«
on:
October 13, 2010, 11:36:49 pm »
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?
Logged
Legacy_Lightfoot8
Hero Member
Posts: 4797
Karma: +0/-0
Synchronized Walking
«
Reply #1 on:
October 14, 2010, 11:14:35 am »
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 .
Logged
Legacy_HipMaestro
Hero Member
Posts: 2849
Karma: +0/-0
Synchronized Walking
«
Reply #2 on:
October 14, 2010, 02:19:26 pm »
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.
Logged
Legacy_Lightfoot8
Hero Member
Posts: 4797
Karma: +0/-0
Synchronized Walking
«
Reply #3 on:
October 14, 2010, 05:04:19 pm »
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.
Logged
Legacy_Mudeye
Full Member
Posts: 238
Karma: +0/-0
Synchronized Walking
«
Reply #4 on:
October 14, 2010, 05:29:33 pm »
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 );
}
}
}
Logged
Legacy_HipMaestro
Hero Member
Posts: 2849
Karma: +0/-0
Synchronized Walking
«
Reply #5 on:
October 14, 2010, 07:45:20 pm »
@ 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.
Logged
Legacy_jmlzemaggo
Hero Member
Posts: 1869
Karma: +0/-0
Synchronized Walking
«
Reply #6 on:
January 22, 2011, 08:59:58 pm »
Simple: Have them falling in love.
Logged
Legacy_La Rose Noire
Newbie
Posts: 49
Karma: +0/-0
Synchronized Walking
«
Reply #7 on:
January 23, 2011, 08:50:32 am »
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.
Logged
Print
Pages: [
1
]
« previous
next »
Bioware Archive
»
Bioware Archive V2
»
Builders - Scripting
»
Synchronized Walking