Possible real time mining integration

Discussions regarding the development of Morrowind Crafting 3.0 (Tamriel Rebuilt edition)

Possible real time mining integration

Postby abot » Sun Jan 05, 2014 6:25 pm

Hello,
like started at the Bethesda forum thread
I am currently using a patch for MC 2.1 enabling real-time mining

Patch is integrated in current standard MC scripts and it works spawning a invisible npc/creature to detect mining pick hits so no messing with ore property or other reference/local scripts changes.

Mod is available here, basically there is a minimal mesh for the spawned invisible hit detector creature, a global short ab01mcHits, ab01mcHitTargetScript local hit detector creature script, and some changes to each mc_mining_xxxXX scripts, injecting the code to spawn the creature, wait for some hits and go on with standard MC script, e.g.

I love interacting with things, I think it is one of the best features added to more recent Bethesda games, so I have real-time mining needed by default but yes, it can be very repetitive if mandatory.
I think once real time is working/integrated it could be relatively easy to add a button "Mine this rock (real time") to couple with standard faster "Mine this rock" button so you can choose any time you mine or a configuration script/global variable you could change any time you like to switch real time mining on/off.

I will probably port this or something similar to upcoming MC3 for my personal game when it is time, but if you find it interesting feel free to use/include code/ideas as you see fit, all in all I have just tried to integrate real-time mining previously done in other mods By The Lys, Arcimaestro Antares, Manauser and probably others...

Code: Select all
begin ab01mcHitTargetScript
; not 100% good with high/near the ceiling rocks yet but works well enough most of the times
short i1
float t1
float myScale
float t2
float x1
float x2
float y1
float y2
float z1
float z2

DontSaveObject

SkipAnim

if ( MenuMode )
   return
endif

if ( GetDisabled )
   if ( t1 < 2 )
      set t1 to ( t1 + GetSecondsPassed )
      return
   endif
   setdelete 1
   return
endif

if ( GetScale != myScale )
   setscale myScale
   ; MessageBox "rescaled"
endif

if ( GetParalysis )
else
   SetParalysis 1
   SetFight 0
   set x1 to GetPos X
   set x2 to ( player->GetPos X )
   set x1 to ( ( x1 + x2 ) * 0.5 )
   set y1 to GetPos Y
   set y2 to ( player->GetPos Y )
   set y1 to ( ( y1 + y2 ) * 0.5 )
   set z1 to GetPos Z
   set z2 to ( player->GetPos Z )
   set z1 to ( ( z1 + z2 ) * 0.5 )
   set myScale to ( mc_scaler * 1.2 )
   SetPos Z z1
   SetPos X x1
   SetPos Y y1
   set x1 to ( player->GetFatigue )
   player->ModCurrentFatigue 30000
   set x2 to ( player->GetFatigue )      ; store player max fatigue
   set x1 to ( x1 - x2 )
   player->ModCurrentFatigue x1      ; restore current fatigue
   set x1 to ( player->GetLevel )
   set x1 to ( GetSquareRoot x1 )
   set x2 to ( x2 / 10 )   ; 10 hits at level 1
   set x2 to ( x2 / x1 )   ; 10 * sqrt(level) hits
   set x2 to ( 0 - x2 )      ; delta fatigue each hit
endif

if ( OnActivate )
endif

if ( GetFight )
   SetFight 0
   StopCombat
endif

if ( t2 > 0 )
   set t2 to ( t2 - GetSecondsPassed )
else
   StopSound "repair"
   set t2 to 0
endif

if ( CellChanged )
   disable
   return
endif

if ( GetPos Z < z1 )
   SetPos Z z1      ; anti-gravity, has slowfall, not needed each frame
endif

if ( player->GetWeaponDrawn )
   if ( player->HasItemEquipped "miner's pick" )
      set i1 to 1
   elseif ( player->HasItemEquipped "BM Nordic Pick" )
      set i1 to 2
   else
      set i1 to 0
   endif
else
   set i1 to 0
endif

if ( i1 )
else
   ; messagebox "Enough of this."
   disable
   return
endif

if ( i1 == 1 )
   if ( HitAttemptOnMe "miner's pick" )
   elseif ( HitOnMe "miner's pick" )
   else
      return
   endif
