Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Starter Scen?

 
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 >> Starter Scen? Page: [1]
Login
Message << Older Topic   Newer Topic >>
Starter Scen? - 2/3/2019 2:13:58 AM   
Whicker

 

Posts: 621
Joined: 6/20/2018
Status: offline
Has anyone created a starter scenario? to work as a base when making a new scen?

I haven't seen one, about to start working on one.

it would start with:

- Sides for Red, Blue and Biologics
- red and blue unfriendly to each other
- bios blind and computer only
- civilian side? or some other side?
- Basic Scoring events
- On Scen load event with some handy functions
- Nicely formatted briefing and descriptions
- Special Action for in game timer

It looks like you could setup triggers for red and blue, and even if you change those to NATO or WP or anything else the existing triggers would all still work as I think they are using the guids.

Any other ideas of what could be in there to make starting a scen easier?
Post #: 1
RE: Starter Scen? - 2/3/2019 5:01:27 AM   
Whicker

 

Posts: 621
Joined: 6/20/2018
Status: offline
Mostly done I think:

- universal scoring for red and blue sides - can play either side and same 2 lua scoring events should work.
- special action for In Game Timer
- special action to deploy recon team from ships or subs (modified from Apache85 Sakura Blue scen)
- briefing and description with basic formatting (obviously this is very subjective, I like the charcoal background, but mainly I dislike the default font that gets used if there are no styles, open to suggestions)
- Survivor script - disabled
- random bios script
- place unit randomly script
- print Unit/Side wrappers
- handful of small misc scripts
- luahistory logging of units destroyed and damaged
- Most functions documented in briefing

Still to do:
- some sort of random weather
- ?

attached scen can be played from either side, there are a few units on each side set to attack each other, just choose a side and press play and speed up to 30x to watch what happens, which isn't much. If you monitor the luahistory log you get info on units destroyed/damaged and scoring.

Check scoring from either side, should be correct (you have to run it as each side, the PlayerSide() gets the scoring).

Updated 8-5-19 v 1.12


Attachment (1)

< Message edited by Whicker -- 8/6/2019 5:05:27 AM >

(in reply to Whicker)
Post #: 2
RE: Starter Scen? - 2/3/2019 2:34:18 PM   
daveoreno


Posts: 49
Joined: 8/27/2016
From: Toronto, Canada
Status: offline
Brilliant time saver. I always love having the built in timer action.

Dave

(in reply to Whicker)
Post #: 3
RE: Starter Scen? - 2/4/2019 4:17:10 AM   
Whicker

 

Posts: 621
Joined: 6/20/2018
Status: offline
I've updated the 2nd post - added some scripts. Still needs a bunch of documentation.

I added the survivors script, and played with it from both sides, it worked, but the messaging needs to be able to be on either side. If it was setup for both sides you could capture an enemy's downed pilot and maybe get some intel? seems cool but not sure it is worth the effort.

(in reply to daveoreno)
Post #: 4
RE: Starter Scen? - 3/15/2019 3:15:55 AM   
Whicker

 

Posts: 621
Joined: 6/20/2018
Status: offline
updated second post with V1.12

List of stuff included:
-------------------------------------------------
Scoring via Lua Actions

Simple scoring is setup for both Red and Blue and should work correctly from either side.

Scoring is controlled by 2 Lua Actions - one for Red Unit Destroyed and one for Blue Unit Destroyed.

You can get as granular as needed with the scoring by adding elseif statements to check different unit properties such as the unit name or classname.

ex: string.match(unit.classname, "F%-15") then points = -17

The % is to escape the dash which is an illegal character in string.match. To use string.match you pass in 2 things - the string to check (unit.classname) and the thing you want to see if is there - in this case f-15 which needs to be f%-15 to allow the dash. Once you have the elseif set then you change the Points to whatever you want. If you are using the Survivors script then you can do the same thing in that same elseif to change the Crew variable.

Available Special Actions

1) In Game Timer - all needed code is in the Special Action.


