Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

Thanks, it turns out the problem was sitting in the chair.:doh: I have everything working as it should now.

P-51D | Fw 190D-9 | Bf 109K-4 | Spitfire Mk IX | P-47D | WW2 assets pack | F-86 | Mig-15 | Mig-21 | Mirage 2000C | A-10C II | F-5E | F-16 | F/A-18 | Ka-50 | Combined Arms | FC3 | Nevada | Normandy | Straight of Hormuz | Syria

Link to comment
Share on other sites

Can't get mist.flagFunc.mapobjs_dead_zones to work

 

Hello,

I've been playing with the Mission editor for a some time , and now trying my first steps with scripts.

As a start, I've been trying to use the mist.flagFunc.mapobjs_dead_zones

I copied the example provided in the Mist PDF and set the flag and triggers (load the script, explode the bridge, and display the message - mission is attached)

For some reason I don't get the resulting message that should appear once the bridge gets exploded.

Can anyone point me to what I'm doing wrong?

Thanks in advance,

Assaf.

MIST test - destroy bridge 1 .miz

Link to comment
Share on other sites

Issue is with MIST, problem has been introduced sometime in the latest versions.

It seems that all the flag functions have this issue.

 

Assaf to fix your problem, go into the mist lua file and edit line 2640 -

if (#mist.getDeadMapObjsInZones(zones) - initial_number) >= req_num and trigger.misc.getUserFlag(flag) == [b][color="Red"]false[/color][/b] then

 

to

 

if (#mist.getDeadMapObjsInZones(zones) - initial_number) >= req_num and trigger.misc.getUserFlag(flag) == [b][color="red"]0[/color][/b] then

 

I've just found this issue in mist.flagFunc.units_in_zones and have been busting my head what was wrong with my script for a few hours now :(

 

Grimes, I would put the changes into GitHub but I'm not sure on how the workflow is done overthere so I leave it to you :)

Link to comment
Share on other sites

  • 4 weeks later...

Looks like there's a problem with mist.getUnitsLOS, not sure exactly why it isn't working might be my own mistake in understanding.

 

When I run for example -

 

local unitEWR = {radarShortName.."_"..radarCoa.."_EWR"}
local unitsTest = ""

--create unitsTest
if radarCoa == "red" then
   unitsTest = mist.makeUnitTable({'[blue][helicopter]','[blue][plane]'})
elseif radarCoa == "blue" then
   unitsTest = mist.makeUnitTable({'[red][helicopter]','[red][plane]'})
end

local unitLOSdata = mist.getUnitsLOS(unitEWR, 3, unitsTest, 0, 20000)
if #unitLOSdata >= 1 then
   Group.getByName(radarShortName.."_"..radarCoa.."_INTERCEPT"):getController():setCommand({["id"] = "Start", ["params"] = {}, })
   taskT.intercept = true
end

I expect the group with INTERCEPT to get a controller started when an enemy unit is in range of 20000m of the unitEWR and in LOS.

In the MIST documentation it does not indicate what are the units to be used when supplying the radius for this function and I could not figure it out through the MIST code as it works with the x,y,z vec points.

 

I've done some tests but can't get a conclusive idea on what are the radius units and if I'm doing anything wrong with this function.

Would appreciate if someone could take a look if there's any problem with how I understand the function or how I run it or if there's anything wrong in the MIST code.

 

Thanks in advance.

Link to comment
Share on other sites

I think I found the problem, still testing but I think the problem is with late activation units.

 

If you have late activation units in the mission, it catalogs them when using [blue][planes] for example, thus taking into account units that are not live in the mission.

 

fixed by adding the following to the MIST code -

 

mist.getUnitsLOS = function(unitset1, altoffset1, unitset2, altoffset2, radius)
   radius = radius or math.huge
   
   local unit_info1 = {}
   local unit_info2 = {}
   
   -- get the positions all in one step, saves execution time.
   for unitset1_ind = 1, #unitset1 do
       local unit1 = Unit.getByName(unitset1[unitset1_ind])
       if unit1 then
           [b]if unit1:isActive() then[/b]
               unit_info1[#unit_info1 + 1] = {}
               unit_info1[#unit_info1]["unit"] = unit1
               unit_info1[#unit_info1]["pos"]  = unit1:getPosition().p
           [b]end[/b]
       end
   end
   
   for unitset2_ind = 1, #unitset2 do
       local unit2 = Unit.getByName(unitset2[unitset2_ind])
       if unit2 then
           [b]if unit2:isActive() then[/b]
               unit_info2[#unit_info2 + 1] = {}
               unit_info2[#unit_info2]["unit"] = unit2
               unit_info2[#unit_info2]["pos"]  = unit2:getPosition().p
           [b]end[/b]
       end
   end

   local LOS_data = {}
   -- now compute los
   for unit1_ind = 1, #unit_info1 do
       local unit_added = false
       for unit2_ind = 1, #unit_info2 do
           if radius == math.huge or (mist.vec.mag(mist.vec.sub(unit_info1[unit1_ind].pos, unit_info2[unit2_ind].pos)) < radius) then -- inside radius
               local point1 = { x = unit_info1[unit1_ind].pos.x, y = unit_info1[unit1_ind].pos.y + altoffset1, z = unit_info1[unit1_ind].pos.z}
               local point2 = { x = unit_info2[unit2_ind].pos.x, y = unit_info2[unit2_ind].pos.y + altoffset2, z = unit_info2[unit2_ind].pos.z}
               if land.isVisible(point1, point2) then
                   if unit_added == false then
                       unit_added = true
                       LOS_data[#LOS_data + 1] = {}
                       LOS_data[#LOS_data]['unit'] = unit_info1[unit1_ind].unit
                       LOS_data[#LOS_data]['vis'] = {}
                       LOS_data[#LOS_data]['vis'][#LOS_data[#LOS_data]['vis'] + 1] = unit_info2[unit2_ind].unit 
                   else
                       LOS_data[#LOS_data]['vis'][#LOS_data[#LOS_data]['vis'] + 1] = unit_info2[unit2_ind].unit 
                   end
               end
           end
       end
   end
   
   return LOS_data
end

Link to comment
Share on other sites

Same issue with late activation groups and goRoute function (this function is also used when using MISTs spawning functions) -

Original:

mist.goRoute = function(group, path)
   local misTask = { 
       id = 'Mission', 
       params = { 
           route = { 
               points = mist.utils.deepCopy(path),
           },    
       },
   }    
   if type(group) == 'string' then
       group = Group.getByName(group)
   end
   local groupCon = group:getController()
   if groupCon then
       groupCon:setTask(misTask)
       return true
   end
   --Controller.setTask(groupCon, misTask)
   return false
end

 

Changed:

mist.goRoute = function(group, path)
   local misTask = { 
       id = 'Mission', 
       params = { 
           route = { 
               points = mist.utils.deepCopy(path),
           },    
       },
   }    
   if type(group) == 'string' then
       group = Group.getByName(group)
   end
   [b]local groupCon = nil
   if group then
       groupCon = group:getController()
   end[/b]
   if groupCon then
       groupCon:setTask(misTask)
       return true
   end
   --Controller.setTask(groupCon, misTask)
   return false
end

Link to comment
Share on other sites

New issue I have found with MIST with the function - mist.flagfunc.units_in_zones(vars)

 

This function knows how to take unit tables inserted in the following way -

mist.flagFunc.units_in_zones
{
   [b]units = {'[red][vehicle]'},[/b]
   zones = {ZONENAME},
   flag = 5,
   req_num = 1,
   interval = 3,
   toggle = true
}

 

These units are based on the mist.dbs.units DB table according to MISTs code.

When the mist.flagFunc.units_in_zones function runs, it takes the unit names and turns them into unit tables using - mist.makeUnitTable function -

if not units.processed then -- run unit table short cuts
   units = mist.makeUnitTable(units)
end

 

And because of -

mist.scheduleFunction(mist.flagFunc.units_in_zones, {[b]{units = units[/b], zones = zones, flag = flag, stopflag = stopflag, zone_type = zone_type, req_num = req_num, interval = interval, toggle = toggle}}, timer.getTime() + interval)

 

This means that from this point forward, the table units, hold what the mist.dbs.units DB had from the point the flagFunc was ran, any newly added (spawned units) or removed units would not be updated and subsequently the flag that would be raised would not be 100% correct.

 

Fix -

mist.scheduleFunction(mist.flagFunc.units_in_zones, {[b]{units = vars.units[/b], zones = zones, flag = flag, stopflag = stopflag, zone_type = zone_type, req_num = req_num, interval = interval, toggle = toggle}}, timer.getTime() + interval)

 

This change will make sure that when the function calls itself over and over, it will throw in the unit names brought by the [red][vehicle] which is updated from the mist.dbs.units DB table and should be correct.

 

Hope I explained it clear enough and hope these fixes that I find would be fixed in future MIST versions.

Link to comment
Share on other sites

Thanks for testing it, figuring out there is a problem, and then posting the solutions. That tends to make posting fixes much easier on my end. :)

 

Those first two fixes will be up on development branch shortly. I don't want to make that specific proposed change for flagfuncs just yet because its forcing it to constantly re-run mist.makeUnitTable which is one of the more process intensive functions. I'd prefer it to update only when it needs to or at least figure out how much of a performance impact re-running it can have.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Really appreciate the work gents. I've had problems with things like GCICAP scripts and civilian flights and i think some others on current versions. I can;t really moan because of the work done to get these things functioning in the first place, MIST has enabled some of these core scripts that have been game changing, but I should say that somewhere wayback the cap scripts stopped and ive been stuck on prior versions too.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Will you make the change so an updated list is ready without constantly running mist.makeUnitTable?

 

Yeah. Most likely what its gonna be is I'll add another variable that gets passed to the function that is basically the original definitions for units to be checked. I will also change the processed flag from mist.makeUnitsTable to return the time the list was compiled and check it against the last time the DBs were updated. If DBs were updated more recently than the list was compiled, then it makes a new list.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

  • 2 weeks later...

Seems like there is still an issue with the CA messages.

We are running the following (it's split into 2 messages because of size limit) -

 

 

 

 

--test coalition for task by active zone flag

if trigger.misc.getUserFlag('red'..taskName)==0 and trigger.misc.getUserFlag('blue'..taskName)==0 then

if taskT.status == 'open' then

if taskT.coa == 'red' then

--red fighters

mist.message.add

{

text = '\n\nIntel:\nOur last defending forces have fallen at '..taskName..' '..Obj..'.\nDefend against the enemy attempts to capture at all costs, until the repair is complete.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Su-27','Mig-21bis'}}},

}

--red attackers

mist.message.add

{

text = '\n\nIntel:\nOur last defending forces have fallen at '..taskName..' '..Obj..'.\nDefend against the enemy attempts to capture at all costs, until the repair is complete.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'A-10C','Su-25T'}}},

}

--red helos

mist.message.add

{

text = '\n\nIntel:\nOur last defending forces have fallen at '..taskName..' '..Obj..'.\nDefend against the enemy attempts to capture at all costs, until the repair is complete.\n\nTask:\n-Bring transport air defense squads to assist in the defense of '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Uh-1h','Mi-8MT','Ka-50'}}},

}

--red CA

mist.message.add

{

text = '\n\nIntel:\nOur last defending forces have fallen at '..taskName..' '..Obj..'.\nDefend against the enemy attempts to capture at all costs, until the repair is complete.\n\nTask:\n-Direct our air forces to defend '..taskName..' '..Obj..'.\n-Control incoming transport forces to assist with the defense of '..taskName..' '..Obj..'.\n\nRed HQ out.',

displayTime = 25,

msgFor = {CA = {'red'}},

}

--blue fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces have managed to win the battle at '..taskName..' '..Obj..'.\nWe must protect the area until our Helos can deploy troops.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'F-15C'}}},

}

--blue attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces have managed to win the battle at '..taskName..' '..Obj..'.\nWe must protect the area until our Helos can deploy troops.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'A-10C','Su-25T'}}},

}

--blue helos

mist.message.add

{

text = '\n\nIntel:\nOur forces have managed to win the battle at '..taskName..' '..Obj..'.\nWe must protect the area until our Helos can deploy troops.\n\nTask:\n-Bring transport squads to capture '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Uh-1h','Mi-8MT','Ka-50','Ka-50'}}},

}

--blue CA

mist.message.add

{

text = '\n\nIntel:\nOur forces have managed to win the battle at '..taskName..' '..Obj..'.\nWe must protect the area until our Helos can deploy troops.\n\nTask:\n-Direct our air forces to capture '..taskName..' '..Obj..'.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {CA = {'blue'}},

}

elseif taskT.coa == 'blue' then

--blue fighters

mist.message.add

{

text = '\n\nIntel:\nOur last defending forces have fallen at '..taskName..' '..Obj..'.\nDefend against the enemy attempts to capture at all costs, until the repair is complete.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Su-27','Mig-21bis'}}},

}

