I've started making some MP missions, which I'm pretty new to actually and I've ran into a few problems lately...
The first problem is ending the mission. A friend of mine wrote the following script to me which I've used:
#start
~1
_cnt1 = {alive _x} count units pagrp
_cnt1 = _cnt1 + ({alive _x} count units pbgrp)
_cnt2 = {_x distance ENDAREA < 200} count units pagrp
_cnt2 = _cnt2 + ({(_x distance ENDAREA) < 200} count units pbgrp)
if(_cnt2 == _cnt1) then {goto "end"} else {goto "start"}
#end
end=true
Basicly it should count the alive units from two groups and execute the ending trigger when every each one of them is within 200 meters from the ENDAREA gamelogic. The script gets executed once all of the mission objectives are complete. In single player it seems to work alright, no problems at all, but in multiplayer the ending trigger gets executed even if the player(s) aren't within the range of the ENDAREA gamelogic. Does anyone know what's that about and how to fix it?
My second problem is about the reveal command. The AI seems to be really dumb sometimes - We can even drive right in front of their nose with an armed truck and snip them one by one and they won't care. The other friendly groups to them don't seem to care either, even when we're within their hearing range. So I created this little script below to make them more intelligent:
if(pickup distance BASE < 170) then {goto "reveal"} else {exit}
#reveal
grp1 reveal pickup
grp2 reveal pickup
grp3 reveal pickup
grp4 reveal pickup
exit
The script should reveal the pickup truck armed with an MG to those four enemy groups when it is firing within 170 meters from the gamelogic BASE. I added an eventhandler "fired" to the truck's init field which executes that script... Again, in single player it seems to work fine and they'll always engage me as they should, but in multiplayer we can still drive right in front of their nose and shoot them and they won't give a shit. Is there a way to fix this?