COOKIES!!!!
Moderator: Moderators
COOKIES!!!!
Whoever can figure out how to correctly find the range of a nanotower with lua gets a cookie. I am using BA to test, and UnitDefs[unitID].buildDistance and UnitDefs[unitID].buildDistance + Spring.GetUnitDefDimensions(unitID).radius both do not give full range, but only about half. Also, if you succeed you will get my pretty lua widget.
- TheFatController
- Balanced Annihilation Developer
- Posts: 1177
- Joined: 10 Dec 2006, 18:46
Re: COOKIES!!!!
buildDistance is correct I'm not sure what you're doing, try this function to test:
Edit: OH you're using UnitDefs[unitID] instead of UnitDefs[unitDefID] that would be why - it's reading another unit :p i'll leave my code in for its leet point spamming and geometry skills
Code: Select all
function widget:UnitFinished(unitID, unitDefID, unitTeam)
local x,_,z = Spring.GetUnitPosition(unitID)
for angle=0,360,40 do
local xp = (x + (math.sin(math.rad(angle)) * UnitDefs[unitDefID].buildDistance))
local zp = (z + (math.cos(math.rad(angle)) * UnitDefs[unitDefID].buildDistance))
Spring.MarkerAddPoint(xp,0,zp)
end
end
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: COOKIES!!!!
TheFatController does not need anymore cookies. I'll take them instead.
Re: COOKIES!!!!
Oh! no wonder! I was thinking that that may be a possibility as i was in the car. Cookies for you!!! That also explains why with a different build order the value was different.
Re: COOKIES!!!!
The cookie king throwns upon sales of counterfeit cookies