--blue attackers

mist.message.add

{

text = '\n\nIntel:\nOur last defending forces have fallen at '..taskName..' '..Obj..'.\nDefend against the enemy attempts to capture at all costs, until the repair is complete.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'A-10C','Su-25T'}}},

}

--blue helos

mist.message.add

{

text = '\n\nIntel:\nOur last defending forces have fallen at '..taskName..' '..Obj..'.\nDefend against the enemy attempts to capture at all costs, until the repair is complete.\n\nTask:\n-Bring transport air defense squads to assist in the defense of '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Uh-1h','Mi-8MT','Ka-50','Ka-50'}}},

}

--blue CA

mist.message.add

{

text = '\n\nIntel:\nOur last defending forces have fallen at '..taskName..' '..Obj..'.\nDefend against the enemy attempts to capture at all costs, until the repair is complete.\n\nTask:\n-Direct our air forces to defend '..taskName..' '..Obj..'.\n-Control incoming transport forces to assist with the defense of '..taskName..' '..Obj..'.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {CA = {'blue'}},

}

--red fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces have managed to win the battle at '..taskName..' '..Obj..'.\nWe must protect the area until our Helos can deploy troops.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'F-15C'}}},

}

--red attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces have managed to win the battle at '..taskName..' '..Obj..'.\nWe must protect the area until our Helos can deploy troops.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'A-10C','Su-25T'}}},

}

