Jump to content

Keep Getting a script error when running MIST script


RTS354

Recommended Posts

I’m trying to get a MIST script running that can detect if map objects within a zone are destroyed. The script is a function call to:

 

mist.flagFunc.mapobjs_dead_zones{ zones = {'bridge1'}, flag = 1}

Note that the trigger zone I created is named "bridge1" and I'm using FLAG 1.

 

I know how to program in LUA, but I’m having issues with how the scripting works in the DCS mission editor. I’m assuming that if a FLAG is zero, it is considered FALSE. I am also assuming that FLAG (1) must be turned on and assigned a value of 0 before calling the “mist.flagFunc.mapobjs_dead_zones” function.

 

According to the MIST documentation this function sets FLAG (1) to TRUE if a map object the zone is destroyed. Here is the MIST documentation for this function:

 

Examples:

mist.flagFunc.mapobjs_dead_zones{ zones = {'bridge1'}, flag = 51 } --[[Once run, this function will set flag 51 is set true if/when a map object has died/dies within the zone named "bridge1".]]

 

BUT I get the following error message when starting the mission:

[string"Mist.flagFunctin.mapobjs_dead{zones = {'bridge1'}, flag = 1}"]: attempt to index global mist' (A nil value)

Here are the triggers in the order they are to be executed:

Trigger1: Mission Start

Condition1: Time More(1)

Actions1: Do SCRIPT FILE (mist_4_3_74.lua)

Trigger2: ONCE (Create Bridge Zone Flags, NO EVENT)

Condition2: (NONE)

Actions2: FLAG ON(1) and then SET FLAG VALUE(1,0)

 

Trigger3: ONCE (Check Bridges, ON EVENT)

Condition3: FLAG IS FALSE (1)

Actions3: DO SCRIPT( mist.flagFunc.mapobjs_dead_zones{ zones = {'bridge1'}, flag = 1})

 

Trigger4: ONCE(Are Bridges Destroyed, NO EVENT)

Condition4: FLAG IS TRUE (1)

Actions4: MESSAGE TO COALITION (BLue, All Bridges are Destroyed, 30, false,0)

So what am I missing?

Link to comment
Share on other sites

Mission start does not require a condition. You can remove the time more(1)

 

Once does require a condition.

 

No need to turn on flag 1 and then turn it back off.

 

 

 

Here is what you need to do

 

Trigger1: Mission Start

Condition1: None

Actions1: Do SCRIPT FILE (mist_4_3_74.lua)

 

Trigger2: ONCE

Condition1: Time More(1)

Actions1: Do SCRIPT (mist.flagFunc.mapobjs_dead_zones{ zones = {'bridge1'}, flag = 1, }

 

Trigger3: ONCE(Are Bridges Destroyed, NO EVENT)

Condition3: FLAG IS TRUE (1)

Actions3: MESSAGE TO COALITION (BLue, All Bridges are Destroyed, 30, false,0)

 

This is assuming you have a trigger zone named 'bridge1' in the mission.


Edited by pmiceli

 

 

 

 

EDsignaturefleet.jpg

Link to comment
Share on other sites

Pmiceli, thanks for the info. The script works perfectly now. Since I had to create the "bridge1" zone, I assumed I had to create the flag1 variable. I'm still confused to where the flag1 variable is created. I thought that the "flag = 1" partof the function was to pass the flag that I created, in this case, flag1 to the function call, and then the function call would flip it to true if a map object was destroyed in the "bridge1" zone.

 

 

Thanks again.

Link to comment
Share on other sites

Pmiceli, thanks for the info. The script works perfectly now. Since I had to create the "bridge1" zone, I assumed I had to create the flag1 variable. I'm still confused to where the flag1 variable is created. I thought that the "flag = 1" partof the function was to pass the flag that I created, in this case, flag1 to the function call, and then the function call would flip it to true if a map object was destroyed in the "bridge1" zone.

 

 

Thanks again.

 

You don't need to initialize any flags. They are assumed to be "Off" (Value = 0) until you assign another value.

 

However, in a complex mission, sometimes it is helpful to assign value of 0 to a flag to keep things straight.

 

 

 

 

EDsignaturefleet.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...