How can I use ChangeMissionStatus via LUA

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
ElGlobo
Posts: 30
Joined: Mon Nov 21, 2022 9:21 am

How can I use ChangeMissionStatus via LUA

Post by ElGlobo »

Hi,

I'm totally noob on lua scripting.

To simulate the player side requesting an AI allied side to launch pre-programmed and inactive missions I would like to change some missions status via special action event that would use LUA script. I found ChangeMissionStatus in ScenEdit_SetAction( { table } ) here https://commandlua.github.io/index2.html#EventHandling
but I don't know how to write properly the syntax and needed variables.

Dou you know some existing examples I could learn from, or show me how to write properly the code :?: ?
User avatar
blu3s
Posts: 1329
Joined: Fri Jul 08, 2022 9:45 am

Re: How can I use ChangeMissionStatus via LUA

Post by blu3s »

If you have never coded I'd start learning some programming basics, what's a variable, what's a function etc. You can use any language, maybe python can be a good starting point to understand the basics.

There are also a good amount of resources in this forum. Use the search functionality when looking for examples.

For SetMission, the parameters you need are explained in the doc

Image

Then in the mission options you will need to set the parameter isActive to True

Image

So you will end something like ScenEdit_SetMission('BLUE', 'CAS Mission', {isActive=true})
ElGlobo
Posts: 30
Joined: Mon Nov 21, 2022 9:21 am

Re: How can I use ChangeMissionStatus via LUA

Post by ElGlobo »

Thank you.

Thank you, yesterday at first glance I didn't seen the ScenEdit_SetMission () function. I managed to do what I wanted, but in a less simple way.

It's quite simple indeed when you know where to look and understand the basics of the LUA.

local mission = ScenEdit_SetMission('side name','existing mission name or ID',{isactive='true'})
Post Reply

Return to “Lua Legion”