--red helos

mist.message.add

{

text = '\n\nIntel:\nOur forces have managed to win the battle at '..taskName..' '..Obj..'.\nWe must protect the area until our Helos can deploy troops.\n\nTask:\n-Bring transport squads to capture '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Uh-1h','Mi-8MT','Ka-50','Ka-50'}}},

}

--red CA

mist.message.add

{

text = '\n\nIntel:\nOur forces have managed to win the battle at '..taskName..' '..Obj..'.\nWe must protect the area until our Helos can deploy troops.\n\nTask:\n-Direct our air forces to capture '..taskName..' '..Obj..'.\n\nRed HQ out.',

displayTime = 25,

msgFor = {CA = {'red'}},

}

end

--trigger.action.outText("ATTENTION!!!\n\n"..taskName.." "..Obj.." has been closed.", 10)

end

taskT.status = 'closed'

 

 

 

 

I'm getting the attached screenshot results.

Seems like the CA messages are overwriting some of the other messages, we sometimes get flickering messages although according to the above script, the message should be sent to different groups.

Screen_150816_011851.thumb.jpg.39cb38a60855f278a0675a7f533b59fc.jpg

Screen_150816_011415.thumb.jpg.ff7ddf3c8125a7cf89a0b4339f677b85.jpg

messages.thumb.jpg.c66535934d1c446088e7f25f727bd8eb.jpg

