Jump to content

(OBSE) Example of a re-createable statue


Recommended Posts

Hey,

as of recently entering the final phase of my work on Nehrim, I also changed the script of the socket of the statue in Castle Darlan so it can be re-created.

Aside of that, I either changed the original appearance as I sometimes found a unconscious player copy laying around on the socket. oO

 

This appeared to work very well:

 

 

SCN BurgDarlanStatueScript

ref playerstatue
ref UNFplayerstatueOLD
Short StatueOnce
short Button
ref rUNFpcEquTorch
ref rUNFinvRef

Begin OnActivate
    if ( StatueOnce == 2 ) && ( IsActionRef player == 1 ) && ( GetPCIsSex Male )
        PlaySound "UIMenuPrevNext"
        MessageBoxEx "Statue of the Hero of Darlan: He freed Castle Darlan and the village of Mortram in the year %.0f of the Third Era after Treomar.%r%r%rThe stonemason is motivated and would like to re-create your statue at any time.%rDo you want to get your statue re-created?|Yes|No"  VarStatueYear
        Let StatueOnce := 3
    elseif ( StatueOnce == 2 ) && ( IsActionRef player == 1 ) && ( GetPCIsSex Female )
        PlaySound "UIMenuPrevNext"
        MessageBoxEx "Statue of the Heroine of Darlan: She freed Castle Darlan and the village of Mortram in the year %.0f of the Third Era after Treomar.%r%r%rThe stonemason is motivated and would like to re-create your statue at any time.%rDo you want to get your statue re-created?|Yes|No",  VarStatueYear
        Let StatueOnce := 3
    else
        PlaySound "UIMenuCancel"
        Return
    endif
End

Begin GameMode
if StatueOnce == 3
    Let Button := GetButtonPressed
    if Button == 0
        Let StatueOnce := 0
        Message "Should be called stone master not stonemason!"
    elseif Button == 1
        Let StatueOnce := 2    
    endif
elseif StatueOnce == 2 && playerStatue.IsIdlePlaying == 0    ;=> Failsafes for stone, no idle and wrong placement.
    if playerstatue.GetPos Z < 10900
        playerStatue.moveto DarlanStatueMarkerRef
        if playerstatue.GetCurrentPackage == PlayerStatuePosePackage
        else
            playerStatue.AddScriptPackage PlayerStatuePosePackage
        endif
    endif
    if playerStatue.HasEffectShader effectStone
    else
        playerStatue.pms effectstone
    endif
    playerstatue.PickIdle StatueIdle
elseif StatueOnce == 1 && playerstatue.HasEffectShader effectStone == 0
    playerstatue.pms effectStone    ;=> To ensure the effectShader is applied ASAP after creating the copy.
elseif StatueOnce == 1 && playerStatue.IsWeaponOut
    playerStatue.setunconscious 1
    playerStatue.AddScriptPackage PlayerStatuePosePackage
    Let StatueOnce := 2
elseif (StatueOnce == 0 && GetStage MQ18 > 49 && Player.IsRidingHorse == 0 && Player.GetCurrentAIPackage != 22 && Player.GetCurrentAIPackage != 23)
    Let rUNFpcEquTorch := Player.GetEquippedObject 14 ;=> We MUST NOT create a statue, when the player is interacting with a horse!!!!!!!
    if rUNFpcEquTorch
        Player.UnequipItemSilent rUNFpcEquTorch    ;=> So no torches will be transfered to the actor copy.
    endif                                        ;=> Prevents the weapon & torch in one hand bug.
        
    ForEach rUNFinvRef <- PlayerRef            
        if rUNFinvRef.IsEquipped                    ;=> We move ALL unequipped items into safety.
        else                                        ;=> CreateFullActorCopy also copies the whole inventory and creates new
            rUNFinvRef.RemoveMeIR UnfPCItemSaferREF    ;=> BaseForms out of the item (safed into the savegame).
        endif                                        
    Loop
        
    if playerstatue                ;=> Previously created is now disabled and later removed.
        playerStatue.Disable
        Let UNFplayerstatueOLD := playerstatue
    endif
        
    Let playerStatue := player.CreateFullActorCopy

    playerStatue.moveto DarlanStatueMarkerRef
    playerStatue.setalert 1
    playerStatue.setdestroyed 1        ; so you can't activate player;
    playerStatue.setscale 1.8
    playerStatue.setav speed 0        ; so you can't move it around
    playerStatue.setghost 1
    UnfPCItemSaferREF.RemoveAllItems Player        ;=> I WANT MY ITEMS BACK!
    Let StatueOnce := 1
    if rUNFpcEquTorch
        Player.EquipItemSilent rUNFpcEquTorch
    endif
    if UNFplayerstatueOLD
        UNFplayerstatueOLD.DeleteFullActorCopy    ;=> Acts as return, therefore will be done at the end.
    endif                                        ;=> Old statue is removed from the savegame.
endif
End

 

 

I just had to add the new container for saving the items of the player, but removing them before creating a full actor copy, won't make so many useless copies fo these items.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...