Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Newby lua Waypoint question

 
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 >> Newby lua Waypoint question Page: [1]
Login
Message << Older Topic   Newer Topic >>
Newby lua Waypoint question - 4/5/2020 9:16:48 AM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
Apologize in advance for my most likely an operator error.
I can add a waypoint for a unit.
My question is should I be able to add the additional info to that waypoint like speed?
And should I see that back in the F2 info of that waypoint.
Found on the feilds on http://commandlua.github.io/#Waypoint
But I cannot get it working.
Best regards and thank you in advance.

_____________________________

Post #: 1
RE: Newby lua Waypoint question - 4/5/2020 2:20:26 PM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
I see now I'm behind in version of the game (steam). So that might be the cause. Please delete this report.
regards

(in reply to Parel803)
Post #: 2
RE: Newby lua Waypoint question - 4/6/2020 12:31:01 PM   
KnightHawk75

 

Posts: 1117
Joined: 11/15/2018
Status: offline
In case it's not version behind issue - Basically you want to build a new table with all your waypoint data you want assigned for the unit, then swap that table for the current .course table on the unit. Are the desired\preset speed part the problem specifically or just getting it to work in general?

local myNewCourse = {};
table.insert(myNewCourse,{latitude=150.0,longitude=10.0,description='Segment 1'});
table.insert(myNewCourse,{latitude=150.0,longitude=20.0,description='Segment 2'});
table.insert(myNewCourse,{latitude=150.0,longitude=30.0,description='Segment 3',desiredSpeed=350.0});
local u = ScenEdit_GetUnit({name='blalbla'});
u.course = myNewCourse;



< Message edited by KnightHawk75 -- 4/7/2020 3:21:18 AM >

(in reply to Parel803)
Post #: 3
RE: Newby lua Waypoint question - 4/6/2020 3:25:30 PM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
Thank you. I'm gonna try this evening

(in reply to KnightHawk75)
Post #: 4
RE: Newby lua Waypoint question - 4/7/2020 7:22:35 AM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
The waypoints worked, thx. I had a SurfaceShip. It checked the box "manual override" but hasn't filled in the desired speed in the appropriate line. Gonna stuggle further this evening.
Another question would be: is it possible to do this for a group (TG)? And if so, which SE should I use.
Thx again
with regards

_____________________________


(in reply to Parel803)
Post #: 5
RE: Newby lua Waypoint question - 4/7/2020 1:22:45 PM   
KnightHawk75

 

Posts: 1117
Joined: 11/15/2018
Status: offline
Hmm, using the desiredSpeed= setting on my install and on an individual unit shows segment3 as having manual speed checked and the 390 speed, not sure why you see different results, though my test were all aircraft.

**That said when I do it for a group, you are correct it doesn't apply the speed settings correctly\as expected.**
That seems like a bug to me, as it always inherits whatever the current group speed settings are for all waypoints, yet does take the throttle preset setting and apply it. I didn't test altitude.

As mentioned yes you can do it for a group, you would use the same se_GetUnit() but use the groupname\groupguid for the unit object, as the group object has it's own .course property table just as you would a singular unit.

One way to get around the speed setting bug is write a function that loops though any given group's member units and apply the waypoints individually to each one.

local function applyWaypoint(uGuid)
 local myNewCourse = {};
 table.insert(myNewCourse,{latitude=150.0,longitude=10.0,description='Segment 1',desiredSpeed=390});
 table.insert(myNewCourse,{latitude=150.0,longitude=15.0,description='Segment 2',desiredSpeed=410.0});
 table.insert(myNewCourse,{latitude=150.0,longitude=20.0,description='Segment 3',desiredSpeed=420.0});
 local u = ScenEdit_GetUnit({guid=uGuid});
 u.course = myNewCourse;
end

local u = ScenEdit_GetUnit({name='SomeGroupOrUnitname'});
if (u ~= nil) then
  if (u.type == 'Group') then
    for i,v in pairs(u.group.unitlist) do
     applyWaypoint(v);
    end
  else
    applyWaypoint(u.guid);
  end
end


Doing the above then does seem to also set the group settings to what the individual units all are, strange, maybe it picks it up from which ever unit is 'lead' in a group? I don't know how to determine the lead in LUA since it seems the unit formation property table doesn't provide that information.







< Message edited by KnightHawk75 -- 4/7/2020 1:26:12 PM >

(in reply to Parel803)
Post #: 6
RE: Newby lua Waypoint question - 4/7/2020 1:58:50 PM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
Going to try again. Thank you for answering.
with regards

_____________________________


(in reply to KnightHawk75)
Post #: 7
RE: Newby lua Waypoint question - 4/7/2020 3:00:48 PM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
It looks like that I can't get it with "desiredSpeed" on a ship. Same on a Submarine. Have it working on a A/C.

Groups works nic, thx. Same issue, if I'm correct, it works for an air group not for a surface ships group.

I'm new at it so could be an operator error on this end.

with regards




_____________________________


(in reply to Parel803)
Post #: 8
RE: Newby lua Waypoint question - 4/7/2020 3:27:39 PM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
The presetThrottle works for all waypoints. But presetDepth not voor the sub.
Atleast on this side.
regards

(in reply to Parel803)
Post #: 9
RE: Newby lua Waypoint question - 4/7/2020 4:14:56 PM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
Probably not importent but it looks like the presetThrottle for A/C with 'military' is the only one that don't give the right response in F2 and the other waypoints after this one are not in the system.