Link to comment
Share on other sites

2nd part -

 

 

elseif trigger.misc.getUserFlag('red'..taskName)==1 and trigger.misc.getUserFlag('blue'..taskName)==1 then

if taskT.underAttack ~= true then

if taskT.coa == 'red' then

--red fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces at '..taskName..' '..Obj..' report that they are under attack.\nWe need to gain air superiority in the area.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Su-27','Mig-21bis'}}},

}

--red attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces at '..taskName..' '..Obj..' report that they are under attack.\nWe need to gain air superiority in the area.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'A-10C','Su-25T'}}},

}

--red helos

mist.message.add

{

text = '\n\nIntel:\nOur forces at '..taskName..' '..Obj..' report that they are under attack.\nWe need to gain air superiority in the area.\n\nTask:\n-Bring transport air defense squads to assist in the defense of '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Uh-1h','Mi-8MT','Ka-50','Ka-50'}}},

}

--red CA

mist.message.add

{

text = '\n\nIntel:\nOur forces at '..taskName..' '..Obj..' report that they are under attack.\nWe need to gain air superiority in the area.\n\nTask:\n-Direct our air forces to defend '..taskName..' '..Obj..'.\n-Control incoming transport forces to assist with the defense of '..taskName..' '..Obj..'.\n\nRed HQ out.',

displayTime = 25,

msgFor = {CA = {'red'}},

}