elseif ( i1 == 2 )
   if ( HitAttemptOnMe "BM Nordic Pick" )
   elseif ( HitOnMe "BM Nordic Pick" )
   else
      return
   endif
endif

if ( Player->GetFatigue <= 0 )
   return
endif
player->ModCurrentFatigue x2

set i1 to Random 10001
if ( i1 > 7500 )
    PlaySound3DVP "repair" 1.0 1.0
elseif ( i1 > 5000 )
    PlaySound3DVP "repair" 1.0 0.95
elseif ( i1 > 2500 )
    PlaySound3DVP "repair" 1.0 0.9
else
    PlaySound3DVP "repair" 1.0 0.85
endif
set t2 to 0.2

if ( ab01mcHits > 0 )
   set ab01mcHits to ( ab01mcHits - 1 )
else
   disable
endif

end

Code: Select all
Begin mc_mining_adamantium11

short duration
short state
short material
short shattered
short temp
short skilltemp
short trainpct
short button
float timer

if ( getdisabled == 1 )
   set timer to ( timer + GetSecondsPassed )
   if ( timer > 3 )
      setdelete 1
   endif
   return
endif

if ( menumode == 1 )
   if ( shattered == 2 )
      set shattered to 3
   endif
endif

if ( menumode == 0 )
   if ( shattered == 3 )
      set material to ( getitemcount ingred_adamantium_ore_01 )
      if ( material > 0 )
         set shattered to 1
      else
         set mc_scaler to ( getscale )
         placeatme mc_adamantiumboulder11_e 1,0,0
         disable
         return
      endif
   endif
endif

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
   return
endif

if ( OnActivate == 1 )
   set mc_skillvalue to mc_mining
   if ( shattered == 1 )
      while ( getitemcount ingred_adamantium_ore_01 > 0 )
         removeitem ingred_adamantium_ore_01 1
      endwhile
      while ( getitemcount ingred_adamantium_ore_01 < material )
         additem ingred_adamantium_ore_01 1
      endwhile
      set shattered to 2
      activate
      return
   elseif ( shattered > 0 )
      activate
      return
   endif
   set state to 1
endif

if ( state == 0 )
   return
endif

if ( state == 1 )
   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 rock, you see %g pieces already broken loose.  Would you like to: ", material,  "Mine this rock", "Cancel"
      else
         messagebox "Your mining skill is 100. Would you like to: ", "Mine this rock", "Cancel"
      endif
   else
      if ( material > 1 )
         messagebox "Your mining skill is %g (%g/100). Examining the rock, you see %g pieces already broken loose.  Would you like to: " mc_mining, trainpct, material,  "Mine this rock", "Cancel"
      else
         messagebox "Your mining skill is %g (%g/100). Would you like to: " mc_mining, trainpct, "Mine this rock", "Cancel"
      endif
   endif
   set state to 2
elseif ( state == 2 )
   set button to getbuttonpressed
   if ( button == -1 )
      return
   elseif ( button == 0 )
      set state to 3
   else
      set state to 0
      return
   endif
elseif ( state == 3 )
   set temp to ( material + 1 )
   set mc_difficulty to ( 20 * temp )
   if ( player->GetItemCount "miner's pick" == 0 )
      if ( player->GetItemCount "BM Nordic Pick" == 0 )
         set state to 0
         messagebox "You need a pick."
         return
      endif
   endif
   if ( player->HasItemEquipped "miner's pick" )
   elseif ( player->HasItemEquipped "BM Nordic Pick" )
   else
      set state to 0
      messagebox "You'd better equip a pick."
      return
   endif
   if ( player->GetWeaponDrawn )
   else
      set state to 0
      messagebox "You'd better draw that pick."
      return
   endif
   set state to Random 3
   set state to ( state + 2 )
   set ab01mcHits to ( state + temp )
   float x1
   float y1
   float z1
   float a1
   set x1 to GetPos X
   set y1 to GetPos Y
   set z1 to GetPos Z
   set a1 to ( player->GetAngle Z )
   if ( a1 >= 0 )
      set a1 to ( a1 - 180 )
   else
      set a1 to ( a1 + 180 )
   endif
   set mc_scaler to GetScale
   placeitem ab01mcHitTarget x1 y1 z1 a1
   set state to 104
   return
