There is a simple way of doing it, but it has some drawbacks, namely its mod specific.
Include the following example gadget in your map at /luarules/gadgets/map_resurrectable_feature.lua
Code:
function gadget:GetInfo() return { name = "Resurrectabke wreck placer", desc = "Resurrectabke wreck placer", author = "beherith", date = "2012 july", license = "GNU GPL, v2 or later", layer = 10, enabled = true } end
if (not gadgetHandler:IsSyncedCode()) then return false end
function gadget:Initialize() wreck=Spring.CreateFeature('corstorm_dead', 2100, 0, 2000) --x,y,z positions Spring.SetFeatureResurrect(wreck,'corstorm') end
Edit: This runs at frame 0, so the feature wont be on map until game start. If the feature is coded onto the map, then the procedure is a bit different, but setfeatureresurrect can still be used.
There is a gadget in The Cursed for a long time now that works quite similar. I just have a custom feature parameter to define what to resurrect into and the gadget is run whenever a feature is created. I use it to have human bodies resurrected into skeletons.
Code:
function gadget:GetInfo() return { name = "Resurretinto", desc = "Reads out custom feature parameters to resurrect them into defined units", author = "azaremoth", date = "2009-17-10", license = "GNU GPL, v2 or later", layer = 0, enabled = true, } end
function gadget:FeatureCreated(fid, fTeam) local fdid = Spring.GetFeatureDefID(fid) local resurrectinto = FeatureDefs[fdid].customParams.resurrectintounit if resurrectinto ~= nil then Spring.SetFeatureResurrect(fid, resurrectinto) else Spring.SetFeatureResurrect(fid, '') end end
Featue defs:
Code:
local featureDefs = { dead = { customParams = { resurrectintounit = "tc_skeleton", },
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum