Jump to content

[Script] Help with message boxes


wmmitchell

Recommended Posts

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 Actor

Message Property V_HuntingRifleAmmo Auto
Message Property V_308Ammo Auto
Message Property V_50Ammo Auto
Weapon Property V_HuntingRifleWeapon Auto Const
objectmod Property mod_HuntingRifle_Chamber_Standard Auto Const
objectmod Property mod_HuntingRifle_Chamber_Acid Auto Const
objectmod Property mod_HuntingRifle_Chamber_Cryo Auto Const
objectmod Property mod_HuntingRifle_Chamber_Electric Auto Const
objectmod Property mod_HuntingRifle_Chamber_Explosive Auto Const
objectmod Property mod_HuntingRifle_Chamber_Frenzy Auto Const
objectmod Property mod_HuntingRifle_Chamber_Incendiary Auto Const
objectmod Property mod_HuntingRifle_Chamber_Paralysis Auto Const
objectmod Property mod_HuntingRifle_Chamber_Poison Auto Const
objectmod Property mod_HuntingRifle_Chamber_Radiation Auto Const
objectmod Property mod_HuntingRifle_Chamber_Standard_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Acid_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Cryo_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Electric_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Explosive_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Frenzy_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Incendiary_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Paralysis_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Poison_50 Auto Const
objectmod Property mod_HuntingRifle_Chamber_Radiation_50 Auto Const



Auto State Waiting

Event 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)
EndIf
ElseIf (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)
EndIf
EndIf


EndIf
EndEvent
EndState

State Busy

Event OnItemUnequipped(Form akBaseObject, ObjectReference akReference)
If (akBaseObject == V_HuntingRifleWeapon as Form)
Self.GoToState("Waiting")
EndIf
EndEvent
EndState

 

 

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

  • Recently Browsing   0 members

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