2) Deploy Recon unit from a ship or sub. Each ship or sub can deploy one recon unit. In order to do so the ship or sub must be within a set distance from land (default 2.5 miles but configurable in the Action code), and must be traveling at less than 6 mph, and at a depth of less than 31m. the code for this is loaded on scen load via a lua action. The Special Action code is just to call the main function. When using the Special Action the user will be prompted for a bearing to send the recon team out on, and that is where the check for land worthyness will happen. If you don't want ships or subs to be able to deploy a recon team just delete the Special Action. If you want to limit the number of units that can deploy a recon unit an easy hack is to make more than one Special Action but make them not repeatable. This would not limit which units could deploy a recon unit, but you would be limiting how many recon teams could be deployed.

3) Unit Locator enter in the name or part of a name of a unit and a pop up message will come up with a link to go to that unit. Probably uses a lot of memory on large scenarios.

Available Functions

Below is a list of functions already loaded into this scenario via on Scenario Load Events.

There are 5 Lua actions loading functions on scen load.

1) SAR - Downed Pilot - Survivors Script (via angster/TyphoonFr modified by Whicker) - (Actually 2 Actions for these)
2) Create Random Bios (via Whicker)
3) Place Unit Randomly (via Whicker / KnightHawk75)
4) Deploy Recon team from subs/ships
5) Misc Helpers (via https://github.com/rjstone/cmano-lua-helpers)

Survivors Script

The Survivors Script is loaded but not enabled. You can enable it by going to the Blue Unit Destroyed Action and un-commenting the last line. There are other Survivor related bits here and there but they can be ignored if you are not using it. That one line is what creates a Survivor.

There are additional configuration options for the Survivors Script located in the main script located under actions - Lua - Load SAR Script.

The potential number of survivors can be controlled by the number of crew passed in. This can be done in the same manner and in the same elseif section as the Lua scoring.

function ww(unitTable)
-- same thing as ScenEdit_GetUnit(unitTable) just easier to type
-- local u = ww({name='F-14D Tomcat', guid='78407e18-3841-4f63-bcc2-df202cc3dc3c'}) print(u.name)

function W_RandomBios(side,topLeftPoint,topRightPoint,bottomRightPoint,bottomLeftPoint,spacingInMiles,minDepth,distanceJitter,angleJitter, addMoreColumns, addMoreRows)
-- requires 4 Reference points (should be a rectangle)
-- requires Tool_EmulateNoConsole(true) if running from the console or you get a mission error
-- ex: W_RandomBios('Biologics','RP-1','RP-2','RP-3','RP-4',37,-40,10,10,2,2)
-- minDepth should be negative
-- the more jitter (angle or distance) the more random


function W_PlaceUnitRandomly(side, ship, distance, bmin, bmax, mindepth,randomalt)
-- side and ship are only required parameters, if you need one at the end then you have to set all previous ones
-- bmin and bmax default to 1 and 360, used to control bearing of where unit can move to ex bmin=90, bmax=180 unit will be placed south east of current location if possible.
-- distance defaults to 100 miles
-- minDepth defaults to -20 meters
-- randomalt is for AC (boolean) defaults to false, you can set depth to anything it is ignored for AC (use 0)
-- W_PlaceUnitRandomly('Blue', 'CG 16 Leahy', 125, 30, 230, -100)
-- W_PlaceUnitRandomly('Blue', 'F-14D Tomcat', 125,1,33,0,true)

function W_GetUnitProps(unitName)
--prints full unit wrapper
--W_GetUnitProps({name='F-14D Tomcat', guid='78407e18-3841-4f63-bcc2-df202cc3dc3c'})
--W_GetUnitProps('F-14D Tomcat')

function W_GetSideProps(sideName)
--prints full Side wrapper wrapper, may be memory hog
--W_GetSideProps('Red')

function W_GetSideUnitTotals(sideName)
--prints the number of ships, subs, AC and facilities on a side, may be memory hog
--W_GetSideUnitTotals('Red')

function W_GetSideUnitTotalsTable(side)
--returns 4 tables of guids - one for each of Aircraft,Ships,Submarines, Facilities in that order
--local AC,Ships,Subs,Facilities =W_GetSideUnitTotalsTable('red')

function W_GetTableCount(table)
-- Count the number of items in a table regardless of table type.

function W_PathOffset()
-- calculates a small number like .002 to be used as an offset to a course (Escape from port uses this)
-- offset = W_PathOffset() or print(W_PathOffset)

function W_GetCourse(side,unitname)
-- prints the course of the unit passed in, use this to get a course to escape from a port (also returns it)
-- W_GetCourse('Blue','F-14D Tomcat')

function W_EscapeFromPort(unitx,newCourse)
-- used to help ships escape a port. Create an Event with trigger of unit enters area (around port but not including it)
-- You need to create a course that will work, then assign that to a variable (NOT local) and pass it in along with unitx
You can also use it with a specific unit by passing in a table with the guid - name is optional but it comes along with it when you right click and choose get Unit ID. This also works if you pass in the function for W_GetCourse with a unit specified in that.
-- W_EscapeFromPort({name='CG 16 Leahy', guid='cde0f12a-3eec-4613-8527-fa9fc92ec98f'},course)
-- W_EscapeFromPort({name='CG 16 Leahy', guid='cde0f12a-3eec-4613-8527-fa9fc92ec98f'}, W_GetCourse('Blue','F-14D Tomcat'))

function W_OverWater(latitude, longitude)
-- check if location is over water, returns true/yes if over water
-- print(W_OverWater('26.7837580250281','-72.7095962123351'))

function W_UnitAltitudeAboveGround(unitguid)
--should only be used on AC, returns value in meters
-- W_UnitAltitudeAboveGround('78407e18-3841-4f63-bcc2-df202cc3dc3c') --F-14

function W_RandomLetter()
-- returns a random uppercase letter. Used to modify a unit name
-- print(W_RandomLetter())

function W_DrawRPCircleAroundUnit(sidename, unit_name, radius, numpts, nameprefix, firstindex)
-- Draw 5nmi radius circle around "US" unit named "My Ship" with 12 points labeled B-1 to B-12
-- W_DrawRPCircleAroundUnit("Blue", "F-14D Tomcat", 5, 12, "B-", 1)

function W_DrawRPCircle(sidename, location, radius, numpts, nameprefix, firstindex)
-- Draw a 30nmi radius circle for side "Blue" around Atlanta with 12 points labeled ATL-1 through ATL-12 like a clock.
-- W_DrawRPCircle("Blue", {latitude='33.761939187143', longitude='-84.3825536773889'}, 30, 12, "ATL-", 1)
-- Last three arguments are optional and have default values if not specified.
-- W_DrawRPCircle("Blue", {latitude='33.761939187143', longitude='-84.3825536773889'}, 30)

function W_DeleteReferencePointsByPrefix(sidename, prefix, firstindex, lastindex)
-- Delete all reference points for a side with a given prefix and a given range of numbers after the prefix.
-- Does not return true/false Example usage:
-- Delete all reference points for "Blue" named B-1 through B-12.
-- W_DeleteReferencePointsByPrefix("Blue", "B-", 1, 12)

function W_AssignUnitsToMission(nameprefix, startcount, endcount, missioname)
-- Assign Units to Mission by name prefix
-- Written by Kevin Kinscherf (2016-12-9)
-- "Functionized" by NimrodX
-- Usage example:
-- W_AssignUnitsToMission("Hawk #", 1, 3, "test") assigns Hawk #'s 1-3 to mission test


function W_TimeFromNow(MinutesFromNow)
-- returns the time x minutes from now in a format that can be used to set a mission start time, or a trigger time. Used by W_SetMissionStartTime
-- currentMission.starttime =W_TimeFromNow(60)
-- print(W_TimeFromNow(120))

function W_SetMissionStartTime(sideName,missionName,minutesFromNow)
-- Set mission to start x minutes from current game time "now"
-- W_SetMissionStartTime('Blue','test',120)

function W_ActivateMission(sideName,missionName)
-- Set a mission active by side,name.

function W_DeactivateMission(sideName,missionName)
-- Set mission inactive by side,name.

function W_RefuelUnitIfLow(side, name, minfuel, fueltype)
-- Refuel Unit if Low
-- This will change the onboard fuel for an aircraft depending upon some condition.
-- If the fuel level goes below 'minfuel' it will be reset to the maximum allowed for the aircraft.
-- To check this level constantly there must be a trigger condition such as one based on time that checks
-- every 15 minutes. So call this in the action for that repeatable event.
-- Example usage:
-- W_RefuelUnitIfLow("Civilian", "Jumbo Jet", 22000) -- refuel to max if fuel gets below 22,000
-- Defaults to airplane fuel but a different fuel type can be set as the 4th argument.

function W_ConfirmSpecialAction(actionDescription)
-- pops up a special mesage box to confirm you want to execute a special action

function W_UnitAltitudeAboveGround(side, unitguid)
-- returns altitude above ground in meters, should only be used on AC
-- print(W_UnitAltitudeAboveGround('blue','78407e18-3841-4f63-bcc2-df202cc3dc3c'))

function W_SetGroupAutodetectable(side,groupName, trueOrFalse, onlyUnitsWithName)
-- change a groups autodetectability, could be ships or air base
-- you can specifiy a particular unit, like runways, or a specific ship (optional)
-- W_SetGroupAutodetectable('blue','Group 355', true,'Leahy')

function W_SetGroupSide(oldSide, groupName, newSide)
-- change a group and its units from one side to another
-- W_SetGroupSide('red','Group 355', 'blue')

function W_CreateAirBase(basename,side,latlonTable, runways, taxiways, accesspoints, tarmacspaces, hangers, ammopads,detectable)
-- Create an Airbase
-- W_CreateAirBase('Blue Base','Blue',{latitude='33.1627149920328', longitude='-85.1563196873111'}, 2, 1, 5,16,16,6,true)

function W_Subtype(type,subtype)
-- Returns readable subtype from subtype number - also prints it to the console log
-- W_Subtype('Ship',3203)



updated for 1.12 8-5-19

< Message edited by Whicker -- 8/6/2019 5:07:41 AM >

(in reply to Whicker)
Post #: 5
RE: Starter Scen? - 3/15/2019 9:34:07 AM   
Gunner98

 

Posts: 4157
Joined: 4/29/2005
From: The Great White North!
Status: offline
Just saw this thread - great idea. You may wish to add random weather. And I recall a script for random commercial shipping, that might be useful if set up disabled similar to the SAR script.

Haven't downloaded this yet but should be able to check it out in a couple weeks.

Thanks

B

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to Whicker)
Post #: 6
RE: Starter Scen? - 3/16/2019 3:03:35 PM   
KnightHawk75

 

