Jump to content
Sign in to follow this  
CarlGustaffa

Positions ok in SP, quite offset in MP, why?

Recommended Posts

I'm at the end of the line on this one, need help. Don't have the slightest idea on what's going on.

I have the following macro:

#define [color="red"]__soundobject[/color] \
sleep 2.678;\
[#[color="RoyalBlue"]s_o_create[/color],[color="SeaGreen"]_vehicle[/color]] call XNetCallEvent;\
_vehicle addEventHandler [#killed, {[#s_o_delete,[_this select 0]] call XNetCallEvent}]

That gets expanded in the following code:

//Some irrelevant stuff above.
switch (_sec_kind) do {
case 8: { //Artillery radar (extra)
	__getPos;
	_vehicle = createVehicle [d_artillery_radar, _poss, [], 0, "NONE"];
	_svec = sizeOf d_artillery_radar;
	_isFlat = (position _vehicle) isFlatEmpty [_svec / 2, 150, 0.7, _svec, 0, false, _vehicle];
	if (count _isFlat > 0) then {
		_vehicle setPos _isFlat;
		[color="SeaGreen"]_poss[/color] = _isFlat;
	};
	[color="seagreen"]_vehicle setPos _poss;[/color]
	_vehicle setDir (floor random 360);
	[_vehicle] execFSM "fsms\XRemoveVehiExtra.fsm";
	__vkilled(artrad_down);
	[color="Red"]__soundobject;[/color]
	sleep 1.0112;
	__specops;
};
};

Where s_o_create boils down to:

XfSoundObjectPlacer = {
private ["_vec","_pos","_trigger"];
_create = {
	_vec = _this select 0;
	_pos = _this select 1;
	_sound = _this select 2;
	_text = _this select 3;
	_trigger = createTrigger ["EmptyDetector", _vec modelToWorld _pos];
	_trigger setTriggerStatements ["true", "", ""];
	_trigger setSoundEffect ["NoSound", "", "", _sound];
	_trigger setTriggerText _text;
	_obj = "Sign_sphere100cm_EP1" createVehicle [0,0,0];
	_obj setPos (_vec modelToWorld _pos);
	hint format ["sphere placed at %1", _vec modelToWorld _pos];
	};
_vec = _this;
switch (typeOf _vec) do {
	case "TK_WarfareBArtilleryRadar_EP1" : {
		[_vec, [-3,-7,7], "Factory07Sfx", "RadarTop"] call _create;
		[_vec, [-3.5,-7.7,4.5], "fx_humming", "RadarBottom"] call _create;
		[_vec,  [-9.6,1,4.5], "Factory01Sfx", "RadarGenerator"] call _create;
	};
};
};

All z values is +2 to be able to see the debug sphere.

When I play this in singleplayer, all is good and dandy. In multiplayer (dedi), the positions I get are seemingly correct compared to each other, but offset many 50-100 meters from the placed object. Don't think it matters, but _poss is also set private for the topmost scope. It shouldn't matter since I'm referencing the actual object (after it is being placed) rather than the position in _poss when it gets to s_o_create.

Any ideas? Again, using modelToWorld with direct reference to the object causes a 50-100 meter offset, but only in multiplayer. Which makes it hard to test.

Edited by CarlGustaffa
Deleted cases from the last snippet.

Share this post


Link to post
Share on other sites

Did you try hosted server with someone joining? Sometimes the results can give a hint on wtf is going on.

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  

×