DMH-Online

Dungeon Masters Helper · Est. 2005

Areas Scripts

NWN Script: full_edge_transition_001.htm

Author Sticky: Post Working Scripts Here
Bartok Posted: Tuesday, 25 June 03:57AM
Here's a simple script that will allow a full edge area transition. If you walk south across the trigger in the SW corner, then you will appear in the NW corner of the new area.

This is based on Richard Conner's Mighty Teleport Script, which needed some tweaks to make it work with the new toolset.

NWScript:
void main()
{
    /*
     * Full-Edge Area Transition
     * -------------------------
     * Based on The Mighty Teleport Script from Richard Conner
     * Jonathan Warrington
     *
     * Usage
     * -----
     * This is attached to the OnClick event of a GenericTrigger
     * Two properties need to be modified to your areas.  First,
     * the GetObjectByTag line, fill in the tag of your trigger,
     * that's in the destination area.  Second, make sure the
     * appropriate vDest is uncommented.
     */
    //Get the PC that just clicked on the transition
    object oClicker = GetClickingObject();
    //Get the location of the PC
    location lLoc = GetLocation( oClicker );
    //Get the PC's postion
    vector vEnter = GetPositionFromLocation( lLoc );
    //The Trigger that's in the destination area
    object oTran = GetObjectByTag( "Area2Tran" );
    //Get the destination area
    object oDestArea = GetArea( oTran );
    //Get the postition of the trigger
    vector lTranVec = GetPositionFromLocation( GetLocation( oTran ) );
    //Calculates the destination postition (Uncomment either
    //the east / west or the north / south one.
    /*East / West Transition*/
    //vector vDest=Vector( lTranVec.x, vEnter.y );
    /*North / South Transition*/
    vector vDest=Vector( vEnter.x, lTranVec.y );

    //Get the PC's facing
    float fFacing = GetFacingFromLocation( lLoc );
    //Create a new Location to place the PC in
    location locNew = Location( oDestArea, vDest, fFacing );
    //Clear all PC actions, (Stop walking) and then jump
    //to the new location.
    AssignCommand( oClicker, ClearAllActions() );
    AssignCommand( oClicker, JumpToLocation( locNew ) );
}
⌂ All Scripts ← PreviousNext → 👁 Category List

All Areas Scripts

📄 ambient_npc_ani 📄 area_spawner 📄 change_lighting 📄 clean_trash_001 📄 clean_trash_002 📄 clean_trash_003 📄 despawn_mobs 📄 despawn_mobs_002 📄 disable_sound 📄 full_edge_transition_001 📄 full_edge_transition_002 📄 full_edge_transition_003 📄 full_edge_transition_004 📄 full_edge_transition_004a 📄 get_pcs 📄 guard_patrols 📄 keyed_transitions 📄 random_enc_001 📄 random_enc_002 📄 random_enc_003 📄 random_enc_004 📄 random_enc_006 📄 random_enc_009 📄 random_encounter_005 📄 random_interiors 📄 random_interiors_001a 📄 restrict_access 📄 sitting_area