Jump to content
Sign in to follow this  
subliminalss

objectMapper.sqf & setVehicleInit

Recommended Posts

Sorry if this has already been answered but I used the search and couldn't find anything.

I'm looking to get the object mapper script to work in arma 3, more specifically the part that sets the new objects Init and executes it, so that for example I can disable damage on CamoNetting among other things.

For those unfamiliar the script takes a list of objects that have been created and maps them according to a location as defined when the object placer is called.

for "_i" from 0 to ((count _objs) - 1) do

{

private ["_obj", "_type", "_relPos", "_azimuth", "_fuel", "_damage", "_newObj", "_vehicleinit"];

_obj = _objs select _i;

_type = _obj select 0;

_relPos = _obj select 1;

_azimuth = _obj select 2;

_fuel = _obj select 3;

_damage = _obj select 4;

_vehicleinit = _obj select 5;

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};

_newObj setVehicleInit format ["%1;",_vehicleinit];

processInitCommands;

["%1;",_vehicleinit]; spawn BIS_fnc_MP;

_newObjs = _newObjs + [_newObj];

};

The above works perfectly in arma 2 however due to disabling off setVehicleInit in Arma 3 and being replaced by BIS_fnc_MP it doesn't work now. See http://community.bistudio.com/wiki/setVehicleInit

How would

//_newObj setVehicleInit format ["%1;",_vehicleinit];

//processInitCommands;

be re-arranged to take the Parameters and set them to execute on an object?

the params would be passed as in this example ["CamoNet_BLUFOR_big_F",[4.70789,0.811523,-0.41924],99.9999,1,0,{this allowDammage false;}],

The link to the scripts is the following: http://forums.bistudio.com/showthread.php?169897-Random-spawn-for-fortifications-road-blocks-etc

Any help would be greatly appreciated I'm well and truly stuck here. It doesn't need to be MP compatible either its only a SP mission. Thanks.

Share this post


Link to post
Share on other sites
["CamoNet_BLUFOR_big_F",[4.70789,0.811523,-0.41924],99.9999,1,0,{_this allowDammage false;}],

_newObj call _vehicleinit;

Note the change to THIS in the calling params, _this as it is the passed object to the called code block, rather than where setVehicleInit inserted the code block straight into the objects init.

Edited by Larrow

Share this post


Link to post
Share on other sites
["CamoNet_BLUFOR_big_F",[4.70789,0.811523,-0.41924],99.9999,1,0,{_this allowDammage false;}],

_newObj call _vehicleinit;

Note the change to THIS in the calling params, _this as it is the passed object to the called code block, rather than where setVehicleInit inserted the code block straight into the objects init.

Whoop thankyou Larrow, I also added some to the code to define allowdammage true as standard but can then be edited in the composition and also get the status of Simulation but this now allows me to add a name to something if I wanted so thats great. Thanks for the help. :)

Share this post


Link to post
Share on other sites
jonieTurnock,

i played some with the mapper and grabber look at this

http://filebin.ca/15OrhnNfc3Nf/Buildarea.Stratis.zip

with this you can grab AI also and map them. and if you look in the mapper where i filter the objects to see if they are Human elements or Static weapons.

maybe it will be of some help i don¨t know.

Thanks ill take a look.:)

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  

×