Jump to content

Aid Menu Item


adianda

Recommended Posts

Im trying to script an aid item that, on use, opens a menu that allows the player to choose a limb to heal for 5 points. When I use the item all of the effects except the menu work properly so im assuming I messed up when coding it but I can't figure out what is wrong. If anyone has any ideas on what I did wrong I would appreciate the help.

 

Edited by adianda
Link to comment
Share on other sites

Well the first piece of advice I can give you (NC I'm dealing with a similar issue...) is make sure the game is even seeing your script. Add some notifications in there to at least let you know the thing is loaded. That would be my first guess as to what is happening on your end. I can't even get a debug message to show ... at this point I'm not even sure scripts will run from the user folder. I know .esp dont. I've added my script to every folder and location I thought it would look in, it still ain't working Edited by markyrocks
Link to comment
Share on other sites

Make sure you have message property filled

 

Make sure you added that magic effect is in the list of Potion's magic effects

Remove aiButton parameter from BandageUseMenu function, you dont need it there. make IButton as local variable inside that function. something like this:

Event OnEffectStart(Actor Target, Actor Caster)
 BandageUseMenu()
Endevent

Function BandageUseMenu()
 int iButton = BandageMenu.show()
 if iButton == 0 
 ;further logic ....
 endif
Endfunction

 

Link to comment
Share on other sites

After some tinkering with the code and trying various things I came back to the original script with the debug messages added in.

Scriptname HPWO_CompressionBandageTreatment extends activemagiceffect

Message Property BandageMenu Auto Const Mandatory
Potion Property HealHead Auto Const Mandatory
Potion Property HealTorso Auto Const Mandatory
Potion Property HealLeftArm Auto Const Mandatory
Potion Property HealRightArm Auto Const Mandatory
Potion Property HealLeftLeg Auto Const Mandatory
Potion Property HealRightLeg Auto Const Mandatory

Event OnEffectStart(Actor akTarget, Actor akCaster)
	BandageUseMenu()
	Debug.MessageBox("OnEffectStart")
endEvent

Function BandageUseMenu ()
	Debug.MessageBox("BandageUseMenu")
	int aiButton = BandageMenu.show()
	If aiButton == 0
		Debug.MessageBox("HealHead")
		Game.GetPlayer().EquipItem(HealHead, 1, true)
	ElseIf aiButton == 1
		Game.GetPlayer().EquipItem(HealTorso, 1, true)
	ElseIf aiButton == 2
		Game.GetPlayer().EquipItem(HealLeftArm, 1, true)
	ElseIf aiButton == 3
		Game.GetPlayer().EquipItem(HealRightArm, 1, true)
	ElseIf aiButton == 4
		Game.GetPlayer().EquipItem(HealLeftLeg, 1, true)
	ElseIf aiButton == 5
		Game.GetPlayer().EquipItem(HealRightLeg, 1, true)
	EndIf
endFunction

I get the "OnEffectStart" and "BandageUseMenu" debug messages but the actual menu doesn't open. Any ideas folks cause Im fresh out at this point.

Link to comment
Share on other sites

Do you have the message properly attached to the script? Also when I said debug message I meant debug.notification("msg") the use of the debug.messagebox might be interfering with the actual menu showing. To ensure that the menu shows you might want to try wrapping a while loop around it. Its probably not necessary but it basically ensures that it doesn't somehow get skipped. just add a break boolean. That's what I would try but someone else might have a better suggestion. Edited by markyrocks
Link to comment
Share on other sites

Just comment out the entire if statement and debug msg and see if you can get the menu to show. I'm thinking the game sees you're trying to equip a spell and just bugs out. I could be completely wrong. I don't know if equipping a spell this way is possible. I realize you're trying to heal limbs but what is the next move? Personally I'd figure out if it's an issue with the menu, if the menu is fine. Just like fake it. Remove all the equip item stuff in the code and just let the menu roll and depending on what the player picks just manually add whatever values to the player you want.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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