DrawLine( {2684.5, 63.96, 489.5} , {2682.5, 63.96, 514.5} , 'ff00ff00' )
Statistics: Posted by Ghoustaq — 28 Apr 2018, 17:46
Statistics: Posted by speed2 — 28 Apr 2018, 07:50
DrawLine( {2684.5, 63.96, 489.5} , {2682.5, 63.96, 514.5} , 'ff00ff00' )
Statistics: Posted by Uveso — 28 Apr 2018, 00:39
Statistics: Posted by speed2 — 27 Apr 2018, 19:28
WARNING: Error running lua script: attempt to get as number a table value
stack traceback:
[C]: in function `DrawLine'
...me commander - forged alliance\maps\11\11_script.lua(31): in function <...me commander - forged alliance\maps\11\11_script.lua:8>
local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
function OnPopulate()
ScenarioUtils.InitializeArmies()
ForkThread(DrawBoundaryLine)
end
function DrawBoundaryLine(self)
local location
local entities
local unitsA
local unitsB
local ArmyBrain
while true do
for k = 1, 3 do
location = ScenarioUtils.MarkerToPosition('BuffArea_' .. k)
entities = GetUnitsInRect( Rect(location[1]-11, location[3]-11, location[1]+11, location[3]+11) )
if entities then
unitsA = EntityCategoryFilterDown(categories.MOBILE, entities)
unitsB = EntityCategoryFilterDown(categories.HYDROCARBON + categories.MASSEXTRACTION, entities)
end
if unitsB then
-- check first if the trigger unit is still present
if unitsB[1] and not unitsB[1].Dead and not unitsB[1]:BeenDestroyed() then
ArmyBrain = unitsB[1]:GetAIBrain() -- unitsB[1] is the first unit inside the unitsB table
for _, instigator in unitsA do
if VDist3(instigator:GetPosition(), location) <= 8 then
if instigator:GetAIBrain()== ArmyBrain then
DrawLine( VECTOR3( {2684.5, 63.96, 489.5} ), VECTOR3( {2682.5, 63.96, 514.5} ), 'ff00ff00' )
end
end
end
end
end
end
WaitSeconds(5) -- waits 5 second. Can be reduced to 1 tick if needed
end
end
Statistics: Posted by Ghoustaq — 27 Apr 2018, 19:25
DrawCircle( Position, Radius, Color )
DrawCircle( VECTOR3( {100, 50, 200} ), 5, 'ff00ff00' )
function DrawBaseRanger()
-- Render the radius of any base and expansion location
if Scenario.MasterChain._MASTERCHAIN_.BaseRanger then
for Index, ArmyRanger in Scenario.MasterChain._MASTERCHAIN_.BaseRanger do
for nodename, markerInfo in ArmyRanger do
-- Draw the inner circle black
DrawCircle(markerInfo.Pos, markerInfo.Rad-0.5, 'ff000000')
-- Draw the main circle white
DrawCircle(markerInfo.Pos, markerInfo.Rad, 'ffFFE0E0')
end
end
end
end
DrawLinePop( Position1, Position2, Color )
DrawLinePop( VECTOR3( {100, 50, 200} ), VECTOR3( {150, 50, 250} ), 'ff00ff00' )
Statistics: Posted by Uveso — 26 Apr 2018, 20:56
Statistics: Posted by Ghoustaq — 26 Apr 2018, 19:12