Jump to content

addgroup waypoint question


Recommended Posts

Hey,

I'm successfully using the addgroup script from this example :

http://forums.eagle.ru/showpost.php?p=1738368&postcount=2

 

It works nice but now I'd like to add a couple of waypoints as well and I'm not sure how that works. I tried adding the whole ["route"] section copied from a different group but it contains also this ["spans"] section that seems to me like some precalculated waypoints and can sometimes contain hundreds of points. If I don't include this section the unit spawns but doesn't move. So is it please possible to add waypoints to dynamically added groups without the ["spans"] section somehow (or do I have to recalculate the whole spans section on spawn?) ? The reason why I'm asking is that I'd like to make this waypoint coordinates random inside a certain area as well but since the spans are precalculated the route would be always the same - so spawning a randomly paced unit is useless when the route is always the same.


Edited by lanmancz

[sIGPIC][/sIGPIC]

 

Gigabyte Aorus Z390 Elite, Intel i9 9900K, Fractal Design Kelvin S36, Zotac GTX 1070 8GB AMP Extreme, 32GB DDR4 HyperX CL15 Predator Series @ 3000 MHz, Kingston SSD 240GB (OS), Samsung 970 EVO 1TB M.2 NVMe (sim), Fractal Design Define R5 Black Window, EVGA SuperNOVA 750 G2, Win 10 Home x64, Thrustmaster Warthog HOTAS, Saitek Pro Flight Rudder Pedals, Thrustmaster MFD Cougar Pack, TrackIR (DelanClip), 3x 27" BenQ EW2740L, Oculus Rift S

 

Link to comment
Share on other sites

Hey,

I'm successfully using the addgroup script from this example :

http://forums.eagle.ru/showpost.php?p=1738368&postcount=2

 

It works nice but now I'd like to add a couple of waypoints as well and I'm not sure how that works. I tried adding the whole ["route"] section copied from a different group but it contains also this ["spans"] section that seems to me like some precalculated waypoints and can sometimes contain hundreds of points. If I don't include this section the unit spawns but doesn't move. So is it please possible to add waypoints to dynamically added groups without the ["spans"] section somehow (or do I have to recalculate the whole spans section on spawn?) ? The reason why I'm asking is that I'd like to make this waypoint coordinates random inside a certain area as well but since the spans are precalculated the route would be always the same - so spawning a randomly paced unit is useless when the route is always the same.

 

In my recent and limited experience, I had groups of ground units spawning with only two waypoints. The first one was the center of a randomly chosen zone and the second one was another zone. They took _ different _ route for each group that spawned, so my guess would be that the spans are calculated when the units appear.

 

Also, since then, I realized MIST2.0 was out, and had delicacies like mist.ground.buildWP, mist.getRandPointInCircle, mist.groupToRandomPoint, mist.groupRandomDistSelf, mist.grouptoRandomZone, and mist.groupToPoint.

 

They should help you to achieve your objective :beer:

Link to comment
Share on other sites

Spans actually doesn't do anything in game. They are there for the mission editor to render the route that is used. So each span is literally each and every single line that visually makes up a route within the editor. You can actually delete the spans from the .miz and the route will still work flawlessly in game. The only "issue" is if you load up into the editor the route will not be visible until you move one of the WP and then it will re-draw the route.

The right man in the wrong place makes all the difference in the world.

Current Projects: Scripting Wiki, Something...

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD, IADScript, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Spans actually doesn't do anything in game. They are there for the mission editor to render the route that is used. So each span is literally each and every single line that visually makes up a route within the editor. You can actually delete the spans from the .miz and the route will still work flawlessly in game. The only "issue" is if you load up into the editor the route will not be visible until you move one of the WP and then it will re-draw the route.

 

Oh really ? That's good. I wonder why my waypoints didn't work then before when I tested it. I will have to play with it more. Thanks for info.

[sIGPIC][/sIGPIC]

 

Gigabyte Aorus Z390 Elite, Intel i9 9900K, Fractal Design Kelvin S36, Zotac GTX 1070 8GB AMP Extreme, 32GB DDR4 HyperX CL15 Predator Series @ 3000 MHz, Kingston SSD 240GB (OS), Samsung 970 EVO 1TB M.2 NVMe (sim), Fractal Design Define R5 Black Window, EVGA SuperNOVA 750 G2, Win 10 Home x64, Thrustmaster Warthog HOTAS, Saitek Pro Flight Rudder Pedals, Thrustmaster MFD Cougar Pack, TrackIR (DelanClip), 3x 27" BenQ EW2740L, Oculus Rift S

 

Link to comment
Share on other sites

Yay, it works nice :

 

 

 

local transport = Unit.getByName('Pilot1')

local wppos = trigger.misc.getZone('PatrolAWP')

local name = "PatrolA"

local gid = 101

 

local spawnpos = transport:getPosition().p

local spawnheading = 0

local radius = 25

local waypoint = {}

 

waypoint.x = wppos.point.x + math.random(wppos.radius * -1, wppos.radius)

waypoint.z = wppos.point.z + math.random(wppos.radius * -1, wppos.radius)

 

 

