Page 1 of 1
LUA or ODF questions regarding shields
Posted: Tue Mar 23, 2010 9:23 pm
by vampire_lord
Well, my mod is getting pretty well, but I have some problems with the shielding on some vehicles (and droidekas too), if I put some AddShield for regenerating it makes the unit invincible because it keeps adding shield no matter how much damage I do, not even at 1 shield minus 1000 damage; Droidekas at least have shield off regeneration so I just removed the minus shield adding, is there some way to delay the add shield rate? health and ammo droids have a PowerUpDelay and I suppose vechicle repair droids once fixed may regenerate shield (is VehicleShield a valid parameter?), so, any hints? maybe I need to alter those parameters via LUA, if that's the case, I would need some help.
Thanks.
Re: LUA or ODF questions regarding shields
Posted: Tue Mar 23, 2010 10:00 pm
by Fiodis
MaxShield sets an upper limit for the shield's strength.
Re: LUA or ODF questions regarding shields
Posted: Wed Mar 24, 2010 1:27 am
by vampire_lord
I use it so it is actually the amount of shielding as in MaxHealth on vehicles for example (health and shield) , my problem is giving shield regeneration, it goes nonstop and thus the vehicle's shield never depletes, that means, the vehicle never takes any damage, it would be helpful if there is a way to delay the shield regeneration.
Re: LUA or ODF questions regarding shields
Posted: Wed Mar 24, 2010 2:11 am
by jangoisbaddest
Decrease the AddShield value. The AddShield value is what determines how quickly the shield's "health" regenerates. A greater value means it regenerates more per some unit of time that I don't quite know (probably second). You can even set it to 0 for no regeneration, or a negative value if you want it to slowly wear down on its own (I've never tried this, but I think the Driodeka uses this mechanic).
This, by the way, is done in the unit's ODF file just like MaxHealth.
Re: LUA or ODF questions regarding shields
Posted: Wed Mar 24, 2010 2:36 pm
by vampire_lord
Already tried with negative AddShield, and yes, the droideka uses it, but even if I put AddShield = 1 (that means 1 per second), once you "deplete" the shield and continue to attack, the shield continues to regenerate and never wears down, any damage your weapon deals gets absorbed by that tiny little bit of shield, my only possible solution is having no regeneration or finding a way to delay it for more than a second via ODF or LUA, but I can't find a valid instruction.
Re: LUA or ODF questions regarding shields
Posted: Thu Mar 25, 2010 12:24 pm
by jangoisbaddest
Well, the problem isn't finding the right instruction...the problem is having the LUA properly determine when the shield is down. I know of no callbacks offhand that can do that. And even if you were to somehow get the LUA to recognize this event, you have another big problem: you can't alter the stats of a single unit already in game. Even despite the many posts telling me it was futile, I tried for a while to get SetProperty to work on a spawned unit (instead of using SetClassProperty and then re-spawning that unit). It just doesn't work, unfortunately. So even if you could set up the proper event callback, you'd have to
1) Start a timer for X seconds
2) save all of that unit's info (map location, curhealth, etc.)
3) use SetClassProperty to change the AddShieldValue
4) teleport the unit away
5) kill it
6) respawn it at the old location
7) create another callback for OnTimerElapse

re-create steps 1-6 for that callback
That would create a very choppy gameplay experience, and it would be a lot more trouble than it's worth IMO. I would just set AddShield to either 0 or a small positive value, then decrease the unit's Health so that when your ordnance gets through, it will do more damage.
Re: LUA or ODF questions regarding shields
Posted: Thu Mar 25, 2010 3:33 pm
by vampire_lord
Too bad, no delay for shields then, I will just let those tanks have limited un-replenishable shield then, droidekas are just fine with no depletion already. Thanks.
Re: LUA or ODF questions regarding shields
Posted: Thu Mar 25, 2010 10:21 pm
by [RDH]Zerted
vampire_lord wrote:...any damage your weapon deals gets absorbed by that tiny little bit of shield...
I don't know why you're having problems. Only 1 damage should be absorbed by the shield. I thought the rest went onto the player. You can look at the Holocron game mode to see that you can kill something with a shield regen. Holocron uses a MaxShield of 900 and an AddShield of 160 (in addition to a 50 AddHealth). Err, well that's all with units. I've never tried it on a vehicle...
If it's broken on vehicles and assuming your vehicles start out with a shield, you can try the following:
Setup events to listen for OnShieldChange on each vehicle. When the shield changes to below a low value, turn off the shield regen using
SetProperty() and destroy the event listener.
If the vehicle is slightly damaged when it's shield strength is 1 and is hit, then use OnHealthChange or OnObjectDamage instead and turn off the shield whenever the event is triggered and remember to still destroy the event listener too. The health/damage events will be called
much less often than the shield change event.
If you want the shield regens to start up again after a while you can do that too, but get the above working first.