Jump to content

Stopping script from executing Functions I don't want...


antstubell

Recommended Posts

... executed.

This is a long script. It is my Anything Destroyable Script and is nowhere near completed. What is almost complete, not perfected yet that's why I need assistance, is the explosives part. The linked video will explain easier.

The script has many debug notifications mainly for my testing but are a great help in the video so you can tell where in the script - the script is.

Issue:- I can only put this in simple terms. I want to stop the script from going to the Function FireOptions() portion of the script when I specifically did not choose that option. After the explosion happens the script needs to quit completely, not go to the next function below it.

I know this will be time consuming so thanks for any help.

 

 

ObjectReference Property StaticGpowder Auto
ObjectReference Property FuseLight Auto
ObjectReference Property FuseExpMarker Auto
ObjectReference Property OtherMarkerDis Auto
ObjectReference Property OtherMarkerEn Auto
ObjectReference Property OtherMarkerEn2 Auto
GlobalVariable Property PrevActi Auto; has object already been activated elsewhere 0-no 1-yes
Explosion Property MyExp Auto
Float Property DelayB4Exp Auto
Explosion Property MyExp2 Auto
Int Property ObjToDstry Auto; user enter value of current object - see comments
Light Property HasTorch Auto
MagicEffect Property MyEff Auto
Message Property Greet Auto
Message Property NoExplosives Auto
Message Property NeedSewKit Auto
Message Property NoFuse Auto
Message Property EquipTorch Auto
Message Property NeedFlame Auto
Message Property ExpMenu Auto
Message Property NotFire Auto; cannot use fire message
MiscObject Property GPowder Auto
MiscObject Property SewKitAsFuse Auto
Sound Property ExpSND Auto
Sound Property Fuse Auto

; ObjToBeDest values associated with destructible items
; 0 Solid structures that can only be blown up - rocks, solid wood
; 1 Objects that can be ignited with kindling or accelerant - log piles
; 2 Objects that are easily ignitable - paper, material, oil

Auto State Waiting
Event OnActivate(ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer())
Int iButtonA = Greet.Show() ; Shows first menu
; check to see if player Literally Has Nothing useful
If iButtonA == 0; explosives chosen
ExplosivesOptions()
EndIf
If (iButtonA == 1) && ObjToDstry == 0; fire chosen but won’t work on this object so don’t go to fire menu
NotFire.show()
GoToState("Waiting")
else
FireOptions()
EndIf

If iButtonA == 2; other chosen
OtherOptions()
EndIf

GoToState("Waiting")

EndIf
debug.notification("Script Ended")
EndEvent
EndState
;----------------------------------------------------------------------
Function ExplosivesOptions()
debug.notification("Explosives Chosen")
If Game.GetPlayer().GetItemCount(GPowder) > 0
Int iButtonExp = ExpMenu.Show(); shows explosives menu-menu only shows available inventory items
If iButtonExp == 0; Button 0 is shown because player has gunpowder
debug.notification("Gunpowder Chosen")
EndIf
EndIf
If Game.GetPlayer().GetItemCount(GPowder) < 1
NoExplosives.show()
; if player does not have gunpowder exit this function
Return

; player does have gunpowder so let us check for a fuse
Elseif Game.GetPlayer().GetItemCount(SewKitAsFuse) < 1; player has nothing to use as a fuse
NoFuse.show(); show player needs fuse msg and exit this finction
Return
ElseIf Game.GetPlayer().GetItemCount(SewKitAsFuse) > 0; player has sewing kit
debug.notification("Sewing Kit Thread Used As Fuse"); player will use sewing kit as a fuse
EndIf
if (Game.GetPlayer().GetItemCount(GPowder) > 0) && (Game.GetPlayer().GetItemCount(SewKitAsFuse) > 0) && (Game.GetPlayer().GetItemCount(HasTorch) < 1)
NeedFlame.show(); player does not have a torch
Return
; player does not have a torch so we exit this fiunction
Elseif (Game.GetPlayer().GetItemCount(GPowder) > 0) && (Game.GetPlayer().GetItemCount(SewKitAsFuse) > 0) && (Game.GetPlayer().GetItemCount(HasTorch) > 0) && (Game.GetPlayer().GetEquippedItemType(0) != 11)
EquipTorch.show(); player has required items but torch is not equipped
Return
; player does not have torch equipped so we exit this function
Elseif (Game.GetPlayer().GetItemCount(GPowder) > 0) && (Game.GetPlayer().GetItemCount(SewKitAsFuse) > 0) && (Game.GetPlayer().GetEquippedItemType(0) == 11)
; everything required to start destruction
Game.GetPlayer().RemoveItem(GPowder, 1)
StaticGpowder.Enable()
FuseLight.Enable()
Fuse.play(FuseExpMarker)
Utility.wait(DelayB4Exp)
EndIf
debug.notification("Now sending to actual explosion function")
Explosion(); send to the actual explosion
debug.notification("this is the end of the explosion options function")
EndFunction
;----------------------------------------------------------------------------------

Function Explosion(); actual Explosion
StaticGpowder.Disable()
FuseLight.Disable()
FuseExpMarker.placeAtMe(MyExp)
FuseExpMarker.placeAtMe(MyExp2)
FuseExpMarker.placeAtMe(MyEff)
ExpSND.play(FuseExpMarker)
OtherMarkerDis.Disable()
OtherMarkerEn.Enable()
OtherMarkerEn2.Enable()
Disable(self)
debug.notification("this is the end of actual explosion function")
EndFunction


Function FireOptions()
debug.notification("Fire Chosen")
EndFunction

Function OtherOptions()
debug.notification("Other Chosen")
EndFunction

 

 

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

 

 

Link to comment
Share on other sites

Try this adjustment to your OnActivate event in the auto state

 

 

Auto State Waiting
  Event OnActivate(ObjectReference akActionRef)
    if (akActionRef == Game.GetPlayer())
      Int iButtonA = Greet.Show() ; Shows first menu
      ; check to see if player Literally Has Nothing useful
      If iButtonA == 0; explosives chosen
        ExplosivesOptions()
      ElseIf (iButtonA == 1) 
        If ObjToDstry == 0; fire chosen but won’t work on this object so don’t go to fire menu
          NotFire.show()
          GoToState("Waiting")
        else
          FireOptions()
        EndIf
      ElseIf iButtonA == 2; other chosen
        OtherOptions()
      EndIf
      GoToState("Waiting")
    EndIf
    debug.notification("Script Ended")
  EndEvent
EndState

Basically, the If / EndIf between each option choice have been converted into ElseIf so that only one gets selected. Had to do a little tweaking with the FireOptions button as you've got a condition that can cancel that choice.

 

 

Link to comment
Share on other sites

Just as an after thought, I want to add a line that will activate a TrapLinker which will cause a rockfall. All this is set up and can be activated by a pull chain, pull bar, a primitive with a Tripwire script attached but what do I script to activate it.

 

Self.Activate(ObjToActivate1) - doesn't work

Activate(ObjToActivate1) - doesn't work

Link to comment
Share on other sites

  • Recently Browsing   0 members

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