Jump to content

FranktheFragger

Recommended Posts

Hi,

 

I have been working on a project for a while, it may seem a bit dumb, but i'm trying to recreate the famous HEV mark IV suit from Half Life. So far, i have been able to do the obviously easy, and make the general HEV welcome play when ever you equip the suit, and the goodbye when every you unequip it. But i need a bit of help, because i would like to also have certain sounds to be triggered when ever your health reaches 75%, 50%, 25%, and then on death. If anyone could help me create a script that would allow me to do that, i would most certainly appreciate it!

Link to comment
Share on other sites

Here ya go (this script is intended to be used by the armor suit).

scn	HEVMkIVSuitScript

short	bEquipped
short	iPlayOnce
float	fHPBase
float	fHPLast
float	fHPCurrent
float	fHPRatio

begin OnUnequip player

	set bEquipped to 0

end

begin OnEquip player

	set fHPBase to player.GetBaseActorValue Health
	set fHPLast to player.GetActorValue Health
	set iPlayOnce to 0
	set bEquipped to 1

end

begin GameMode

	if bEquipped
		if player.GetDead
			set bEquipped to 0
			PlaySound PlayerDeadSound
		else
			set fHPCurrent to player.GetActorValue Health
			if fHPLast != fHPCurrent
				set fHPRatio to fHPCurrent / fHPBase
				if fHPRatio <= 0.25
					if iPlayOnce != 3
						set iPlayOnce to 3
						PlaySound HP25Sound
					endif
				elseif fHPRatio <= 0.5
					if iPlayOnce != 2
						set iPlayOnce to 2
						PlaySound HP50Sound
					endif
				elseif fHPRatio <= 0.75
					if iPlayOnce != 1
						set iPlayOnce to 1
						PlaySound HP75Sound
					endif
				elseif iPlayOnce
					set iPlayOnce to 0
				endif
				set fHPLast to fHPCurrent
			endif
		endif
	endif

end
Link to comment
Share on other sites

Question, when i save it, it doesn't say anything. But when i try to close the window, it says: Do you want to save the current script?

 

Current =

 

 

I have tried to give it a name, but it simply wont work. I would appreciate a bit of help.

Edited by FranktheFragger
Link to comment
Share on other sites

  • Recently Browsing   0 members

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