Jump to content

Options menu keeps opening back up after selection. help?


Recommended Posts

i have a custom option menu that pops up when equiping an outfit, you make your selection from the menu and anOmod is equipped to the outfit and the menu closes... but then the same damn menu pops back up on an infinate loop unless i cancel out of the menu.

 

i think the menu pops back up because the outfit is being re-equiped when the Omod is equipped to it.

 

how do i stop the menu opening again straight away?

 

 

heres what i have so far...

Scriptname SM_Equip extends ObjectReference


Actor Property PlayerREF Auto

Message Property OptionsMESG Auto

ObjectMod Property Mod_1 Auto
ObjectMod Property Mod_2 Auto
ObjectMod Property Mod_3 Auto
ObjectMod Property Mod_4 Auto



Event OnEquipped(Actor Owner)

	RegisterForRemoteEvent(Owner, "OnItemEquipped")
	
EndEvent


Event Actor.OnItemEquipped(Actor Owner, Form BaseObject, ObjectReference Ref1)

	
 	if Owner == Game.GetPlayer()

	   Int iButton = OptionsMESG.Show() ; Shows your menu.

		If iButton == 0  ; Open

			Self.AttachMod(Mod_1)

			Debug.Notification("Mod 1 equipped")
			UnregisterForRemoteEvent(Owner, "OnItemEquipped")

		ElseIf iButton == 1  ; Closed

			Self.AttachMod(Mod_2)

			Debug.Notification("Mod 2 equipped")
			UnregisterForRemoteEvent(Owner, "OnItemEquipped")
	
		ElseIf iButton == 2 ; Unzipped

			Self.AttachMod(Mod_3)		
	
			Debug.Notification("Mod 3 equipped")
			UnregisterForRemoteEvent(Owner, "OnItemEquipped")

  	 	ElseIf iButton == 3 ; Tied

			Self.AttachMod(Mod_4)

			Debug.Notification("Mod 4 equipped")
			UnregisterForRemoteEvent(Owner, "OnItemEquipped")

		ElseIf iButton == 4 ; Cancel

			Debug.Notification("Style unchanged")
			UnregisterForRemoteEvent(Owner, "OnItemEquipped")

		EndIf
	EndIF

 EndEvent
Link to comment
Share on other sites

Using variable to control when the mod is being attached could work:

Scriptname SM_Equip extends ObjectReference

Message Property OptionsMESG Auto

ObjectMod Property Mod_1 Auto
ObjectMod Property Mod_2 Auto
ObjectMod Property Mod_3 Auto
ObjectMod Property Mod_4 Auto

Bool CurrentlyAttachingMod = False

Event OnEquipped(Actor Owner)
	if Owner == Game.GetPlayer() && !CurrentlyAttachingMod
		CurrentlyAttachingMod = True
		Int iButton = OptionsMESG.Show() ; Shows your menu.
		If iButton == 0  ; Open
			AttachMod(Mod_1)
			Debug.Notification("Mod 1 equipped")
		ElseIf iButton == 1  ; Closed
			AttachMod(Mod_2)
			Debug.Notification("Mod 2 equipped")
		ElseIf iButton == 2 ; Unzipped
			AttachMod(Mod_3)		
			Debug.Notification("Mod 3 equipped")
  	 	ElseIf iButton == 3 ; Tied
			AttachMod(Mod_4)
			Debug.Notification("Mod 4 equipped")
		ElseIf iButton == 4 ; Cancel
			Debug.Notification("Style unchanged")
		EndIf
		CurrentlyAttachingMod = False
	EndIf
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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