Jump to content

Help with a script-


ENO

Recommended Posts

I had posted this in the MIST thread but wasn’t getting any traction there- I’m hoping someone can help since my mission is now stalled until I can get over this bump.

 

I'm trying to liven up the map a bit for some free flight / casual stuff without putting too much on the map. When client aircraft approach an airport I'm currently trying to set a flag that activates a little moose function that puts some uncontrolled aircraft on the ground and activates them randomly.

 

I'm pretty sure I have everything with MIST / MOOSE set up properly- since everything I tested out on small scale worked as expected.

 

My problem now is that I have all the MIST scripts that set the flags when client aircraft enter the zones around the individual airports on the same page... I'm pretty sure what's happening is I'm referencing aircraft names but there is no unit table. I've tried activating just by script individually but it still didn't work... so I'm scratching my head since I don't recall having any issues with this back in the old days... I know it's something I'm doing wrong.

 

I've gotten to the table mist.makeUnitTable (table t) in the guide- so I know I need to do that... But unfortunately I am useless since I don't know how.

 

Here is an example of one of the unit in zone scripts that I have together...

 

do

mist.flagFunc.units_in_zones{

units = {'F14 1', 'F14 2', 'F14 3', 'F14 4', 'F18C 1', 'F18C 2', 'F18C 3', 'F18C 4', 'AJS37 1', 'AJS37 2', 'MIG19 1', 'MIG19 2', 'F86 1', 'F86 2', 'AV8B 1', 'AV8B 2'},

zones = {'Sukhumi-Babushara 5'},

flag = 5

}

end

 

Basically I'm trying to separate client aircraft from dynamically / randomly spawned AI from the random air traffic script... When any of those aircraft fly into Sukhumi flag 5 would be set, initiating the moose script that deploys some uncontrolled aircraft.

 

Thanks in advance,

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Just taking a quick look away from the computer, but I think you need a comma after the "flag = 5" part

 

Thanks! I’ll double check the guide as well and see if I deleted it thinking it wasn’t necessary in the absence of any other scripted options.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Flag is the last index in the table, if a comma is added after it, I think the Lua interpreter will expect to find another index/value... if it doesn't find anything, I think the script will crash.

I could be wrong about this, ofc.

 

ENO, have you tried asking on the MIST discord channel?


Edited by Hardcard
Link to comment
Share on other sites

Flag is the last index in the table, if a comma is added after it, I think the Lua interpreter will expect to find another index/value... if it doesn't find anything, I think the script will crash.

I could be wrong about this, ofc.

 

ENO, have you tried asking on the MIST discord channel?

 

No, actually. I got crickets in the MIST thread but didn’t think about the discord. I’ll look it up- thanks again.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Make sure it is the pilot name, not the group name and that each plane is its own group.

 

I have used that function in a few missions of mine without issue. Are those the right parentheses? Not the normal () ?

 

I won't be at my PC to take a look until later in the weekend but I can paste in the code if you don't find the answer by then.

Link to comment
Share on other sites

Are those the right parentheses? Not the normal () ?

 

{} need to be used, since it's a table.

 

Tbh, it looks weird to me too, since I'm used to functions relying on () for parameters... but then again, I'm pretty lost when it comes to MIST :cry:

 

 

@ENO

 

Contact Grimes, he'll have the answer for you.

 

Wild (perhaps even foolish) idea... have you tried this?

 

 

do

mist.flagFunc.units_in_zones({

units = {'F14 1', 'F14 2', 'F14 3', 'F14 4', 'F18C 1', 'F18C 2', 'F18C 3', 'F18C 4', 'AJS37 1', 'AJS37 2', 'MIG19 1', 'MIG19 2', 'F86 1', 'F86 2', 'AV8B 1', 'AV8B 2'},

zones = {'Sukhumi-Babushara 5'},

flag = 5

})

end

 

 

I've seen that the MIST documentation examples use {} only, so I don't think () are required... but there's no harm in trying.

(Also, triple check that all your unit names are correct, like feefifofum suggested)

 

 

Do you absolutely need to use MIST for this, though?

I'm not familiar with MIST, but I know my way around MOOSE.

 

If all you need are zone checks for specific client units, this can done with MOOSE.


Edited by Hardcard
Link to comment
Share on other sites

Hey guys- thanks.

 

The script I based that one on is pretty much straight out of the hoggit wiki- one of the samples provided in the guide. This is the one I used found HERE:

 

do

 

mist.flagFunc.units_in_zones{

units = {'Chevy11', 'Chevy12', 'Chevy13', 'Chevy14'},

zones = {'Mozdok', 'Krymsk', 'Anapa', 'Mineral'},

flag = 100,

zone_type = 'sphere'

}

end

 

The zone type defaults to cylinder which is the one I needed so I just removed that and didn't think a comma was necessary.

 

 

I'll try your suggestion out too Hardcard.

 

To be honest I used to use this script a lot back when I was mission building a couple years ago and I don't remember ever having any trouble with it. I never had to set up unit tables or anything... I just initiated MIST at the beginning of the mission and the scripts would generally do what they're told assuming I'd entered them properly.

 

Grimes walked right by my post in the hoggit discord last night so I think he's busy... but the MOOSE suggestion is another option- I'm not as familiar with it other than some limited features I can emulate with the help of the videos that are available.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Okay... well I THINK I figured out what I did wrong- but I don't recall that it was necessarily "wrong" before...

 

Anyway-

 

Originally I was using MIST as the initiating script... I thought that's what we used to do. It's been years so I may be mistaken. Now I'm using "do script file" for MIST.

 

I did get that to work- using the script exactly as above (using only 1 aircraft mind you for the test)... so now I'll continue to work out from there and see if I can get it working on a couple fronts.

 

Johnv you're probably right- I just copied the guide exactly. I'm currently running it in "do script" fashion... maybe it's redundant when used there. I'll try it without and see.

 

Edit: John you were right- it worked without it.


Edited by ENO

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

  • Recently Browsing   0 members

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