Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

[LUA] Activate Mission

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> [LUA] Activate Mission Page: [1]
Login
Message << Older Topic   Newer Topic >>
[LUA] Activate Mission - 2/3/2016 9:45:16 PM   
snowburn


Posts: 188
Joined: 9/24/2013
From: Bovril, Argentina
Status: offline
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.
Post #: 1
RE: [LUA] Activate Mission - 2/3/2016 10:55:40 PM   
Rory Noonan

 

Posts: 2816
Joined: 12/18/2014
From: Brooklyn, NY
Status: offline
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.

(in reply to snowburn)
Post #: 2
RE: [LUA] Activate Mission - 2/3/2016 10:58:43 PM   
snowburn


Posts: 188
Joined: 9/24/2013
From: Bovril, Argentina
Status: offline
Thanks apache85, i will try that.

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

(in reply to Rory Noonan)
Post #: 3
RE: [LUA] Activate Mission - 2/3/2016 11:01:47 PM   
mikmykWS

 

Posts: 11524
Joined: 3/22/2005
Status: offline
Its in the event editor itself. Look for the Action change Mission Status.

_____________________________


(in reply to snowburn)
Post #: 4
RE: [LUA] Activate Mission - 2/4/2016 4:25:32 PM   
snowburn


Posts: 188
Joined: 9/24/2013
From: Bovril, Argentina
Status: offline

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.

(in reply to mikmykWS)
Post #: 5
RE: [LUA] Activate Mission - 2/4/2016 4:34:41 PM   
Yokes

 

Posts: 298
Joined: 3/14/2007
Status: offline
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

(in reply to snowburn)
Post #: 6
RE: [LUA] Activate Mission - 2/4/2016 4:41:26 PM   
mx1

 

Posts: 76
Joined: 1/16/2014
Status: offline
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.


(in reply to snowburn)
Post #: 7
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> [LUA] Activate Mission Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

1.656