Resurrectable features/wrecks

Resurrectable features/wrecks

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

Post Reply
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Resurrectable features/wrecks

Post by Beherith »

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: Select all

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.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Resurrectable features/wrecks

Post by Jazcash »

Image
User avatar
azaremoth
Cursed Developer
Posts: 549
Joined: 17 Feb 2005, 22:05

Re: Resurrectable features/wrecks

Post by azaremoth »

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: Select all

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

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

if (not gadgetHandler:IsSyncedCode()) then
  return false  --  no unsynced code
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: Select all

local featureDefs = {
  dead = {
	  customParams          = {
		resurrectintounit	= "tc_skeleton",
	  },	

 [...]

  },
}
unitDef.featureDefs = featureDefs
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Resurrectable features/wrecks

Post by REVENGE »

Resurrecting this thread. :regret:

In the wiki, neither Spring.SetFeatureHealth nor Spring.SetFeatureResurrect contain an option for resurrectProgress. The documentation seems to be current for the source code.

Does anyone know of a way to set the progress for a feature / wreckage?
User avatar
The Yak
Posts: 351
Joined: 20 May 2012, 05:36

Re: Resurrectable features/wrecks

Post by The Yak »

nice rez... I didn't know this was possible
Post Reply

Return to “Map Creation”