Jump to content
Da_Hollander

Adding small bases / outposts at generated missions

Recommended Posts

Hello all,

 

As the title says, I'd like to have some help with adding a group of objects that form an outpost at a dynamic mission.

Context: you're in a mission and a randomly spawned mission pops up. I want several objects to spawn at that mission so it can be fortified and what not.

 

To make my question more specific: The objects in the example code are placed well and have certain coordinates + rotations etc. Is there any way to make such 'group' of objects myself and write them in a simular way as the example code? Because the issue is that I have no idea how I could get the 'relative' coordinates of the objects.

 

I hope my question is formed clear enough to understand..

 

I have example code here:

//////////////////////
// -- ADD THIS -- 1 //
//////////////////////
_centerSpawn = _this select 0;
_centerSpawnX = _centerSpawn select 0;
_centerSpawnY = _centerSpawn select 1;
/////////////////
// -- END -- 1 //
/////////////////

_vehicle_0 = objNull;
if (true) then
{
  _this = createVehicle ["Land_MultiMeter_F", [1817.7195, 5623.689, -1.2397766e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_0 = _this;
  _this setPos [1817.7195, 5623.689, -1.2397766e-005];
};
///////////////////////
// -- ADD THIS --  2 //
///////////////////////
_centerObj = getPosWorld _vehicle_0; 
_centerX = _centerObj select 0;
_centerY = _centerObj select 1;
deleteVehicle _vehicle_0;
/////////////////
// -- END -- 2 //
/////////////////
_vehicle_1 = objNull;
if (true) then
{
  _this = createVehicle ["Land_Cargo_HQ_V2_F", [1818.382, 5624.3564, -9.5367432e-007], [], 0, "CAN_COLLIDE"];
  _vehicle_1 = _this;
  _this setDir 16.173525;
  _this setPos [(1818.382)-_centerX+_centerSpawnX, (5624.3564)-_centerY+_centerSpawnY, -9.5367432e-007];
};

_vehicle_2 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_3_F", [1811.2635, 5621.4463, 1.9073486e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_2 = _this;
  _this setDir 106.22929;
  _this setPos [(1811.2635)-_centerX+_centerSpawnX, (5621.4463)-_centerY+_centerSpawnY, 1.9073486e-006];
};

_vehicle_3 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_5_F", [1811.7753, 5617.7754, 8.5830688e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_3 = _this;
  _this setDir 17.772383;
  _this setPos [(1811.7753)-_centerX+_centerSpawnX, (5617.7754)-_centerY+_centerSpawnY, 8.5830688e-006];
};

_vehicle_4 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_1_F", [1826.0121, 5622.8223, -1.4305115e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_4 = _this;
  _this setDir 109.19431;
  _this setPos [(1826.0121)-_centerX+_centerSpawnX, (5622.8223)-_centerY+_centerSpawnY, -1.4305115e-006];
};

_vehicle_6 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_5_F", [1818.0166, 5617.2568, -7.6293945e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_6 = _this;
  _this setDir 16.170671;
  _this setPos [(1818.0166)-_centerX+_centerSpawnX, (5617.2568)-_centerY+_centerSpawnY, -7.6293945e-006];
};

_vehicle_9 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_5_F", [1826.0255, 5629.1235, -5.7220459e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_9 = _this;
  _this setDir 196.55594;
  _this setPos [(1826.0255)-_centerX+_centerSpawnX, (5629.1235)-_centerY+_centerSpawnY, -5.7220459e-006];
};

_vehicle_13 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_3_F", [1813.771, 5629.9653, 5.7220459e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_13 = _this;
  _this setDir 106.22929;
  _this setPos [(1813.771)-_centerX+_centerSpawnX, (5629.9653)-_centerY+_centerSpawnY, 5.7220459e-006];
};

_vehicle_16 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_3_F", [1827.408, 5628.5742, 3.3378601e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_16 = _this;
  _this setDir 99.777275;
  _this setPos [(1827.408)-_centerX+_centerSpawnX, (5628.5742)-_centerY+_centerSpawnY, 3.3378601e-006];
};

_vehicle_19 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_3_F", [1824.6447, 5617.9897, 5.2452087e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_19 = _this;
  _this setDir 106.8838;
  _this setPos [(1824.6447)-_centerX+_centerSpawnX, (5617.9897)-_centerY+_centerSpawnY, 5.2452087e-006];
};

_vehicle_26 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_1_F", [1825.6771, 5621.7358, 2.8610229e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_26 = _this;
  _this setDir 105.16212;
  _this setPos [(1825.6771)-_centerX+_centerSpawnX, (5621.7358)-_centerY+_centerSpawnY, 2.8610229e-006];
};

_vehicle_29 = objNull;
if (true) then
{
  _this = createVehicle ["Land_HBarrier_1_F", [1827.2349, 5623.9165, 1.4305115e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_29 = _this;
  _this setDir 193.59006;
  _this setPos [(1827.2349)-_centerX+_centerSpawnX, (5623.9165)-_centerY+_centerSpawnY, 1.4305115e-006];
};

 

 

Share this post


Link to post
Share on other sites
3 hours ago, Da_Hollander said:

if (true) then


facebook_facepalm_400x400.jpg

 

3 hours ago, Da_Hollander said:

I have no idea how I could get the 'relative' coordinates of the objects.


worldToModel

Share this post


Link to post
Share on other sites
9 hours ago, killzone_kid said:

 

Haha I guess the person in the example code had to make sure @ if true

 

Thanks for linking to worldToModel, will check that and see if I can find out how it works.

Share this post


Link to post
Share on other sites

You could use my c-pack, Josef.moveObjects to move objects and keep there position/ rotation to each other.

Its possible to use as an ordinary function even if you don't won't to use TypeSQF.

I can release it in the forum if your interested.

 

//Josef

Share this post


Link to post
Share on other sites
41 minutes ago, Josef_ said:

You could use my c-pack, Josef.moveObjects to move objects and keep there position/ rotation to each other.

Its possible to use as an ordinary function even if you don't won't to use TypeSQF.

I can release it in the forum if your interested.

 

//Josef

Cheers, will look into that.

 

Unfortunately I do not know how I can use the worldToModel stuff.. Can't find any examples or tutorials online either. Could anyone explain or link me to an explenation of it?

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

×