Posts: 113
Joined: 11/15/2018
Status: offline
Nice.





(in reply to Gunner98)
Post #: 7
RE: Starter Scen? - 4/22/2019 3:55:46 AM   
Whicker

 

Posts: 621
Joined: 6/20/2018
Status: offline
updated post 2 and 5 for version 1.7

- better tested/fixed some bugs, examples of functions should now work with the test units in the game already
- added couple more helper functions
- W_GetCourse(side,unitname)
- W_TimeFromNow(MinutesFromNow)

(in reply to KnightHawk75)
Post #: 8
RE: Starter Scen? - 6/1/2019 1:14:08 PM   
lumiere

 

Posts: 90
Joined: 3/19/2019
From: Japan
Status: offline
In short: AWESOME!

_____________________________

The first casualty when war comes is truth.
US Senator Hiram W. Johnson (?)

(in reply to Whicker)
Post #: 9
RE: Starter Scen? - 6/2/2019 4:43:06 PM   
Andrea G


Posts: 300
Joined: 10/9/2017
From: Genoa, Italy
Status: offline
Well with all this documentation there is no reason I should refrain from designing myself

_____________________________

"My name is Maurizio Cocciolone"
Italian pilot downed during Desert Storm
Start phrase of his interviw on the Iraqui TV

