Where can I find the HEV suit coding?

Hi guys. Just wondering where I can find the HEV suit coding in my files, or if anyone could post it here?

Basically I’m looking for the bit of code that tells the game what to do when the suit should take damage.

There is a Plugin for ASSmod which allows you to give and take armor from players, however at the moment, taking armor actually takes health:

if (ASS_RunPluginFunction( “AllowPlayerArmor”, true, PLAYER, TO_RECIEVE, ARMOR )) then

			if (ARMOR < 0) then

				TO_RECIEVE:Hurt( -ARMOR )
				ASS_LogAction( PLAYER, ASS_ACL_ARMOR, "took " .. -ARMOR .. " armor from " .. ASS_FullNick(TO_RECIEVE) )

is a snippet of what the designer coded, obviously he thinks that Hurt(-armor) will remove armor, but I have a suspicion that what that is actually doing is Hurting the health (as Hurt is the command) and using (-ARMOR) as a reference for how many units of health to remove.

Please correct me if I’m wrong.

So does anyone know what to put instead of ‘Hurt’ in order to remove just Suit armor?

Thanks.

[lua]
TO_RECIEVE:SetArmor(TO_RECIEVE:Armor()-ARMOR)
[/lua]

Ty Ralle, but this just adds on more armor. -ARMOR is the value it reads to send to the chat command basically. so SetArmor gives armor, but what takes it away?

What?

[lua]TO_RECEIVE:SetArmor( TO_RECEIVE:Armor( ) - 10 )[/lua]

That removes 10 armor for me.

So you want to remove only armor, and not have the player take any damage until his armor wears off? What you could do is use the Gamemode.ScalePlayerDamage hook. You could try to do something like this : [lua]function ScaleDamage( ply, hitgroup, dmginfo )

local pArmor = ply:Armor()

 if pArmor => 1 then -- If the player has any armor points
 
	local dDamage = dmginfo:GetDamage()
	
	if pArmor => dDamage then and -- and he has more armor then the damage received
		ply:SetArmor(pArmor - dDamage) -- then deduct the damage off the armor.
	else -- If the damage is higher then the armor
		ply:SetArmor(0) -- Set the armor to 0 and
		ply:TakeDamage(dDamage - pArmor, dmginfo:GetAttacker(), dmginfo:GetInflictor()) -- inflict the reduced damage to the player with the original attacker.
		dmginfo:ScaleDamage( 0 ) -- Scale the damage to 0 so the player doesn't receive it twice.
	end
 else
	dmginfo:ScaleDamage( 1 ) -- If the player had no armor then he takes normal damage.
end

end

hook.Add(“ScalePlayerDamage”,“ScaleDamage”,ScaleDamage)[/lua]

As seen on the wiki page you can also make it so that some body parts are more resilient then others.

No, he wants to only take armor away from players using ASSMod.

Oh, right. Then it’s exactly like ralle105 said.

afraid it didn’t work guys. I’ll post the whole original code I got in the plugin here, and you will see what I mean hopefully:

local PLUGIN = {}

PLUGIN.Name = “Armor”
PLUGIN.Author = “Legitcobra”
PLUGIN.Date = “January 30 2008”
PLUGIN.Filename = PLUGIN_FILENAME
PLUGIN.ClientSide = true
PLUGIN.ServerSide = true
PLUGIN.APIVersion = 2
PLUGIN.Gamemodes = {}

if (SERVER) then

ASS_NewLogLevel("ASS_ACL_ARMOR")

function PLUGIN.GiveTakeArmor( PLAYER, CMD, ARGS )

	if (PLAYER:IsTempAdmin()) then

		local TO_RECIEVE = ASS_FindPlayer(ARGS[1])
		local ARMOR = tonumber(ARGS[2]) or 0

		if (!TO_RECIEVE) then

			ASS_MessagePlayer(PLAYER, "Player not found!

")
return

		end
		
		if (ARMOR == 0) then return end // nothing to do!

		if (PLAYER != TO_RECIEVE) then
			if (TO_RECIEVE:IsBetterOrSame(PLAYER) && ARMOR < 0) then

				// disallow!
				ASS_MessagePlayer(PLAYER, "Access denied! \"" .. TO_RECIEVE:Nick() .. "\" has same or better access then you.")
				return
			end
		end

		if (ASS_RunPluginFunction( "AllowPlayerArmor", true, PLAYER, TO_RECIEVE, ARMOR )) then

			if (ARMOR < 0) then

				TO_RECIEVE:Hurt( -ARMOR )
				ASS_LogAction( PLAYER, ASS_ACL_ARMOR, "took " .. -ARMOR .. " armor from " .. ASS_FullNick(TO_RECIEVE) )

			else

				TO_RECIEVE:SetArmor( TO_RECIEVE:Armor() + ARMOR )
				ASS_LogAction( PLAYER, ASS_ACL_ARMOR, "gave " .. ASS_FullNick(TO_RECIEVE) .. " " .. ARMOR .. " armor"  )

			end

		end


	else

		ASS_MessagePlayer( PLAYER, "Access Denied!

")

	end

end
concommand.Add("ASS_GiveTakeArmor", PLUGIN.GiveTakeArmor)

end

if (CLIENT) then

function PLUGIN.GiveTakeArmor(PLAYER, AMOUNT)

	if (!PLAYER:IsValid()) then return end
	
	RunConsoleCommand( "ASS_GiveTakeArmor", PLAYER:UniqueID(), AMOUNT )
	return true

end

function PLUGIN.PosAmountPower(MENU, PLAYER)

	for i=10,100,10 do
		MENU:AddOption( tostring(i),	function() PLUGIN.GiveTakeArmor(PLAYER,  i) end )
	end

end

function PLUGIN.NegAmountPower(MENU, PLAYER)

	for i=10,100,10 do
		MENU:AddOption( tostring(i),	function() PLUGIN.GiveTakeArmor(PLAYER,  -i) end )
	end

end

function PLUGIN.AddMenu(DMENU)			

	DMENU:AddSubMenu( "Give Armor", nil, function(NEWMENU) ASS_PlayerMenu( NEWMENU, {"IncludeLocalPlayer","HasSubMenu"}, PLUGIN.PosAmountPower  ) end ):SetImage( "gui/silkicons/heart" )
	DMENU:AddSubMenu( "Take Armor", nil, function(NEWMENU) ASS_PlayerMenu( NEWMENU, {"IncludeLocalPlayer","HasSubMenu"}, PLUGIN.NegAmountPower  ) end ):SetImage( "gui/silkicons/pill" )

end

end

ASS_RegisterPlugin(PLUGIN)

Put your code in [ lua ] [/ lua] tags so we can read it.
Anyways, I have no idea how ASSMod works so I can’t help you there.

Replace TO_RECIEVE:Hurt( -ARMOR ) with the line in my first post like I told you to, and you’ll be one step closer to solving the problem.

I have done. It just seems to still add Armor on, as I’m pretty sure -ARMOR is a value not a command

ARMOR is negative. Replace the - with a + or use ARMOR = math.abs(ARMOR) before that line.

Hi guys, Lexic, the math.abs soluton combined with Ralles original code worked perfectly. thanks to both of you :slight_smile: cheers for the help guys, appreciate it.