Page 1 of 1
How to turn a unit off with bos?
Posted: 15 Aug 2012, 12:39
by Forboding Angel
When a condition isn't met.
In this case, we have techlost() and techgranted()
I tried
set Activation to 1; (and 0, and true/false)
but it had no effect on this unit.
The unit in particular makes energy, and I would like to reduce it's energy output to 0 while techlost.
I'm thinking this should be easy but for some reason I can't figure it out.
Re: How to turn a unit off with bos?
Posted: 15 Aug 2012, 12:53
by Pressure Line
I think you actually have to have the unit 'use' -ve energy. IIRC thats how *A solars do it.
Re: How to turn a unit off with bos?
Posted: 15 Aug 2012, 13:30
by Forboding Angel
Here is the script as it is.
http://pastebin.com/XuduyYuA
I switched it to energyuse -number, that caused the button added by onoffable = true to work correctly.
TechGadget wrote:------------------------------------------------------------
The COB functions TechLost and TechGranted will be called
by the gadget if a unit requiring a tech has them.
------------------------------------------------------------
Amidoinitrong?
Re: How to turn a unit off with bos?
Posted: 15 Aug 2012, 20:46
by Deadnight Warrior
Edit the unitdef to have
onoffable=0; actvatewhenbuild=1; and it will be fine, no extra buttons, and the ACTIVATION will be set according to TechLost and TechGranted calls.
The unit script is OK, but I'd
remove some redundant code.
It could be that the gadget doesn't call those functions when a unit is built, but only when the tech status changes.
Re: How to turn a unit off with bos?
Posted: 15 Aug 2012, 23:05
by knorke
lol i derail with lua:
Spring.SetUnitResourcing
Re: How to turn a unit off with bos?
Posted: 15 Aug 2012, 23:14
by Forboding Angel
Thanks deadknight
@knorke, get me a 1:1 bos:lua converter and we'll talk ;p
Re: How to turn a unit off with bos?
Posted: 15 Aug 2012, 23:18
by knorke
maybe you could call it from within the tech-gadget?
then it wont matter if unitscript is bos or lua.