endif
if ( state == 104 )
   if ( ab01mcHits > 0 )
      if ( player->GetWeaponDrawn )
      else
         set state to 0
         return
      endif
      if ( player->HasItemEquipped "miner's pick" )
      elseif ( player->HasItemEquipped "BM Nordic Pick" )
      else
         set state to 0
      endif
      return
   endif
   startscript mc_skillcheck
   set state to 4
   return
elseif ( state == 4 )
   if ( mc_skill_results == 0 )
      return
   elseif ( mc_skill_results == 1 )
      messagebox "You succeed in mining some raw adamantium from the rock."
      playsound "repair"
      set material to ( material + 1 )
      set state to 10
      set mc_craft_results to 1
      return
   elseif ( mc_skill_results == -1 )
      if ( material == 0 )
         messagebox "You were unable to mine any adamantium from this rock."
         playsound "pack"
         set mc_scaler to ( getscale )
         placeatme mc_adamantiumboulder11_e 1,0,0
         disable
         return
      endif
      messagebox "You have mined this rock 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
   endif
endif
end

Cheers for upcoming new version!
abot
 
Joined: Sun Jan 05, 2014 5:47 pm

Re: Possible real time mining integration

Postby Denina » Sun Jan 05, 2014 6:54 pm

Ok, maybe I'm just being dense but I don't really understand this. I always thought the mining was done in real time so how does this differ from mining in MC as is? I'm a little confused. Sorry.
User avatar
Denina
Queen of Sarcasm
 
Joined: Mon Mar 04, 2013 10:57 pm
Location: Balmora, usually

Re: Possible real time mining integration

Postby Toccatta » Sun Jan 05, 2014 7:23 pm

Real-time mining in this case refers to the player actually equipping his pick-axe and swinging it at the ore rock. Essentially, it's the same as clicking the "mine this rock" button except that it's more interactive.

Also, as the button appears in menu-mode, which causes most scripts to pause and time to stop passing, swinging the pick really does act in "real time" where clicking the mining button occurs in a paused state. Apart from the interactive aspect, it would make a big difference for people using a fortify spell to either boost their luck or fatigue while mining, as the spell would fall off much more quickly. The stop-time aspect of the menu tends to extend the effect of those spells (although not indefinitely, as there is already a built-in gap between messageboxes which allows time to pass... just not "real time").
"All that is gold does not glitter; not all those who wander are lost.
The old that is strong does not wither; deep roots are not reached by the frost."
- Bilbo Baggins
User avatar
Toccatta
The Untitled
 
Joined: Wed Mar 13, 2013 4:37 am
Location: Somewhere in Vvardenfell

Re: Possible real time mining integration

Postby Denina » Sun Jan 05, 2014 7:27 pm

Okay, now I follow you. Thanks for the explanation.

Abot, when you use your script does it cause any lag or the game to get bogged down? I glanced through your script and it looks pretty intensive. I just wondered how the game functions when it's running, especially if there is a lot of ore in a cell.
User avatar
Denina
Queen of Sarcasm
 
Joined: Mon Mar 04, 2013 10:57 pm
Location: Balmora, usually

Re: Possible real time mining integration

Postby abot » Sun Jan 05, 2014 8:18 pm

Denina wrote:Abot, when you use your script does it cause any lag or the game to get bogged down? I glanced through your script and it looks pretty intensive. I just wondered how the game functions when it's running, especially if there is a lot of ore in a cell.
I don't think there should be a noticeable difference compared to the original script, changes are limited
relevant original script part:
Code: Select all
elseif ( state == 3 )
   set temp to ( material + 1 )
   set mc_difficulty to ( 20 * temp )
   if ( player -> GetItemCount "miner's pick" == 0 )
      messagebox "You can't mine rocks without a miner's pick"
      set state to 0
      return
   endif
   startscript mc_skillcheck
   set state to 4

