Forged Alliance Forever Forged Alliance Forever Forums 2018-04-28T17:46:59+02:00 /feed.php?f=53&t=16138 2018-04-28T17:46:59+02:00 2018-04-28T17:46:59+02:00 /viewtopic.php?t=16138&p=162966#p162966 <![CDATA[Re: How to use these commands? Give me some examples, please]]>
Uveso wrote:
You don't need to write the Vector stuff, its only for explanation that we need 3 values for the position:
Code:
DrawLine( {2684.5, 63.96, 489.5} , {2682.5, 63.96, 514.5} , 'ff00ff00' )


@Uveso

OK! I got it :)

Statistics: Posted by Ghoustaq — 28 Apr 2018, 17:46


]]>
2018-04-28T07:50:38+02:00 2018-04-28T07:50:38+02:00 /viewtopic.php?t=16138&p=162963#p162963 <![CDATA[Re: How to use these commands? Give me some examples, please]]> https://github.com/FAForever/fa

Statistics: Posted by speed2 — 28 Apr 2018, 07:50


]]>
2018-04-28T00:39:19+02:00 2018-04-28T00:39:19+02:00 /viewtopic.php?t=16138&p=162959#p162959 <![CDATA[Re: How to use these commands? Give me some examples, please]]>
Code:
DrawLine( {2684.5, 63.96, 489.5} , {2682.5, 63.96, 514.5} , 'ff00ff00' )

Statistics: Posted by Uveso — 28 Apr 2018, 00:39


]]>
2018-04-27T19:28:50+02:00 2018-04-27T19:28:50+02:00 /viewtopic.php?t=16138&p=162958#p162958 <![CDATA[Re: How to use these commands? Give me some examples, please]]>

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>

The function needs a number and you're feeding it with a table.

Statistics: Posted by speed2 — 27 Apr 2018, 19:28


]]>
2018-04-27T19:25:45+02:00 2018-04-27T19:25:45+02:00 /viewtopic.php?t=16138&p=162957#p162957 <![CDATA[Re: How to use these commands? Give me some examples, please]]>
Thanks! Do you know how to deal with the error? :?:

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>


VECTOR3( {2684.5, 63.96, 489.5} ) is the position of BUFFAREA_1 and VECTOR3( {2682.5, 63.96, 514.5} )is the position of BUFFAREA_2
Code:
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


]]>
2018-04-26T20:56:25+02:00 2018-04-26T20:56:25+02:00 /viewtopic.php?t=16138&p=162942#p162942 <![CDATA[Re: How to use these commands? Give me some examples, please]]>

Code:
DrawCircle( Position, Radius, Color )
DrawCircle( VECTOR3( {100, 50, 200} ), 5, 'ff00ff00' )


Example:
Code:
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


Code:
DrawLinePop( Position1, Position2, Color )
DrawLinePop( VECTOR3( {100, 50, 200} ), VECTOR3( {150, 50, 250} ), 'ff00ff00' )


I don't know the other 2 commands. But i guess the name tells us what they will do ;)

Statistics: Posted by Uveso — 26 Apr 2018, 20:56


]]>
2018-04-26T19:12:18+02:00 2018-04-26T19:12:18+02:00 /viewtopic.php?t=16138&p=162938#p162938 <![CDATA[How to use these commands? Give me some examples, please.]]> INFO: Draw a 3d circle at a with size s and color c
2.DrawLine
INFO: Draw a 3d line from a to b with color c
3.DrawLinePop
INFO: Draw a 3d line from a to b with color c with a circle at the end of the target lin
4.GetHighlightBackgroundColor
INFO: color GetHighlightBackgroundColor()
5.GetHighlightForegroundColor
INFO: color GetHighlightForegroundColor()

Statistics: Posted by Ghoustaq — 26 Apr 2018, 19:12


]]>