How to subtract health?
Hi. This is for TF2 RTD plugin, kinda been screwing around seeing if I could add some of my own skills to it. Im fairly new to SM scripting so... Im trying to figure out how one would subtract health.
What I tried didnt work. Like, this is the code for multiplying health. Code:
SetEntityHealth(i, RoundToCeil(classHealth[GetEntProp(i, Prop_Send, "m_iClass")] * GetConVarFloat(c_Health))); // buff the health Code:
c_Health = CreateConVar("sm_rtd_health","1.5","Health multiplier."); |
Re: How to subtract health?
You want to take away 40% of their life? Multiply their current life by 0.6.
|
Re: How to subtract health?
Ahhh really thats it. Damn ok. :P Way over thought that one lol.
Thanks bl4nk. |
Re: How to subtract health?
What commands you adding? I Added ALOT for my server myself :)
|
Re: How to subtract health?
Quote:
Oh ya? Might be interested in checking that out. So far, im still working on this health one, but this badhealth one will subtract 40-50%(or whatever value you specify) health from the entire team. I added firebomb, and freezebomb as well for bad commands. Thats it so far. If you wouldnt mind sharing, id love to see what stuff you came up with. Im kinda new and still learning sm so... So far firebomb and freezebomb just use the cvars straight out of the funcommands.cfg, so like I still have to adjust radius, time, and team affected via that config. I wanna try and make those into the rtd plugin itself. I was also screwing around and planning on fiddling with some of the other current skills. Like I thought beacon should just stay on until they die since its such a minor "bad" skill, instead of a time period. Possibly put a custom timer. I couldnt get that to work either though. I tried to set a 60 second timer for that so it doesnt utilize the cvar timelimit, but It wouldnt work. This leads me to another question I have for bl4nk if you see this. How do you check their current health, instead of class health? I cant find what looks at their current health first before adding the % health. Code:
SetEntityHealth(i, RoundToCeil(classHealth[GetEntProp(i, Prop_Send, "m_iClass")] * GetConVarFloat(c_Badhealth))); // subtract the health |
Re: How to subtract health?
Quote:
|
Re: How to subtract health?
I think I realize what I need to figure out for this. I need to get the code to get their CURRENT health, not the entire classes normal health. That is what it is currently doing correct? Its getting their full class health, not their current health. The author of that plugin should prolly do that as well. How do you get their current health?
Code:
public DiceBadhealth(client) Right now what it does is, reduces health based on the cvar set. However, like lets say it reduces a heavy from 300 to 120 heath. If his health goes under that, if the skill gets rolled again, it actually raises their health back to 120. |
Re: How to subtract health?
So... You need to convert their health into a variable and compare it with a if statement before you set it. If it would take it to zero, then fire the death event and kill the player.
|
Re: How to subtract health?
Code:
SetEntityHealth(i, RoundToCeil(GetEntProp(i, Prop_Send, "m_iHealth") * GetConVarFloat(c_Badhealth))); |
Re: How to subtract health?
Thanks bl4nk, you rock. That works perfectly.
|
All times are GMT -4. The time now is 08:11. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.