is changed to
Code: Select all
elseif ( state == 3 )
   set temp to ( material + 1 )
   set mc_difficulty to ( 20 * temp )
   if ( player->GetItemCount "miner's pick" == 0 )
      if ( player->GetItemCount "BM Nordic Pick" == 0 )
         set state to 0
         messagebox "You need a pick."
         return
      endif
   endif
   if ( player->HasItemEquipped "miner's pick" )
   elseif ( player->HasItemEquipped "BM Nordic Pick" )
   else
      set state to 0
      messagebox "You'd better equip a pick."
      return
   endif
   if ( player->GetWeaponDrawn )
   else
      set state to 0
      messagebox "You'd better draw that pick."
      return
   endif
   set state to Random 3
   set state to ( state + 2 )
   set ab01mcHits to ( state + temp )
   float x1
   float y1
   float z1
   float a1
   set x1 to GetPos X
   set y1 to GetPos Y
   set z1 to GetPos Z
   set a1 to ( player->GetAngle Z )
   if ( a1 >= 0 )
      set a1 to ( a1 - 180 )
   else
      set a1 to ( a1 + 180 )
   endif
   set mc_scaler to GetScale
   placeitem ab01mcHitTarget x1 y1 z1 a1
   set state to 104
   return
endif
if ( state == 104 )
   if ( ab01mcHits > 0 )
      if ( player->GetWeaponDrawn )
      else
         set state to 0
         return
      endif
      if ( player->HasItemEquipped "miner's pick" )
      elseif ( player->HasItemEquipped "BM Nordic Pick" )
      else
         set state to 0
      endif
      return
   endif
   startscript mc_skillcheck
   set state to 4
   return

The spawned collider creature is disabled and deleted right after mining
abot
 
Joined: Sun Jan 05, 2014 5:47 pm

Re: Possible real time mining integration

Postby abot » Sun Jan 05, 2014 8:42 pm

Toccatta wrote:it would make a big difference for people using a fortify spell to either boost their luck or fatigue while mining
Probably not much as script counts the hits based on HitOnMe and also HitAttemptOnMe, the latter should fire on pick swinging regardless of player luck/axe stat
Other scripts I've seen used player->GetSoundPlaying, but that implied having to check player facing.

The idea was to provide a animated/scenic part before standard MC rewarding mechanic
abot
 
Joined: Sun Jan 05, 2014 5:47 pm

Re: Possible real time mining integration

Postby Toccatta » Sun Jan 05, 2014 9:34 pm

I think you misunderstood my comment. I saw that your script was written to eliminate the distinction between hits and misses with the axe... otherwise, the player's mining success would be more dependent on axe skill than mining skill. What I was actually referring to in that quote is that the success or failure of the actual mining is modified by high luck and exceptional fatigue ( >100% ) just like any other attempted skill in Morrowind. I've made an effort to make the skills in MC function as closely as possible to the hard-coded skills of Morrowind, and that includes allowing the player to make use of a few of the more common game exploits.

The point I was making with Denina is that for the purposes of mining a rock, a person could cast a high level luck booster for three seconds and mine a rock 20 times or so before the spell wore off, getting the benefits of the luck in determining the success or failure of the mining attempt. The fact that most of the mining is done in menu mode with only short breaks between the messageboxes extends the three second spell to last through a large number of attempts. In real-time, the player would probably only be able to swing the pick two or three times before the spell wore off, possibly less - as the player would have to shift from casting mode to combat mode, and the animation would use up a portion of that time as well.

On a side note, the script is now more complex than it once was. I'm not sure if it would affect the changes you're discussing, but here is the new script:

Code: Select all
Begin mc_mining_iron00a

short state
short material
short shattered
short skilltemp
long trainpct
short button
float timer
short auto
short nopick
float skill_effective
float skill_base
float difficulty_base
float tempmod
float rewardmod
float temp
float fatiguemax
float fatiguemod
short effectiveskill
float currenthealth
float fate
float luck
float reward
short Pstr
short Pwil
short Pend
short Pagi
float Pfat

if ( shattered == 4 )
   return
endif

if ( menumode == 1 )
   if ( shattered == 2 )
      set shattered to 3
   endif
endif

if ( menumode == 0 )
   if ( shattered == 3 )
      set material to ( getitemcount mc_iron_ore )
      if ( material > 0 )
         set shattered to 1
      else
         set mc_scaler to ( getscale )
         placeatme mc_ironboulder00a_e 1,0,0
         set shattered to 4
         disable
         return
      endif
   endif
