Jump to content
Sign in to follow this  
DTM2801

The answer how to create your custom object compositions

Recommended Posts

I've found a way to create/save/share and use your own object compositions using slightly adjusted BIS scripts objectgrabber and objectmapper.

Download and open the package at the bottom and place @SAP_render (thank you Sgt.Ace) in your arma2 dir, place objectmapper and objectgrabber in your missionsfolder.

How to create a custom composition:

  1. Open the editor (2d) using the map "Render Island"
  2. Load the mission "objectgrabber".
  3. Place your objects on the map.
  4. If you want a custom object init you have to use this format in the initialisation field of the object otherwise it wont be grabbed: this setvariable ["VehicleInit","<YOUR INITSTRING>;"]
  5. Place the player unit in the middle of your composition and put this in its init: null = [getpos this,200] execvm "objectGrabber.sqf"; // (200 is the radius, adjust when needed).
  6. Preview the mission, the objects are now written in arma2.rpt.
  7. Copy all text between "startgrabbing" and "endgrabbing" (not the ### lines) and paste this in the file composition_template.sqf at the marked area located in the missionfolder "objectmapper\compositions\".
  8. Remove , at the last line of the copied text.

Example arma2.rpt

["MASH",[0,0,0],0,1,0],

["Land_GuardShed",[35.9503,29.7019,0],0,1,0],

["ACamp",[-41.3973,-33.6524,0],0,1,0],

After editing

["MASH",[0,0,0],0,1,0],

["Land_GuardShed",[35.9503,29.7019,0],0,1,0],

["ACamp",[-41.3973,-33.6524,0],0,1,0]

9. Save the file in the missions compositions folder.

How to place your created composition on the map:

(in this example I use my sample map, but it works the same when using your own missionmap).

  1. Open the mission Render Island -> objectmapper.
  2. Place a gamelogic on the map and put this in the init: null= ["test_comp", getdir this, getpos this] execVM "Createcomposition.sqf"; (replace "test_comp" with your own compositioname without .sqf)
  3. Preview the mission and your composition is placed (you can place multiple and different compositions at once).

I've also included the original BIS compositions.

Custom compositions v0.3

Custom compositions v0.3 (RTE compatible) thanks Binesi

Manhattan composition

Edited by DTM2801
added composition

Share this post


Link to post
Share on other sites

You did simplify the way it works. Nice job dude!

Note :I have found that the vehicules "spawn" using either objectMapper.sqf or Armatech's createcompositions.sqf seem to be droped from 1 or 2 meters above the ground. Even when Z coordinates are set to negative values.

This results in making the vehicules bouncing a little once they hit the floor. On the SAP_render it would not do much trouble. BUT on an irregular terrain such as in Chernarus, it may gives some problems.

By exemple: let's say a tank with a Land_CamoNetB_EAST placed above it.

If you spawn both on the same time, the CamoNet would be created at the very same time as the Tank is in mid-air and the CamoNet would be damaged and somewhat fall down on the tank, overlapsing it. This looks pretty ugly.

So the fix I use is:

1-I split the composition in 3 parts:

A-The Tank first. B-The rest except for the CamoNet, and C-The CamoNet.

2-Instead of calling the objectMapper.sqf/createcomposition.sqf directly from the gamelogic, I rather call an init script and place the command null = [getpos this,getdir this, "test_comp"] call (compile (preprocessFileLineNumbers "objectMapper.sqf"));

for each 3 parts within it using a sleep command to let the tank "land" on the ground.

This works perfectly.

Also the objectMapper.sqf has an optionnal parameter that would randomize by the chosen value, the chance each object has of being created. Splicing the whole composition into "sub-compositions" would be usefull if you want to randomize some elements without affecting other ones.

Share this post


Link to post
Share on other sites

Glad its of use to you The-Neurocyber.

For the bouncing objects I dont recall this happening with the BIS compositions, while your 2way solution is a nice workaround I'll look in to it some more.

-----

I made several attempts to replicate your issue with tanks, hmmwv and camo nets on different map/locations on Utes and Chernarus, all objects seem to be stable when mission loaded.

This is the composition I used:

 
private ["_objs"];
_objs =
[
["HMMWV_M2",[8.59381,1.34076,-0.000391006],274.106,1,0],
["HMMWV_M2",[8.99571,-3.27191,-0.000391006],264.106,1,0],
["Land_CamoNet_NATO",[10.0272,-0.928986,0],89.1061,1,0],
["HMMWV_M2",[-2.41623,9.68683,-0.000391006],185,1,0],
["HMMWV_M2",[2.20206,10.0167,-0.000391006],175,1,0],
["HMMWV_M2",[-10.355,-2.74402,-0.000391006],93.3227,1,0],
["Land_CamoNet_NATO",[-0.124405,11.0846,0],0,1,0],
["HMMWV_M2",[-10.8199,1.86264,-0.000391006],83.3227,1,0],
["Land_CamoNet_NATO",[-11.8194,-0.494019,0],268.323,1,0],
["M1A1",[-0.618729,-18.2269,-0.0751133],358.972,1,0],
["Land_CamoNetB_EAST",[-0.288605,-18.4742,0],183.526,1,0],
["FoldChair",[15.8349,-10.8842,0],0,1,0],
["FoldTable",[16.6358,-11.8452,0],183.526,1,0],
["FoldChair",[17.4872,-10.9962,0],0,1,0],
["Land_CamoNetVar_EAST",[17.1119,-12.2887,0],132.052,1,0]
];
_objs

Can you post your composition so I can see what happens?

Edited by DTM2801

Share this post


Link to post
Share on other sites

actually I got it with the original anti-air_ru1.sqf but it somewhat random depending on the surface (on the first spawn). However when I delete and respawn the set, the collapse of CamoNet happen almost every time.

As an exemple here is the modded AA camp setup I use :

private ["_objs"];

_objs =

[

["Land_Antenna",[6,17,0],45,1,0],

["Pile_of_wood",[4,14,0],140,1,0],

["Land_CamoNetB_EAST",[4.7,3.2,1],47.5,1,0],

["RUVehicleBox",[9,7,0],40,1,0],

["2S6M_Tunguska",[1,1,-0.3],225,1,0],

["Barrel1",[6.5,8.5,0],40,1,0],

["Barrel4",[7,9,0],40,1,0],

["Land_Fire_barrel",[6.5,9.5,0],40,1,0],

["Land_Fire_barrel",[6,9,0],40,1,0],

["Land_Toilet",[4,9.5,0],0,1,0],

["Paleta2",[0,8,0],40,1,0],

["Misc_cargo_cont_tiny",[11,3,0],40,1,0],

["SmallTable",[9,0,0],130,1,0],

["SatPhone",[8.9,0.1,0.6],130,1,0],

["Satelit",[9,-1.7,0.01],130,1,0],

["PowerGenerator",[7,-3,0],40,1,0],

["Igla_AA_pod_East",[3,-9,0],195,1,0],

["Land_fort_bagfence_round",[2.5,-11,0],195,1,0],

["Land_fort_rampart",[-4.3,-5,0],40,1,0],

["RULaunchersBox",[-4.3,-3.8,0],40,1,0],

["RUBasicAmmunitionBox",[-2.6,-5.4,0],40,1,0],

["Land_A_tent",[-6,19,0],0,1,0],

["Land_A_tent",[-9,18,0],320,1,0],

["Land_A_tent",[-10.7,15.3,0],290,1,0],

["Land_Fire",[-6,14,0],0,1,0],

["Park_bench1",[-4.5,14,0],270,1,0],

["Park_bench1",[-6.5,12.5,0],20,1,0],

["Fort_EnvelopeBig",[-10.1,8.4,0],280,1,0],

["KORD",[-10,8,0],280,1,0],

["RUBasicAmmunitionBox",[-9.5,9.6,0],100,1,0],

["Land_fort_bagfence_corner",[-10,3.5,0],90,1,0],

["SearchLight_RUS",[-9,2,0],270,1,0],

["Fort_Crate_wood",[-9.5,0,0],270,1,0],

["RUBasicAmmunitionBox",[-8.7,0,0],90,1,0],

["Land_fort_bagfence_corner",[-9.5,-0.4,0],0,1,0]

];

_objs

I've try with your composition, the M1A1's CamoNet looks fine the first time and collapse on all further respawn

Maybe it does differ based upond one's HW config, if that so I'll keep using a sleep command to be sure of greater compatibility.

Maybe, also its because Im using rather createcomposition.sqf than objectMapper.sqf.

I'll try it immediately with your Custom_compositions mission file.

---------- Post added at 09:28 PM ---------- Previous post was at 08:52 PM ----------

Did few tests, act the same with both objectMapper.sqf and createcomposition.sqf

But, upon further tests I found that ONLY (as far as Ive tested) the tanks did "bounce" on spawn. And all of them have a minor bounce effect except for the 2S6M_Tunguska which was actually the one I use for my composition.

Dunno why but that 2S6M_Tunguska react as paperweight and bounce noticablely more than other tracked vehicules.

Share this post


Link to post
Share on other sites

I see what you mean with the bouncing tank.

As a test I used the objectgrabber on your composition (just put the grabbercode in the init of the player) and then I used that output in the same composition file and guess what.... it doesnt bounce anymore.

here is the regrabbed version:

 
private ["_objs"];
_objs =
[
["Land_fort_bagfence_round",[3.23767,10.0195,-0.0164075],195.068,1,0],
["Igla_AA_pod_East",[3.77136,12.3232,-0.00584841],195.068,1,0],
["Land_fort_rampart",[-3.55981,16.0249,-0.0297489],40.0474,1,0],
["RUBasicAmmunitionBox",[-1.85791,15.6235,0.00108433],40.0385,1,0],
["RULaunchersBox",[-3.55652,17.2249,0.0042367],40.0474,1,0],
["PowerGenerator",[7.76147,17.9973,0.000842094],40.0529,1,0],
["LocationLogic",[0.74646,21.0215,0],0.0457857,1,0],
["Satelit",[9.76624,19.2942,0.0109596],130.042,1,0],
["2S6M_Tunguska",[1.87695,21.9275,-1.82141],225.03,1,0],
["RUBasicAmmunitionBox",[-7.95349,21.0283,0.00141907],89.9807,1,0],
["Fort_Crate_wood",[-8.75354,21.0291,0.00128317],269.981,1,0],
["Land_fort_bagfence_corner",[-8.75391,20.6292,-0.00734138],0.110806,1,0],
["SmallTable",[9.7561,21.0054,0.000432968],130.042,1,0],
["SatPhone",[9.651,21.1099,0.600214],130.042,1,0],
["SearchLight_RUS",[-8.25232,23.0288,-2.0504e-005],269.981,1,0],
["Land_CamoNetB_EAST",[5.44897,24.2178,1.0041],47.5524,1,0],
["Land_fort_bagfence_corner",[-9.25073,24.5295,0.0357766],89.9677,1,0],
["Misc_cargo_cont_tiny",[11.7489,24.0127,0.00101948],40.0642,1,0],
["Paleta2",[0.752808,29.0215,0.0112319],40.051,1,0],
["RUVehicleBox",[9.76636,28.0146,0.0189261],40.0552,1,0],
["Fort_EnvelopeBig",[-9.34656,29.4304,0.0610332],279.983,1,0],
["KORD",[-9.08289,28.9644,0.00923109],279.983,1,0],
["Land_Toilet",[4.75403,30.5183,0.0161867],0.0885393,1,0],
["Barrel1",[7.26868,29.5002,0.000860214],40.0552,1,0],
["Land_Fire_barrel",[6.76904,30.0005,0.00086689],40.0552,1,0],
["Barrel4",[7.76904,29.9998,0.000857353],40.0552,1,0],
["Land_Fire_barrel",[7.26941,30.5002,0.00085783],40.0552,1,0],
["RUBasicAmmunitionBox",[-8.74585,30.6292,0.00156879],99.983,1,0],
["Park_bench1",[-5.73071,33.5156,0.00100613],20.1121,1,0],
["Park_bench1",[-3.73291,35.0142,0.000738144],269.972,1,0],
["Land_Fire",[-5.24011,35.0244,0.000169277],0.145987,1,0],
["Pile_of_wood",[4.75769,35.0183,-0.0596499],140.039,1,0],
["Land_A_tent",[-9.94128,36.3301,0.00201273],289.979,1,0],
["Land_Antenna",[6.75989,38.0166,0.0147829],45.0529,1,0],
["Land_A_tent",[-8.23914,39.0286,0.00208521],320.066,1,0],
["Land_A_tent",[-5.2384,40.0264,0.00183868],0.163166,1,0]
];
_objs

Share this post


Link to post
Share on other sites

Hum .. also the bounce effect was amplified by the Z-axis negative value I did put on the 2S6M_Tunguska.

After reset that value to 0 the bounce on 2S6M_Tunguska... and other tanks (which was almost unnoticable) is even reduced.

But now you can clearly notice that (Only) the 2S6M_Tunguska is falling from above the ground (and now even higher) which still causes the CamoNet to collapse.

---------- Post added at 09:50 PM ---------- Previous post was at 09:35 PM ----------

Hum this is funny, I've used the 2S6M_Tunguska Z-Axis coord : -1.82141 in my composition.

The 2S6M_Tunguska do not bounce anymore, indeed. But try it with an M1A1...

Now the other tanks seems to bounce a little more, but indeed the bouncing is now acceptable.

I think this is due to:

1- the relative pos is get from the logic object that is set to an heigh of 424.4769 and

2- the object's model center is definitely irregular depending on the objects.

---------- Post added at 10:08 PM ---------- Previous post was at 09:50 PM ----------

Also I didn't use the objectgrabber in the player's init since I rather build my composition in the 3d editor using Dyno grabber function. Maybe I should then re-use it afterwards base upon player's position.

Thanks for your help buddy.

---------- Post added at 10:12 PM ---------- Previous post was at 10:08 PM ----------

I forgot to ask you : Im actually looking for a way to flatten grass around created composition without using the invisible H object (which interfere with AI on Chopper landing)

By any chance did you have any idea ?

Share this post


Link to post
Share on other sites

There might be the prob in position difference between 2d/3d editor and the composition center.. I'll do some comparisment tomorrow.

You could try this in a gl or something for the clearing of an area, I used it to place a base in the middle of the woods somewhere in a chernarus:

{DeleteCollection _x} foreach (NearestObjects [this, [], 100]) - ((GetPos this) NearObjects 100);

(obviously 100 is radius, so adjust accordingly)

Share this post


Link to post
Share on other sites

2lygQ_tDkvg


It's probably a game problem rather than a positioning problem. Hadn't seen a mission that solved this issue, though the effect may be lower for certain vehicles/locations.

Share this post


Link to post
Share on other sites

Holy crap! It's speak itself litteraly...

---------- Post added at 11:24 PM ---------- Previous post was at 11:12 PM ----------

Hum ...negative

it does clear out the trees but grass isn't deleted.

Actually faltten the grass is the only option we got since BIS bring us a new command or bring back the grasscutter used in Arma 1

---------- Post added at 11:58 PM ---------- Previous post was at 11:24 PM ----------

There might be the prob in position difference between 2d/3d editor and the composition center.. I'll do some comparisment tomorrow.

You could try this in a gl or something for the clearing of an area, I used it to place a base in the middle of the woods somewhere in a chernarus:

{DeleteCollection _x} foreach (NearestObjects [this, [], 100]) - ((GetPos this) NearObjects 100);

(obviously 100 is radius, so adjust accordingly)

Hum even worse is that if I use that command, I found that the objects deleted (bushes, trees, fences, wrecks and rocks) would not reappears on restart. They will all remains vanished UNTIL I did reload the Chernarus map.

(Still vanished if I load another mission on the same island, in that case Chernarus) So its a very bad grasscutter plan B

Share this post


Link to post
Share on other sites

hehe, well it did exactly what I wanted.. then you remove all grass on the map with setTerrainGrid 50; placed in init.sqf. :D

Share this post


Link to post
Share on other sites

Code & package updated in first post.

changes:

- Objectgrabber: changed arma2.rpt output for easier copy/paste.

- Objectmapper: init code cleanup.

Share this post


Link to post
Share on other sites

Very nice. I have been looking for a good solution to do this. One question though, or maybe a feature request. In some of the BIS compositions they do a bit more then just setting the position of an object. For example this is from a script in the campaign missions:

_group_6 = createGroup _center_0;

_unit_13 = objNull;
if (true) then
{
 _this = _group_6 createUnit ["USMC_Soldier_Pilot", [10434.267, 1932.4336, 2.0980835e-005], [], 0, "CAN_COLLIDE"];
 _unit_13 = _this;
 _this setVehicleVarName "BIS_BMaddox";
 BIS_BMaddox = _this;
 _this setVehicleInit "this setRank ""Sergeant""; this setIdentity ""Maddox""; this setBehaviour ""CARELESS""; this setCombatMode ""BLUE""; group this setGroupId [localize ""str_callsign_starforce""]";
 _this setUnitAbility 0.60000002;
 _this moveInDriver _vehicle_524;
 if (false) then {_group_6 selectLeader _this;};
};

Would it be possible to extend your solution to capture the object's init? I assume it is a variable somewhere.

This would allow for things like grass cutting as you can create a helo H that has an init to spawn a deletion of itself, which is how I usually handle getting grass out of the way. This would also give enough functionality to put in real units and do any number of odd or complex setups.

*EDIT*

Oh, also - one trick for people using this. If you already have some layouts which you've created in the editor you can transfer them into this pretty easily. Just move whatever it is you want to map close to 0,0,0 (the lower left hand corner of the map). Then copy that mission.sqm into a new folder with a ".render" extension. Load that up with the render map and there is your composition.

Edited by Binesi

Share this post


Link to post
Share on other sites
Would it be possible to extend your solution to capture the object's init? I assume it is a variable somewhere.

Adding object inits to the compositions would indeed be a nice extention, but.. I've no idea how to grab the objects init, I've tried several options after searching the forum, BIS wiki, google but I cant get the init as a result other then creating a seperate variable which has to be created for every object manually.

So if anyone has an idea how to get this please share.

EDIT: After comparing existing scripts I've implemented the variable

Edited by DTM2801

Share this post


Link to post
Share on other sites

Code & Package update

-Objectgrabber: included the option vehicleinit in the grabberscript (see first post for instructions)

-Objectmapper: included original BIS compositions

Share this post


Link to post
Share on other sites

I think it's merly doable , but one have to do 3 steps:

1- Modify the composition spawner script (either objectmapper.sqf or createcomposition.sqf) so it can handle one more argument passed to it. (Which is the Init line as a string)

2 - Get the string with a private variable

3 - And on the very bottom of the script in the "creation" procedure loop, there you use the variable that has taken the argument and assing it to each unit processed in the loop.

This should do the trick. I haven't tested it but I was thinking of doing something alike there to name each of the object individually.

Hum thinking of it... make that so it takes the new argument from the same script which has the composition, so if done properly, it should only give the Init argument to predefined element in the composition script. Otherwise you may get all of the element with the same init command.

Edited by The-Neurocyber

Share this post


Link to post
Share on other sites
I think it's merly doable , but one have to do 3 steps:

1- Modify the composition spawner script (either objectmapper.sqf or createcomposition.sqf) so it can handle one more argument passed to it. (Which is the Init line as a string)

2 - Get the string with a private variable

3 - And on the very bottom of the script in the "creation" procedure loop, there you use the variable that has taken the argument and assing it to each unit processed in the loop.

This should do the trick. I haven't tested it but I was thinking of doing something alike there to name each of the object individually.

Hum thinking of it... make that so it takes the new argument from the same script which has the composition, so if done properly, it should only give the Init argument to predefined element in the composition script. Otherwise you may get all of the element with the same init command.

I think you missed the last posts, the initialisation field of an oject is implemented.. or did you encounter any problems with it?

Share this post


Link to post
Share on other sites

Very nice. I've already made a dozen new compositions (and fixed some of the default BIS ones) using this.

Another trick if you are also using RTE. Make another version of the object mapping script and add this to the last line:

{_x call ION_RTE_pAddObject;} forEach _newObjs;

Now when you use a composition all the objects will be added to RTE so you can edit them in real time and even save them back out into the mission.sqm. This is a great way to edit the existing BIS compositions.

Share this post


Link to post
Share on other sites
Very nice. I've already made a dozen new compositions (and fixed some of the default BIS ones) using this.

Another trick if you are also using RTE. Make another version of the object mapping script and add this to the last line:

{_x call ION_RTE_pAddObject;} forEach _newObjs;

Now when you use a composition all the objects will be added to RTE so you can edit them in real time and even save them back out into the mission.sqm. This is a great way to edit the existing BIS compositions.

Thanks for the tip, added the RTE compatible version to the first post.

Share this post


Link to post
Share on other sites

DTM,

sorry for digging up an old thread, but how do I use the manhattan one? What I mean is as far as what should it read in the init line of the game logic? I tried "manhattan" and everything else I could think of and when I previewed, there was nothing?

Anyways thanks for these, I'm trying to get the hang of making some myself, but having issues with the Hesco's. Trying to do triple (2 on the bottom and one on the top in between the two) but doing it in RTE, but its becoming a major issue so these compositions come in handy in the meantime for quick FOB's and such. :)

Share this post


Link to post
Share on other sites

how do I use the manhattan one? What I mean is as far as what should it read in the init line of the game logic? I tried "manhattan" and everything else I could think of and when I previewed, there was nothing?

You download, extract the archive and put manhattan.sqf in your missionfolder\compositions folder.

The init would be:

null= ["manhattan", getdir this, getpos this] execVM "Createcomposition.sqf";

This should work.

Share this post


Link to post
Share on other sites

Thanks mate, worked like a charm! I think what the issue was I was putting the manhattan.sqf in instead of Creatcomposition.sqf--durrr, stupid me! :o

Thanks again, much appreciated. :D

Share this post


Link to post
Share on other sites

dont mean to bring this thread up again, but im having issues with the z coordinate of my compositions. When i created them in the 3d editor it looked like this:

hidingspot.jpg

now once i grab it, and create a new compositions file and load it up using game logic, it looks like this:

hidingspotcrushed.jpg

basically all of the objects just start at 0 height. with the exception of 1 that somehow managed to be in the right position, but everything else is not where its supposed to be.

ive been looking at the script itself and tried to search for an issue related to it, but i dont see anything wrong with the _z variable in the script.

have any ideas on how to fix it so it properly sets it up at the correct height?

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  

×