greyday01 Posted January 25, 2020 Share Posted January 25, 2020 I want to put a script on an activator to prevent in being used more than once per day. Is there a vanilla script that I can use for this? Or if not how would you go about it? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 25, 2020 Share Posted January 25, 2020 (edited) Probably not what you're looking for exactly. But worth testing nonetheless. This will allow your activation to take place and then any time after put up a box that states it cannot be used. It uses a fixed time span rather than complicated math to turn on the ability to use at a specific time of day. Bool IsUsable = true Event OnActivate(ObjectReference akActivator) If akActivator == Game.GetPlayer() If IsUsable == true ;do your activation stuff IsUsable = false RegisterForSingleUpdateGameTime(24.0) ;waits a minimum of 24 game hours, can come later than 24 hours if sleeping / waiting / fast travel extends past the exact 24 hour mark. EndIf Else Debug.Messagebox("Unable to use this at this time") EndIf EndEvent Event OnUpdate() If IsUsable == false IsUsable = true EndIf EndEvent Edited May 18, 2020 by IsharaMeradin Link to comment Share on other sites More sharing options...
greyday01 Posted January 27, 2020 Author Share Posted January 27, 2020 I want to put a script on an activator to prevent in being used more than once per day. Is there a vanilla script that I can use for this? Or if not how would you go about it? Thank you. I'll try that. Link to comment Share on other sites More sharing options...
greyday01 Posted February 27, 2020 Author Share Posted February 27, 2020 I just wanted to thank IsharaMeridin. Her script worked perfectly. Thank you Ishara, you are always very helpful to us novices. Link to comment Share on other sites More sharing options...
QaxeIsKaze Posted May 18, 2020 Share Posted May 18, 2020 This script throws an error that it was expecting an EndIf, and I am not sure where to put it. I am guessing that it's because you have 2 ifs, but only 1 endif? But as I said, I'm not sure where that 2nd endif goes. If akActivator == Game.GetPlayer() If IsUsable == true Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 18, 2020 Share Posted May 18, 2020 This script throws an error that it was expecting an EndIf, and I am not sure where to put it. I am guessing that it's because you have 2 ifs, but only 1 endif? But as I said, I'm not sure where that 2nd endif goes. If akActivator == Game.GetPlayer() If IsUsable == trueGood catch, updated the code posted earlier. Link to comment Share on other sites More sharing options...
Wahnfried1883 Posted October 6, 2020 Share Posted October 6, 2020 (edited) Hi there, I want to make a similar script on an activator that gives me a dragon soul once per day. I tried using the script above, but it doesn't work. This is the original script I am using, which is working so far every time when triggering the activator: Scriptname aaMTGF_AbsorbDragonSoulScript extends ObjectReferenceimport utilityimport gameEvent OnActivate(ObjectReference akActivator)Game.GetPlayer().modActorValue("dragonsouls", 1); effectsDragonAbsorbEffect.Play(self, 8, GetPlayer())DragonAbsorbManEffect.Play(GetPlayer(), 8, self); Sounds for when the wispy particles being to fly at the player.NPCDragonDeathSequenceWind.play(self)NPCDragonDeathSequenceExplosion.play(self)wait(0.1); On man power absorb effect shader.DragonPowerAbsorbFXS.Play(GetPlayer())wait(4);Stop fx shader on player showing power absorb.DragonPowerAbsorbFXS.Stop(GetPlayer())wait(4); Get rid of art attached to dragon and player showing streaming magic.DragonAbsorbEffect.Stop(self)DragonAbsorbManEffect.Stop(GetPlayer())EndEvent; absorb effects:VisualEffect Property DragonAbsorbEffect AutoVisualEffect Property DragonAbsorbManEffect Autosound property NPCDragonDeathSequenceWind autosound property NPCDragonDeathSequenceExplosion autoEffectShader Property DragonPowerAbsorbFXS Auto What I have to change exactly that my script is working only once per day? Any help is appriciated. Edited October 6, 2020 by Wahnfried1883 Link to comment Share on other sites More sharing options...
dylbill Posted October 6, 2020 Share Posted October 6, 2020 (edited) It should look like this: Scriptname aaMTGF_AbsorbDragonSoulScript extends ObjectReference import utility import game Bool Usable = true Event OnActivate(ObjectReference akActivator) If (akActivator As Actor) == GetPlayer() If Usable == True Usable = False Game.GetPlayer().modActorValue("dragonsouls", 1) ; effects DragonAbsorbEffect.Play(self, 8, GetPlayer()) DragonAbsorbManEffect.Play(GetPlayer(), 8, self) ; Sounds for when the wispy particles being to fly at the player. NPCDragonDeathSequenceWind.play(self) NPCDragonDeathSequenceExplosion.play(self) wait(0.1) ; On man power absorb effect shader. DragonPowerAbsorbFXS.Play(GetPlayer()) wait(4) ;Stop fx shader on player showing power absorb. DragonPowerAbsorbFXS.Stop(GetPlayer()) wait(4) ; Get rid of art attached to dragon and player showing streaming magic. DragonAbsorbEffect.Stop(self) DragonAbsorbManEffect.Stop(GetPlayer()) RegisterForSingleUpdateGameTime(24.0) ;udates in 24 hours Else Debug.MessageBox("Can only be used once a day.") Endif Endif EndEvent Event OnUpdateGameTime() Usable = true EndEvent ; absorb effects: VisualEffect Property DragonAbsorbEffect Auto VisualEffect Property DragonAbsorbManEffect Auto sound property NPCDragonDeathSequenceWind auto sound property NPCDragonDeathSequenceExplosion auto EffectShader Property DragonPowerAbsorbFXS Auto Edited October 6, 2020 by dylbill Link to comment Share on other sites More sharing options...
ReDragon2013 Posted October 6, 2020 Share Posted October 6, 2020 just a version with two boolVars, instead of one .. nothings specialaaMTGF_AbsorbDragonSoulScript Scriptname aaMTGF_AbsorbDragonSoulScript extends ObjectReference ; https://forums.nexusmods.com/index.php?/topic/8351218-activation-once-per-day/ EffectShader PROPERTY DragonPowerAbsorbFXS auto VisualEffect PROPERTY DragonAbsorbEffect auto VisualEffect PROPERTY DragonAbsorbManEffect auto Sound PROPERTY NPCDragonDeathSequenceWind auto Sound PROPERTY NPCDragonDeathSequenceExplosion auto Bool bBusy ; [default=False] Bool bDone ; [default=False] ; -- EVENTs -- 2 ; https://www.creationkit.com/index.php?title=Play_-_VisualEffect EVENT OnUpdateGameTime() ; after 24 hours reset our boolVars bBusy = False bDone = False ENDEVENT EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - not player activated ENDIF ;--------------------- IF ( bBusy ) IF ( bDone ) ; give message only, after the whole absorbing is done Debug.MessageBox("Can only be used once a day.") ENDIF RETURN ; - STOP - boolVar is TRUE, do nothing ENDIF ;--------------------- bBusy = TRUE (akActionRef as Actor).ModActorValue("dragonsouls", 1.0) ; start visual effects DragonAbsorbEffect.Play(self as ObjectReference, 8.0, akActionRef) ; -> 1 DragonAbsorbManEffect.Play(akActionRef, 8.0, self as ObjectReference) ; -> 2 ; Sounds for when the wispy particles being to fly at the player. NPCDragonDeathSequenceWind.Play(self as ObjectReference) NPCDragonDeathSequenceExplosion.Play(self as ObjectReference) Utility.Wait(0.1) DragonPowerAbsorbFXS.Play(akActionRef) ; -> 3 shaderFX on Utility.Wait(4.0) DragonPowerAbsorbFXS.Stop(akActionRef) ; <- 3 shaderFX off Utility.Wait(4.0) ; stop both visuals after 8 sec, get rid of art attached to dragon and player showing streaming magic. DragonAbsorbManEffect.Stop(akActionRef) ; <- 2 DragonAbsorbEffect.Stop(self as ObjectRefeence) ; <- 1 ; register for 24 hours ingame waiting RegisterForSingleUpdateGameTime(24.0) ; absorbing is over, show message by activation now bDone = TRUE ENDEVENT Link to comment Share on other sites More sharing options...
Wahnfried1883 Posted October 6, 2020 Share Posted October 6, 2020 Thank you to dylbill and ReDragon2013, you guys helped me a lot! Works like a charm! Link to comment Share on other sites More sharing options...
Recommended Posts