How to turn a unit off with bos?

How to turn a unit off with bos?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

How to turn a unit off with bos?

Post 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.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: How to turn a unit off with bos?

Post by Pressure Line »

I think you actually have to have the unit 'use' -ve energy. IIRC thats how *A solars do it.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: How to turn a unit off with bos?

Post 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?
User avatar
Deadnight Warrior
Posts: 183
Joined: 08 Jun 2009, 17:59

Re: How to turn a unit off with bos?

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: How to turn a unit off with bos?

Post by knorke »

lol i derail with lua:
Spring.SetUnitResourcing
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: How to turn a unit off with bos?

Post by Forboding Angel »

Thanks deadknight :-)

@knorke, get me a 1:1 bos:lua converter and we'll talk ;p
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: How to turn a unit off with bos?

Post by knorke »

maybe you could call it from within the tech-gadget?
then it wont matter if unitscript is bos or lua.
Post Reply

Return to “Game Development”