Jump to content

Recommended Posts

Posted

Greetings!

 

I'm wondering if there is any way to make a ground group move to another (enemy, script spawned) ground group.

 

The enemy group spawns on a random point in a zone, and I want the friendly unit to move to where the enemy groups current position on a trigger (so the fridndly group can go to the enemy group even if it moves).

 

Any help would be much appreciated!

 

Cheers.

Posted

You would have to use the scripting engine to give the orders. Mist has a function that assigns a route automatically. So just get a point of the enemy group or maybe the average position of the units in the group and then pass that coordinate to the mist function.

 

If the enemy group moves you will need to run the function again with an updated position.

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

Cool! I love that Mist has an answer to everything.

 

So, the process would be:

 

1. Enemy group spawns.

2. Mist gets the enemy group location (GetLeadPos, mist.getAvgPos? Which one would be better? getAvgPos sounds best to me).

3. When flag 1 is true, Mist sends that current position to GroupToRandomPoint which the Friendly group heads off to.

 

Would I make this as a separate script file or as doscript in the editor? If separate script file, how would that look? I've never made one from scratch.

 

I'm a little ashamed that I don't know more about this, sorry.

Posted

Oh, I see.

 

I think I understand the components to make it work, but I'm not sure of how to actually put it together.

Posted

mist.groupToPoint('spawnedgroup', {groupName="enemygroup",point=Group.getByName("gato5"):getUnit(1):getPosition().p,‘cone’, nil, 40, false)

 

this should probably work.

 

THis will make spawnedgroup go to enemygroup. (you put the names you want. BUT

if spawnedgroup and enemy group is not known, you should work with tables and iterations... and I cant help, in fact, I want to know too!!!

Posted

Thanks! That looks like it will go into a "do script" trigger?

 

Both groups are known, meaning I have the names for both the groups.

Posted

Tried it in a Do Script, No joy, I get a Mission Script Error saying [string mist.groupToPoint('Friendly', {groupName=Enemy", point=G...]:1: unexpected symbol near 'â'

 

Also, what is "gat o5"?

Posted (edited)

Try this, sorry

 

mist.groupToPoint('spawnedgroup',point=Group.getByName("enemygroup"):getUnit(1):getPosition().p,‘cone’, nil, 40, false)

 

The wp should be the first unit of the enemies.

 

Edit: see that "cone" is the formation, 40 the speed... Etc. Check the function in the Mist manual.

Edited by ESAc_matador
Posted
Got script error again :/

 

Put your mission here, let me check. But I tell you, I am everything but a Lua expert. Just trying to help, since I see you are even worse than me!

 

By the way, did you put the Mist file first? Via do script?

Posted

Yes, Mist loads first, ten second trigger later I'm trying to make group Blue move to group Red.

 

I really appreciate the help, I'm sorry for beeing daft with this. I understand the concept of everything we are trying to do here, but I just can't see the specifics of what works and what doesnt :)

BlureToRed.miz

Posted

So I'm trying to get group Blue to go to group Red.

 

I feel this should work:

 

mist.groupToPoint('Blue', mist.getAvgPos(mist.makeUnitTable({'[g]Red'})), nil, 35, 30)

 

But it doesnt.

 

I've gotten getAvgPos and makeUnitTable to work by triggering smoke using:

 

trigger.action.smoke(mist.getAvgPos(mist.makeUnitTable({'[g]Red'})), trigger.smokeColor.Green)

 

I can't however get groupToPoint to work, I've tried making a zone named MyZone and using

 

mist.groupToPoint('Blue', 'myZone', nil, 35, 30)

 

But I get a script error.

 

Now I'm almost bald.

Posted (edited)

Ok, I got groupToPoint working using

 

mist.groupToPoint("Blue", 'MyZone', 'Diamond', nil, 15, 0)

 

So one would think it should work with replacing 'MyZone' with the getAvgPos:

 

mist.groupToPoint("Blue", mist.getAvgPos(mist.makeUnitTable({'[g]Red'})), 'Diamond', nil, 15, 0)

 

But no.

 

I need an adult.

Edited by EasyEB
Posted (edited)
Ok, I got groupToPoint working using

 

 

 

So one would think it should work with replacing 'MyZone' with the getAvgPos:

 

 

 

But no.

 

I need an adult.

 

 

 

ok, what happen is a function that needs a triggerzone, and we are giving a point. We should make a trigger with this point.

 

from the http://en.wiki.eagle.ru/wiki/Simulator_Scripting_Engine/DCS:_World_1.2.1/Part_1#trigger

 

triggerzone has this format, so, try

 

mist.groupToPoint("Blue", TriggerZone = { point = mist.getAvgPos(mist.makeUnitTable({'[g]Red'}), radius = 300}, 'Diamond', nil, 15, 0)

Edited by ESAc_matador
Posted (edited)

I think I understand what you mean.

 

It gave me

 

Mission Script Error

[string mist.groupToPoint("Blue", TriggerZone = { point = mist.getAvgPo..."]:1: ')' expected near '='

 

Tried

 

mist.groupToPoint("Blue", TriggerZone = { point = mist.getAvgPos(mist.makeUnitTable({'[g]Red'})), radius = 300}, 'Diamond', nil, 15, 0)

 

No dice.

Edited by EasyEB
Posted

For future explorers, here's what worked.

 

mist.groupToRandomPoint({group = 'Group1', point = mist.getLeadPos('Group2'), form = 'Diamond', speed = mist.utils.kmphToMps(15)})

 

Apparently doesn't work on Nevada atm though :(

 

Thanks for the help Grimes!

Posted

Great!

 

That makes me finnally the oportunity to make smarter red groups. My idea, when group is alive less than 50% another group that are in reserve, goes to the position of the group damaged. That can make an interesting feature... For instance, you make a frontline eith 3 groups. When the first of them is 50% we suposse that is the weakest point so the AI automatically goes there to reinforce.

 

Long missions saved eith DAWS can give us the opportunity for small campaings.

Posted
For future explorers, here's what worked.

 

Apparently doesn't work on Nevada atm though :(

 

I was going to PM you this, but might as well say it publicly. Its how the script works and what it does that is broken. Basically there is no way to actually know where roads are on a map short of searching a bunch of different points to see if there is a road there. The function instead exploited a behavior where if you tell AI to use an "on road" waypoint the AI will interpret that as the nearest road to that point. Right now AI can't find that nearest road on Nevada and they just drive in circles. However if given a WP that is physically on the road they will find and drive it no problem. The function is a very generic group order that generally forces AI to travel on roads. You can always generate a route with your own code entirely offroad if it suits your needs.

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)

Grimes, I could kiss you.

 

This works for Nevada:

 

mist.groupToRandomPoint({group = 'Group1', point = mist.getLeadPos('Group2'), form = 'Diamond', speed = mist.utils.kmphToMps(15), disableroads = true})

 

When triggered it will make Group1 move to Group2's current position.

Edited by EasyEB
  • Recently Browsing   0 members

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