Area Mex gadget support for multiple mexes
Moderator: Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Area Mex gadget support for multiple mexes
local mexBuildCommandID = -UnitDefNames["emetalextractor"].id
I want to add water mexes to it as well (in particular "euwmetalextractor"), but I'm not sure how because the way it seems to be set up with the way the commands are issued, I don't know how to add another type of mex to it.
Can someone help me out?
I want to add water mexes to it as well (in particular "euwmetalextractor"), but I'm not sure how because the way it seems to be set up with the way the commands are issued, I don't know how to add another type of mex to it.
Can someone help me out?
Re: Area Mex gadget support for multiple mexes
That gadget is absolutely atrocious, it really should be deleted and rewritten for scratch.
However, if you are after a quick fix. I'd replace the lines that look like this:
With an appropriate call to a function like:
e.g.
However, if you are after a quick fix. I'd replace the lines that look like this:
Code: Select all
spGiveOrderToUnit(unitID, mexBuildCommandID, {data.mex[i].x,0,data.mex[i].z} , {"shift"})
Code: Select all
function TellUnitToBuildMexAt(uId, x, z)
local y = Spring.GetGroundHeight(x, z)
if y < 0 then
spGiveOrderToUnit(uId, UNDERWATERMEXID, {x, y, z}, {"shift"})
else
spGiveOrderToUnit(uId, LANDMEXID, {x, y, z} , {"shift"})
end
end
Code: Select all
TellUnitToBuildMexAt(unitID, data.mex[i].x, data.mex[i].z)
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Area Mex gadget support for multiple mexes
Thanks for the help. I got this far, but what do I do about line 121?
http://pastebin.mozilla.org/1837950
http://pastebin.mozilla.org/1837950
Re: Area Mex gadget support for multiple mexes
Same pattern as the other
Becomes
Code: Select all
spGiveOrderToUnit(unitID, mexBuildCommandID, {orderedCommands[i].x,0,orderedCommands[i].z} , {"shift"})
Code: Select all
TellUnitToBuildMexAt(unidID, orderedCommands[i].x, orderedCommands[i].z)
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Area Mex gadget support for multiple mexes
Ahh thanks.
Ok, hopefully last hurdle...
http://pastebin.com/YXxpv1xB
Errors with 56: bad unit id, so obviously I'm not giving it the right information in the declared locals, but I'm not sure what it needs?
I assume I need to call the unit names differently.
Ok, hopefully last hurdle...
http://pastebin.com/YXxpv1xB
Errors with 56: bad unit id, so obviously I'm not giving it the right information in the declared locals, but I'm not sure what it needs?
I assume I need to call the unit names differently.
Re: Area Mex gadget support for multiple mexes
its in real time so the visual basic gui is tracing the wrong ip adress.Forboding Angel wrote: Errors with 56: bad unit id, so obviously I'm not giving it the right information in the declared locals, but I'm not sure what it needs
line 119 unidID unitID
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Area Mex gadget support for multiple mexes
Changed. Still errors on 56 or 54 (depending on where I draw the circle -> water/land). Difference is instead of bad unit id, now it's bad command id.
Code: Select all
[f=0001125] Error: LuaRules::RunCallIn: error = 2, AllowCommand, [string "LuaRules/Gadgets/cmd_area_mex.lua"]:56: GiveOrderToUnit(): bad command ID
Re: Area Mex gadget support for multiple mexes
Niobium wrote UNDERWATERMEXID and LANDMEXID as placeholders for your unitnames.
you have
Assuming that are your mex names, change to:
change to
^- that is how you get unitdefid to a unitname
Or if you want to have it "more right" remove the "-" sign from the above and add it in all the spGiveOrderToUnit
you have
Code: Select all
local underWaterMexID = euwmetalextractor
local landMexID = emetalextractor
change to
Code: Select all
local landMexID = -UnitDefNames["emetalextractor"].id
local underWaterMexID = -UnitDefNames["euwmetalextractor"].id
Or if you want to have it "more right" remove the "-" sign from the above and add it in all the spGiveOrderToUnit
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Area Mex gadget support for multiple mexes
Derp. Thanks
I had actually set those unitnames like that, but when I started getting bad unitID errors I reverted them (thinking that I wasn't understanding what nio was saying correctly). Thanks for clearing it up for me and thanks a ton Niobium for helping me out <3
I had actually set those unitnames like that, but when I started getting bad unitID errors I reverted them (thinking that I wasn't understanding what nio was saying correctly). Thanks for clearing it up for me and thanks a ton Niobium for helping me out <3