GADGET REQUEST: Unit morphing/replacement
Posted: 16 Oct 2009, 10:40
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.
Open Source Realtime Strategy Game Engine
https://springrts.com/phpbb/
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
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
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