Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
iV - Ghost

getPos / setPos height on Server

Recommended Posts

I'm having some problems with setting the z-value in my naval mine script.

Local test are positiv. The height setting work fine. But on my server it doesn't work.

The mines spawn on the ground and not in 1 - (random 4).

 

fn_minesCreate.sqf

/*
 *
 * Filename: fn_minesCreate.sqf
 * Author: [iV] Ghost
 * Description: Creating a minefield and a marker on given position and radius.
 *
 * Example: ["M_Mines_Therisa_1", [17172, 12396], 30, "APERSMine", [8, 9, 10]] call iV_fnc_minesCreate;
 *
 */



// RUN ON DEDICATED SERVER OR PLAYER HOST
if (!isServer) exitWith {};



// VARIABLES
params ["_markerName", "_pos", "_radius", "_type", "_mineMax"];
private _random = selectRandom _mineMax;



// CREATE MARKER
[_markerName, _pos, [_radius, _radius], "colorOPFOR"] call iV_fnc_markerArea;



// CREATE MINES
for "_i" from 1 to _random do {
	
    private _mine = createMine [_type, _pos, [], _radius];
    _mine setDir (random 360);
    private _minePos = getPos _mine;
	
	
    // IF SURFACE IS WATER
    if (surfaceIsWater _minePos) then {
	
        private _z = 1 + (random 4);
        _mine setPos [getPos _mine select 0, getPos _mine select 1, (getPos _mine select 2) - _z];
		
    };
	
};

 

  • Haha 1

Share this post


Link to post
Share on other sites

Mines are hanging up in the sky (~10m).

Share this post


Link to post
Share on other sites

Is this happening using the moored mine?

If so, the issue is that the datum point of the mine is at the bottom of the chain, not on the warhead.

  • Like 1

Share this post


Link to post
Share on other sites

In my mission, I encoutered many problems with positioning naval mines. First is the position issue I talk about above. The other is that way that you can't reposition mines after they've been created. I'm not sure why, perhaps it's a multiplayer issue, but anyway, you can see how I got around some issues and just plain avoided others.

Unpack that, and look in the server/secondarymissions/do_navalmineclear file. I've left a lot of the comments and documentation in there because others have asked to look over the file since I wrote it. Feel free to use and abuse, put me in the credits of anything you keep :)

  • Like 3

Share this post


Link to post
Share on other sites

Yes the "problem" is only in mp and with the naval mines.

Should we create a ticket in the bugtracker for that?

 

I'll take a look into your mission.

Share this post


Link to post
Share on other sites
4 hours ago, iV - Ghost said:

 

Should we create a ticket in the bugtracker for that?

 

You can try, but you'd be wasting your time. :)

 

I'm pretty sure that the problem is that changes in naval mine positions are not broadcast over the network. Remote exec'ing the setpos on all clients *might* work, but I wrote this script before I was familiar with remoteexec, so as you'll see, I make sure the spawn position is good before I spawn the mine there so that I don't have to move it afterwards.

 

See my comments on the biki page a year ago.

https://community.bistudio.com/wiki/createMine

And here almost exactly 5 years ago where I found the same issue you have

 

Note that I have surface and moored mines, but no seabed ones. They kept on spawning inside rocks and while I could have fixed that up, I didn't have the time and so I just made the mission not spawn the seabed mine.

Share this post


Link to post
Share on other sites

What if you attach it to an anchor of some sort? Then move and position the anchor.

Share this post


Link to post
Share on other sites

OK. Find and define the position before creating the mine (moored) is the right way.

Thanks for your help guys.

  • Like 2

Share this post


Link to post
Share on other sites

×