DMH-Online

Dungeon Masters Helper · Est. 2005

Placeables Scripts

NWN Script: random_teleport.htm

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" ))));
    }
}
⌂ All Scripts ← PreviousNext → 👁 Category List

All Placeables Scripts

📄 cast_haste 📄 check_fire 📄 chest_puzzle 📄 close_door 📄 close_door_002 📄 close_door_003 📄 close_door_004 📄 create_item_with_delay 📄 darklamp 📄 darklamp_002 📄 day_night_lights 📄 day_night_lights_002 📄 destroy_spawned_items 📄 destroy_spawned_items_002 📄 door_guard 📄 door_lock_item 📄 dragging_placeables 📄 encounter_on_open 📄 encounter_on_open_002 📄 fair_loot 📄 fire_burns 📄 guarded_chest 📄 kill_attacker 📄 kill_nearby 📄 lights_on_off 📄 linked_doors 📄 moveable_placeables 📄 multi_door 📄 open_doors 📄 poly_attacker 📄 polymorph_pc 📄 polymorph_pc_002 📄 random_teleport 📄 refil_chest 📄 refil_chest_002 📄 refil_chest_003 📄 refil_chest_004 📄 refil_chest_005 📄 refil_chest_006 📄 refil_chest_007 📄 remove_with_item 📄 respawner 📄 smart_doors 📄 spit_treasure 📄 talkable_placeables 📄 talking_door 📄 talking_sign 📄 talking_sign_002 📄 talking_sign_003 📄 talking_sign_004 📄 teleporting_chairs 📄 useable_bedroll 📄 useable_birdcage 📄 useable_cannon 📄 useable_catapult 📄 useable_chair 📄 useable_chair_002 📄 useable_chair_003 📄 useable_chair_004 📄 useable_couch 📄 useable_divining_pool 📄 useable_gong 📄 useable_kegs 📄 useable_kegs_002 📄 useable_placeables_002 📄 useable_sign 📄 useable_sign_002 📄 useable_sundial 📄 useable_sundial_002 📄 useable_sundial_003 📄 useable_sundial_004 📄 useable_sundial_005 📄 useable_sundial_006 📄 useable_training_dummy 📄 useable_training_dummy_002 📄 useable_training_dummy_003 📄 useable_training_dummy_004 📄 useable_trapdoor 📄 useable_trapdoor_002 📄 useable_trapdoor_003 📄 useable_trapdoor_004 📄 weapon_spawn_per_class 📄 worth