Want to double check a teleport script (before using it)

Post » Fri May 04, 2012 12:32 am

I got a script from the script library and tweaked it to what I think should work. But before I start using it, figured I'd get it double checked. (been so long since I done much scripting in any Bethesda games)

Begin MV_DW_SkullScriptshort OnPCEquipshort buttonif ( MenuMode == 1 )    returnendifif ( OnPCEquip == 1 )    MessageBox "Where would you like to go?" "Darkwater Caverns" "Return to last location" "Nevermind"    set OnPCEquip to 2endifif ( OnPCEquip == 2 )    set button to GetButtonPressed        if ( button == -1 )                return    endif        if ( button == 0 )    if ( GetPCCell "Darkwater Caverns" == 1)        MessageBox "Already home."        set OnPCEquip to 0        return    Else                    player->AddSpell MV_DW_Marker                    set OnPCEquip to 3    endif    endif        if ( button == 1)                player->AddSpell MV_DW_Recall                set OnPCEquip to 3    endif       if ( button == 2 )                set OnPCEquip to 0        endifendifif ( OnPCEquip == 3 )    if ( player->GetEffect sEffectMark == 1 )        player->RemoveSpell MV_DW_Marker        player->PositionCell -4 895 -75 “Darkwater Caverns"        set OnPCEquip to 0    elseif ( player->GetEffect sEffectRecall == 1 )        player->RemoveSpell MV_DW_Recall        set OnPCEquip to 0    endifendifEnd MV_DW_SkullScript
User avatar
+++CAZZY
 
Posts: 3403
Joined: Wed Sep 13, 2006 1:04 pm

Post » Thu May 03, 2012 3:47 pm

I don't think setting OnPCEquip to anything but zero is a good idea. Sure it has to be declared, but it's a system variable used only to determine if a PC has equipped an item or not (0=they haven't; 1=they have). Instead, I would recommend using another variable like location to determine where to send the PC. In your OnPCEquip check, set it back to zero and set location to 1. Other than that, I don't see any issues with it, but I would have to test it out in game to be sure.
User avatar
Dan Stevens
 
Posts: 3429
Joined: Thu Jun 14, 2007 5:00 pm

Post » Fri May 04, 2012 2:49 am

Is there a way to store the player's position where I don't need to give them a mark/recall spell effect that will bork any marks they had?

Tried not using the onpcequip but it kept returning to the menu and never exiting the menu (so went back to the old version that worked)
User avatar
Joe Bonney
 
Posts: 3466
Joined: Tue Jul 17, 2007 12:00 pm


Return to III - Morrowind