Author Sticky: Post Working Scripts Here
matman Posted: Monday, 24 June 06:29PM
Author Sticky: Post Working Scripts Here
matman Posted: Monday, 24 June 07:43PM
1. Script Name: Improved Random Portal

2. What it does: Teleport to a random location via a useable object.

3. Notes: Ok, that last script I posted had a major flaw in it. See if you can spot it  This one actually does what it's supposed to, but unfortunately it jumps the player around before settling on a waypoint. Any advice to fix this would be appreciated.

4. The Script itself:

NWScript:
void main()

{

    //Get the player who clicked on the portal

    object oPC = GetLastUsedBy();

    //Choose a number between 0 and 7

    int nWaypointNumber = Random(8);

    //Choose a location from a waypoint in the next area based on the number we

    //chose, and make the player teleport there

    switch (nWaypointNumber)

    {

        case 0: AssignCommand( oPC, JumpToLocation( GetLocation( GetWaypointByTag( "My_Waypoint001" ))));

        case 1: AssignCommand( oPC, JumpToLocation( GetLocation( GetWaypointByTag( "My_waypoint002" ))));

        case 2: AssignCommand( oPC, JumpToLocation( GetLocation( GetWaypointByTag( "My_waypoint003" ))));

        case 3: AssignCommand( oPC, JumpToLocation( GetLocation( GetWaypointByTag( "My_waypoint004" ))));

        case 4: AssignCommand( oPC, JumpToLocation( GetLocation( GetWaypointByTag( "My_waypoint005" ))));

        case 5: AssignCommand( oPC, JumpToLocation( GetLocation( GetWaypointByTag( "My_waypoint006" ))));

        case 6: AssignCommand( oPC, JumpToLocation( GetLocation( GetWaypointByTag( "My_waypoint007" ))));

        case 7: AssignCommand( oPC, JumpToLocation( GetLocation( GetWaypointByTag( "My_waypoint008" ))));

    }

}