Page 1 of 1
resurrectable corpses
Posted: 07 Aug 2010, 16:34
by dcore221
is it possible to add resurrectable wreckages to maps?
Re: resurrectable corpses
Posted: 07 Aug 2010, 22:12
by yanom
I doubt it, because maps must be used with many mods. For example, If i put a wreck of a mod-specific unit like CA's Meteor Controler, then tried to rez the unit while playing BA, it would crash.
Re: resurrectable corpses
Posted: 07 Aug 2010, 22:38
by dcore221
what about mod specific maps? i want it to work with balanced annihilation,
is this possible?
Re: resurrectable corpses
Posted: 07 Aug 2010, 23:30
by SirMaverick
You can do it with Lua (gadget):
Code: Select all
local fid = Spring.CreateFeature("armstump_dead", 100, 100, 100)
Spring.SetFeatureResurrect(fid, "armstump")
Just tested, it won't work without SetFeatureResurrect even if feature is resurrectable (feature def).
For details see:
http://springrts.com/wiki/Lua_SyncedCtr ... e_Handling
Re: resurrectable corpses
Posted: 08 Aug 2010, 01:53
by dcore221
Thanks

Re: resurrectable corpses
Posted: 08 Aug 2010, 01:56
by Jazcash
A map with Krog wrecks everywhere would be lolz. First person to rez them wins!
Re: resurrectable corpses
Posted: 08 Aug 2010, 02:40
by JohannesH
Jazcash wrote:A map with Krog wrecks everywhere would be lolz. First person to rez them wins!
Id just reclaim them...
Re: resurrectable corpses
Posted: 08 Aug 2010, 02:58
by dcore221
the xyz can it be set to random instead of choosing position?
Re: resurrectable corpses
Posted: 08 Aug 2010, 17:23
by SeanHeron
Basiclly yes, but it'll require a little code (relatively simple), rather than being able to use a setting "random". You'll need the map widths and then use math.random(0,widthyouwant), I think. I'd post if I had a little more time.
Re: resurrectable corpses
Posted: 11 Aug 2010, 09:42
by Google_Frog
You can include units in maps so you could make a rezzable corpse that technically works with any game. I wouldn't recommend this as the unit would not be balanced for any game.
Re: resurrectable corpses
Posted: 11 Aug 2010, 11:31
by lurker
I would advise against making the feature via lua and causing a dependency on BA. Just check if the UnitDef exists, and if so run SetFeatureResurrect. Assuming that doesn't hit a bug, you'll have a normal map for most games, and something you can rez wherever it makes sense.
If you want a randomized location, then I would suggest you include a map_armstump_dead so it still works outside of BA.
Re: resurrectable corpses
Posted: 13 Aug 2010, 01:06
by dcore221
what about if i didt know the map size could random placement still work?
im using this code for a mod im making
at the minute i have resurrectable wreckages in all 4 corners on anymap but id prefer it to be random placement if possible, can this be done without knowing the map dimensions?
Re: resurrectable corpses
Posted: 13 Aug 2010, 17:27
by CarRepairer
dcore221 wrote:what about if i didt know the map size could random placement still work?
im using this code for a mod im making
at the minute i have resurrectable wreckages in all 4 corners on anymap but id prefer it to be random placement if possible, can this be done without knowing the map dimensions?
If you're doing this for a mod, just put the code in your mod rather than each map.
You can find the map size easily in the gadget by using Game.mapSizeX, Game.mapSizeZ.
Re: resurrectable corpses
Posted: 13 Aug 2010, 19:07
by dcore221
this is what i got so far
LuaRules\Gadgets\rez.lua
Code: Select all
local fid = Spring.CreateFeature("armstump_DEAD", 0, 900, 0)
Spring.SetFeatureResurrect(fid, "armstump")
local fid = Spring.CreateFeature("armstump_DEAD", 0, 900, 100000)
Spring.SetFeatureResurrect(fid, "armstump")
local fid = Spring.CreateFeature("armstump_DEAD", 100000, 900, 0)
Spring.SetFeatureResurrect(fid, "armstump")
local fid = Spring.CreateFeature("armstump_DEAD", 100000, 900, 100000)
Spring.SetFeatureResurrect(fid, "armstump")
will put a stumpy in all corners unless the map is bigger than 100000
what do i need to add to make it random placement?
Re: resurrectable corpses
Posted: 13 Aug 2010, 19:12
by oksnoop2
Code: Select all
if frame % (30 * meteorInterval) == 0 then
-- pick a random location as the meteor spawn point
local meteorSpawnX = math.random(Game.mapSizeX)
local meteorSpawnZ = math.random(Game.mapSizeZ)
local meteorSpawnY = Spring.GetGroundHeight(meteorSpawnX, meteorSpawnZ) + meteorSpawnHeight
maybe something like this can be used? I don't know.