--blue fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces are attacking at '..taskName..' '..Obj..'.\nWe must help the attack until all enemy forces are destroyed.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'F-15C'}}},

}

--blue attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces are attacking at '..taskName..' '..Obj..'.\nWe must help the attack until all enemy forces are destroyed.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'A-10C','Su-25T'}}},

}

--blue helos

mist.message.add

{

text = '\n\nIntel:\nOur forces are attacking at '..taskName..' '..Obj..'.\nWe must help the attack until all enemy forces are destroyed.\n\nTask:\n-Bring transport squads to capture '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Uh-1h','Mi-8MT','Ka-50','Ka-50'}}},

}

--blue CA

mist.message.add

{

text = '\n\nIntel:\nOur forces are attacking at '..taskName..' '..Obj..'.\nWe must help the attack until all enemy forces are destroyed.\n\nTask:\n-Direct our air forces to attack '..taskName..' '..Obj..'.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {CA = {'blue'}},

}

elseif taskT.coa == 'blue' then

--blue fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces at '..taskName..' '..Obj..' report that they are under attack.\nWe need to gain air superiority in the area.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Su-27','Mig-21bis'}}},

}

--blue attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces at '..taskName..' '..Obj..' report that they are under attack.\nWe need to gain air superiority in the area.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'A-10C','Su-25T'}}},

}

--blue helos

mist.message.add

{

text = '\n\nIntel:\nOur forces at '..taskName..' '..Obj..' report that they are under attack.\nWe need to gain air superiority in the area.\n\nTask:\n-Bring transport air defense squads to assist in the defense of '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Uh-1h','Mi-8MT','Ka-50','Ka-50'}}},

}

--blue CA

mist.message.add

{

text = '\n\nIntel:\nOur forces at '..taskName..' '..Obj..' report that they are under attack.\nWe need to gain air superiority in the area.\n\nTask:\n-Direct our air forces to defend '..taskName..' '..Obj..'.\n-Control incoming transport forces to assist with the defense of '..taskName..' '..Obj..'.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {CA = {'blue'}},

}

--red fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces are attacking at '..taskName..' '..Obj..'.\nWe must help the attack until all enemy forces are destroyed.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'F-15C'}}},

}

--red attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces are attacking at '..taskName..' '..Obj..'.\nWe must help the attack until all enemy forces are destroyed.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'A-10C','Su-25T'}}},

}

--red helos

mist.message.add

{

text = '\n\nIntel:\nOur forces are attacking at '..taskName..' '..Obj..'.\nWe must help the attack until all enemy forces are destroyed.\n\nTask:\n-Bring transport squads to capture '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Uh-1h','Mi-8MT','Ka-50','Ka-50'}}},

}

--red CA

mist.message.add

{

text = '\n\nIntel:\nOur forces are attacking at '..taskName..' '..Obj..'.\nWe must help the attack until all enemy forces are destroyed.\n\nTask:\n-Direct our air forces to attack '..taskName..' '..Obj..'.\n\nRed HQ out.',

displayTime = 25,

msgFor = {CA = {'red'}},

}

end

end

taskT.underAttack = true

elseif trigger.misc.getUserFlag('red'..taskName)==1 and trigger.misc.getUserFlag('blue'..taskName)==0 then

if taskT.coa ~= 'red' then

taskT.coa = 'red'

taskT.status = 'open'

taskT.spawnGroups = {}

taskT.underAttack = false

--red fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to have air superiority in the area Until '..taskName..' '..Obj..' is completly repaired.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Su-27','Mig-21bis'}}},

}

--red attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to have air superiority in the area Until '..taskName..' '..Obj..' is completly repaired.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'A-10C','Su-25T'}}},

}

--red helos

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to have air superiority in the area Until '..taskName..' '..Obj..' is completly repaired.\n\nTask:\n-Bring transport air defense squads to defend '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Uh-1h','Mi-8MT','Ka-50'}}},

}

--red CA

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to have air superiority in the area Until '..taskName..' '..Obj..' is completly repaired.\n\nTask:\n-Direct our air forces to defend '..taskName..' '..Obj..'.\n\nRed HQ out.',

displayTime = 25,

msgFor = {CA = {'red'}},

}

--blue fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to gain air superiority in the area and try to recapture '..taskName..' '..Obj..'.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'F-15C'}}},

}

--blue attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to gain air superiority in the area and try to recapture '..taskName..' '..Obj..'.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'A-10C','Su-25T'}}},

}