(in reply to lumiere)
Post #: 10
RE: Starter Scen? - 6/2/2019 11:15:24 PM   
Whicker

 

Posts: 621
Joined: 6/20/2018
Status: offline
thanks, I like it so far.

I just updated it to 1.8. How many times while you are typing out ScenEdit_GetUnit() do you just wish you could type something easier?

I added a function that is called ww that takes in a unit table and returns ScenEdit_GetUnit().

So instead of:
local u = ScenEdit_GetUnit({name='F-14D Tomcat', guid='78407e18-3841-4f63-bcc2-df202cc3dc3c'})
print(u.name)

you can do:
local u = ww({name='F-14D Tomcat', guid='78407e18-3841-4f63-bcc2-df202cc3dc3c'})
print(u.name)

normally all the functions I create start with W_ to make sure they are unique, ww is just easier and is unique as well hopefully.

(in reply to Andrea G)
Post #: 11
RE: Starter Scen? - 6/29/2019 9:23:45 PM   
Whicker

 

Posts: 621
Joined: 6/20/2018
Status: offline
added unit locator as a special action and a few new functions:

function W_UnitAltitudeAboveGround(side, unitguid)
-- returns altitude above ground in meters, should only be used on AC
-- print(W_UnitAltitudeAboveGround('blue','78407e18-3841-4f63-bcc2-df202cc3dc3c'))