endif
   
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 > mc_skillcap )
         set mc_train_mining to mc_skillcap
      endif
      if ( mc_mining >= mc_skillcap )
         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
   return
endif

if ( OnActivate == 1 )
   set mc_skillvalue to mc_mining
   if ( shattered == 1 )
      while ( getitemcount mc_iron_ore > 0 )
         removeitem mc_iron_ore 1
      endwhile
      while ( getitemcount mc_iron_ore < material )
         additem mc_iron_ore 1
      endwhile
      set shattered to 2
      activate
      return
   elseif ( shattered > 0 )
      activate
      return
   endif
   if ( player -> GetItemCount "miner's pick" == 0 )
      set nopick to 1
   else
      set nopick to 0
   endif
   set state to 1
endif

if ( state == 0 )
   return
endif

if ( state == 1 )

   if ( mc_relaxed == 1 )
      if ( nopick )
         messagebox "You cannot mine the rock without a miner's pick."
         set state to 0
         return
      endif
      playsound "repair"
      if ( material < 20 )
         set material to 20
      endif
messagebox "You mined the rock as much as you are able, and managed to loosen a total of %g pieces of ore in the process.", material
      playsound "pack"
      set shattered to 1
      set state to 0
      return
   endif

   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 == mc_skillcap )
      if ( material > 1 )
         messagebox "Your mining skill is %g. Examining the rock, you see %g pieces already broken loose.  Would you like to: ", mc_skillcap, material,  "Mine this rock", "Begin Continuous Mining", "Fast Mine", "Cancel"
      elseif ( material == 1 )
         messagebox "Your mining skill is %g. Examining the rock, you see a piece already broken loose.  Would you like to: ", mc_skillcap, "Mine this rock", "Begin Continuous Mining", "Fast Mine", "Cancel"
      else
         messagebox "Your mining skill is %g. Would you like to: ", mc_skillcap, "Mine this rock", "Begin Continuous Mining", "Fast Mine", "Cancel"
      endif
   else
      if ( material > 1 )
         messagebox "Your mining skill is %g (%g/100). Examining the rock, you see %g pieces already broken loose.  Would you like to: " mc_mining, trainpct, material,  "Mine this rock", "Begin Continuous Mining", "Fast Mine", "Cancel"   
      elseif ( material == 1 )
         messagebox "Your mining skill is %g (%g/100). Examining the rock, you see a piece already broken loose.  Would you like to: " mc_mining, trainpct,  "Mine this rock", "Begin Continuous Mining", "Fast Mine", "Cancel"   
      else
         messagebox "Your mining skill is %g (%g/100). Would you like to: " mc_mining, trainpct, "Mine this rock", "Begin Continuous Mining", "Fast Mine", "Cancel"
      endif
   endif
   set state to 2
elseif ( 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 > 0.5 )
         set timer to 0
         set state to 3
         return
      elseif ( mc_mining >= 100 )
         if ( timer > 0.125 )
            set timer to 0
            set state to 3
            return
         endif
      endif
   endif   
   if ( button == -1 )
      return
   elseif ( button == 3 )
      set state to 0
      return
   endif
   if ( nopick )
      messagebox "You cannot mine the rock without a miner's pick."
      set state to 0
      return
   endif
   if ( button == 0 )
      set state to 3
   elseif ( button == 1 )
      set auto to 1
      set state to 1
      return
   elseif ( button == 2 )
      set state to 5
      return
   endif
elseif ( state == 3 )
   set mc_skillvalue to mc_mining
   set temp to ( material + 1 )
   set mc_difficulty to ( 5 * temp )
   if ( material > 52 )
      set mc_skillvalue to 0
   endif
   startscript mc_skillcheck
   set state to 4
