Jump to content

Recommended Posts

Posted (edited)


Any thoughts on the best way to fix this. The point is to make sure the player has an axe when activating. If so,the screen fades to black, the mining sound plays, the player's health etc is effected, the player gets resources added to inventory and 2 game hours pass. The 'mine' then resets if the player wants to mine some more.

This script works... just wondering if there is something I could improve on.







scn BlackbriarResourceSaltMiningScriptMAIN

int State

Begin onActivate
If Player.GetItemCount BlackbriarWeaponAxe >= 1 && State == 0 && GetActionRef == player
set State to 1
endif
End

Begin GameMode

If State == 1
imod FadeToBlackISFX
Playsound BlackbriarBlackSmithHammer
RewardXP 5
ShowMessage BlackbriarSaltMinigMesg
Player.DamageActorValue Health 5
Player.ModActorValue Strength 2
Player.DamageActorValue Dehydration 5
Player.DamageActorValue Hunger 5
Player.additem BlackbriarSalt 10
set State to 0
set gamehour to gamehour + 2
Endif

End

 

Edited by Guest
Posted

Three things I do need to improve > 1. remove player controls during fadeout. 2. make fadeout time a bit longer (since it takes about 2 hours game time to mine). 3. Have BlackbriarSaltMinigMesg show AFTER you fade back in...

Posted

I use staged timers for just about everything that I want to script as a sequence of events.

scn BlackbriarResourceSaltMiningScriptMAIN

int State
float fTimer

Begin onActivate
    If Player.GetItemCount BlackbriarWeaponAxe >= 1 && State == 0 && GetActionRef == player
        set State to 1
      endif
End

Begin GameMode

    if (fTimer > 0)
        set fTimer to fTimer - GetSecondsPassed
    else
        If State == 1
            imod FadeToBlackISFX
            DisablePlayerControls 1 1 1 1 0 1 1        ;only allow looking
            set State to 2
            set fTimer to 3                         ;depending on Imod
            Playsound BlackbriarBlackSmithHammer
        elseif State == 2
            EnablePlayerControls 1 1 1 1 1 1 1
            RewardXP 5
            ShowMessage BlackbriarSaltMinigMesg
            Player.DamageActorValue Health 5
            Player.ModActorValue Strength 2
            Player.DamageActorValue Dehydration 5
            Player.DamageActorValue Hunger 5
            Player.additem BlackbriarSalt 10
            set State to 0
            ;need some code here to account for gamehour > 23 or crossing into next day. See NVDLC03ThinkTankDoorSCRIPT for example
            set gamehour to gamehour + 2
        endif
    endif

End
Posted

You should also do a check to ensure you're not doing something bad such as setting the game hour to a value higher than 2359. It should handle that well, but better safe than sorry. It might inadvertently break another mod. I myself sometimes use a GameHour== 30 value to disable something, since GameHour should never be higher than 23.59

  • Recently Browsing   0 members

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