SCRIPTING Skyrim - Mine Ore - Glow mod

I really loved playing through Skyrim but never crafted any armor or weapons because I had no idea which rocks had ore in them. So when steam workshop support was added I wrote a script to make all the rocks in the world that are minable glow so they are easy to locate from a distance. Once the ore has been mined the glow will disappear, but when they can be mined again the glow re-appears.



I then had my full set of daedric armor!


Here's the script I wrote:

Scriptname OreGlow extends ObjectReference
EffectShader property UBG13Bright2FXSCOPY0000 auto

FormList Property MinedRockList Auto

bool Function HasBeenMined()
        return MinedRockList.HasForm(self)
endFunction

bool Function HasNotBeenMined()
        return !MinedRockList.HasForm(self)
endFunction

Function StartGlow()
  UBG13Bright2FXSCOPY0000.Play(self)
EndFunction

Function StopGlow()
UBG13Bright2FXSCOPY0000.Stop(self)
EndFunction

Event OnCellAttach()

         if HasNotBeenMined()
StartGlow()
         Endif
EndEvent

Event OnCellDetach()
StopGlow()
EndEvent

Event OnDestructionStageChanged(int aiOldStage, int aiCurrentStage)
StopGlow()
MinedRockList.AddForm(self)
EndEvent

Event OnReset()
StartGlow()
MinedRockList.RemoveAddedForm(self)
EndEvent

Once the rock has been mined the rock is moved to a list and each time an area is loaded a check is performed whether the rock is in the list and if it is not an effect is applied.


Its quite popular with over 28,000 unique views and over 11,000 current subscribers :-)


No comments:

Post a Comment