elseif ( state == 4 )
   if ( mc_skill_results == 0 )
      return
   elseif ( mc_skill_results == 1 )
      set material to ( material + 1 )
      if ( auto == 2 )
         messagebox "You have succeed in loosening a total of %g pieces of iron ore from the rock.", material
      endif
      playsound "repair"
      set state to 10
      set mc_craft_results to 1
      return
   elseif ( mc_skill_results == -1 )
      if ( material == 0 )
         messagebox "You were unable to mine any ore from this rock."
         playsound "pack"
         set mc_scaler to ( getscale )
         placeatme mc_ironboulder00a_e 1,0,0
         disable
         set state to 0
         return
      endif
      messagebox "You have mined this rock 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
   endif
elseif ( state == 5 )
   set Pstr to ( player -> getstrength )
   set Pwil to ( player -> getwillpower )
   set Pend to ( player -> getendurance )
   set Pagi to ( player -> getagility )
   set Pfat to ( player -> getfatigue )
   set temp to ( player -> getluck ) ; get the player's luck
   set temp to ( temp - 50 ) ; convert to a range of -50 to 50
   set temp to ( temp / 5 ) ; convert to a range of -10 to 10
   set luck to ( 100 + temp ) ; convert to a range of 90 to 110
   set luck to ( luck / 100 ) ; convert to a percentage from .9 to 1.1
   set fatiguemax to ( Pstr + Pwil + Pend + Pagi )
   set fatiguemod to ( Pfat / fatiguemax ) ; fatigue also directly affects a player's skill level.
   if ( fatiguemod > 1 )
      set temp to ( fatiguemod - 1 )
      set temp to ( temp / 3 )
      set fatiguemod to ( 1 + temp )
   endif
   if ( luck > 1.3 ) ; Cap the luck at 200 to avoid ugly exploitation
      set luck to 1.3
   endif
   if ( fatiguemod > 1.2 ) ; Cap the fatigue at 120% to avoid ugly exploitation
      set fatiguemod to 1.2
   endif
   set currenthealth to ( player -> gethealthgetratio )
   set currenthealth to ( currenthealth * 2 )
   if ( currenthealth > 1 )
      set currenthealth to 1
   endif
   set state to 6
elseif ( state == 6 )
   while ( shattered == 0 )

      set skill_base to mc_mining
      if ( material > 52 )
         set skill_base to 0
      endif
      set temp to ( material + 1 )
      set difficulty_base to ( 5 * temp )
      set temp to ( random 32700 ) ; Very wide random range
      set temp to ( temp / 545 - 20 ) ; convert to a range of -20 to 40
      set fate to ( 100 + temp ) ; convert to a range of 80 - 140
      set fate to ( fate / 100 ) ; convert to a percentage from .8 to 1.4

      set skill_effective to ( skill_base * currenthealth * fatiguemod * fate * luck )
      set tempmod to ( ( 100 - skill_base + difficulty_base ) / 100 )
      if ( tempmod < 0 )
         set tempmod to 0
      endif
      set rewardmod to ( tempmod * tempmod )
      if ( rewardmod > 2.4 )
         set rewardmod to 2.4
      endif
      set mc_level_reward to ( mc_default_reward * rewardmod )

      if ( skill_effective >= difficulty_base )

          set skilltemp to ( mc_mining + 1 )
         set mc_train_mining to ( mc_train_mining + mc_level_reward )
         if ( mc_train_mining > mc_skillcap )
            set mc_train_mining to mc_skillcap
         endif
         if ( mc_mining >= mc_skillcap )
            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
         set material to ( material + 1 )
      else
         if ( material == 0 )
            messagebox "You were unable to mine any ore from this rock."
            playsound "pack"
            set mc_scaler to ( getscale )
            placeatme mc_ironboulder00a_e 1,0,0
            disable
            set shattered to 1
            set state to 0
            return
         endif
         playsound "repair"
         messagebox "You mined the rock as much as you are able, and managed to loosen a total of %g pieces of ore in the process.", material
         playsound "pack"
         set shattered to 1
         set state to 0
         set mc_craft_results to 0
         set mc_skill_results to 0
      endif
   endwhile
endif
end
"All that is gold does not glitter; not all those who wander are lost.
The old that is strong does not wither; deep roots are not reached by the frost."
- Bilbo Baggins
User avatar
Toccatta
The Untitled
 
Joined: Wed Mar 13, 2013 4:37 am
Location: Somewhere in Vvardenfell

