Jump to content

Help using MIST in regards to respawning a group randomly in a zone!


Recommended Posts

Greetings everyone!

I posted this question on Hoggit, and a very helpful individual suggested I post here for a better chance at an answer, as well as being able to post my mission files and such.

 

So, here i am!

 

My Issue:

 

I have a simple defense scenario.  I have a group of 10 defending tanks against a group of invading tanks.   The invading tanks, on death, should respawn again somewhere in the respawn zone at random and continue the attack from the new location.

 

Now, I have gotten it to work up till continuing their previous task.  

 

The invading tanks die, they respawn randomly in zone, annndd, thats it.  They don't seem to have their original task anymore and just sit there doing nothing unless an enemy is within range.

 

I would like these invading tanks to continue the original task assigned to them through the Mission editor but with a different start point (since they respawn randomly in the zone)

 

Now, the helpful individual has already attempted to help me, but my knowledge in this subject is pretty mediocre lol.  I feel like i am using his solutions incorrectly, or there is something else i did that was wrong.

 

HERE is the original reddit post so you can read what has already been done 

 

I will also attach my mission file for your consideration!

 

Thank you all in advance, and I hope to learn more from this!

 

Have a pleasant day.

Ground test.miz

Link to comment
Share on other sites

1 hour ago, avp216 said:

...

My Issue:...

 

hi, your code in the trigger "Respawn RG-1 Flag" has 2 flaws : a "local" wrote "locall" and a "gp:getUnits(1)" instead of "gp:getUnit(1)" (getUnits() and getUnit() functions don't do the same thing).
Here is the corrected code that works :

Spoiler

local gp = Group.getByName('Russia Ground 1') 
if gp then 
    local lead = gp:getUnit(1) 
    if lead then  
        local leadPoint = lead:getPoint()    
        local route = mist.getGroupRoute('Russia Ground 1', true) 
        route[1].x = leadPoint .x    
        route[1].y = leadPoint .z    
       mist.goRoute(gp, route)  
    end
end

 

  • Thanks 1
Link to comment
Share on other sites

Thank you VERY much toutenglisse!

 

It worked wonderfully!

 

The spelling of local was probably my bad lol.  I wish the script box was bigger XD

 

In any case, I appreciate the time you took to help me out!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...