Jump to content

Need help with Script


eleglas

Recommended Posts

Can someone please tell me what is wrong with my code (see below). I'm trying to make a simple cloaking system for when I push the Y key that will toggle on and off. But the new GECk being like it is, won't tell me what's wrong with my code; please can someone help. I really hate it when this happens!

 

Thanks.

 

SCN aaaStealthX

Int bIsYPressed
Int StealthOn

Begin GameMode

If bIsYPressed != IsKeyPressed 21; Y
set bIsYPressed to bIsYPressed == 0
	If StealthOn == 0
		If Player.GetItemCount 000StealthModule == 0
			Player.Additem 000StealthModule 1 1
		Endif
		Player.Equipitem 000StealthModule 1 1
		Set StealthOn to 1
	Elseif StealthOn == 1
		Player.UnEquipitem 000StealthModule 1 1
		Player.Removeitem 000StealthModule 1 1
	Endif
Endif

END

 

Nevermind, I fixed it.

 

Need more help, see below.

Edited by eleglas
Link to comment
Share on other sites

Thanks for that, but I'm trying to do it myself, but I've ran into another complication. I get a CTD whenever I load a save now, I have 2 custom scripts running, one of them (at least) must be doing something wrong, see them below. The first is my stealth field one; I was trying to get it to toggle instead of forcing me to hold down the button (Y). The other is a script to change my weapon from a long range, to a short range by the push of a button. I think it's this one that is causing all the problems, but I can't seem to see how, can anyone help:

 

Stealth Module:

SCN 000StealthX

Int bIsYPressed
Int StealthOn

Begin GameMode

If Player.GetEquipped 000TuskanArmor == 1

If bIsYPressed != IsKeyPressed 21; Y
set bIsYPressed to bIsYPressed == 0
	If StealthOn == 0
		If Player.GetItemCount 000StealthModule == 0
			Player.Additem 000StealthModule 1 1
		Endif
		Player.Equipitem 000StealthModule 1 1
		Set StealthOn to 1
	Endif
Endif
If bIsYPressed != IsKeyPressed 21; Y
set bIsYPressed to bIsYPressed == 0
	If StealthOn == 1
		Player.UnEquipitem 000StealthModule 1 1
		Player.Removeitem 000StealthModule 1 1
		Set StealthOn to 0
	Endif
Endif

Endif

END

 

Rifle Switch:

 

SCN 000RifleX

Int bIsBPressed
Int ShortRifle

Begin GameMode

If bIsBPressed != IsKeyPressed 48; B
set bIsBPressed to bIsBPressed == 0
	If ShortRifle == 0
		If Player.GetItemCount 000TuskanRifleShort == 0
			Player.AddItem 000TuskanRifleShort 1
		Endif
		Player.Equipitem 000TuskanRifleShort 1 1
		Player.Removeitem 000TuskanRifle 1 1
		Set ShortRifle to 1
	Endif
Endif

If bIsBPressed != IsKeyPressed 48; B
set bIsBPressed to bIsBPressed == 0
	If ShortRifle == 1
		If Player.GetItemCount 000TuskanRifle == 0
			Player.AddItem 000TuskanRifle 1
		Endif
		Player.Equipitem 000TuskanRifle 1 1
		Player.Removeitem 000TuskanRifleShort 1 1
		Set ShortRifle to 0
	Endif
Endif

END

Link to comment
Share on other sites

  • Recently Browsing   0 members

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