Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

RE: Checking an aircraft in flight for RTB (5% chance)

 
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 Legion >> RE: Checking an aircraft in flight for RTB (5% chance) Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
RE: Checking an aircraft in flight for RTB (5% chance) - 5/27/2020 8:33:35 PM   
BeirutDude


Posts: 1655
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
Thank you!

Trying to digest this right now! I'm SURE I'm going to have LOTS of questions. I have to look at my licence each morning to remember who I am!

Honestly thanks for your help and its going to take me a while looking this over. Downloaded the ZIP.

_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!

(in reply to KnightHawk75)
Post #: 31
RE: Checking an aircraft in flight for RTB (5% chance) - 5/27/2020 8:37:36 PM   
KnightHawk75

 

Posts: 512
Joined: 11/15/2018
Status: offline
quote:

ALSO, when posting here how do I get the post to properly indent?


In normal forum text you kinda can't I don't think. But if you wrap it in a code block (see 'code' button in reply dialog) it usually sticks... though you might have to break things up into multiple blocks, I often have to do that if it's longer than 10-15 lines.

local Konge_1 = ScenEdit_GetUnit({ guid='XMJRWB-0HLVVBRGSPOG6'})
if Konge_1.condition_v == 'Airborne' then
    Konge_1SystemsCheck = math.random(1,1000)
    if Konge_1SystemsCheck == 1 then
        Konge_1:RTB(true)
        ScenEdit_SpecialMessage ('NATO', 'Konge 1 reports it is suffering from an engine systems failure.')
    end
end 

(in reply to BeirutDude)
Post #: 32
RE: Checking an aircraft in flight for RTB (5% chance) - 5/27/2020 8:41:13 PM   
KnightHawk75

 

Posts: 512
Joined: 11/15/2018
Status: offline

quote:

ORIGINAL: BeirutDude

Thank you!

Trying to digest this right now! I'm SURE I'm going to have LOTS of questions. I have to look at my licence each morning to remember who I am!

Honestly thanks for your help and its going to take me a while looking this over. Downloaded the ZIP.


Your welcome, and take your time, you're not wrong it's a lot to digest.

(in reply to BeirutDude)
Post #: 33
RE: Checking an aircraft in flight for RTB (5% chance) - 5/28/2020 3:32:51 PM   
jkgarner

 

Posts: 61
Joined: 4/30/2020
Status: offline
This is some good stuff...
lots of useful tricks (parameter checking, pseudo namespaces, default parameters)
and all well commented for understanding.

thanks

(in reply to KnightHawk75)
Post #: 34
RE: Checking an aircraft in flight for RTB (5% chance) - 5/29/2020 2:57:52 AM   
KnightHawk75

 

Posts: 512
Joined: 11/15/2018
Status: offline
quote:

ORIGINAL: jkgarner

This is some good stuff...
lots of useful tricks (parameter checking, pseudo namespaces, default parameters)
and all well commented for understanding.

thanks

Thanks. yeah lots typos in the comments looking back on it now I'll try to clean some of them up when\if I go back in to add the mission assignment parts, but something is usually better than nothing. I'm fan of pseudo namespaces now that cmo does not clean up the environment between scene loads, a potential for conflict exits now, even though in theory one scenes on-load of global vars and functions should overwrite prior scenes copies with the same name, but there are cases where issues can still come up unless one is very careful.

On that note I'm trying in a longer term person habit\project to pull together all my personal scripts (and some from others with credit) that have some generic use under a sort of larger api framework. Atm i call it gKHApi and then split all my files up and load\register them in a semi organized namespaces like gKH.base,gKH.Sensors, gKH.Comms,gKH.Movement,gKH.Waypoints,gKH.Unit, gKH.Database, etc That way I only load what's needed for any given scenario during startup by running the script from file, and each sub namespace knows the other namespace requirements for itself and checks if they exist first before loading. Maybe sometime I'll give a preview of the whole thing in some sample scenario or just upload it to github where people can just grab what they find useful. Would be so much easier if the default 'module' and some other basic features in lua were available, but they are restricted in the commercial version for presumably security reasons the same that all the io and load functions are so been trying to find workable ways to overcome that. The down side is it assumes it's folder and files exist under \lua\gkhapi and making people copy things into folders while shouldn't be a challenge seems to be if judging just by beta release threads.