(in reply to Parel803)
Post #: 10
RE: Newby lua Waypoint question - 4/7/2020 9:06:29 PM   
KnightHawk75

 

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

quote:

ORIGINAL: Parel803

It looks like that I can't get it with "desiredSpeed" on a ship. Same on a Submarine. Have it working on a A/C.

On singular ships and subs desiredSpeed does works for me but...
It will not work while ship\sub is member of a group though(unless it's the only member of the group), and only the lead of a group will even take a waypoint when it's a surface group, oddly multiple subs do get waypoints if grouped among themselves. I imagine this is because of all the relative\fixed station bearing logic stuff for surface ship groups overwriting whatever waypoints we set. idk?? The inconsistent treatment is odd and confusing though.

Still bottom line is setting speed on group's waypoints seems broken, and particularly so when it comes to grouped ships\subs where there isn't a good work around - other then not grouping. I didn't have a chance to test the presetDepth settings much but it did appear to take 'Surface' and 'Shallow' etc even though the f2 gui doesn't display it correctly it stays in the waypoint table but I didn't run it long enough to see if it actually followed the instructions.

(in reply to Parel803)
Post #: 11
RE: Newby lua Waypoint question - 4/8/2020 7:22:17 AM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
Thank you for you're time and lessons in the lua. Enjoyed it.
with regards

_____________________________


(in reply to KnightHawk75)
Post #: 12
RE: Newby lua Waypoint question - 4/8/2020 6:05:23 PM   
orca

 

Posts: 490
Joined: 11/6/2013
Status: offline
Edit- sorry posted in wrong tread. Please disregard.

Not sure if the LUA forum or game feature request forum is the best location for this post but I will start here to see what others think....

I frequently have difficulties timing missions/strikes when creating a scenario. Until a possible future strike planner is available, some kind of LUA time trigger script may be helpful to plan strikes/missions.

LUA timetrigger script:
is an action.
when this timetrigger script is triggered, a timer (length of time determined by the user) starts
when this timer ends then the script creates a new trigger that can be used to initiate an event (ie launch strike mission)

possible script variables: timer length, resulting new trigger name

There are several relatively clunky workarounds to accomplish this basic goal of timing, but I think a LUA script like this would be very helpful for scenario designers. I know little about LUA so not sure if this is even possible.




< Message edited by orca -- 4/9/2020 12:33:45 AM >

(in reply to Parel803)
Post #: 13
RE: Newby lua Waypoint question - 6/22/2021 8:06:57 AM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
A follow up Question just to confirm, if I may.

I Tried:
local myNewMLA = {};
table.insert(myNewMLA,{latitude='12.2719935992898', longitude='111.929875733348',description='TstLeg2',presetAltitude='High25000'});
table.insert(myNewMLA,{latitude=12.3,longitude=111.0,description='TstLeg3',presetAltitude='low'});
local u = ScenEdit_GetUnit({name='F-16AM Falcon MLU', guid='50PVO4-0HM9L8UEF7T5O'});
u.course = myNewMLA;
print (u.course)

The print gives me both preset Altitudes for the WP's
{ [1] = { Description = 'TstLeg2', latitude = 12,2719935992898, TypeOf = 'ManualPlottedCourseWaypoint', longitude = 111,929875733348, PresetAltitude = 'High25000' }, [2] = { Description = 'TstLeg3', latitude = 12,3, TypeOf = 'ManualPlottedCourseWaypoint', longitude = 111, PresetAltitude = 'Low1000' } }

But when clicking on the waypoint in my main screen, the settings doesn't give me the setting filled in. Same in the Unit window under 'unit alt/speed' for the waypoint info.

Just wondering if this is a glitch or correct presented.

The unit is going to the preset altitude, so that works fine.

with regards GJ

added: looks to me the same for desiredAltitudeTF=100. But I realize I might be doing something wrong here.

< Message edited by Parel803 -- 6/22/2021 8:27:22 AM >

(in reply to orca)
Post #: 14
RE: Newby lua Waypoint question - 6/22/2021 11:49:22 PM   
KnightHawk75

 

Posts: 1117
Joined: 11/15/2018
Status: offline
@Parel803
That's correct it works, but is not showing up in the gui, we probably should report that glitch (i'm thinking it's not intentional). ;)


(in reply to Parel803)
Post #: 15
RE: Newby lua Waypoint question - 6/23/2021 6:28:44 PM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
Thanks for the answer.Should I post it somewhere else or is it oké in this forum?
wit regards GJ

(in reply to KnightHawk75)
Post #: 16
RE: Newby lua Waypoint question - 6/24/2021 1:05:20 AM   
KnightHawk75

 

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

quote:

ORIGINAL: Parel803

Thanks for the answer.Should I post it somewhere else or is it oké in this forum?
wit regards GJ

I would post in tech support (not all the devs get a chance to read all these threads for everything discussed), along with a simple stripped down scene, that includes a simple special action that when pressed runs code that demonstrates the issue. That way they can just load it, press it and then check the gui.

(in reply to Parel803)
Post #: 17
RE: Newby lua Waypoint question - 6/25/2021 6:41:24 PM   
Parel803

 

Posts: 412
Joined: 10/10/2019
From: Netherlands
Status: offline
Thx I'll try to do so.
with regarsd GJ

(in reply to KnightHawk75)
Post #: 18
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Newby lua Waypoint question 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.305