function W_SetGroupAutodetectable(side,groupName, trueOrFalse, onlyUnitsWithName)
-- change a groups autodetectability, could be ships or air base
-- you can specify a particular unit, like runways, or a specific ship (optional)
-- W_SetGroupAutodetectable('blue','Group 355', true,'Leahy')

function W_SetGroupSide(oldSide, groupName, newSide)
-- change a group and its units from one side to another
-- W_SetGroupSide('red','Group 355', 'blue')

(in reply to Whicker)
Post #: 12
RE: Starter Scen? - 7/18/2019 3:55:16 AM   
magi

 

Posts: 1285
Joined: 2/1/2014
Status: offline
thank you sir....

(in reply to Whicker)
Post #: 13
RE: Starter Scen? - 8/6/2019 5:16:19 AM   
Whicker

 

Posts: 621
Joined: 6/20/2018
Status: offline
updated to 1.12 to add:

function W_CreateAirBase(basename,side,latlonTable, runways, taxiways, accesspoints, tarmacspaces, hangers, ammopads,detectable)
-- Create an Airbase
-- W_CreateAirBase('Blue Base','Blue',{latitude='33.1627149920328', longitude='-85.1563196873111'}, 2, 1, 5,16,16,6,true)

function W_Subtype(type,subtype)
-- Returns readable subtype from subtype number - also prints it to the console log
-- W_Subtype('Ship',3203)

function W_GetSideUnitTotalsTable(side)
--returns 4 tables of guids - one for each of Aircraft,Ships,Submarines, Facilities in that order
--local AC,Ships,Subs,Facilities =W_GetSideUnitTotalsTable('red')

the last one is interesting - it returns 4 tables of guids - 1 for each of AC,Ships,Subs and Facilities. It is a bit of a memory hog. Not sure what I will do with it, but one idea I have is to use it along with the subtype converter to build a list of units each side has based on their subtype. So you could run it as you finish building a scenario to generate a list of units the enemy side has - without revealing exactly what they are - like 44 Fighters, 12 bombers etc. Could even divide the number by the number in a squadron to be more opaque and say 3 squadrons of fighters, 2 squadrons of bombers, 3 DDGs and 4 SSNs.

The create airbase one is probably my favorite.

(in reply to magi)
Post #: 14
RE: Starter Scen? - 8/7/2019 6:03:42 AM   
Dimitris


Posts: 11153
Joined: 7/31/2005
Status: offline
Don't want to spoil things, but scripts such as these are going to be very useful quite soon. Thank you for sharing.

_____________________________


(in reply to Whicker)
Post #: 15
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Starter Scen? 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

0.133