EasyEB Posted May 17, 2016 Posted May 17, 2016 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.
Grimes Posted May 18, 2016 Posted May 18, 2016 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 Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
EasyEB Posted May 18, 2016 Author Posted May 18, 2016 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.
ESAc_matador Posted May 18, 2016 Posted May 18, 2016 3. You use GroupToPoint... Since the point is defined.
EasyEB Posted May 18, 2016 Author Posted May 18, 2016 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.
ESAc_matador Posted May 18, 2016 Posted May 18, 2016 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!!!
EasyEB Posted May 18, 2016 Author Posted May 18, 2016 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.
EasyEB Posted May 18, 2016 Author Posted May 18, 2016 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"?
ESAc_matador Posted May 18, 2016 Posted May 18, 2016 (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 May 18, 2016 by ESAc_matador
ESAc_matador Posted May 18, 2016 Posted May 18, 2016 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?
EasyEB Posted May 18, 2016 Author Posted May 18, 2016 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
EasyEB Posted May 18, 2016 Author Posted May 18, 2016 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.
EasyEB Posted May 18, 2016 Author Posted May 18, 2016 (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 May 18, 2016 by EasyEB
ESAc_matador Posted May 18, 2016 Posted May 18, 2016 (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 May 18, 2016 by ESAc_matador
EasyEB Posted May 18, 2016 Author Posted May 18, 2016 (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 May 18, 2016 by EasyEB
ESAc_matador Posted May 18, 2016 Posted May 18, 2016 That happens to me when i use makeunittable sometimes i dont know why!
EasyEB Posted May 20, 2016 Author Posted May 20, 2016 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!
ESAc_matador Posted May 20, 2016 Posted May 20, 2016 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.
Grimes Posted May 21, 2016 Posted May 21, 2016 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 Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
EasyEB Posted May 21, 2016 Author Posted May 21, 2016 (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 May 21, 2016 by EasyEB
Recommended Posts