Begin mc_mining_stalhrimshort stateshort materialshort shatteredshort tempshort skilltempshort trainpctshort buttonfloat timershort autoshort chippedif ( menumode == 1 ) if ( shattered == 2 ) set shattered to 3 endifendifif ( menumode == 0 ) if ( shattered == 3 ) set material to ( getitemcount ingred_raw_stalhrim_01 ) if ( material > 0 ) set shattered to 1 else set shattered to 4 endif endifendif if ( state == 10 ) set skilltemp to ( mc_mining + 1 ) if ( mc_craft_results == 1 ) set mc_train_mining to ( mc_train_mining + mc_level_reward ) if ( mc_train_mining > 100 ) set mc_train_mining to 100 endif if ( mc_mining >= 100 ) set mc_train_mining to 0 endif if ( mc_train_mining >= skilltemp ) set mc_mining to ( mc_mining + 1 ) set mc_train_mining to 0 playsound "skillraise" messagebox "Your mining skill increases to %g." mc_mining endif endif set mc_craft_results to 0 set mc_skill_results to 0 set state to 1 returnendifif ( OnActivate == 1 ) if ( player -> GetItemCount "BM Nordic Pick" == 0 ) messagebox "You don't have the tools to do anything with this." set state to 0 return endif if ( GetJournalIndex "CO_8a" == 30 ) Journal CO_8a 40 elseif ( GetJournalIndex "CO_8" == 30 ) Journal CO_8 40 endif if ( mc_mining < 90 ) if ( chipped == 0 ) messagebox "Your mining skill is too low to effectively mine the stalhrim block. However, the special nordic pick allows you to break off a single piece anyway." player -> additem ingred_raw_stalhrim_01 1 playsound "repair" set chipped to 1 elseif ( chipped == 1 ) messagebox "You have already chipped a piece of stalhrim off. If your skill at mining were higher, you might be able to get more." endif return else if ( chipped == 0 ) messagebox "The special nordic pick allows you to break off a single piece easily. Your skill at mining is high enough that you could get more with some effort." player -> additem ingred_raw_stalhrim_01 1 playsound "repair" set chipped to 1 return endif endif set mc_skillvalue to mc_mining if ( shattered == 1 ) while ( getitemcount ingred_raw_stalhrim_01 > 0 ) removeitem ingred_raw_stalhrim_01 1 endwhile while ( getitemcount ingred_raw_stalhrim_01 < material ) additem ingred_raw_stalhrim_01 1 endwhile set shattered to 2 activate return elseif ( shattered == 4 ) messagebox "This stalhrim block has already been mined out. There is no more available stalhrim." return elseif ( shattered > 0 ) activate return endif set state to 1endifif ( state == 0 ) returnendifif ( state == 1 ) if ( auto == 1 ) set auto to 2 messagebox "Continuous mining mode active", "Cancel" endif if ( auto == 2 ) set state to 2 return endif set trainpct to ( mc_train_mining * 100 ) set trainpct to ( trainpct / ( mc_mining + 1 ) ) if ( mc_mining == 100 ) if ( material > 1 ) messagebox "Your mining skill is 100. Examining the block, you see %g pieces already broken loose. Would you like to: ", material, "Mine the stalhrim block", "Begin Continuous Mining", "Cancel" else messagebox "Your mining skill is 100. Would you like to: ", "Mine the stalhrim block", "Begin Continuous Mining", "Cancel" endif else if ( material > 1 ) messagebox "Your mining skill is %g (%g/100). Examining the block, you see %g pieces already broken loose. Would you like to: " mc_mining, trainpct, material, "Mine the stalhrim block", "Begin Continuous Mining", "Cancel" else messagebox "Your mining skill is %g (%g/100). Would you like to: " mc_mining, trainpct, "Mine the stalhrim block", "Begin Continuous Mining", "Cancel" endif endif set state to 2elseif ( state == 2 ) set button to getbuttonpressed if ( auto == 2 ) if ( button == 0 ) set auto to 0 set state to 0 return endif set timer to ( timer + getsecondspassed ) if ( timer > .5 ) set timer to 0 set state to 3 return elseif ( mc_mining >= 100 ) if ( timer > .125 ) set timer to 0 set state to 3 return endif endif endif if ( button == -1 ) return elseif ( button == 0 ) set state to 3 elseif ( button == 1 ) set auto to 1 set state to 1 return elseif ( button == 2 ) set state to 0 return endifelseif ( state == 3 ) set mc_skillvalue to mc_mining set temp to ( material + 1 ) set mc_difficulty to ( 20 * temp ) startscript mc_skillcheck set state to 4elseif ( state == 4 ) if ( mc_skill_results == 0 ) return elseif ( mc_skill_results == 1 ) set material to ( material + 1 ) messagebox "You succeed in loosening a total of %g pieces of stalhrim from the block.", material playsound "repair" set state to 10 set mc_craft_results to 1 return elseif ( mc_skill_results == -1 ) messagebox "You have mined this block as much as you are able." playsound "pack" set shattered to 1 set state to 0 set mc_craft_results to 0 set mc_skill_results to 0 endifendifend