68 lines
1.8 KiB
Plaintext
68 lines
1.8 KiB
Plaintext
|
void main()
|
||
|
{
|
||
|
|
||
|
|
||
|
// get my own tag
|
||
|
string sMytag=GetTag(OBJECT_SELF);
|
||
|
// get my waypoint's tag
|
||
|
string sMyWP="WP_"+sMytag;
|
||
|
|
||
|
// get the tag of the transition I am going to - this is my own name
|
||
|
string sDestag=GetName(OBJECT_SELF);
|
||
|
// get the tag of the waypoint of my destination
|
||
|
string sDestWP="WP_"+sDestag;
|
||
|
|
||
|
//Get the PC that just clicked on the transition
|
||
|
object oClicker = GetEnteringObject();
|
||
|
//Get the location of the PC
|
||
|
location lLeave = GetLocation( oClicker );
|
||
|
//Get the PC's postion
|
||
|
vector vLeave = GetPositionFromLocation( lLeave );
|
||
|
|
||
|
//The Trigger that's in the destination area
|
||
|
object oTran = GetObjectByTag( sDestag );
|
||
|
//Get the destination area
|
||
|
object oDestArea = GetArea( oTran );
|
||
|
|
||
|
// debug
|
||
|
|
||
|
//SpeakString(sMytag);
|
||
|
//SpeakString(sMyWP);
|
||
|
//SpeakString(sDestag);
|
||
|
//SpeakString(sDestWP);
|
||
|
|
||
|
// get the vector of the entering waypoint.
|
||
|
|
||
|
location lWPleave = GetLocation( GetObjectByTag(sMyWP) );
|
||
|
vector vWPleave = GetPositionFromLocation( lWPleave );
|
||
|
|
||
|
|
||
|
|
||
|
///get the PC's vector when compared to the leaving WP.
|
||
|
vector vDifference = vWPleave-vLeave;
|
||
|
|
||
|
// get the location of the waypoint to go to
|
||
|
|
||
|
location lWPenter = GetLocation( GetObjectByTag(sDestWP) );
|
||
|
|
||
|
|
||
|
/// get the vector of the spawnpoint to go to:
|
||
|
|
||
|
vector vWPenter = GetPositionFromLocation( lWPenter );
|
||
|
|
||
|
/// add in the difference
|
||
|
|
||
|
vector vFinal= vWPenter-vDifference;
|
||
|
|
||
|
|
||
|
|
||
|
//Get the PC's facing
|
||
|
float fFacing = GetFacingFromLocation( lLeave );
|
||
|
//Create a new Location to place the PC in
|
||
|
location locNew = Location( oDestArea, vFinal, fFacing );
|
||
|
//Clear all PC actions, (Stop walking) and then jump
|
||
|
//to the new location.
|
||
|
AssignCommand( oClicker, ClearAllActions() );
|
||
|
AssignCommand( oClicker, JumpToLocation( locNew ) );
|
||
|
}
|