GADGET REQUEST: Unit morphing/replacement
Moderator: Moderators
GADGET REQUEST: Unit morphing/replacement
Can someone post a simple replacement script? This is all i need, all modifications like cost and paralyzing the unit afterward i can implement myself.
Re: GADGET REQUEST: Unit morphing/replacement
or teach me how in the world to get the overly complicated unit_morph script working and what version to use...
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: GADGET REQUEST: Unit morphing/replacement
Did you use the morph_defs config file?
Re: GADGET REQUEST: Unit morphing/replacement
Yes. All i got were a bunch of errors. I debugged it, then the gadget did nothing.
I tried xta's version and ca's version, both of which work in their respective games....
I tried xta's version and ca's version, both of which work in their respective games....
Re: GADGET REQUEST: Unit morphing/replacement
You might try the 1944 one, but I think there is a dependency on another lua gadget...
Re: GADGET REQUEST: Unit morphing/replacement
1944 one is the CA one with relatively minor changes to suit our needs.
Re: GADGET REQUEST: Unit morphing/replacement
Im still getting this error spammed every frame:
here is my luarules/Config/morph_defs.lua
Code: Select all
[ 325] LuaRules::RunCallIn: error = 2, Update, [string "LuaRules/Gadgets/unit_morph.lua"]:1044: bad argument #1 to 'snext' (table expected, got nil)
Code: Select all
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local devolution = false
local morphDefs = {
ant = {
[1] = {into = 'mantis', time = 10,},
},
mantis = {
[1] = {into = 'ant', time = 10,},
},
}
--
-- Here's an example of why active configuration
-- scripts are better then static TDF files...
--
--
-- devolution, babe (useful for testing)
--
if (devolution) then
local devoDefs = {}
for src,data in pairs(morphDefs) do
devoDefs[data.into] = { into = src, time = 10, metal = 1, energy = 1 }
end
for src,data in pairs(devoDefs) do
morphDefs[src] = data
end
end
return morphDefs
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Re: GADGET REQUEST: Unit morphing/replacement
Try this:
There's only 1 morph destination per unit, you do not need to set it as a table of tables (ie the part with [1] was not needed and probably caused those errors).
Code: Select all
local devolution = false
local morphDefs = {
ant = {into = 'mantis', time = 10,},
mantis = {into = 'ant', time = 10,},
}
--
-- Here's an example of why active configuration
-- scripts are better then static TDF files...
--
--
-- devolution, babe (useful for testing)
--
if (devolution) then
local devoDefs = {}
for src,data in pairs(morphDefs) do
devoDefs[data.into] = { into = src, time = 10, metal = 1, energy = 1 }
end
for src,data in pairs(devoDefs) do
morphDefs[src] = data
end
end
return morphDefs
Re: GADGET REQUEST: Unit morphing/replacement
Didn't help...
WHAT IS "snext" ??????????????
WHAT IS "snext" ??????????????
Re: GADGET REQUEST: Unit morphing/replacement
Probably the iterator function for spairs.
Re: GADGET REQUEST: Unit morphing/replacement
Why is my morphdefs null?
So frustrating....

So frustrating....







- Attachments
-
- unit_morph.lua
- (35.31 KiB) Downloaded 116 times
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: GADGET REQUEST: Unit morphing/replacement
db, use this one. It's simple, straight forward, and it just so happens to work.
(edit the config of course)
(edit the config of course)
- Attachments
-
- LuaRules.zip
- (9.37 KiB) Downloaded 26 times