How would I turn off units when there's no energy?
Moderator: Moderators
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
How would I turn off units when there's no energy?
The subject pretty much sums it up.
I am wanting to have it so my radar towers turn off when there's no energy to support them (they'll have an energyUse value). I didn't see a unitdef Tag for this, and I imagine it's something that could be rather easily scripted. Maybe.
So, any good ideas? Remember, I use Lua for my animation script, and I want the easiest method possible.
I am wanting to have it so my radar towers turn off when there's no energy to support them (they'll have an energyUse value). I didn't see a unitdef Tag for this, and I imagine it's something that could be rather easily scripted. Maybe.
So, any good ideas? Remember, I use Lua for my animation script, and I want the easiest method possible.
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: How would I turn off units when there's no energy?
IIRC if a unit uses energy, when you run out, it stops. (this only applies to things covered by the unit's 'Activation' status ie: radar and cloaking. Obviously weapons that need energy to fire won't fire if you dont have any as well...) no unit scripting required.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: How would I turn off units when there's no energy?
Hmmm, well I tested it (gave the tower an energyUse of 300 to make testing easy), and cheated it into a game with no energy makers. The radar kept working, I could see enemy units for verification.
Re: How would I turn off units when there's no energy?
Gundam has an energy use script, it doesn't use the TA resource but runs more like a C&C power economy.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: How would I turn off units when there's no energy?
That's exactly what I wanted. Thanks a ton Google_Frog for the suggestion.
Re: How would I turn off units when there's no energy?
hmmm, this also refers to a longstanding bug with resource consumption
Re: How would I turn off units when there's no energy?
Just as a side note: a few years back, radars stopped worked when you estalled, but this got changed to them keeping on working even on estall. Dont know the specifics, but I can dig them up if you are interested.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: How would I turn off units when there's no energy?
I would just assume that if a unit is consuming energy, it should stop working when the energy is no longer there.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How would I turn off units when there's no energy?
More of the retarded spring breaking it's back to support *A modders who couldn't mod their way out of a paper bag.
Re: How would I turn off units when there's no energy?
Hardly, its that longstanding bug in energy and metal consumption.
E.g. you have 500 energy income. Unit 1 takes 20 energy to build a structure, 480 left. Unit 2 uses 480 to build a missile. Unit 3 has a static energy consumption of 3 energy per second, oh wait we've already used our 500 energy and there's none in reserve, thats +3 free energy, Unit 4 needs 1 metal to do an uber important thing, oh well too late, it didnt get in quick enough... etc
As a result all your energy/resource is distributed unevenly and can result in free income and bad behaviour
E.g. you have 500 energy income. Unit 1 takes 20 energy to build a structure, 480 left. Unit 2 uses 480 to build a missile. Unit 3 has a static energy consumption of 3 energy per second, oh wait we've already used our 500 energy and there's none in reserve, thats +3 free energy, Unit 4 needs 1 metal to do an uber important thing, oh well too late, it didnt get in quick enough... etc
As a result all your energy/resource is distributed unevenly and can result in free income and bad behaviour
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: How would I turn off units when there's no energy?
I've noticed for a long time that Energy in particular didn't always "make sense" in how it worked. Glad to know I wasn't crazy.
Since this is a long-standing bug, apparently, I'm guessing we won't be seeing a fix anytime soon? Is this like a really hard to solve bug, or just a result of laziness?
Since this is a long-standing bug, apparently, I'm guessing we won't be seeing a fix anytime soon? Is this like a really hard to solve bug, or just a result of laziness?
Re: How would I turn off units when there's no energy?
I've raised this in the past, and engine developers have discussed it too, and we're all in agreement that it needs fixing at some point but:
- Some horrendous consequences of this bug resulting in free resources when stalling where fixed many months ( years? ) ago by the developers, making the bug far less urgent.
- Content developers who are most affected by this have partially sidestepped the issue entirely with their own resource gadgets, many not even realising there was an issue
- Now that the effect of the bug is greatly diminished in comparison to the past, the urgency has gone and more important things have taken priority.
Re: How would I turn off units when there's no energy?
It's a hard-to-solve bug, they've been over this.SanadaUjiosan wrote:I've noticed for a long time that Energy in particular didn't always "make sense" in how it worked. Glad to know I wasn't crazy.
Since this is a long-standing bug, apparently, I'm guessing we won't be seeing a fix anytime soon? Is this like a really hard to solve bug, or just a result of laziness?
Spring doesn't handle resource consumption in a nice, fixed-time balance-sheet format. Units don't request resources and then consume them the next cycle - the engine has to determine whether or not the unit gets its requested resource at the exact LOC it requested it. The engine just runs a loop through units. If unit X adds to energy, then energy is added to the current E total. If unit X subtracts energy, then energy is removed from the E total. If there's not enough energy for the unit, then the unit doesn't do what it wants.
The problem is that to fix it you'd have to completely change the unit scripts, since a unit has to ask "can I do this?" and the engine currently gives you a fixed yes/no answer on the spot. To fix it, the correct answer is "I'll get back to you on that, let me finish going through all the mandatory stuff and then we'll talk about whether you can fire your pew-pew".
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How would I turn off units when there's no energy?
From what I've seen, units requesting the least amount of energy will get it first. For example, in Evo all units need energy to fire, so generally the light raider tanks will get assigned energy over the big skirmish/assault dudes.
Some free energy is still given and in terms of metal makers it was bad (I added them a while back as a supplementary thingy), and I noticed that people using them en masse were getting free resources. So, in order to put a stop to that, I simply made it so that they require more energy and produce more metal (proportionally), and that more or less did the trick.
Some free energy is still given and in terms of metal makers it was bad (I added them a while back as a supplementary thingy), and I noticed that people using them en masse were getting free resources. So, in order to put a stop to that, I simply made it so that they require more energy and produce more metal (proportionally), and that more or less did the trick.