Can a units type be changed vie Lua?

Can a units type be changed vie Lua?

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
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Can a units type be changed vie Lua?

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

Re: Can a units type be changed vie Lua?

Post 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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Can a units type be changed vie Lua?

Post by smoth »

You will run into issues with unit targeting/behavior if the alt weapon has a shorter rang..
Post Reply

Return to “Game Development”