wmmitchell Posted September 16, 2022 Share Posted September 16, 2022 Hello I am working on a script for my ammo swap mod. What I want it to do is initially prompt a message, then based off the selection of the first message prompt one of two other messages. This is what it looks like: ScriptName SelectAmmoHuntingRifle extends ActorMessage Property V_HuntingRifleAmmo AutoMessage Property V_308Ammo AutoMessage Property V_50Ammo AutoWeapon Property V_HuntingRifleWeapon Auto Constobjectmod Property mod_HuntingRifle_Chamber_Standard Auto Constobjectmod Property mod_HuntingRifle_Chamber_Acid Auto Constobjectmod Property mod_HuntingRifle_Chamber_Cryo Auto Constobjectmod Property mod_HuntingRifle_Chamber_Electric Auto Constobjectmod Property mod_HuntingRifle_Chamber_Explosive Auto Constobjectmod Property mod_HuntingRifle_Chamber_Frenzy Auto Constobjectmod Property mod_HuntingRifle_Chamber_Incendiary Auto Constobjectmod Property mod_HuntingRifle_Chamber_Paralysis Auto Constobjectmod Property mod_HuntingRifle_Chamber_Poison Auto Constobjectmod Property mod_HuntingRifle_Chamber_Radiation Auto Constobjectmod Property mod_HuntingRifle_Chamber_Standard_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Acid_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Cryo_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Electric_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Explosive_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Frenzy_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Incendiary_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Paralysis_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Poison_50 Auto Constobjectmod Property mod_HuntingRifle_Chamber_Radiation_50 Auto ConstAuto State WaitingEvent OnItemEquipped(Form akBaseObject, ObjectReference akReference)Actor player = Game.GetPlayer()Weapon gunToMod = player.GetEquippedWeapon(0)If (akBaseObject is Weapon && gunToMod == V_HuntingRifleWeapon)Self.GoToState("Busy")int ButtonPressed = V_HuntingRifleAmmo.show()If (ButtonPressed == 0)in ButtonPressed = V_308Ammo.show()If (ButtonPressed == 0)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Standard)Utility.Wait(0.5)ElseIf (ButtonPressed == 1)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Acid)Utility.Wait(0.5)ElseIf (ButtonPressed == 2)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Cryo)Utility.Wait(0.5)ElseIf (ButtonPressed == 3)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Electric)Utility.Wait(0.5)ElseIf (ButtonPressed == 4)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Explosive)Utility.Wait(0.5)ElseIf (ButtonPressed == 5)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Frenzy)Utility.Wait(0.5)ElseIf (ButtonPressed == 6)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Incendiary)Utility.Wait(0.5)ElseIf (ButtonPressed == 7)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Paralysis)Utility.Wait(0.5)ElseIf (ButtonPressed == :cool:player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Poison)Utility.Wait(0.5)ElseIf (ButtonPressed == 9)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Radiation)Utility.Wait(0.5)EndIfElseIf (ButtonPressed == 1)int ButtonPressed = V_50Ammo.show()If (ButtonPressed == 0)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Standard_50)Utility.Wait(0.5)ElseIf (ButtonPressed == 1)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Acid_50)Utility.Wait(0.5)ElseIf (ButtonPressed == 2)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Cryo_50)Utility.Wait(0.5)ElseIf (ButtonPressed == 3)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Electric_50)Utility.Wait(0.5)ElseIf (ButtonPressed == 4)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Explosive_50)Utility.Wait(0.5)ElseIf (ButtonPressed == 5)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Frenzy_50)Utility.Wait(0.5)ElseIf (ButtonPressed == 6)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Incendiary_50)Utility.Wait(0.5)ElseIf (ButtonPressed == 7)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Paralysis_50)Utility.Wait(0.5)ElseIf (ButtonPressed == :cool:player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Poison_50)Utility.Wait(0.5)ElseIf (ButtonPressed == 9)player.AttachModToInventoryItem(gunToMod as Form, mod_HuntingRifle_Chamber_Radiation_50)Utility.Wait(0.5)EndIfEndIfEndIfEndEventEndStateState BusyEvent OnItemUnequipped(Form akBaseObject, ObjectReference akReference)If (akBaseObject == V_HuntingRifleWeapon as Form)Self.GoToState("Waiting")EndIfEndEventEndState I get the error "function variable ButtonPressed may not shadow a previously defined variable". As a workaround I just made one super long message with 20 selections but that isn't really ideal as it feels clunky. I am fairly novice when it comes to scripting and am still trying to teach myself things. Any help would be appreciated. Link to comment Share on other sites More sharing options...
RaidersClamoring Posted September 16, 2022 Share Posted September 16, 2022 Just remove the "Int" from "int ButtonPressed = V_50Ammo.show()" and you will get rid of that message. That's what it means by "shadowing", declaring it twice. Link to comment Share on other sites More sharing options...
wmmitchell Posted September 17, 2022 Author Share Posted September 17, 2022 Just remove the "Int" from "int ButtonPressed = V_50Ammo.show()" and you will get rid of that message. That's what it means by "shadowing", declaring it twice. Thank you that worked! I figured it was probably something simple. Link to comment Share on other sites More sharing options...
Recommended Posts