antstubell Posted September 15, 2019 Share Posted September 15, 2019 ... 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 AutoObjectReference Property FuseLight AutoObjectReference Property FuseExpMarker AutoObjectReference Property OtherMarkerDis AutoObjectReference Property OtherMarkerEn AutoObjectReference Property OtherMarkerEn2 AutoGlobalVariable Property PrevActi Auto; has object already been activated elsewhere 0-no 1-yesExplosion Property MyExp AutoFloat Property DelayB4Exp AutoExplosion Property MyExp2 AutoInt Property ObjToDstry Auto; user enter value of current object - see commentsLight Property HasTorch AutoMagicEffect Property MyEff AutoMessage Property Greet AutoMessage Property NoExplosives AutoMessage Property NeedSewKit AutoMessage Property NoFuse AutoMessage Property EquipTorch AutoMessage Property NeedFlame AutoMessage Property ExpMenu AutoMessage Property NotFire Auto; cannot use fire messageMiscObject Property GPowder AutoMiscObject Property SewKitAsFuse AutoSound Property ExpSND AutoSound 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, oilAuto State WaitingEvent OnActivate(ObjectReference akActionRef)if (akActionRef == Game.GetPlayer())Int iButtonA = Greet.Show() ; Shows first menu; check to see if player Literally Has Nothing usefulIf iButtonA == 0; explosives chosenExplosivesOptions()EndIfIf (iButtonA == 1) && ObjToDstry == 0; fire chosen but won’t work on this object so don’t go to fire menuNotFire.show()GoToState("Waiting")elseFireOptions()EndIfIf iButtonA == 2; other chosenOtherOptions()EndIfGoToState("Waiting")EndIfdebug.notification("Script Ended")EndEventEndState;----------------------------------------------------------------------Function ExplosivesOptions()debug.notification("Explosives Chosen")If Game.GetPlayer().GetItemCount(GPowder) > 0Int iButtonExp = ExpMenu.Show(); shows explosives menu-menu only shows available inventory itemsIf iButtonExp == 0; Button 0 is shown because player has gunpowderdebug.notification("Gunpowder Chosen")EndIfEndIfIf Game.GetPlayer().GetItemCount(GPowder) < 1NoExplosives.show(); if player does not have gunpowder exit this functionReturn; player does have gunpowder so let us check for a fuseElseif Game.GetPlayer().GetItemCount(SewKitAsFuse) < 1; player has nothing to use as a fuseNoFuse.show(); show player needs fuse msg and exit this finctionReturnElseIf Game.GetPlayer().GetItemCount(SewKitAsFuse) > 0; player has sewing kitdebug.notification("Sewing Kit Thread Used As Fuse"); player will use sewing kit as a fuseEndIfif (Game.GetPlayer().GetItemCount(GPowder) > 0) && (Game.GetPlayer().GetItemCount(SewKitAsFuse) > 0) && (Game.GetPlayer().GetItemCount(HasTorch) < 1)NeedFlame.show(); player does not have a torchReturn; player does not have a torch so we exit this fiunctionElseif (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 equippedReturn; player does not have torch equipped so we exit this functionElseif (Game.GetPlayer().GetItemCount(GPowder) > 0) && (Game.GetPlayer().GetItemCount(SewKitAsFuse) > 0) && (Game.GetPlayer().GetEquippedItemType(0) == 11); everything required to start destructionGame.GetPlayer().RemoveItem(GPowder, 1)StaticGpowder.Enable()FuseLight.Enable()Fuse.play(FuseExpMarker)Utility.wait(DelayB4Exp)EndIfdebug.notification("Now sending to actual explosion function")Explosion(); send to the actual explosiondebug.notification("this is the end of the explosion options function")EndFunction;----------------------------------------------------------------------------------Function Explosion(); actual ExplosionStaticGpowder.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")EndFunctionFunction FireOptions()debug.notification("Fire Chosen")EndFunctionFunction 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 More sharing options...
IsharaMeradin Posted September 15, 2019 Share Posted September 15, 2019 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 More sharing options...
antstubell Posted September 15, 2019 Author Share Posted September 15, 2019 Thank you for your help. Works as intended. :thumbsup: Link to comment Share on other sites More sharing options...
antstubell Posted September 15, 2019 Author Share Posted September 15, 2019 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 workActivate(ObjToActivate1) - doesn't work Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 15, 2019 Share Posted September 15, 2019 Try:ObjToActivate1.Activate() According to the wiki examples this would seem like the way to go. If you want to pass something in as the akActivator you can. Especially, if you have a script on the object being activated which expects the player or other actor to activate the object. Link to comment Share on other sites More sharing options...
antstubell Posted September 16, 2019 Author Share Posted September 16, 2019 I see where you're coming from looking at the wiki but not working.I get 'Compile Succeeded' and this error... : argument akactivator is not specified and has no default value Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 16, 2019 Share Posted September 16, 2019 Then add something in for the akActivator parameter. Possibly the player. That would be your choice depending upon what your script(s) / mod are doing. In pseudo terms:Thing_getting_activated.Activate(Thing_causing_the_activation) Link to comment Share on other sites More sharing options...
antstubell Posted September 16, 2019 Author Share Posted September 16, 2019 Figured it out. Should be... ObjToActivate1.Activate(self) As long as the activator being activated has a script on it then this will force it to run that script. In my case it forced the TrapLinker to run the FallingRocks script. Link to comment Share on other sites More sharing options...
Recommended Posts