Jump to content

Make an activator not activate after... activation.


Recommended Posts

So what is my title about? First off check the attachment. The orange bar is the invisible activator that has the script which controls a 3 stage fire. Everything works as inteneded. Only by accident did I discover an issue. Player starts fire, watches if so inclined, but the activator stays 'active' until the 3 stages (20 secs.) have finished meaning player can restart fire repeatedly until script is done and activator is disabled. I can't disable the activator while the script is doing its 'thing'.

Ideas/advice please.

Video will help too,..

https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2134169&parId=B60C11D037429D8E%21191&o=OneUp

Link to comment
Share on other sites

Without seeing the script, cannot make any accurate suggestions. However, I suspect that you may benefit from using either a bool or states.

 

Bool example

Bool isBusy = false

Event OnActivate(ObjectReference akActivator)
  If isBusy == false
    isBusy = true
    ;do stuff
  EndIf
EndEvent

Reset the bool to false when the script is done "doing its thing"

 

State example

Auto State Waiting
  Event OnActivate(ObjectReference akActivator)
    GoToState(Busy)
    ;do stuff
  EndEvent
EndState

State Busy
  Event OnActivate(ObjectReference akActivator)
    ;do nothing
  EndEvent
EndState

Switch back to the waiting state when the script is done "doing its thing"

 

FYI - I am a bit rusty on states so if the example is off, hopefully someone will swing by with any necessary corrections.

Link to comment
Share on other sites

Sorry, I fogot that.

 

 

Scriptname My_StartFire extends ObjectReference

ObjectReference Property StartFireMarker Auto
ObjectReference Property MiddleFireMarker Auto
ObjectReference Property TreeFallMarker Auto
Light Property HasTorch Auto
Message Property Greet Auto
Message Property EquipTorch Auto
Message Property NeedFlame Auto

Event OnActivate(ObjectReference akActionRef)
Int iButton = Greet.Show() ; Shows your menu.

If iButton == 0 && (Game.GetPlayer().GetEquippedItemType(0) == 11)
StartFireMarker.enable()
Utility.wait(20.0)
; player has torch equipped main fire starts
TreeFallMarker.enable()
MiddleFireMarker.enable()
StartFireMarker.disable()
Utility.wait(20.0)
; tree falls fire goes from main to mid
MiddleFireMarker.disable()
Disable(self)
; fire dies down activator disables

ElseIf iButton == 0 && (Game.GetPlayer().GetItemCount(HasTorch) >= 1)
EquipTorch.show()
; player has torch but not equipped

ElseIf iButton == 0 && (Game.GetPlayer().GetItemCount(HasTorch) < 1)
NeedFlame.show()
; player does not have a torch at all

ElseIf iButton == 1

EndIf

EndEvent

 

Link to comment
Share on other sites

Switch back to the waiting state when the script is done "doing its thing"

 

FYI - I am a bit rusty on states so if the example is off, hopefully someone will swing by with any necessary corrections.

I think that it should be GoToState("Busy").

Edited by Rasikko
Link to comment
Share on other sites

Scriptname My_StartFire extends ObjectReference

ObjectReference Property StartFireMarker Auto
ObjectReference Property MiddleFireMarker Auto
ObjectReference Property TreeFallMarker Auto
Light Property HasTorch Auto
Message Property Greet Auto
Message Property EquipTorch Auto
Message Property NeedFlame Auto
 
Auto State Waiting
Event OnActivate(ObjectReference akActionRef)
          Int iButton = Greet.Show()
       If iButton == 0 && (Game.GetPlayer().GetEquippedItemType(0) == 11)
           GotoState("Activated")   ; Protects itself from being reactivated - No need for declaring a State, will work as is.
           StartFireMarker.enable()
           Utility.wait(20.0)
           TreeFallMarker.enable()
           MiddleFireMarker.enable()
           StartFireMarker.disable()
           Utility.wait(20.0)
           MiddleFireMarker.disable()
           Utility.wait(0.2)
           self.Disable()  ; Triggers its deletion after finishing its functions.
           Utility.wait(0.5)
           self.Delete()
 
  ElseIf iButton == 0 && (Game.GetPlayer().GetItemCount(HasTorch) >= 1)
            EquipTorch.show()
 
  ElseIf iButton == 0 && (Game.GetPlayer().GetItemCount(HasTorch) < 1)
            NeedFlame.show()
 
  ElseIf iButton == 1
 
  EndIf
EndEvent
EndState

 

 

 

IsharaMeradin suggestions will also work, choose and pick your way...

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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