Jump to content
Sign in to follow this  
oniellnz

Mp csar

Recommended Posts

I am making a dynamic operations system using scripts and no triggers. COC NS 2 has been used to communicate messages, marker movement etc.

My problem is that I have two groups.

Player Group

Crew group

The idea is that when the player Group is within a certain distance of the crew group, then they get rescued.

This works in the editor, and in MP as the server. Works too as a client, unless you get in to a vehicle. After this, the server thinks the leader of the group is almost always at the vehicle, even when the player gets out.

Each player is named P1, P2... etc. I have used both the P1 and Player's group leader to check the distance on the server, but I still have this problem.

Help!

Edited by oniellnz

Share this post


Link to post
Share on other sites

hi,

I am making a dynamic operations system using scripts and no triggers. COC NS 2 has been used to communicate messages, marker movement etc.

My problem is that I have two groups.

Player Group

Crew group

The idea is that when the player Group is within a certain distance of the crew group, then they get rescued.

This works in the editor, and in MP as the server. Works too as a client, unless you get in to a vehicle. After this, the server thinks the leader of the group is almost always at the vehicle, even when the player gets out.

Each player is named P1, P2... etc. I have used both the P1 and Player's group leader to check the distance on the server, but I still have this problem.

Help!

Not sure I really understand what you want here you should explain a bit better. Anyway I made a script to check the distance between 2 units (player leader and crew leader) for extraction purpose.

Explaination: When the player leader is less than the distance set in the script (1000m in the demo) then the crew group (M113 in the demo) moves to the player leader position, when the M113 is less than 100m of the player leader then it waits that the player group get in the M113 and when all are in it moves to extraction point, when the M113 is less than 100m of the extraction point it ends the mission.

SP/MP compatible. BTW, the code may needs some adjustments since I wrote the script very fast.

init.sqs

nik_endMision=false
[WestGrp1,WestGrp2,1000,WestM113,gl_extraction] exec "dis_check.sqs"

exit

dis_check.sqs

;************************************************************************************************
;Distance Check for extraction Script by Nikiller v0.9b
;Check distance between 2 units for extraction purpose
;NOTE: put a game logic named server on the map
;contact: nikillerofp@hotmail.fr
;[unitGrpName1,unitGrpName2,distance,extractionVehicleName,extractionPoint] exec "scriptName.sqs"
;************************************************************************************************

if (local server) then {} else {goto "ende"}

_grp = _this select 0
_rgrp = _this select 1
_dis = _this select 2
_veh = _this select 3
_gl = _this select 4

_del=10

#check
~_del
_l=leader _grp
_rl=leader _rgrp
if ({alive _x} count units _grp<1) then {goto "ende"}
if ((_l distance _rl < _dis) && (canMove _veh)) then {goto "move"} else {goto "check"}

#move
~_del
_l=leader _grp
_rl=leader _rgrp
_pos=getPos _l
driver _veh doMove _pos
if ({alive _x} count units _grp<1) then {goto "ende"}
if ((canMove _veh) && (_rl distance _l>=100)) then {goto "move"}


#getin
~_del
_icount=0
_num=0
"if (alive _x) then {_num = _num + 1}" forEach units _grp
"if (vehicle _x == _veh) then {_icount = _icount + 1}" forEach units _grp
if (_icount == _num)  then {goto "extract"} else {goto "getin"}

#extract
~_del
_ex=getPos _gl
driver _veh doMove _ex
if ((canMove _veh) && (_veh distance _gl>=100)) then {goto "extract"}

~_del
nik_endMission=true; publicVariable "nik_endMission"

#ende

exit

Here's a demo to show how it works.

DEMO LINK

Hope it helps.

cya.

Nikiller.

Edited by Nikiller

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×