resurrectable corpses
Moderator: Moderators
resurrectable corpses
is it possible to add resurrectable wreckages to maps?
Re: resurrectable corpses
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
what about mod specific maps? i want it to work with balanced annihilation,
is this possible?
is this possible?
-
- Posts: 834
- Joined: 19 May 2009, 21:10
Re: resurrectable corpses
You can do it with Lua (gadget):
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
Code: Select all
local fid = Spring.CreateFeature("armstump_dead", 100, 100, 100)
Spring.SetFeatureResurrect(fid, "armstump")
For details see: http://springrts.com/wiki/Lua_SyncedCtr ... e_Handling
Re: resurrectable corpses
A map with Krog wrecks everywhere would be lolz. First person to rez them wins!
Re: resurrectable corpses
Id just reclaim them...Jazcash wrote:A map with Krog wrecks everywhere would be lolz. First person to rez them wins!
Re: resurrectable corpses
the xyz can it be set to random instead of choosing position?
Re: resurrectable corpses
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.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: resurrectable corpses
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
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.
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
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?
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?
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: resurrectable corpses
If you're doing this for a mod, just put the code in your mod rather than each map.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?
You can find the map size easily in the gadget by using Game.mapSizeX, Game.mapSizeZ.
Re: resurrectable corpses
this is what i got so far
LuaRules\Gadgets\rez.luawill put a stumpy in all corners unless the map is bigger than 100000
what do i need to add to make it random placement?
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")
what do i need to add to make it random placement?
Re: resurrectable corpses
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