Page 1 of 1
Unit Morphing LuaRules Gadget
Posted: 25 Apr 2007, 23:32
by trepan
Here's an example of a unit morphing gadget (LuaRules), and its config file.
12.5 MByte video
http://trepan.bzflag.bz/spring/morph.mpeg
LuaRules/Gadgets/unit_morph.lua
http://trepan.homelinux.net/spring/unit_morph.lua
LuaRules/morphdefs.lua (config file)
http://trepan.homelinux.net/spring/morphdefs.lua
Some points:
1. The config file data could be integrated into the FBI files. I much
prefer using lua files as config files (for testing), because their scripting
ability makes it much easier to change multiple entries with less typing.
2. The morph rendering effect is weak, it could be made a lot better.
One thing that I might add is the ability to completely disable the normal
unit rendering to allow some neat clip plane effects. The progress
indicator could be made to look more like the standard ones.
3. Attaching the new unit to a transporter should be possible.
4. This gadget is ".luarules reload" safe, although morphs are restarted.
It will remove and re-add the 'Morph' command to all applicable units
during a reload, and will return the used metal (with normal stopping
penalty) to the unit's team.
Posted: 25 Apr 2007, 23:51
by Peet
Trepan, I do believe I speak for many modders when I say THIS IS EPIC WIN.
Posted: 25 Apr 2007, 23:56
by Noruas
Now we can do evolution and upgrading certain units.
Posted: 26 Apr 2007, 00:30
by FLOZi
Very cool.
Wonder if we can think of anyhting to use this for in S44.
Posted: 26 Apr 2007, 00:45
by Snipawolf
Okay, now... Can we make it to where a unit purchases the upgrade to morph itself... (I still can't watch the damned videos

)
Posted: 26 Apr 2007, 01:08
by trepan
Try this one:
3.3 MByte AVI (ffmpeg -i morph.mpeg morph.avi)
http://trepan.bzflag.bz/spring/morph.avi
Posted: 26 Apr 2007, 01:11
by jackalope
hey guys this is a good feature.
Posted: 26 Apr 2007, 01:19
by Snipawolf
Its not that problem.. Realplayer can't find its codecs, VLC kills my computer, windows media interprets everything as an audio file...
Posted: 26 Apr 2007, 03:38
by Nemo
Holy...awesome...speechless...
Trepan, you ROCK.
Posted: 26 Apr 2007, 04:23
by Lolsquad_Steven
jackalope wrote:EDIT by trepan: removed lame remark.
I will not have this thread go down the racial / political
path that other recent threads have been steered towards.
Hahahahaha, this made my day.
Posted: 26 Apr 2007, 07:10
by Argh
I wish you'd just use a standard codec lol... ah well, I guess I'll have to just test this. The real trick is hooking a UI element (a button) to the unit, having the button execute the call. If in addition to this, we could track some other game states... hmm...
Posted: 26 Apr 2007, 09:04
by trepan
1. I used the 'standard' xvidcap codec. Does the AVI version not work?
2. The button is already hooked up. Scan through the code and look
for morphCmdDesc to see how it is done. Note that is works with both
the default control panel and LuaUI (and that an AI can even look for
it by searching through the CommandDescriptions).
You can use the SetUnitRulesParam() command to keep track of
unit states. If you go that route, the information will be maintained even
when LuaRules is shutdown. It can be queried by all lua scripts, and
will probably be made available to the AI interface in the future (once
I've cleaned up the lua scripts, made them easier to use (gadgets), and
finished some of the documentation).
Posted: 26 Apr 2007, 13:41
by Zenka
great! now we can finnally make upgreadable mexes :) not to mention tons of other aspecs in mods.
Re: Unit Morphing LuaRules Gadget
Posted: 14 Dec 2017, 05:01
by MaDDoX
Not sure if I should post it here or in a new thread, but here it goes. I've cooked up a new version of unit_morph.lua with the following improvements:
-- Default buildtime, buildcostenergy and buildcostmetal is now the difference between original and target unit values
-- Accepts and prioritizes definitions in customData.morphdef
-- Properly talks to multi_tech.lua (tech tree gadget by zwzsg)
-- 'require' entry now require techs instead of units
-- 'require' supports multiple tech requirements (comma-separated)
-- Morph button text now shown in red when requirements not fulfilled
PS.: This version doesn't require an unitdefs_data.lua file (big blob of all units .fbi which I use for Google Sheets integration), simply uncomment the first block within the AddCustomMorphDefs() method for the standard multi-file units definitions.
Hope it helps!
Re: Unit Morphing LuaRules Gadget
Posted: 14 Dec 2017, 11:11
by nixtux
Hey MaDDoX, which version of the gadget did you use a base?
Thanks nixtux
Re: Unit Morphing LuaRules Gadget
Posted: 01 May 2018, 16:55
by MaDDoX
The latest I could find :)
Forboding Angel has added it successfully to a recent EvoRTS release.
My current dev version also includes morph pause (must have!) and a powerful morph queue, with which you can queue units/structures to be morphed and they're morphed one at a time, to prevent stalling your economy. Not ready for release though, some lingering errors to be fixed.
Other nice things are planned and/or under development, like prioritizing energy/metal/units morphs in the queue, highlight the units in queue (and show their index #) while holding the meta key, etc.