Jump to content

EnableMarker Activate w/ Timer Script


Recommended Posts

Hi all,

 

I am relatively new to scripting w/ papyrus. I have searched YouTube, Nexus forums to no avail. What I am trying to do is a basic script that enables two or more EnableMarkers with an activator at the same time, and then when you select the activator again 1 of the EnableMarkers is Disabled and one or more of the other EnableMarkers continue for lets say 20 seconds then Disable.

 

Thank you!

 

~Revenant

Edited by Guest
Link to comment
Share on other sites

Look at the docs for OnActivate() and Utility.RandomInt

 

Here's some hacked up Papyrus to show the general idea. Dunno if it works.

 

 

ObjectReference Property objMarker01 Auto Mandatory
ObjectReference Property objMarker02 Auto Mandatory

int iRandom
bool bActivated = false

Event OnActivate(ObjectReference akActionRef)
    
    if bActivate == false then
    
        bActivate = true
        
        int iRandom = Utility.RandomInt(1, 2)
        
        if iRandom == 1 then
            WaitThenDisable(objMarker01)
        Else
            WaitThenDisable(objMarker02)
        EndIf
        
    EndIf    
    
EndEvent

Function WaitThenDisable(ObjectReference objMarker)

    Utility.Wait(20)
    objMarker.Disable()
    bActivate = false
    
EndFunction
Link to comment
Share on other sites

 

I'm not the best scripter myself and I don't know how or if you have any of this set up yet but for your timer just do this.

MyXMarker_01.Disable()
Wait(20)
MyXMarker_02.Disable()

 

I'll give it a go. Right now I just have one marker tied to my script I found that RRTV put in a tutorial.

ScriptName EnableWaterFXScript extends ObjectReference

{Script Turns Water effects On and Off}

ObjectReference Property WaterFXMarker Auto

Event OnActivate(ObjectReference akActionRef)
	if(WaterFXMarker.IsEnabled())
	 WaterFXMarker.disable()
	Else
	 WaterFXMarker.enable()
	EndIf
EndEvent

I am not sure how to activate multiple markers with this simple script. I have two effects I want to activate then, turn one of them off when you re-activate the Activator. After that have the other marker shut off after 20 seconds..

Link to comment
Share on other sites

You need second property which will be filled with the effect which you want to be disabled after 20 seconds. Your script should be something like this:

ScriptName EnableWaterFXScript extends ObjectReference

{Script Turns Water effects On and Off}

ObjectReference Property WaterFXMarker Auto
ObjectReference Property Marker2 Auto

bool blockActivation = false

Event OnActivate(ObjectReference akActionRef)
	if (!blockActivation)
		if(WaterFXMarker.IsEnabled())
			WaterFXMarker.disable()
			StartTimer(20, 10)
			blockActivation = true
		Else
			WaterFXMarker.enable()
	EndIf
EndEvent

Event OnTimer(int aiTimerID)		
	If aiTimerID == 10 
    	Marker2.disable()
    	blockActivation = false
	EndIf
EndEvent

 

Edited by shavkacagarikia
Link to comment
Share on other sites

I want to thank chucksteel, FiftyTifty and RedRocketTV For helping me get this to work here is what I came up with thanks to you guys!!!!!

 

ObjectReference Property YouGuysRock Auto

ScriptName ShowerFXScript extends ObjectReference

{Script Turns Two FX On and Off 2nd on delay}

ObjectReference Property WaterSprayMarker Auto
ObjectReference Property WaterFXMarker Auto

Event OnActivate(ObjectReference akActionRef)
	if(PHR_WaterMarker.IsEnabled())
	 PHR_WaterMarker.disable()
	 Utility.Wait(20)
	 PHR_WaterFXMarker.disable()
	 Else
	 PHR_WaterMarker.enable()
	 PHR_WaterFXMarker.enable()
	EndIf
EndEvent

This worked awesome! and hope someone elseIf gets use from this!

Link to comment
Share on other sites

 

You need second property which will be filled with the effect which you want to be disabled after 20 seconds. Your script should be something like this:

ScriptName EnableWaterFXScript extends ObjectReference

{Script Turns Water effects On and Off}

ObjectReference Property WaterFXMarker Auto
ObjectReference Property Marker2 Auto

bool blockActivation = false

Event OnActivate(ObjectReference akActionRef)
	if (!blockActivation)
		if(WaterFXMarker.IsEnabled())
			WaterFXMarker.disable()
			StartTimer(20, 10)
			blockActivation = true
		Else
			WaterFXMarker.enable()
	EndIf
EndEvent

Event OnTimer(int aiTimerID)		
	If aiTimerID == 10 
    	Marker2.disable()
    	blockActivation = false
	EndIf
EndEvent

 

 

Wow I like your script as well! I'm going to try that one to see if it's any better!!!

 

Thanks!!!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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