--blue helos

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to gain air superiority in the area and try to recapture '..taskName..' '..Obj..'.\n\nTask:\n-Bring transport squads to assist in the attack of '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Uh-1h','Mi-8MT','Ka-50'}}},

}

--blue CA

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to gain air superiority in the area and try to recapture '..taskName..' '..Obj..'.\n\nTask:\n-Direct our air forces to attack '..taskName..' '..Obj..'.\n-Control incoming transport forces to assist with the attack of '..taskName..' '..Obj..'.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {CA = {'blue'}},

}

--trigger.action.outText("ATTENTION!!!\n\nred has captured "..taskName.." "..Obj, 10)

end

taskT.status = 'open'

elseif trigger.misc.getUserFlag('red'..taskName)==0 and trigger.misc.getUserFlag('blue'..taskName)==1 then

if taskT.coa ~= 'blue' then

taskT.coa = 'blue'

taskT.status = 'open'

taskT.spawnGroups = {}

taskT.underAttack = false

--blue fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to have air superiority in the area Until '..taskName..' '..Obj..' is completly repaired.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Su-27','Mig-21bis'}}},

}

--blue attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to have air superiority in the area Until '..taskName..' '..Obj..' is completly repaired.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'A-10C','Su-25T'}}},

}

--blue helos

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to have air superiority in the area Until '..taskName..' '..Obj..' is completly repaired.\n\nTask:\n-Bring transport air defense squads to defend '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the defense.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {unitTypes = {blue = {'Uh-1h','Mi-8MT','Ka-50'}}},

}

--blue CA

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to have air superiority in the area Until '..taskName..' '..Obj..' is completly repaired.\n\nTask:\n-Direct our air forces to defend '..taskName..' '..Obj..'.\n\nBlue HQ out.',

displayTime = 25,

msgFor = {CA = {'blue'}},

}

--red fighters

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to gain air superiority in the area and try to recapture '..taskName..' '..Obj..'.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'F-15C'}}},

}

--red attackers

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to gain air superiority in the area and try to recapture '..taskName..' '..Obj..'.\n\nTask:\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'A-10C','Su-25T'}}},

}

--red helos

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to gain air superiority in the area and try to recapture '..taskName..' '..Obj..'.\n\nTask:\n-Bring transport squads to assist in the attack of '..taskName..' '..Obj..'.\n-Make way towards '..taskName..' '..Obj..' as soon as possible to assist the attack.\n\nRed HQ out.',

displayTime = 25,

msgFor = {unitTypes = {red = {'Uh-1h','Mi-8MT','Ka-50'}}},

}

--red CA

mist.message.add

{

text = '\n\nIntel:\nOur forces have captured '..taskName..' '..Obj..'.\nWe need to gain air superiority in the area and try to recapture '..taskName..' '..Obj..'.\n\nTask:\n-Direct our air forces to attack '..taskName..' '..Obj..'.\n-Control incoming transport forces to assist with the attack of '..taskName..' '..Obj..'.\n\nRed HQ out.',

displayTime = 25,

msgFor = {CA = {'red'}},

}

--trigger.action.outText("ATTENTION!!!\n\nblue has captured "..taskName.." "..Obj, 10)

end

taskT.status = 'open'

end

 

Link to comment
Share on other sites

Ugh, alright I'll try to figure it out. I wish there was a way to send CA and only CA players messages. It might work with "message to group" and just send it to all ground forces, but CA players aren't guaranteed to be in a group. My workaround to it has its drawbacks...

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

  • 2 weeks later...

It is based on what the unit is called within the actual mission file, so in the case of the Mi-8 it is actually "Mi-8MT". Basically they just made it so the aircraft name on the front-end is changed so that compatibility with older missions won't be broken instead of adding another aircraft type or just replacing the old Mi-8MT with the Mi-8MTV2.

 

I'll see if I can come up with a decent solution for it. Right now the Mi-8 is the only aircraft that is setup like this, but it may be useful to allow for some flexibility with regard to other aircraft. For instance have it work with just "mig21" instead of MiG-21Bis.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Hi Grimes,

Kind of doing a community favour here for someone who has no scripting knowledge and is asking questions about Raf's Automan script. They want to use it to respawn aircraft as per the scripts functionality but at different altitudes. I'm not the best lua coder about but it seems from a quick look through Raf's script that it is using mist.respawnInZone with a dispersion radius. Looking at Mist this essentially results in a random vec2 point being returned via a call to teleportToPoint.