But back to the topic..

Before I add the addition of the MISSION action option, I should explain what I'm thinking it'll do and maybe you guys can tell me if it's even worth adding or useful? So the idea is you set the action parameter to 'mission', and when set to mission instead of rtb'ing, it will assign the unit to a mission instead of RTB which the dice hit them.

Which mission it gets assigned to will depend upon what home base (unit.base) the unit has, and what the missionPrefix parameter is set too. So let's say unit#1 is based out of Airbase1, and misisonPrefix = 'Ferry_' it'll lookup the unit's base and then look to see if a mission "Ferry_Airbase1" exists, and if it does it will assign the unit to that mission, if does not it will print an error that the mission doesn't exist and move on with processing. Optionally... I could just have it create the ferry mission if it doesn't exist... but then we get into what parameters should that ferry mission have, and should it ever get removed?

Another option I thought of is when dealing with a custom TBL mode vs SIDE mode which I had in mind above, just allowing an additional action= and mission= entries in the user supplied table, in that case it'll try and first use those settings, which will allow far greater flexibility such that one can mix and match what they want done per-unit, with RTB being the default if missing.
{guid='ABSOME-GUID123456789',action='RTB'}
{name='Some Unit #1',side='Red',action='Mission',mission='FerryToSomeAirport1'}
{guid='ABSOME-GUID12345678A',action='Mission',mission='FerryToSomeOtherAirport',create=true} --create if doesn't exist?
--if we wanted to go yet another step further.
{name='Some Unit #1',side='Red',action='DamageEngine',damageType='light'} -- no auto rtb.