Re: Possible real time mining integration

Postby abot » Mon Jan 06, 2014 4:49 pm

Toccatta wrote:I think you misunderstood my comment. I saw that your script was written to eliminate the distinction between hits and misses with the axe... otherwise, the player's mining success would be more dependent on axe skill than mining skill. What I was actually referring to in that quote is that the success or failure of the actual mining is modified by high luck and exceptional fatigue ( >100% ) just like any other attempted skill in Morrowind. I've made an effort to make the skills in MC function as closely as possible to the hard-coded skills of Morrowind, and that includes allowing the player to make use of a few of the more common game exploits.
The point I was making with Denina is that for the purposes of mining a rock, a person could cast a high level luck booster for three seconds and mine a rock 20 times or so before the spell wore off, getting the benefits of the luck in determining the success or failure of the mining attempt. The fact that most of the mining is done in menu mode with only short breaks between the messageboxes extends the three second spell to last through a large number of attempts. In real-time, the player would probably only be able to swing the pick two or three times before the spell wore off, possibly less - as the player would have to shift from casting mode to combat mode, and the animation would use up a portion of that time as well.
Uhm, well if real-time stopping to emulate possible exploits is a priority versus realtime scenics I see no easy solution, it is a different vision.
On a side note, the script is now more complex than it once was. I'm not sure if it would affect the changes you're discussing, but here is the new script:
I don't know, it seems to me much of the new code is similar to what was isolated in mc_skillcheck, maybe trying to move the new code when stable to a similar isolated mc_skillcheck2 could shorten the repetitive similar scripts code.

I will try to apply the patch ideas when new MC is released and see if it still works for me, cheers!
abot
 
Joined: Sun Jan 05, 2014 5:47 pm

Re: Possible real time mining integration

Postby Toccatta » Mon Jan 06, 2014 5:29 pm

Emulating possible exploits isn't a priority except in that I'm trying to ensure the pseudo-skills function as closely to real skills as possible. Some skills work in real-time while others do not. For example, alchemy and armor repair don't work in real-time, as you can make hundreds of potions or repair an entire load of damaged armor in seconds. Combat skills, on the other hand, are by definition in real-time. So I'm satisfied handling it either way. I was merely pointing out a distinction in response to Denina's question, "how does this differ from mining in MC as is?" And then clarifying what I saw as a misunderstanding when you seemed to think my comment about luck referred to successfully hitting the rock with the pick.

Isolating the skillcheck code wouldn't work because the script uses a while-loop to calculate all the attempts from the "fast mine" option in a single frame. It cannot wait for the normal multi-script handshaking associated with the standard mining. It's the reason why the skillcheck subroutine code was moved INTO the script in the first place.
"All that is gold does not glitter; not all those who wander are lost.
The old that is strong does not wither; deep roots are not reached by the frost."
- Bilbo Baggins
User avatar
Toccatta
The Untitled
 
Joined: Wed Mar 13, 2013 4:37 am
Location: Somewhere in Vvardenfell

Re: Possible real time mining integration

Postby Huskobar » Mon Jan 13, 2014 4:17 pm

Whether mining (or chopping) occurs in real time is largely atmospheric, the way I see it. Time passage in real time can prevent minor exploits, sure, while manipulation of 'gamehour' can lend diversity to time passage; e.g. perhaps it takes longer to mine ebony than iron. (Likewise in Woodworking, it would take longer to make a wine rack than a wooden bowl).
Exploits can come in many forms. Whether from increased Attack or increased Strength I don't know, but I find I can get about 20% more ore by wearing the constant-effect Talisman of the Cold Warrior from Wizard's Islands. By far and away, however, the greatest determinant of quantity obtained is Mining/Chopping skill. Once above the difficulty threshold, skill progression is rapid enough to satisfy most ore demands.
Furthermore, how resources are used has a large bearing on how much is sought; e.g. using 15 iron ingots to make a nordic axe which boosts your Smithing skill by one step (and is of dubious value usage wise and septim wise) vs using those ingots to make several iron throwing knives which will boost your Smithing skill by several steps (and might be of more practical use).
Huskobar
 
Joined: Mon Jan 13, 2014 3:36 pm


Return to MC Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron