Jump to content

unit respawn bugged? or did i create a loop?


Recommended Posts

Hi,

 

hope someone knwos how to handle this:

 

I have a group (plane group) consisting of 4 planes each named

plane 1

plane 2

plane 3

plane 4

 

For each unit I configured

> continous action > condition unit dead (plane 1) dead > action = message out (unit dead)

 

My respawn is configured as:

> continous action > condition group dead (plane group) > action = if not Group.getByName('plan group') then mist.respawnGroup('plane group', true) end

 

 

If all planes (the whole group) dies & is respawned it keeps saying (unit dead) each second.

I dont get it because everything has respawned right?! So nothing should be dead anymore?!

 

im using latest mist in dcs 2.1

 

 

Thanks for any reply!

 

regards

f

Link to post
Share on other sites

Do it as a switched action, try that. And if you're using the latest Mist, you don't need the "if not" part. I've literally just been playing around with that mist function. In other words, the action part is "Do Script" and then mist.respawnGroup("groupname", true)

Win 10 | i7 4770 @ 3.5GHz | 32GB DDR3 | 6 GB GTX1060

Link to post
Share on other sites
Do it as a switched action, try that. And if you're using the latest Mist, you don't need the "if not" part. I've literally just been playing around with that mist function. In other words, the action part is "Do Script" and then mist.respawnGroup("groupname", true)

 

hi doodenkoff,

 

i tried that .. unfortunately it keeps looping. maybe a bug in 2.1?

 

im very dissapointed with how the scripting is working in dcs 2.1. maybe i revert back to the late activation trick. not pretty ... but works

Link to post
Share on other sites

Interesting. For the record, I just set this up in 1.5 and it works as expected.

 

Switched Condition > Group is Dead: (groupName) > Do Script: mist.respawnGroup(groupname)

 

Last unit in group is destroyed and immediately a new group is spawned to replace it.

 

I think this part is an issue for you:

 

> continous action > condition unit dead (plane 1) dead > action = message out (unit dead)

 

My guess is that the original units do not disappear from the data tables and since it is a continuous action, it is repeatedly seeing a dead unit.

 

If you don't mind my asking, why do you want a message when one plane dies?

Win 10 | i7 4770 @ 3.5GHz | 32GB DDR3 | 6 GB GTX1060

Link to post
Share on other sites

"My guess is that the original units do not disappear from the data tables and since it is a continuous action, it is repeatedly seeing a dead unit. "

> seems the horror comes true.

 

 

If you don't mind my asking, why do you want a message when one plane dies?

im working on a ww2 Mission and the message is intended as "one of our Bombers has been shot, enemy gains 5 Points" > increase flag 1 by 5 and so on..

 

at this Point im really giving up. would be a pitty if i dont find a workaround for that..

Link to post
Share on other sites

Okay, I get it. I was picturing a group of AI that you were directly engaging, not somewhere else on the map.

 

I assume you expect that particular unit may be destroyed more than once?

Win 10 | i7 4770 @ 3.5GHz | 32GB DDR3 | 6 GB GTX1060

Link to post
Share on other sites
I assume you expect that particular unit may be destroyed more than once?

 

 

 

yes absolutely! Unfortunately it seems as if the dead unit is kept somewhere "dead" although it has been respawned as "alive" in a new group.

 

 

For instance: your plane group "bomber" consists of 4 planes plane1 to 4

If you check for plane 1 being dead > action message , nothing happens (which is ok at this step)

 

If the plane is shot & dead the action triggers and says > message plane dead

Now if you respawn the whole group (all planes are shot) with mist (respawngroup('bomber',true) the condition check for dead unit 1 (plane1) still triggers as > message dead although the new identical group "should" consist of new & alive "plane1 to 4)

 

Would be nice to have a solution for that.

Link to post
Share on other sites

Have you tried the mist.cloneGroup(groupname) function? Or maybe mist.dynAdd? One of those may work just different enough. For instance, the documentation for mist.dynAdd says, "If it is the same as a pre-existing group, this function will overwrite and remove that group existing from the mission."

Win 10 | i7 4770 @ 3.5GHz | 32GB DDR3 | 6 GB GTX1060

Link to post
Share on other sites

The problem with doing this in the trigger is that is assumes when you respawn 'Plane 1' you are actually respawning the exact same group, which is not the case - it spawns a new group 'Plane 1 #001' that has most of the information cloned from the first group, but it's not the same group. I dont think there is a way to revive a dead group (except maybe by deactivate/activate)

 

You would probably be better off creating a scheduled function that checks every few seconds if a plane has died, respawn a new one, and change the check to the new group on the next iteration.

 

This is some pseudo code, it probably will not compile:

 

MyGroupsToCheck = { Group.GetByName('Plane 1'), Group.GetByName('Plane 2') }

timer.scheduleFunction(function(args, time)
   local GroupsToRemove = {}
   for i, grp in pairs(MyGroupsToCheck) do
       if grp:getLife() == 0 then
             -- respawn group
             _myGrp = Mist.Spawn(--etc)
             table.insert(GroupsToRemove , {Index = i, NewGroup = _myGrp})
       end
   end

   -- iterate through GroupToRemove, remove the old dead group, and insert newly respawned groups to be checked
   for i, grp in pairs(GroupsToRemove) do
       table.remove(MyGroupsToCheck, grp.Index)
       table.insert(MyGroupsToCheck, grp.NewGroup)
   end

return time + 10 -- rerun this function again in the next 10 seconds
end, MyGroupsToCheck, timer.getTime + 30)

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Link to post
Share on other sites
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...