Jump to content

Enable script that's on a short timer...


Rayek

Recommended Posts

I'm trying to enable a spell effect (The animated static)...but only for a couple of seconds every time the activator is selected.

 

I have the basic enable script (below) but I am unclear on how to add the StartTimer Function:

 

Scriptname RE_EnableTimerScript extends ObjectReference

ObjectReference Property SpellEffect Auto

Event OnActivate(ObjectReference akActionRef)
  If akActionRef == Game.GetPlayer()
   SpellEffect.Enable()

  Endif
Endevent
Any help is appreciated.
Since a timer would be added...will it just re-start the effect/timer each time the activator is clicked?
Thanks.
Edited by Rayek
Link to comment
Share on other sites

This isnt FO4. StartTimer doesn't exist. You need to use OnUpdate, or a short wait instead.

 

So after the enable line, you can add Utility.wait(x.x) x.x being how many(as a float) seconds you want the thing to be enabled, and then disable after it.

You may need to take in account for things like the person spamming the activation, which would cause threading. Simplest way I think would be to a check if the thing is already disabled first?

Edited by Lisselli
Link to comment
Share on other sites

Is this what you are trying to do?

 

If you are working with scripts these two pages will be useful to you.

 

https://www.creationkit.com/index.php?title=Category:Script_Objects

https://www.creationkit.com/index.php?title=While

Scriptname RE_EnableTimerScript extends ObjectReference

ObjectReference Property SpellEffect Auto

Event OnActivate(ObjectReference akActionRef)
GoToState("Waiting") ; https://www.creationkit.com/index.php?title=State_Reference
SE(akActionRef); Why did I use a function? 
GoToState("") ; Back to the empty state  - The state outside defined states. 
Endevent

Function SE(ObjectReference A) ;Why did I have to define the action ref and not the SpellEffect?
If A == Game.GetPlayer()
Else
  Return
EndIf

SpellEffect.Enable()
Utility.Wait(2.0) ; https://www.creationkit.com/index.php?title=Utility_Script
SpellEffect.Disable()

EndFunction


State Waiting 
Event OnActivate(ObjectReference akActionRef)
EndEvent
EndState
Edited by Masterofnet
Link to comment
Share on other sites

Thanks @Lisselli and @Masterofnet.

 

Ahhh...I need to stop looking for help by typing Creation Kit only.

 

@Masterofnet

 

Yes, that works exactly how I was hoping. I appreciate the references for the information as well...learning to fish as opposed to just being handed a fish.

 

I know it's not much but I will include you guys in the credits of my mod as a lil thank you if you don't mind.

Edited by Rayek
Link to comment
Share on other sites

This actually works great...for almost everything.

 

Oddly enough one of the items I'm using it for DLCCraftingStaffWorkbench will not fade...while everything else I've tested does. It insists on popping. Figures.

 

Makes me wonder if there is a .nif property or a setting that doesn't allow it to fade...Might be because it has a 2nd Marker Model attached.

 

Thanks again @IsharaMeradin

 

EDIT: For the record it is the extra Marker Model that was added that made it unable to fade. I just created a static in the exact same location, nulled all textures but the marker for the DLCCraftingStaffWOrkbench (renamed of course) and added the static to to script...fade is now intact.

Edited by Rayek
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...