WallHeath Charger: time between use Created 8 years ago2015-06-04 06:41:31 UTC by abbadon abbadon

Created 8 years ago2015-06-04 06:41:31 UTC by abbadon abbadon

Posted 8 years ago2015-06-04 06:41:31 UTC Post #325789
Hi, I want my wallhealth charger couldn´t be used inmediately after one player uses it, I mean , I want it to deny the next recharge in a determined amount of time. I used Healthkit.cpp as a base for the reloader units in my MOD, but I want them not to be useable for a certain amount of time because players often remain "glued" to them recharging continuously and making the gameplay less interesting.

As always, the solution and solutioner will be on v 2.0 MOD´s credits, as Dr.Orange is!! ^_^
Posted 8 years ago2015-06-04 06:57:22 UTC Post #325790
Hmm. func_healthchargers don't seem to have a "master" parameter, so I don't think you can lock one out in that way (incidentally, not sure exactly what would trigger a lockout; the chargers themselves don't have any innate triggering ability). Assuming this is from vanilla HL, I'm not sure there's anything you can do to move the charger out of the way parenting-style...

I'm guessing func_healthcharges are like buttons and can be pressed through walls/doors, etc., excluding the possibility of rigging up a "cover" of sorts.
Jessie JessieTrans Rights <3
Posted 8 years ago2015-06-04 07:56:58 UTC Post #325791
Im sure you can code that functionality in.

As for conventional methods, there isn't a way to hide them without putting a big ass wall next to it. Maybe a button that comes out and the player would push on it instead of the healthcharger ?
rufee rufeeSledge fanboy
Posted 8 years ago2015-06-04 08:02:13 UTC Post #325792
Mmmmm, that´s so tricky, I thought that it could be possible to make hte reloader just detect what amount of ammo has the player ans then decide to reload or not, but even if I tried it, it doesen´t work :(
Posted 8 years ago2015-06-04 11:31:07 UTC Post #325795
Wouldn't you just create a variable like Charger_cooldown, and set that variable to a time?

pseudo code:

If (used && Charger_cooldown <= 0)
{
Heal
}

if (<timer reset criteria>)
{
Charger_cooldown = <time>
}

then you'd have to define the timer code.

I think there's a game tick somewhere that toggles every 16.66ms (i could be wrong) but then in THAT code, you'd need to decrement the charger_cooldown

SO it could be like
if(game_tick && charger_cooldown > 0 )
{
charger_cooldown--;
}
Tetsu0 Tetsu0Positive Chaos
You must be logged in to post a response.