Jump to content

Scripting Problem


MechanicalPirate

Recommended Posts

I need a script for an item (An Ingestible) that when used will cause a menu to come up with several buttons. Depending on which of these buttons is pressed a different effect will be given. I can do this for an activator but I can't get it to work for ALCH items such as stimpaks or food.

 

Any Ideas?

Link to comment
Share on other sites

Hmm, I've been trying OnActorEquip. I think I tried OnEquip and it came up with an error. I'll get back to you on that soon.

 

Edit: OnEquip tells me the ItemId I'm using is invalid. OnActivate does the same. It seems they both want an Actor Reference not an item.

Link to comment
Share on other sites

You shouldn't need to have an item ID if the script is attached directly to the item you want the script to run on. Actually, I'm positive about this because while trying to test out a script for someone else I used an OnEquip script on an item (StealthBoy) and it worked, but I'll take another look and see what I come up with.
Link to comment
Share on other sites

scn ACEMedicalBraceEffect

Short controlvar
Short button

Begin ScriptEffectStart
 If ( controlvar == 0 )
ShowMessage  ACEMedicalBraceMsg
Set controlvar to 1
 ElseIf ( controlvar > 1 )
Activate
 EndIf
End

Begin GameMode
 If ( controlvar == 1 )
Set button to GetButtonPressed
If ( button == -1 )
  Return
ElseIf ( button == 0)
  ShowMessage ACEMedicalBraceMsgStayInPain
 AddItem ACEMedicalBrace 1
  Set controlvar to 2
ElseIf ( button == 1)
  ShowMessage ACEMedicalBraceMsgLeftLeg
 CastImmediateOnSelf ACEBraceLeftLeg
  Set controlvar to 3
ElseIf ( button == 2)
  ShowMessage ACEMedicalBraceMsgLeftArm
 CastImmediateOnSelf ACEBraceLeftArm
  Set controlvar to 3
ElseIf ( button == 3)
  ShowMessage ACEMedicalBraceMsgRightArm
 CastImmediateOnSelf ACEBraceRightArm
  Set controlvar to 3
ElseIf ( button == 4)
  ShowMessage ACEMedicalBraceMsgRightLeg
 CastImmediateOnSelf ACEBraceRightLeg
  Set controlvar to 3
ElseIf ( button == 4)
  ShowMessage ACEMedicalBraceMsgNowhere
  AddItem ACEMedicalBrace 1
  Set controlvar to 2
EndIf
 ElseIf ( controlvar == 1 )
Activate
Set controlvar to 0
 EndIf
End

Begin ScriptEffectFinish
If (controlvar == 2)
	Return
Else
	ShowMessage ACEMedicalBraceEffectOverMsg
Endif
End

 

Edit: So I got my previous problem working, the menu shows and when I click on the buttons they do what they should.

 

But now I've fallen into the trap of conditioned buttons. The button for crippled left leg only shows if the player has a crippled left leg. However, due to the buttons having conditions, sometimes I can click the third button which says "Right Leg" and instead I get a fixed up left arm! Is there any way around this issue, or should I change the script so that all the buttons are present at all times?

Link to comment
Share on other sites

  • 1 month later...
Hi, is the last script you posted a working one? I Tried using it, i get the menu to show up but whichever option i click in the menu has no effect. (It doesn't actually enter in the gameMode section i've tried printing a debug message there)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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