Jump to content

Photo

Need scripting help


  • Please log in to reply
No replies to this topic

#1
eviltwinNE

eviltwinNE

    Stranger

  • Members
  • Pip
  • 3 posts
I have a mod that make the dragon priest mask be able to warp from anywhere in skyrim to the dragon priest sanctuary and then back to your original location. I'm trying to make it usable once a day but something isnt working with the hoursSinceLastUse variable and i cant figure it out. This is my script and im not much of a programmer so if something is really goofy here thats why.


Scriptname DunLabyrinthianWoodenMaskModSCRIPT extends ActiveMagicEffect
{Script that handles the use of the wooden Bromjunaar mask as a key to the sanctuary}

objectReference property SanctuaryMarker auto
{Where to put the player when the mask is used as a key}
location property DragonPriestSanctuaryLocation auto
{The sanctuary Cell}
imageSpaceModifier property AzuraFadeToBlack auto
{Use a basic fade-to-black for the transition}
imageSpaceModifier property FadeToBlackBackImod auto
Sound Property TransitionSFX Auto

objectReference property maskActual auto
{Point explicity to the unique, placed reference of the mask in the world}

ObjectReference selfRef
ObjectReference warpMarker
bool property firstRun = true auto
float lastUseTime
float hoursSinceLastUse

EVENT OnEffectStart(Actor Target, Actor Caster)

selfRef = caster

if caster == game.GetPlayer() && !firstRun
hoursSinceLastUse = 24 * (Utility.GetCurrentGameTime() - lastUseTime)

endif

debug.trace("hoursSinceLastUse = " + hoursSinceLastUse)

if caster == game.getPlayer() && !game.getPlayer().IsInCombat() && ((hoursSinceLastUse > 24.0) || firstRun)
firstRun = false
warpMarker = game.getPlayer().PlaceAtMe(Game.GetForm(00000032))
AzuraFadeToBlack.apply()
TransitionSFX.play(caster)
utility.wait(2.5)
caster.moveTo(SanctuaryMarker)
FadeToBlackBackImod.apply()
AzuraFadeToBlack.remove()

endif

endEVENT

EVENT onEffectFinish(Actor Target, Actor Caster)
if Caster == game.getPlayer() && game.getPlayer() .isInLocation(DragonPriestSanctuaryLocation) == TRUE
;when player removes the mask in sanctuary, return to Skyrim
AzuraFadeToBlack.apply()
TransitionSFX.play(caster)
utility.wait(2.5)
game.getPlayer().MoveTo(warpMarker)
FadeToBlackBackImod.apply()
AzuraFadeToBlack.remove()
if caster.getItemCount(maskActual) < 1
; safety catch - if the player dropped the mask in the sanctuary, add it to inventory so it doesn't get lost.
caster.addItem(maskActual)
endif
hoursSinceLastUse = 0.0
debug.trace("hoursSinceLastUse = " + hoursSinceLastUse)
lastUseTime = Utility.GetCurrentGameTime()
debug.trace("lastUseTime = " + lastUseTime)

endif
warpMarker.Delete()
endEVENT




Page loaded in: 0.927 seconds