Moving people around
Wp:Teleport("waypoint"); Instantly teleports actor to the waypoint
Wp:Goto("waypoint"); actor walks to the waypoint.
If the waypoint you're trying to reach is in another room, the actor will reach the transition waypoint, go into the crucifiction pose (default unanimated postion), and teleport to the transition waypoint in the next room. Looks goofy. It's better to take control and only goto the transition waypoint, then teleport to the next room and continue from there.
Example: I want the WO to move from the control room ladder (CR_Stairs) back to his regular position in the fore quarters.
Rather than doing this:
It looks better to do this:
Quote:
Wp:Goto("CR_WP08_DOOR");
Wp:Teleport("RR_WP01_DOOR");
Wp:Goto("QRF_Watch");
|
CR_WP08_DOOR is the waypoint in the control room next to the foreward hatch. RR_WP01_DOOR is the waypoint on the other side of the hatch. Ideally we'd perform an animation there to have him duck thru the hatch, but we don't have one that'll work.
Generally, when you want to move people around, it's best to find out where they are first. You don't want to trigger your new sequence if he's already there, right? Wp:IsCurrentWaypoint("waypoint") will tell you that.
For the example above, we'd only want the WO to walk from the ladder if that's where he's currently located, so we put our move logic into an if statement conditioned off his current waypoint. If he's not at CR_STAIRS, it won't be executed. I've highlighted the syntax.
Quote:
if Wp:IsCurrentWaypoint("CR_STAIRS") then
{Wp:Goto("CR_WP08_DOOR");
Wp:Teleport("RR_WP01_DOOR");
Wp:Goto("QRF_Watch");
}
endif;
|
It's sometimes preferable to use 'not' logic on that check. Suppose I want to send the WO to waypoint WT_CR02 on the bridge when surfaced. I don't care where he's currently at, if he's not on the bridge. An exclamation point in front of the check reverses the logic. So !Wp:IsCurrentWaypoint("waypoint") means
not at that waypoint. If he's aready there, we'll add an else condition and have him perform the appropriate animation.
Quote:
if !Wp:IsCurrentWaypoint("WT_CR02") then
{Wp:Teleport("WT_CR02");
}
else
{Wp:PlayAnimationAndWait( "WT_CR02_Contact01_7A" ); <--- this is the 'mad pointer' animation, btw
}
endif;
|
The if check is also where you should perform any uniform changes and whatnot. Let's give him binoculars and since his default torso already show binoculars around his neck, we'll swap his torso for a similar one without them. When we bring him back, we'll have to remember to swap them back.
Quote:
if !Wp:IsCurrentWaypoint("WT_CR02") then
{Wp:Teleport("WT_CR02");
Wp:SetBodyPartVisibility("object1_Binocular", 1);
Wp:SetBodyPartVisibility("D_Torso03", 0);
Wp:SetBodyPartVisibility("D_Torso01", 1);
}
else
{Wp:PlayAnimationAndWait( "WT_CR02_Contact01_7A" );
}
endif;
|