local data = {

["visible"] = false,

["route"] =

{

["points"] =

{

[1] =

{

["alt"] = 1,

["type"] = "Turning Point",

["ETA"] = 0,

["alt_type"] = "BARO",

["formation_template"] = "",

["y"] = spawnpos.z + radius,

["x"] = spawnpos.x + radius,

["ETA_locked"] = true,

["speed"] = 4,

["action"] = "Diamond",

["task"] =

{

["id"] = "ComboTask",

["params"] =

{

["tasks"] =

{

}, -- end of ["tasks"]

}, -- end of ["params"]

}, -- end of ["task"]

["speed_locked"] = true,

}, -- end of [1]

[2] =

{

["alt"] = 1,

["type"] = "Turning Point",

["ETA"] = 0,

["alt_type"] = "BARO",

["formation_template"] = "",

["y"] = waypoint.z,

["x"] = waypoint.x,

["ETA_locked"] = false,

["speed"] = 4,

["action"] = "Diamond",

["task"] =

{

["id"] = "ComboTask",

["params"] =

{

["tasks"] =

{

}, -- end of ["tasks"]

}, -- end of ["params"]

}, -- end of ["task"]

["speed_locked"] = true,

}, -- end of [2]

}, -- end of ["points"]

}, -- end of ["route"]

["groupId"] = gid,

["tasks"] =

{

}, -- end of ["tasks"]

["hidden"] = false,

["units"] =

{

[1] =

{

["y"] = spawnpos.z + radius,

["type"] = "Soldier M249",

["name"] = name..1,

["unitId"] = gid..1,

["heading"] = spawnheading,

["playerCanDrive"] = true,

["skill"] = "Excellent",

["x"] = spawnpos.x + radius,

}, -- end of [1]

[2] =

{

["y"] = spawnpos.z + radius,

["type"] = "Soldier M249",

["name"] = name..2,

["unitId"] = gid..2,

["heading"] = spawnheading,

["playerCanDrive"] = true,

["skill"] = "Excellent",

["x"] = spawnpos.x - radius,

}, -- end of [2]

[3] =

{

["y"] = spawnpos.z,

["type"] = "Soldier M4",

["name"] = name..3,

["unitId"] = gid..3,

["heading"] = spawnheading,

["playerCanDrive"] = true,

["skill"] = "Excellent",

["x"] = spawnpos.x + (radius * 1.3),

}, -- end of [3]

[4] =

{

["y"] = spawnpos.z,

["type"] = "Soldier M4",

["name"] = name..4,

["unitId"] = gid..4,

["heading"] = spawnheading,

["playerCanDrive"] = true,

["skill"] = "Excellent",

["x"] = spawnpos.x - (radius * 1.3),

}, -- end of [4]

[5] =

{

["y"] = spawnpos.z - radius,

["type"] = "Soldier M4",

["name"] = name..5,

["unitId"] = gid..5,

["heading"] = spawnheading,

["playerCanDrive"] = true,

["skill"] = "Excellent",

["x"] = spawnpos.x + radius,

}, -- end of [5]

[6] =

{

["y"] = spawnpos.z - radius,

["type"] = "Soldier M4",

["name"] = name..6,

["unitId"] = gid..6,

["heading"] = spawnheading,

["playerCanDrive"] = true,

["skill"] = "Excellent",

["x"] = spawnpos.x - radius,

}, -- end of [6]

}, -- end of ["units"]

--["y"] = spawnpos.z,

--["x"] = spawnpos.x,

["name"] = name,

--["start_time"] = 0,

--["task"] = "Ground Nothing",

} -- end of [1]

 

coalition.addGroup(country.id.USA, Group.Category.GROUND, data)

 

 

 

when the script is activated (radio comms in the test mission) it creates a squad of soldiers 'PatrolA' around unit 'Pilot1' (I will use this when player lands the huey at the LZ) and they start to move to a waypoint marked by trigger zone 'PatrolAWP'. Work well. Spans didn't matter after all. But one question though: depending on the spawn radius I choose some of the soldiers often get stuck (probably colliding with the heli) and don't move any more. Can I do something about that pls ?

 

Also when I'm at it - is there a switch waypoint type command that I could use to make a unit pingpong around 2 (or more) waypoints for example ? Like add do script action at waypoint 2 to make the unit to switch back to waypoint 1 ?

test.miz


Edited by lanmancz

[sIGPIC][/sIGPIC]

 

Gigabyte Aorus Z390 Elite, Intel i9 9900K, Fractal Design Kelvin S36, Zotac GTX 1070 8GB AMP Extreme, 32GB DDR4 HyperX CL15 Predator Series @ 3000 MHz, Kingston SSD 240GB (OS), Samsung 970 EVO 1TB M.2 NVMe (sim), Fractal Design Define R5 Black Window, EVGA SuperNOVA 750 G2, Win 10 Home x64, Thrustmaster Warthog HOTAS, Saitek Pro Flight Rudder Pedals, Thrustmaster MFD Cougar Pack, TrackIR (DelanClip), 3x 27" BenQ EW2740L, Oculus Rift S

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...