Jump to content
Sign in to follow this  
xsdmx

Dynamic Object Compositions and 2D Editor

Recommended Posts

Little piece of code to create all compositions on map with named markers. In editor all you need is a player unit and then the code below to init.sqf. Use ALT + Left Mouse Button to teleport around.

// init.sqf

private["_posX", "_posY", "_i", "_cfg", "_count", "_cfgiName", "_markerName", "_cfgiTags"];

sleep 1;

_posX = (getPos player) select 0;
_posY = ((getPos player) select 1) + 50;

// Read Config File
_cfg =(configFile >> "CfgObjectCompositions");
_count = count _cfg;

hintSilent "Starting Composition Generation...";

for [{_i = 0}, {_i < _count}, {_i = _i + 1}] do
{
_cfgiName = configName (_cfg select _i);
_cfgiTags = getArray ((_cfg select _i) >> "tags");

// Create Marker
_markerName = createMarker["mrk" + _cfgiName, [_posX + (_i%8)*400, _posY + floor(_i/8)*90 + (_i%2)*45]];
_markerName setMarkerShape "ICON";
_markerName setMarkerType "FOB";
_markerName setMarkerText _cfgiName;

// Marker Color
if ("west" in _cfgiTags) then { _markerName setMarkerColor "ColorBlue"; };
if ("east" in _cfgiTags) then { _markerName setMarkerColor "ColorRed"; };
if ("resistance" in _cfgiTags) then { _markerName setMarkerColor "ColorYellow"; };

// Create Composition
_newComp = [(getMarkerPos _markerName), (markerDir _markerName), _cfgiName] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

};

hintSilent "..done!";

// Teleport with ALT + LMB
onMapSingleClick "
if ((local player) and _alt) then
{
(vehicle player) setPos _pos;
}";

Will look like this on map:

dynamicobjectcompositio.th.gif

Radio trigger with [] exec "camera.sqs" in activation line should be useful too.

Share this post


Link to post
Share on other sites

I've been using camp1_us for a mission and noticed that there is a weapons cache in the composition crammed full of weapons.

Any idea how to get rid of the weapons and/or put new ones in?

Share this post


Link to post
Share on other sites

No idea really, but scanning the area (around composition position) for crates using nearestObjects or something would be my first attempt.

Share this post


Link to post
Share on other sites
I've been using camp1_us for a mission and noticed that there is a weapons cache in the composition crammed full of weapons.

Any idea how to get rid of the weapons and/or put new ones in?

It's not possible to alter the original compositions. You'll have to edit the original compositions and spawn it via the custom composition script you can find in this thread.

Share this post


Link to post
Share on other sites

Sounds reasonable. So I'm wondering what would be the easiest way to find out what's in these compositions? Extracting ca.pbo seems the best approach?

Edited by redmotion

Share this post


Link to post
Share on other sites

True,

check out the SQF files in \modules\DynO\data\scripts\compositions

Open them in a simple text editor and replace the class names if necessary. You can even alter the objects in simple way. Take a look at this example: http://glt.pastebin.com/a8WFPTTk

In this example I added a different flag to the flag pole. You can use absolute and relative paths in that line. Instead of adding other flags you can add different weapons and magazines to the composition weapon crates. It works the way like in the editor using addWeaponCargo and addMagazineCargo.

At the end however it can only be loaded via the custom composition script.

Share this post


Link to post
Share on other sites

Do custom compositions work in OA?

I am following the Biki instructions under "Creating Custom compositions" and I never get the objectGrabber.sqf to generate the arma2.rpt. Just enter the mission with no dialog boxes, etc. indicating the script is running. If I'm reading the script correctly I should see something state that it is running and that it finishes... correct?

I am using default install, no mods, Utes island.

Player init from the mission file:

init="null=[getpos player,200] execVM ""objectGrabber.sqf"";";

I've copied the sqf into the mission folder. I've also tried with a game logic and a trigger but still no RPT is generated.

Share this post


Link to post
Share on other sites

Thanks! I found it was there all along - that's what I get for working on things so late :)

Share this post


Link to post
Share on other sites
Little piece of code to create all compositions on map with named markers. In editor all you need is a player unit and then the code below to init.sqf. Use ALT + Left Mouse Button to teleport around.

Radio trigger with [] exec "camera.sqs" in activation line should be useful too.

Thanks a Million!.. i needed this for the lost key keep camp list.

Edited by Loki
grammer

Share this post


Link to post
Share on other sites
Little piece of code to create all compositions on map with named markers. In editor all you need is a player unit and then the code below to init.sqf. Use ALT + Left Mouse Button to teleport around.

// init.sqf

private["_posX", "_posY", "_i", "_cfg", "_count", "_cfgiName", "_markerName", "_cfgiTags"];

sleep 1;

_posX = (getPos player) select 0;
_posY = ((getPos player) select 1) + 50;

// Read Config File
_cfg =(configFile >> "CfgObjectCompositions");
_count = count _cfg;

hintSilent "Starting Composition Generation...";

for [{_i = 0}, {_i < _count}, {_i = _i + 1}] do
{
_cfgiName = configName (_cfg select _i);
_cfgiTags = getArray ((_cfg select _i) >> "tags");

// Create Marker
_markerName = createMarker["mrk" + _cfgiName, [_posX + (_i%8)*400, _posY + floor(_i/8)*90 + (_i%2)*45]];
_markerName setMarkerShape "ICON";
_markerName setMarkerType "FOB";
_markerName setMarkerText _cfgiName;

// Marker Color
if ("west" in _cfgiTags) then { _markerName setMarkerColor "ColorBlue"; };
if ("east" in _cfgiTags) then { _markerName setMarkerColor "ColorRed"; };
if ("resistance" in _cfgiTags) then { _markerName setMarkerColor "ColorYellow"; };

// Create Composition
_newComp = [(getMarkerPos _markerName), (markerDir _markerName), _cfgiName] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

};