Could you consider - for aircraft only - making this Vec3 in your next version? So you get a random Vec3 respecting ground alt out of teleportToPoint and thereby a randomisation in position out of respawnInZone? I realise this means changing to Vec3 in teleportToPoint which could cause a lot of grief so perhaps this may mean an aircraft/helo specific version of respawnInZone or teleportToPoint?? Anyway just thinking aloud sorry.

 

Thanks,

Stonehouse

 

Link to question about Raf's script http://forums.eagle.ru/showpost.php?p=2464626&postcount=22


Edited by Stonehouse
add link to Doum76's post
Link to comment
Share on other sites

teleportToPoint already accepts vec3 points. If its given a vec3 point it will use the y value as the altitude that it will spawn the group at. That is to say providing the point is higher than the ground, otherwise the function will spawn the units with a bit of ground clearance. At the moment if a vec3 point isn't given then it spawns the AI a set altitude above ground level. It would be pretty straight forward to randomize the altitude at which AI aircraft are spawned at if a vec2 point is passed to the function, aka all of the spawn/clone/teleport stuff.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

ok but does respawnInZone do vec3? Maybe I misread the doco but I thought it said it only did vec2. Looking at the mist code it seemed to do some stuff and then pass it off to teleportToPoint to do the actual spawn. So I assumed that respawnInZone needed to be enhanced to allow randomisation in the altitude component of the vector.

 

Ah well I will go back and read it again properly this time. Thanks Grimes.

 

Cheers,

Stoney


Edited by Stonehouse
Link to comment
Share on other sites

It is a little convoluted since its dealing with different coordinate formats.

 

RespawnInZone uses zonenames, which when you use trigger.misc.getZone() returns a vec3 coordinate for a point. Which gets passed to teleportToPoint. If I recall all y (altitude) values with trigger.misc.getZone are 0. This function just gathers the data for teleportToPoint to use.

 

teleportToPoint then uses getRandPointInCircle which accepts either vec2/vec3 coordinates and returns a vec2 coordinate that is assigned to a new variable. Later on in the script when its defining each unit in the groups new coordinates it will generate an altitude to spawn the unit at IF its an aircraft/helicopter. The current release uses a pretty basic check to see if the y variable of point is greater than 0 and if it is higher than terrain at the x/z coordinates. If it isn't it will spawn the group at 300m AGL. I've changed this (need to test it) to spawn at a random altitude of a few thousand meters.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Ok I see what you mean about convoluted lol. Thank you. I think in that case once your change gets released then the automan script will work as Doum is trying to make it work without tweaks. I just wish it was as easy to get going properly again on GCICAP updates, I seem to have run into coder's block ;D

 

Cheers,

Stoney

Link to comment
Share on other sites

  • 2 weeks later...

Just pushed an update to development branch. It includes a few fixes and changes. Felt the need to get this out since I uhhh used a version of this iteration in my recent On Station mission update that wasn't exactly done. :music_whistling:

 

 

So the plan is that whenever 1.5 drops I will be releasing an update to mist to coincide with it. There are some changes to how a few things work that an update to mist is required in 1.5. For ease of use I'll be labeling the major version for mist to be "4.0" even though not a whole lot will change with it. I haven't quite decided how to handle it in terms of branches and what not. At the moment I'm leaning toward pushing a final update for the 1.2.16 version and then simply use development branch for 1.5 until it leaves open beta.

 

 

v53 changes

-added mist.getAvgPos now accepts static objects in addition to units.

-added mist.getLastDBUpdateTime which returns the most recent time the DB update function has run.

-changed mist.makeUnitTable processed entry to return the time it was processed instead of a boolean value.

-Changed teleport/respawn/clone functions to spawn aircraft at random altitudes instead of

constants if the point given is vec2/not specified.

-Fixed FlagFuncs will now recognize units added in dynamically. Note this only applies if you

send it unitNameTable identifier and not the table that the function creates.

-Added variable to all flagfuncs. unitTableDef is the original definition used for units.

-Fixed all getUserFlag checks to compare with numerical value instead of boolean

 

 

Xcom, fixes to message handling are still in progress. At least part of what I am changing will be in the last fixes to get pushed before I transition to 1.5 support.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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