Jump to content

Help requested in script


dontpanic

Recommended Posts

I am trying to make the player get an option on what there weapons customizations are and to be able to select them once the chosen button is pressed. It seems I can get the message with options to pop up but once the loadout is selected nothing happens. can someone take a look at these two scripts I tried separately and tell me what I did wrong.

 

First Script Tried

SCRIPTNAME 1CCLRM1A1ThompsonChangeScript ; Dontpanic M1A1 Thompson Customization Script

int awaitingInput
int buttonvar
float weaponCondition

BEGIN OnEquip Player
If Player.GetEquipped 1CCLRWeapM1A1Thompson || Player.GetEquipped 1CCLRWeapM1A1ThompsonDrumMag
       showmessage 1CCLRM1A1ThompsonChangeMessage
       ENDIF
End

begin gamemode
if awaitingInput == 1
	set buttonVar to getbuttonpressed

	if buttonVar > -1
		set awaitingInput to 0

		if buttonVar == 0
		    set weaponCondition to player.GetWeaponHealthPerc / 100
		    player.AddItemHealthPercent 1CCLRWeapM1A1Thompson 1  weaponCondition 1
		    player.EquipItem 1CCLRWeapM1A1Thompson 0 1
		    removeme
			; choice 1
		elseif buttonVar == 1
		    set weaponCondition to player.GetWeaponHealthPerc / 100
		    player.AddItemHealthPercent 1CCLRWeapM1A1ThompsonDrumMag 1  weaponCondition 1
		    player.EquipItem 1CCLRWeapM1A1ThompsonDrumMag 0 1
		    removeme
			; choice 2
		elseif buttonVar == 2
			; choice 3
		endif
	endif
endif
end

 

Second script Tried

SCRIPTNAME 1CCLRM1A1ThompsonChangeScript ; Dontpanic M1A1 Thompson Customization Script

int awaitingInput
int buttonvar

BEGIN OnEquip Player
If Player.GetEquipped 1CCLRWeapM1A1Thompson || Player.GetEquipped 1CCLRWeapM1A1ThompsonDrumMag
       showmessage 1CCLRM1A1ThompsonChangeMessage
       ENDIF
End

begin gamemode
if awaitingInput == 1
	set buttonVar to getbuttonpressed

	if buttonVar > -1
		set awaitingInput to 0

		if buttonVar == 0
		    player.removeitem 1CCLRWeapM1A1Thompson
		    player.removeitem 1CCLRWeapM1A1ThompsonDrumMag
			player.additem 1CCLRWeapM1A1Thompson
			; choice 1
		elseif buttonVar == 1
		    player.removeitem 1CCLRWeapM1A1Thompson
			player.removeitem 1CCLRWeapM1A1ThompsonDrumMag
			player.additem 1CCLRWeapM1A1ThompsonDrumMag
			; choice 2
		elseif buttonVar == 2
			; choice 3
		endif
	endif
endif
end

Link to comment
Share on other sites

gsmanners is correct in that your "if awaitingInput == 1" condition will never be satisfied, assuming that the value of that variable is not edited remotely anywhere.

 

I've recently published an article on creating scripted menus like these that you will hopefully find useful. Here's a link - Making a Menu

 

Cipscis

Link to comment
Share on other sites

  • Recently Browsing   0 members

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