Jump to content
Sign in to follow this  
Nephris1

[dedi] setpos

Recommended Posts

Hi friends,

i am at war with the dedicated server and its scripts ect.

I initialize a position in my init.

koffer and heli are set objects on map, as also "mkr" is an already existing marker.

Right now i get the position to playce my heli

call compile format ["
heli setpos [(getmarkerpos ""mkpos%1"" select 0),(getmarkerpos ""mkpos%1"" select 1),0]
",ceil(random 16)];

I place my maker "mkr" to the helis position

"mkr" setmarkerpos getpos heli;  

at the end my suitcase called "koffer" is "beamed" to the heli position

Koffer setpos getpos heli;

my dead pilots move the same way

pil1 setpos [(getpos heli select 0)+(random 10)-5,(getpos heli select 1)+(random 14)-7,0];
pil2 setpos [(getpos heli select 0)+(random 16)-8,(getpos heli select 1)+(random 8)-4,0];

When i now start the map in Coop everything works fine.

Starting on a dedicated server, the helicopter (heli) gets moved to its position, the marker ("mkr") and the suitcase (koffer) dont.

I ve no clue why.

This is the complete part of my init

///// Heli ComPosition

call compile format ["
heli setpos [(getmarkerpos ""mkpos%1"" select 0),(getmarkerpos ""mkpos%1"" select 1),0]
",ceil(random 16)];
"mkr" setmarkerpos getpos heli;                                                               // Heli Marker 
sleep 0.01;

Koffer setpos getpos heli;
pil1 setpos [(getpos heli select 0)+(random 10)-5,(getpos heli select 1)+(random 14)-7,0];
pil2 setpos [(getpos heli select 0)+(random 16)-8,(getpos heli select 1)+(random 8)-4,0];

Any suggestions?

Share this post


Link to post
Share on other sites

i had some similar problems with compile.. it works strangely...

try putting all other code in compile too. either dont use compile, use random to get number of marker and put markers to array to select from. maybe it will help?

Share this post


Link to post
Share on other sites

Lokks like u r right.

I changed the code

 _mlist = ["mkpos1","mkpos2","mkpos3",..............];

_mlocation = _mlist select (floor(random(count _mlist)));

heli setpos [(getmarkerpos _mlocation select 0),(getmarkerpos _mlocation select 1),0];
.....

and it works now.

Thx.

Another prob occured while testing and i guess it is about the local/global things.

So my insertion marker are not at the position where the player is.

Do i ve to execute my player position on server only?

/////  Player Position

_wlist = [wpos1,wpos2,wpos3,wpos4,wpos5];
_rlist = [rpos1,rpos2,rpos3,rpos4,rpos5];

_wlocation = _wlist select (floor(random(count _wlist)));
_rlocation = _rlist select (floor(random(count _rlist)));

//hint format ["Position: %1",_wlocation];

w1 setpos [(getpos _wlocation select 0)+(random 3),(getpos _wlocation select 1)+(random 6),0];

Share this post


Link to post
Share on other sites

Yes, because random is different on each machine. So, whenever you use it, do it on server only.

Share this post


Link to post
Share on other sites

Ok I understand why.

I now executed it on the server machine like that

if(isServer)then{
/////  Player Position

_wlist = [wpos1,wpos2,wpos3,wpos4,wpos5];
_rlist = [rpos1,rpos2,rpos3,rpos4,rpos5];

_wlocation = _wlist select (floor(random(count _wlist)));
_rlocation = _rlist select (floor(random(count _rlist)));

//hint format ["Position: %1",_wlocation];

w1 setpos [(getpos _wlocation select 0)+(random 3),(getpos _wlocation select 1)+(random 6),0];
w2 setpos [(getpos _wlocation select 0)+(random 5),(getpos _wlocation select 1)+(random 5),0];
w3 setpos [(getpos _wlocation select 0)+(random 6),(getpos _wlocation select 1)+(random 3),0];

s1 setpos [(getpos _rlocation select 0)+(random 3),(getpos _rlocation select 1)+(random 6),0];
s2 setpos [(getpos _rlocation select 0)+(random 5),(getpos _rlocation select 1)+(random 5),0];
s3 setpos [(getpos _rlocation select 0)+(random 6),(getpos _rlocation select 1)+(random 3),0];

w_ammo setpos [(getpos _wlocation select 0)+(random 8),(getpos _wlocation select 1)+(random 8),0];
r_ammo setpos [(getpos _wlocation select 0)+(random 8),(getpos _wlocation select 1)+(random 8),0];



////Marker init.

"insertionW" setmarkerpos getpos _wlocation;
"insertionR" setmarkerpos getpos _rlocation;
//if(Side player==EAST)then{CheckPlayerDistFalse=true;}else{CheckPlayerDistFalse=false;}; 

};

But the player wasnt moved to _wlocation/r_location.

Jeez....this is like teachning a cow how to play football...

Is the the array stuff only to be executed on server then?

Means this

 _wlist = [wpos1,wpos2,wpos3,wpos4,wpos5];
_rlist = [rpos1,rpos2,rpos3,rpos4,rpos5];

_wlocation = _wlist select (floor(random(count _wlist)));
_rlocation = _rlist select (floor(random(count _rlist)));

edit: no that dosent work either....ffs.

Edited by Nephris1

Share this post


Link to post
Share on other sites

So, what you are trying to do is to randomly pick starting position for 2 different sides of players? Sides being west and resistance?

http://forums.bistudio.com/showthread.php?t=93529

Place markers named:

startpos_west_1, startpos_west_2, etc

startpos_guer_1, startpos_guer_2, etc

Place west units and ammo crate on top of the startpos_west_1, do same with resistance by placing them on top of startpos_guer_1.

Init.sqf:

[["west",5,[w_ammo]],["guer",5,[r_ammo]]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf";

Share this post


Link to post
Share on other sites

Yeah,....i already recon the link in your sig 15min ago and followed it.

Gonna try to get it working now.

Edith sais: works great, thx m8!

Edited by Nephris1

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  

×