Jump to content

Mist | mist.goRoute not working


Go to solution Solved by Grimes,

Recommended Posts

Posted (edited)

After reading the following topic with no success:

I was trying to edit a late acivated group route through this lua code using mist:

cityIntel = trigger.misc.getZone(city);

-- Activate Group

Group.activate(Group.getByName('1º Defense Squadron'))
jetRoute = mist.getGroupRoute('1º Defense Squadron')
jetRoute[2]["x"] = cityIntel.point.x
jetRoute[2]["y"] = cityIntel.point.z
mist.goRoute('1º Defense Squadron', jetRoute) 

The group is configured as in the attached image, but when it gets activated, it flyes to "DP" and gets RTB. The coordinate of "DP" remain the same as in the editor instead of changing to coded zone coordinate. If I run mist.getGroupRoute before and after the group is activated, the result is the same, and mist.goRoute is always returning true.

 

image.png

Edited by Jack Bauer
  • Solution
Posted

AI generally don't like being spawned and then immediately being given a new task. Best to have at least some delay built in. Since you are spawning the group in the same motion you can easily just change the route it starts with. 

local cityIntel = trigger.misc.getZone(city);
local ng = mist.getGroupTable('1º Defense Squadron')
ng.lateActivation = nil							-- group is set to late activate, remove the value so it doesn't spawn late activated
ng.route.points[2].x = cityIntel.point.x  --- rroute is part of groupTable, but might want to verify that waypoint exists. 
ng.route.points[2].y = cityIntel.point.z
mist.dynAdd(ng)     -- spawns the group 

 

  • Like 1

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

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted (edited)

Work like a charm! Final code:

local jetGroup = mist.getGroupTable('1º Defense Squadron')

jetGroup.lateActivation = nil		
jetGroup.category = "PLANE"
jetGroup.country = 18
jetGroup.route.points[2].x = cityIntel.point.x
jetGroup.route.points[2].y = cityIntel.point.z

mist.dynAdd(jetGroup)   

 

Edited by Jack Bauer
  • Recently Browsing   0 members

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