[LUA] Activate Mission (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios



Message


snowburn -> [LUA] Activate Mission (2/3/2016 9:45:16 PM)

Hello!!

Is any way to change the status (from inactive to active) of a mission?
I got the following script:

local number=ScenEdit_GetKeyValue('destroyedScud')
number=number+1
ScenEdit_SetKeyValue('destroyedScud', number)

print(ScenEdit_GetKeyValue('destroyedScud'))

ScenEdit_SpecialMessage('United States', number..' Scud groups destroyed, '..9-number..' remains' )

if number==3 then
ScenEdit_SpecialMessage('United States', 'INIT MISSION 1' )

elseif number==5 then
ScenEdit_SpecialMessage('United States', 'INIT MISSION 2' )

elseif number==7 then
ScenEdit_SpecialMessage('United States', 'INIT MISSION 3' )

end

i need to active mission 1, 2 and 3 when the player destroy 3,5 and 7 scuds sites.

Thanks.




Rory Noonan -> RE: [LUA] Activate Mission (2/3/2016 10:55:40 PM)

There doesn't seem to be a lua function for activating missions. What you could do instead is create the missions and have them active with no units assigned, then use the 'ScenEdit_AssignUnitToMission' function to assign desired units to the mission. It should have the same end effect.




snowburn -> RE: [LUA] Activate Mission (2/3/2016 10:58:43 PM)

Thanks apache85, i will try that.

i hope the devs add a function to change mission status.




mikmykWS -> RE: [LUA] Activate Mission (2/3/2016 11:01:47 PM)

Its in the event editor itself. Look for the Action change Mission Status.




snowburn -> RE: [LUA] Activate Mission (2/4/2016 4:25:32 PM)


quote:

ORIGINAL: mikmyk

Its in the event editor itself. Look for the Action change Mission Status.


Can i use an action inside an lua script? i need to activate the mission when the the player destroy 3 SCUD sites.




Yokes -> RE: [LUA] Activate Mission (2/4/2016 4:34:41 PM)

snowburn,

One way to make it work would be to have some hidden units somewhere in the middle of nowhere. When you want to activate a mission, have one of these units (I like to use city markers) move inside a set of waypoints. Then have a "unit remains inside area" trigger set for 1 second with an action of activating the mission.

Kinda klugy, but it should work.

Yokes




mx1 -> RE: [LUA] Activate Mission (2/4/2016 4:41:26 PM)

Why don't you define a mission with no units assigned to it, and then assign units to mission with Lua ScenEdit_AssignUnitToMission() when conditions are met?

By the way the example Lua code might work incorrectly. If you are dealing with numerical values (like counting number of SCUD destroyed) the proper way is:
x = tonumber(ScenEdit_GetKeyValue("X"))
x = x+1
ScenEdit_SetKeyValue("X",X)


as the KeyValue is stored as string.





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.59375