Page 1 of 1

Can a units type be changed vie Lua?

Posted: 16 Aug 2011, 22:06
by Erik
For example i have two slightly different units and want to toggle the movement class or change the weapons.
So i want to transit from "unitxyz_a" to "unitxyz_b".
Hitpoints etc, should not be changed.

Is something like this already done somewhere?

Re: Can a units type be changed vie Lua?

Posted: 16 Aug 2011, 22:30
by knorke
change weapons:
give the unit both weapons, allow only one weapon to fire depending on which weapon is chosen. (via unit script)
easiest way to get some toggle button is onoffable=true

change movement:
max speed, turn, acceleration can be changed via simply calling a function:
http://springrts.com/wiki/SetMoveTypeDataExample

toggling the movedef of a unit is not possible though. (cant make a ship into an airplane)
Basically you can only change how a unit moves but not where it can go. See also meh :?

There is a "morph gadget" which basically turns one unit into another unit. In conflict terra and S44 it is used to "deploy" units, maybe that is what you want.

Re: Can a units type be changed vie Lua?

Posted: 16 Aug 2011, 22:45
by smoth
You will run into issues with unit targeting/behavior if the alt weapon has a shorter rang..