f3cuk / WICKED-AI

Wicked AI missions for your server
30 stars 59 forks source link

AI dying on mission spawn doesn't count as dead & Mission not finishing #149

Closed Basti890 closed 7 years ago

Basti890 commented 8 years ago

When a Mission is spawning and some AI are dying during the spawn the mission will never despawn with for example 99% Killrate before mission complete.

The reason seems to be that the natural death of AI on mission spawn don't count in the killcounter.

2 solution are realsitic:

  1. Start the counter for dead AI as soon as the spawn of mission beginns. (maybe not easy to implement)
  2. in the ai_monitor.sqf count the remaining living AI and corrent the avlue in the wai_mission_data (the first value of the array)
  3. instead of checking how many AI is dead on mission count if the number of living AI is low enough (like set in config) to complete teh mission.

I can also implement such function if u want, (or at least make an example) but I don't know how to count living AI only for a specific mission.

Maybe it could also be a Bug with the AI cache (I got it activated). I'll check this later on my testserver.

Basti890 commented 8 years ago

AI-Cache is not the Problem, but has a strange bug, when enabling it the Mayor in Mayors-Mansions will loos his special setup to wait till player is nearby

On searching the code and arma2 documentation I thick I found the Problem, If the unit dies BEFOR the Eventhandler "Killed" is added the Death of the unit will be ignored.

So some solutions for the problem might be usefull:

  1. call _unit = _unitGroup createUnit [_aiskin,[_pos_x,_pos_y,_pos_z],[],0,"CAN COLLIDE"]; _unit addEventHandler ["Killed",{[_this select 0, _this select 1, "ground"] call on_kill;}]; together, so the EventHandler is added on the earliest possible point.
  2. check after befor adding the eventHandler if the unit is still alive (or in case of death just skip counting the unit to the mission.
  3. give the AI God-Mode untill the EventHandler is added
Basti890 commented 8 years ago

Tested solution 1, it didn't work

And while NOT 1 AI is living the debug-log says 51 AI living! I killed many with Apache maybe its buggy if u killed many AI it seems to bug.

I think solution #2 should be the best solution.