Deleted2746547User Posted July 6, 2013 Share Posted July 6, 2013 (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 July 6, 2013 by Guest Link to comment Share on other sites More sharing options...
Deleted2746547User Posted July 6, 2013 Author Share Posted July 6, 2013 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... Link to comment Share on other sites More sharing options...
rickerhk Posted July 6, 2013 Share Posted July 6, 2013 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 Link to comment Share on other sites More sharing options...
Gribbleshnibit8 Posted July 6, 2013 Share Posted July 6, 2013 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 Link to comment Share on other sites More sharing options...
Deleted2746547User Posted July 7, 2013 Author Share Posted July 7, 2013 THANK YOU both for your suggestions!!!!!!!!!!!!!!!!I am going to look at that and see how it goes. I'm horrible with scripting and it really took me forever to get that one to work. I'll be back. Link to comment Share on other sites More sharing options...
Recommended Posts