SE_SetTrigger parameters

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
vettim89
Posts: 3739
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

SE_SetTrigger parameters

Post by vettim89 »

Looking over the Lua documentation there is scant information on how to set up various triggers in the 'add' mode

What is the proper syntax to add a trigger for 'unit enters area'?
"We have met the enemy and they are ours" - Commodore O.H. Perry
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: SE_SetTrigger parameters

Post by KnightHawk75 »

Recently answered here fb.asp?m=4974239 (post#12), though specific to the persons need regarding a 'specific unit' level of specificity in the TargetFilter, omit level of specificity if not needed in the filter options.

Put more plainly:
When mode is "add" and type = "UnitEntersArea" further options are:
TargetFilter = {} where it can contains one or more of following comma delimited as needed in the table if needed, and...IF being used at all.
TARGETSIDE = 'TextSideName ie Blue',
TARGETTYPE = 'TextType ie Facility',
TARGETSUBTYPE = 'interger value of the ie class's subtype 5001',
SPECIFICUNITCLASS = 'integer value of the dbid\class ie 2784',
SPECIFICUNITID = 'Guid of the exact unit(technically could be a string name I think but avoid that)'
Area = { comma delimited list of existing RP names here ie 'MyRP-1','MyRP-2','MyRP-3','MyRP-4'}
ETOA = 'integer of dotnet-ticktime datetime type representing entering time. leave empty to be start scenario time'
LTOA = 'integer of dotnet-ticktime datetime type representing leaving time. leave empty to be end of scenario time.'
NOT = 'boolean if the trigger is to be reversed use true. No need to include unless setting to true.'
ExitArea = 'boolean representing if the trigger is reversed ie true is treated as unit exits area trigger. no need to include unless setting to true.'

BTW - One way to see what the options are when dealing with this is to dump an existing created one, either dumping the table entries, or exporting the mission.

PS: If you need to calculate dotnet-ticktime to and from normal game timestamps you can use the following:

Code: Select all

function convertDotNetTickTimeToLuaTimestamp(theDotNetStamp)
    return (tonumber(theDotNetStamp) - 621355968000000000) / 10000000
 end
 
 function convertLuaTimestampToDotNetTickTime(theUnixStamp)
    return 621355968000000000 + (tonumber(theUnixStamp) * 10000000)
 end
 
 

Let me know if something doesn't click\make sense to you.
User avatar
vettim89
Posts: 3739
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

RE: SE_SetTrigger parameters

Post by vettim89 »

so the following code works (somewhat)

local patrol=ScenEdit_UnitX()
BuildCircleOfRPs('Iran',patrol,'1')
local zone={}
counter = 1
while counter <13 do
zone[counter]=patrol.name .. "-" .. counter
counter=counter+1
end
local tname='Iran:SOH Int ('patrol.name')'
ScenEdit_SetTrigger({mode='add', description=tname, type='UnitEntersArea', TargetSide='Neutral', TargetType='ship', area=zone})

The problem is that the trigger created does not set up for TargetSide (reads 'any side') nor TargetType (reads 'any type')

Is this a simple syntax issue??
"We have met the enemy and they are ours" - Commodore O.H. Perry
User avatar
vettim89
Posts: 3739
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

RE: SE_SetTrigger parameters

Post by vettim89 »

ORIGINAL: vettim89

so the following code works (somewhat)

local patrol=ScenEdit_UnitX()
BuildCircleOfRPs('Iran',patrol,'1')
local zone={}
counter = 1
while counter <13 do
zone[counter]=patrol.name .. "-" .. counter
counter=counter+1
end
local tname='Iran:SOH Int ('patrol.name')'
ScenEdit_SetTrigger({mode='add', description=tname, type='UnitEntersArea', TargetSide='Neutral', TargetType='ship', area=zone})

The problem is that the trigger created does not set up for TargetSide (reads 'any side') nor TargetType (reads 'any type')

Is this a simple syntax issue??
Never mind - saw the error - failed to include the 'TargetFilter" line
"We have met the enemy and they are ours" - Commodore O.H. Perry
Post Reply

Return to “Lua Legion”