Jump to content

Home

(TSL) Script question


Malxados

Recommended Posts

For booleans, just change the number to boolean, like in the following script:

 

void main() {
  SetGlobalBoolean( string "MY_NEW_GLOBAL", int "STAGE" );
}

 

To warp to another module, where the last two parameters are optional:

 

void main() {
  StartNewModule( string "MODULE_NAME", string "WAYPOINT_NAME", string "MOVIE_TO_PLAY" );
}

 

To warp to another location within the same module:

 

void main() {
  ActionJumpToLocation( location "LOCATION_NAME" );
}

 

- Star Admiral

Link to comment
Share on other sites

I recommend using this script for warping to another vector in the same module. (You have X,Y & Z coordinates)

void main() {
   object oJump = GetFirstPC();
   // Presumably you want to jump the PC, otherwise replace this with:
   // object oJump = GetObjectByTag("tag_of_npc");

   vector vJump;
       vJump.x = 0.0; // X Coord
       vJump.y = 0.0; // Y Coord
       vJump.z = 0.0; // Z Coord
   float fFacing = 90.0; // 0 degrees is East, 90 is North and follows counter-clockwise respectively.
   location lJump = Location(vJump, fFacing);

   AssignCommand(oJump, ActionJumpToLocation(lJump));
}

 

Alternatively if you want to jump to a Waypoint (.utw template) you can use this.

void main() {
   object oJump = GetFirstPC();
   // Presumably you want to jump the PC, otherwise replace this with:
   // object oJump = GetObjectByTag("tag_of_npc");
   object oJumpto = GetWaypointByTag("tag_of_waypoint");

   location lJump = GetLocation(oJumpto);

   AssignCommand(oJump, ActionJumpToLocation(lJump));
}

 

Hope that helps. ;)

Link to comment
Share on other sites

Yours is more detailed. Should have done the same for mine. Thanks glovemaster.

 

BTW, just for my own knowledge, we are allowed to assign commands to the PC with a script? I thought that the AssignCommand() function only works for NPCs.

 

- Star Admiral

Link to comment
Share on other sites

BTW, just for my own knowledge, we are allowed to assign commands to the PC with a script? I thought that the AssignCommand() function only works for NPCs.

 

You can; though unless you do it in a cutscene or otherwise have locked out player controls any actions assigned to the player character could be overridden by the player if they clear or manipulate their action queue (the little box where attacks, feats and power uses to be performed are listed).

Link to comment
Share on other sites

You can; though unless you do it in a cutscene or otherwise have locked out player controls any actions assigned to the player character could be overridden by the player if they clear or manipulate their action queue (the little box where attacks, feats and power uses to be performed are listed).

 

Yes, I found that just moving clears the action queue - I'm unsure if there is any function to temporarily stop control of the PC short of NoClicks() which doesn't stop movement.

 

What I did was to stop the player from moving at the same time, off the top of my head I think it was EffectEntangle() or decreasing the PC's movement speed by 100%.

Link to comment
Share on other sites

You can stop the player by using

 

" ClearAllActions "

 

" ActionDoCommand(SetCommandable(FALSE,oNPC)); "

 

to make the PC unable to control " oNPC "and

 

" object oNPC=GetFirstPC; "

 

to varify oNPC.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...