Jump to content

Recommended Posts

Posted (edited)

Hello,

 

I've created a simple mission with 3 unarmed ground units. 1 blue and 2 red, on Batumi Airfield.

 

I've been pulling my hair out to get the blue unit to move to one of the red units via script.

 

The mission initializes MIST via Mission Init then executes my custom script at mission start.

 

My custom script looks like this:

blueUnit1 = Unit.getByName('BLUEUNIT1')
blueUnit1Pos = mist.utils.makeVec2(Unit.getPosition(blueUnit1).p)

redUnit2 = Unit.getByName('REDUNIT2')
redUnit2Pos = mist.utils.makeVec2(Unit.getPosition(redUnit2).p)

trigger.action.smoke(blueUnit1Pos, 3) --Smoke marker on start position
trigger.action.smoke(redUnit2Pos, 1) --Smoke marker on end position


path = {}
path[#path + 1] = mist.ground.buildWP(blueUnit1Pos,'Off road',60) -- first point on path is present position
path[#path + 1] = mist.ground.buildWP(redUnit2Pos,'Off road',60) -- second point on path is target position

blueGroup1 = Group.getByName('BLUEGROUP1')
mist.goRoute(blueGroup1, path)

 

Now the 'BLUEUNIT1' sets off and moves straight to the coastline and then turns either north or south by the water and continues on a super slow beach stroll. PLEASE if anyone can enlighten me what I'm doing wrong with the code?

But the SMOKE MARKERS put on the same positions as the WP's get built from, are on the units exact spot.

I've attached the .miz file for your inspection as well so you can try it out. The scripts are inside offcourse.

movetounit_test.miz

Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Posted

No one? Grimes or Speed, any of you guys care to waste a couple of minutes on me? :book:

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Posted

Apparently if you assign a route via scripting on a mission start trigger the AI's mind explodes and they do whatever they want.

 

Simply changing it to the following makes it work. Once> Time More than 1> Do Script File

  • 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
Apparently if you assign a route via scripting on a mission start trigger the AI's mind explodes and they do whatever they want.

 

Simply changing it to the following makes it work. Once> Time More than 1> Do Script File

 

 

Thank you :smartass:Grimes!:smartass: And how the hell did you discover this? lol

Thanks alot!! I'll give this a shot asap. Rep inbound!

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

  • Recently Browsing   0 members

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