Page 1 of 1

Shields that go DOWN.

Posted: 20 Jun 2007, 08:10
by Argh
Er, that's it- I'd like to have Shields with a timer feature. If the Shield is reduced to 0 or fewer hitpoints, it'd stay OFF until the timer resets. I've been wanting this just about forever- it'd make certain types of gameplay practical.

Posted: 20 Jun 2007, 09:35
by AF
Like supcom?

Where shields use energy to recharge then stop at 100%, consumign a set amount fo energy and falling if the nergy isnt there, and the shield takes a battering till it reaches 0% where it falls and it starts charging again?

Posted: 20 Jun 2007, 13:17
by KDR_11k
No, he means like Halo, the shield won't recharge for a set amount of time after a hit (or only after it's drained?). A problem is that Spring's shields never drain totally, they can't block anything that does more damage than they have energy left so a shield that can't block anything at its current charge will still have a power > 0.

Posted: 20 Jun 2007, 13:25
by AF
So basically, when a shield reaches 0 itll turn off, and after so long itll turn back on again? Thats what they do in supcom.

In supcom

Shield has a little yellow charge.

When hit charge goes down, charge slowly goes back up.

When charge reaches zero, shield falls, and shield recharges.

When shield reaches 100 charge it goes back up and process repeats. The timer here controls how long it takes to get to 100 charge after it fails.

Posted: 20 Jun 2007, 13:31
by Neddie
No, no, when a shield is under fire, it does not charge.

Posted: 20 Jun 2007, 14:22
by AF
like supcom?

Posted: 20 Jun 2007, 15:47
by Zpock
It would be nice if this is simply controlled by the COB script. What we need is something like:

get/set shieldstate
get/set shieldstrength

And I guess the actual answer is: go LUA it!

Posted: 20 Jun 2007, 16:01
by AF
Yes this is perfectly possible in lua, have you not seen trepan meddling with shields in lua to make stealth shields?

Posted: 20 Jun 2007, 16:12
by rattle
This is more useful as set/get in COB to be honest.

Posted: 20 Jun 2007, 16:16
by imbaczek
With LuaCOB it doesn't matter where it is, as long as it's either in BOS or Lua.

Posted: 20 Jun 2007, 16:37
by rattle
Well, it's cleaner if certain things are done in certain ways. Like everything else got a get/set event while shields need LUA.

Posted: 20 Jun 2007, 16:43
by trepan
It wasn't possible in lua, but it is now. I've added:

Code: Select all

local enabled, power = Spring.GetUnitShieldState(unitID)
-- and --
Spring.SetUnitShieldPower([enabled], [power])
enabled is a boolean
power is a number

You can use nil for either with SetUnitShieldState() to avoid setting it.

If a unit has more than one shield, then the largest shield is used.

Posted: 20 Jun 2007, 16:51
by trepan
Forget that, I've left Spring.GetUnitShieldState() as it is,
but removed the enabled parameter from Spring.SetUnitShieldState().
I've also added the following COB constant:

Code: Select all

#define SHIELD_POWER 95 // set or get
-1 is returned if the unit has no shield, otherwise, the shield's
current power is returned in scaled format (shield->curPower * COBSCALE).
The same scaled format is used to set the shield's power.

COB already controls the shield state via the "AimPrimary + weaponNum"
COB call-in (which is run about once a second, SlowUpdate()).

Posted: 21 Jun 2007, 01:26
by MR.D
You guys are overlooking a unit that already has this feature that you might be able to pull code from and use for the shield.

LVL-2 Radar jammers in all the AA/BA/CA mods, are set to turn off when they take damage.

Maybe you can pull that code and modify it to get a little closer than starting from scratch.

Posted: 21 Jun 2007, 04:32
by FLOZi
Shields aren't controlled by activation though.

Posted: 21 Jun 2007, 08:30
by zwzsg
Controlling them via the AimPrimary returning or not (like currently in 74b3) gives us more freedom. Like, having several shields that goes down for different reasons, and having an activation that does something else. For instance, it's what allowed me to have two different shields of two colours in KP 1.3 ONS, with only one showing at once.