hintSilent "..done!";

// Teleport with ALT + LMB
onMapSingleClick "
if ((local player) and _alt) then
{
(vehicle player) setPos _pos;
}";

Will look like this on map:

dynamicobjectcompositio.th.gif

Radio trigger with [] exec "camera.sqs" in activation line should be useful too.

:eek

Thanks Rok!! : :yay:

Share this post


Link to post
Share on other sites

@Legislator:

In Domination the placer is changed so that during placement all placed objects are added to an array. The contents of this array is deleteVehicle'd when a target is considered complete. Search for i.e. d_delfirebase_objects to see how it's done.

Another approach might be to add a variable to the object upon placement, and a cleanup script deletes these objects whenever you want.

Share this post


Link to post
Share on other sites

Confirmed this after many rounds of tweaking and testing:

If an AI squad get's in a vehicle, then exits the vehicle and is then told to defend a position using the defend function, they will never man static weapons. If they proceed to the area on foot, they will man static weapons every time.

Anyone know a way around this?

Share this post


Link to post
Share on other sites
Is it possible to modify the templates? (without using a mod, that is). Or at least get the reference to one of the component objects in the template so it can be manipulated?

Edit: That random option is freakin' awesome, btw

Yes you can extract them fom the ca folder. All compositon are there. So you simpley can edit them.

I has made a small example with the most opject compositions.

So you only need to copy and paste the Object Location from the Editor.

All compositions get call via the Location Name via the init.sqf file

All composition you find in this mission map in location "Composition_direct_Load.Chernarus\dyno\data\scripts\compositions" and get loated directly from there. So it`s easyer to edit of load custom Compositions.

Also i thing is mp compatible.!!!

You can download the Demo Mission there:

http://www.4shared.com/folder/c_8Tvg5J/_online.html

Edited by (NL) Nero

Share this post


Link to post
Share on other sites

_newObjs = [_pos, (random 360), ["usmc", "medium"]] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

what other 'tags' are avalible besides "medium"?

large,small iam assuming.. but some compositions class names don't include a "size" in their name, some are just labeled firebase_1, fueldepot_1, airpark_1 etc.. are these off named composition an integeral part of a "medium","small","large" compositions?

also, iam trying to access an object using nearestobjects, like the Tungsta that spawns in at the Russian anti air composition.I would like to access it without having to edit any composition scripts. How would I be able to tell via trigger if a tungsta is in the trigger list?

Edited by Iceman77

Share this post


Link to post
Share on other sites

Hey guys,

Sorry to bring up an old thread, but I've been fiddling with Object compositions and I've just run into a slight problem. I'm making it so on a certain vehicle, when you click the action 'Deploy FOB', the composition "Small Base" is built around the stryker.

Now, I've got it to work perfectly with the stryker and have the composition built in the direction the stryker is facing, rather than the world's direction.

The stryker is called "HQStry" and in init field;

this addAction ["Deploy Base", "spawnfob.sqf"];

spawnfob.sqf is;

_d = getDir HQstry;
_newObjs = [getPos HQstry, _d, "smallbase"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

Now the above works, there's no problems there. It's just when I make another one, say for a heli, and call it spawnheli and change HQstry to HQhawk. When I do that, follow everything exactly, it doesn't work. Does anyone know why? I'll give you the example;

The blackhawk is called "HQhawk" and in init field;

this addAction ["Deploy HeliBase", "spawnheli.sqf"];

spawnheli.sqf is;

_d = getDir HQhawk
_newObj = [getPos HQhawk, _d, "heli_park_us1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

Any idea why that wouldn't work the same as it does for the stryker?

Share this post


Link to post
Share on other sites
Hey guys,

Sorry to bring up an old thread, but I've been fiddling with Object compositions and I've just run into a slight problem. I'm making it so on a certain vehicle, when you click the action 'Deploy FOB', the composition "Small Base" is built around the stryker.

Now, I've got it to work perfectly with the stryker and have the composition built in the direction the stryker is facing, rather than the world's direction.

The stryker is called "HQStry" and in init field;

this addAction ["Deploy Base", "spawnfob.sqf"];

spawnfob.sqf is;

_d = getDir HQstry;
_newObjs = [getPos HQstry, _d, "smallbase"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

Now the above works, there's no problems there. It's just when I make another one, say for a heli, and call it spawnheli and change HQstry to HQhawk. When I do that, follow everything exactly, it doesn't work. Does anyone know why? I'll give you the example;

The blackhawk is called "HQhawk" and in init field;

this addAction ["Deploy HeliBase", "spawnheli.sqf"];

spawnheli.sqf is;

_d = getDir HQhawk
_newObj = [getPos HQhawk, _d, "heli_park_us1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

Any idea why that wouldn't work the same as it does for the stryker?

Assuming you have done *everything* you have said you have done; and correctly. My guess its the missing semi-colon after

_d = getDir HQhawk

Script errors enabled?

Share this post


Link to post
Share on other sites

Just wondering if anyone has an idea why this isnt working on a dedicated server. I have a trigger which is activated by independant being present, with this on the ACT line: nul = ["zavaraksouth", getDir zavaraksouthmarketspawn, getPos zavaraksouthmarketspawn] execVM "Createcomposition.sqf"; zavaraksouth is the name of the composition and zavaraksouthmarketspawn is the name of the trigger where the composition spawns, it works fine in the editor once the trigger fires it builds the composition, but it will not work on dedicated server. I have the trigger set to Switch also.

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  

×