Home   Help Search Login Register  

Author Topic: Static defense template  (Read 2376 times)

0 Members and 1 Guest are viewing this topic.

Offline CrazyAce

  • Members
  • *
Static defense template
« on: 05 Oct 2009, 16:46:10 »
I'm not sure where to put this question; I haven't been able to find what I'm looking for as I'm new to this part of editing. What I'm trying to find is how to create a static defense template. I'm beta testing a mission and decided that a few more static defenses would be great to have, but I don't know where to start in making one. To get an idea of the mission, it's closely related to a Warfare type of mission in that the player builds stuff.

:edit:

A tutorial would be great :good:

Offline celoush

  • Members
  • *
  • Lazy czech mission designer
    • My czech website about mission design

Offline CrazyAce

  • Members
  • *
Re: Static defense template
« Reply #2 on: 06 Oct 2009, 07:29:50 »
Compositions; that's what I'm looking for :good: thanx. Phew... I think I might have asked for the world here :blink: this doesn't seem easy. Anyone have suggestions?

I looked in the 3D editor and combined a few bunkers together with static defense for testing, but I can't save them as a template.

Offline robs

  • Members
  • *
Re: Static defense template
« Reply #3 on: 06 Oct 2009, 09:37:11 »
Compositions are really handy but not very well documented.  You'll need a Createcomposition.sqf script to use them.  Here's the one I've been using:

Code: [Select]
/*
Original Script
objectMapper.sqf Author: Joris-Jan van 't Land
Edited by armatec

Description:
Takes an array of data about a dynamic object template and creates the objects.

Parameter(s):
_this select 0: compositions name - "fuelDepot_us"
_this select 1: Direction in degrees - Number
_this select 2: Location to start

Exsample:
["fuelDepot_us", 0, getpos player] execVM "Createcomposition.sqf";
*/
_script = _this select 0;
_azi = _this select 1;
_pos = _this select 2;
_objs = [];
_objs = call (compile (preprocessFileLineNumbers format ["\CA\modules\DynO\data\scripts\compositions\%1.sqf",_script]));
private ["_posX", "_posY"];
_posX = _pos select 0;
_posY = _pos select 1;
_newObjs = [];
private ["_multiplyMatrixFunc"];
_multiplyMatrixFunc =
{
private ["_array1", "_array2", "_result"];
_array1 = _this select 0;
_array2 = _this select 1;
_result =
[
(((_array1 select 0) select 0) * (_array2 select 0)) + (((_array1 select 0) select 1) * (_array2 select 1)),
(((_array1 select 1) select 0) * (_array2 select 0)) + (((_array1 select 1) select 1) * (_array2 select 1))
];
_result
};
for "_i" from 0 to ((count _objs) - 1) do
{
private ["_obj", "_type", "_relPos", "_azimuth", "_fuel", "_damage", "_newObj"];
_obj = _objs select _i;
_type = _obj select 0;
_relPos = _obj select 1;
_azimuth = _obj select 2;
if ((count _obj) > 3) then {_fuel = _obj select 3;};
if ((count _obj) > 4) then {_damage = _obj select 4;};
private ["_rotMatrix", "_newRelPos", "_newPos"];
_rotMatrix =[[cos _azi, sin _azi],[-(sin _azi), cos _azi]];
_newRelPos = [_rotMatrix, _relPos] call _multiplyMatrixFunc;
private ["_z"];
if ((count _relPos) > 2) then {_z = _relPos select 2} else {_z = 0};
_newPos = [_posX + (_newRelPos select 0), _posY + (_newRelPos select 1), _z];
_newObj = _type createVehiclelocal _newPos;
_newObj setDir (_azi + _azimuth);
_newObj setPos _newPos;
if (!isNil "_fuel") then {_newObj setFuel _fuel};
if (!isNil "_damage") then {_newObj setDamage _damage};
_newObjs = _newObjs + [_newObj];
};

Hopefully the comment at the top explains its use.  You can use markers with getMarkerPos to place them which is probably the least intrusive way.  The only problem I've had with them is that vehicle locks aren't consistent and you can't change them easily so make sure the composition doesn't contain anything which is going to alter the mission too much if the player can use it.

I'm afraid I have no idea how to save custom compositions but I would be interested to hear how it's done.

Offline CrazyAce

  • Members
  • *
Re: Static defense template
« Reply #4 on: 07 Oct 2009, 05:47:26 »
Thanx guys for replying, but I'm still lost on how to create a custom composition. I'll ask around on other forums and see if someone can help... if I find anything out, I'll report back with a how to for record keeping  ;)