Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Trying to make SAR Scenario

 
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 >> Trying to make SAR Scenario Page: [1]
Login
Message << Older Topic   Newer Topic >>
Trying to make SAR Scenario - 6/27/2016 1:12:33 AM   
Halsey1945

 

Posts: 21
Joined: 5/18/2015
Status: offline
Hello Everyone,

I am trying to make a SAR scenario in the Gulf of Mexico. It has the USCG searching for four randomly placed lifeboats. I am using a neutral side. This is to keep you from knowing where they are. I have gotten the lifeboats to randomly spawn. Now I am trying to have the lifeboats switch sides once they are detected. I have a detection trigger and am trying to use a lua script (SetUnitSide) action. However, I am having trouble using the UnitX script to tell Command which unit needs to change sides. Does anyone have any advice? I am quite new to lua.
Post #: 1
RE: Trying to make SAR Scenario - 6/27/2016 1:45:19 AM   
Rory Noonan

 

Posts: 2816
Joined: 12/18/2014
From: Brooklyn, NY
Status: offline
Generally I would do something like so:

Unit = ScenEdit_UnitX() --Assigns UnitX table activating the trigger to the variable 'Unit'
UnitID = Unit.name --Assigns the 'name' field from the above table to the variable 'UnitID'
ScenEdit_SetUnitSide({side='Side 1',name=UnitID,newside='Side 2'}) --Changes side

If that doesn't work post your scenario up and I'll have a look

Bonus tip working with Lua: Use an editor like Notepad++ to check your code before you put it into CMANO, and if you're having trouble try running it line by line to find the error. Also make good use of the print command to check your variables. It gets easier, and the more you use it the more you'll find reasons to use it

< Message edited by apache85 -- 6/27/2016 1:50:32 AM >

(in reply to Halsey1945)
Post #: 2
RE: Trying to make SAR Scenario - 6/27/2016 1:56:11 AM   
Randomizer


Posts: 1473
Joined: 6/28/2008
Status: offline
I would advise deleting the life rafts after rescue as they serve no puropose once the people in them are picked up.

See:

Scripting sea rescues

Your call

-C

(in reply to Rory Noonan)
Post #: 3
RE: Trying to make SAR Scenario - 6/27/2016 10:40:32 PM   
Halsey1945

 

Posts: 21
Joined: 5/18/2015
Status: offline
Thank you Apache! That worked like a charm.

Good point Randomizer. However, I can't seem to get the reference points to follow the rafts after they teleport. And, I can't seem to create a trigger and event after the scenario is loaded. I can create reference points surrounding the rafts, but not the trigger. That may be because I am a noob to Lua though. As of right now I am just having the user dispatch cutters to the rafts and pick them up.

(in reply to Randomizer)
Post #: 4
RE: Trying to make SAR Scenario - 6/28/2016 12:16:36 AM   
Randomizer


Posts: 1473
Joined: 6/28/2008
Status: offline
If you want to get fancy you're going to need to learn Lua. Experiment with the script console, it's a great tool for scenario writing.

Fix the reference points to the raft and they will teleport with the raft to the scene of the sinking. You can test this easily enough but you can demonstrate it by just fixing the reference point, move the raft (using the M=Move command) then run the game for one second and the reference points will teleport as intended. Then write events to delete the raft when the rescue is triggered. Because the raft side is neutral, the Player's map will not become cluttered with dead reference points.

If you examine the test scenario I linked to above, the necessary Lua scripts should all be there and need only be copied and edited according to your requirements and naming conventions.

-C

(in reply to Halsey1945)
Post #: 5
RE: Trying to make SAR Scenario - 6/29/2016 8:14:03 PM   
Halsey1945

 

Posts: 21
Joined: 5/18/2015
Status: offline
Thank you Randomizer. The script console is great. I am currently playing around with it and learning quite a bit. And, you are right Apache. Notepad++ is great.I have used it for other programming, but didn't realize it can help with Lua, too. I just wish it was more accessible. Since, I am legally blind and my magnifier does not follow the cursor. Anyways, I think I'm starting to get the hang of it. And, there is so many uses for it.

(in reply to Randomizer)
Post #: 6
RE: Trying to make SAR Scenario - 7/17/2016 7:18:30 PM   
Halsey1945

 

Posts: 21
Joined: 5/18/2015
Status: offline
A bit off topic. However, what are the following scripts? I found them in the script console. And, haven't found anything in the forums, wikis, or documentation about them.

VP_GetSide(table)
VP_GetUnit(table)
World_GetCircleFromPoint(table)
World_GetElevation(table)

(in reply to Halsey1945)
Post #: 7
RE: Trying to make SAR Scenario - 7/18/2016 3:34:14 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
quote:

ORIGINAL: Halsey1945

A bit off topic. However, what are the following scripts? I found them in the script console. And, haven't found anything in the forums, wikis, or documentation about them.

VP_GetSide(table)
VP_GetUnit(table)
World_GetCircleFromPoint(table)
World_GetElevation(table)


1. VP_GetSide(table) Gives a pointer to the 'side' object. Only use I have seen to date is for the change to the Nav Zones as shown in 1.11 SR1
mySide = VP_GetSide({Name="US"})
myZone = mySide.getnonavzone("AAW Zone 1") [Alternative for excl. zone: myZone = mySide.getexclusionzone("Forbidden Zone 1")]
myZone.isactive = "True"/"False"


2.VP_GetUnit(table) I expect that this is similar except it lets you address a 'unit' to get the 'side'. But you could use ScenEdit_GetUnit() and use the 'side' value of it to feed into VP_GetSide().

3.World_GetElevation(table) Gives you altitude of the location specified
unit=ScenEdit_GetUnit({Name="Cactus #2"});print(unit);
world = World_GetElevation({latitude=unit.latitude, longitude=unit.longitude});print(world) -- altitude of the point Cactus #2 is flying over


4.World_GetCircleFromPoint(table) As it says, it will give you a set of 45 points around a location at a specific radius (in NM)
world = World_GetCircleFromPoint({latitude=unit.latitude, longitude=unit.longitude, radius = 100});print(world)
for i=1,45 do
ScenEdit_AddReferencePoint({
side='LZs',
lat=world.Latitude,
lon=world.Longitude,
name=i,
highlighted="yes"})
end



< Message edited by michaelm -- 7/18/2016 4:00:25 AM >


_____________________________

Michael

(in reply to Halsey1945)
Post #: 8
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Trying to make SAR Scenario 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

5.547