-- or further still, though at this point we're becoming just a generic random action on unit script.
-- which may\may not be a bad thing but i'd probably rename all the function at that point lol.
{name='Some Unit #1', side='Red', action='DamageSensor', sensorType=dbid#} --disables first matching sensor
{name='Some Unit #1', side='Red', action='DamageSensor', sensorType='Random'} --picks one at random to disable.

Thing is, and maybe one of you can enlighten me, is I don't fully grasp what the ferry mission solves that RTB doesn't. Is it just wanting to be able to easily control the speed\altitude and doctrine of the returning unit(s) per-homebase? I can see that aspect, but I'm probably just missing something obvious that's more important.

Thoughts?

< Message edited by KnightHawk75 -- 5/29/2020 11:02:10 PM >

(in reply to jkgarner)
Post #: 35
RE: Checking an aircraft in flight for RTB (5% chance) - 5/29/2020 1:19:28 PM   
jkgarner

 

Posts: 61
Joined: 4/30/2020
Status: offline
@KnightHawk75:

Regarding your statement...

quote:


On that note I'm trying in a longer term person habit\project to pull together all my personal scripts (and some from others with credit) that have some generic use under a sort of larger api framework. Atm i call it gKHApi and then split all my files up and load\register them in a semi organized namespaces like gKH.base,gKH.Sensors, gKH.Comms,gKH.Movement,gKH.Waypoints,gKH.Unit, gKH.Database, etc That way I only load what's needed for any given scenario during startup by running the script from file, and each sub namespace knows the other namespace requirements for itself and checks if they exist first before loading. Maybe sometime I'll give a preview of the whole thing in some sample scenario or just upload it to github where people can just grab what they find useful. Would be so much easier if the default 'module' and some other basic features in lua were available, but they are restricted in the commercial version for presumably security reasons the same that all the io and load functions are so been trying to find workable ways to overcome that. The down side is it assumes it's folder and files exist under \lua and making people copy things into folders while shouldn't be a challenge seems to be if judging just by beta release threads.


I have been looking at (and started) creating a pseudo-namespace for the functions similar to what you describe. One issue that I ran into was how to insert them easily AND ensure they remain in the scenario after saving and loading, all while choosing the directory for the scripts... (I like to keep my stuff separate from community/official release, AND I like to have each scenario's scripts in its own directory. This makes finding stuff later a lot easier.

To accomplish this, I put together a way to insert the 'library' functions easily into the scenario, and guarantee that they are available when reloading.

The short of it is that I have two scripts. The library script and a library init script. My library is called 'AFWI', thus I have AFWI.lua and AFWIinit.lua.

I have written the instructions for use in the init file. This file creates the sides, and a few events (with triggers and actions) to load the side scripts, and most importantly, load the AFWI library.

I have uploaded an abbreviated AFWI library (as an example) and the AFWIinit file along with simple scenario side setup scripts to show how things go together.

Feel free to examine are modify/use as you see fit.





Attachment (1)

(in reply to KnightHawk75)
Post #: 36
RE: Checking an aircraft in flight for RTB (5% chance) - 5/29/2020 11:01:02 PM   
KnightHawk75

 

Posts: 512
Joined: 11/15/2018
Status: offline
I'll look it over later tonight, sounds like we're doing similar things (just makes sense after all right!), similarly organized .. Just quick eyeballing though.... dam though dude your comments are so neat and tidy!


(in reply to jkgarner)
Post #: 37
RE: Checking an aircraft in flight for RTB (5% chance) - 5/31/2020 2:12:29 PM   
BeirutDude


Posts: 1655
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
Man you guys are soooooo far beyond my skills. I'm looking at the code and, well I guess I'm hopeless!

_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!

(in reply to KnightHawk75)
Post #: 38
RE: Checking an aircraft in flight for RTB (5% chance) - 5/31/2020 2:49:06 PM   
BeirutDude


Posts: 1655
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
So I initially did a Ferry Mission and that worked well.

The two issues I had with it were...

1. The player could just reassign it to the original mission (which admittedly they can as well with an RTB)
2. If I assigned the aircraft to an "Allied Side" and Ferried/RTBed it to the base then it gone for the remainder of the scenario unless I found a way to "Give it back" some time after it landed and the first was within my skills but the second wasn't (didn't know how to test if a unit has returned to base and landed nor allow proper time to "fix" the aircraft).

I'm still troubled on why
Math.Random(N,M)
Math.Randomseed(ostime())

Are not working correctly in the game but ARE working in the Lua Console!!!!! That is a major issue to me!

< Message edited by BeirutDude -- 5/31/2020 2:50:33 PM >


_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!

(in reply to KnightHawk75)
Post #: 39
RE: Checking an aircraft in flight for RTB (5% chance) - 6/1/2020 9:30:21 AM   
KnightHawk75

 

Posts: 512
Joined: 11/15/2018
Status: offline
Well you know #2 now, sort of anyway. :)
Just for clarity for future readers the order should be reversed when used, though it was probably just how you typed it for the post.
Math.Randomseed(ostime())
Math.Random(N,M)

As for the why, idk.

But you're not stay the sample (with use of improvedRandom() ) isn't working right?

(in reply to BeirutDude)
Post #: 40
RE: Checking an aircraft in flight for RTB (5% chance) - 6/13/2020 3:32:44 PM   
BeirutDude


Posts: 1655
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
So Knighthawk75, thank you very much fir trying t help me, but I've looked this all over over the past 2 weeks or so and I don't understand any of it. Guess I'm just hopeless, but thanks for trying.

_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!

(in reply to KnightHawk75)
Post #: 41
RE: Checking an aircraft in flight for RTB (5% chance) - 6/14/2020 8:19:40 PM   
KnightHawk75

 

Posts: 512
Joined: 11/15/2018
Status: offline
Well you don't have to necessarily understand it fully to use it. Or is that what you mean too?

Are there particular parts, or pieces of certain function where you get lost and I could help explain what's going on?

(in reply to BeirutDude)
Post #: 42
Page:   <<   < prev  1 [2]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> RE: Checking an aircraft in flight for RTB (5% chance) Page: <<   < prev  1 [2]
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