Arma 3
ITN - Illuminate The Night
This topic has been locked
GhostJB  [developer] Jul 9, 2023 @ 5:08pm
Useful scripts for people building their own compats
The following few comments include scripts I've developed for generating the offsets that ITN uses to position its effects (lasers and lights).

Weapon offsets get put in ConfigFile >> CfgITNCompat >> weapons >> [weapon class name] >> gjb_itn_memoryPoints[] or ConfigFile >> CfgWeapons >> [weapon class name] >> gjb_itn_memoryPoints[]. Be careful of inheritance if you store them in CfgWeapons! Currently only the array for the side proxy should be included in this array, but in the future I hope to also support optics, so the optics proxy can also be stored here in position 1.

Device offsets get put in ConfigFile >> CfgITNCompat >> accessories>> [deviceclass name] >> gjb_itn_memoryPoints[] or ConfigFile >> CfgWeapons >> [deviceclass name] >> gjb_itn_memoryPoints[]. Be careful of inheritance if you store them in CfgWeapons! This array wants three entries, each being the coordinates output by the script in the second comment for the laser's position, the illuminator's position, and the flashlight's position, in that order.

The script in the third comment is for manually determining device offsets. This can be useful for fixing the belt-fed weapons geometry bug.
Last edited by GhostJB; Jul 9, 2023 @ 5:19pm
< >
Showing 1-3 of 3 comments
GhostJB  [developer] Jul 9, 2023 @ 5:08pm 
###For gather weapon offsets###
//To Use:
//Equip a weapon. Determine its type,
//input for _type, and run the script.
//If [0,0,0] is returned, try a different
//value for _lod. LODs 0-2 should return
//a value.

//Define weapon type.
// Primaries = 0
// Handguns = 1
// Launchers = 2
_type = 0;

//Define model LOD to check
_lod = 1;

//Prepare pull
_unit = player;
_w = currentWeapon _unit;
_cfgW = configFile >> "CfgWeapons" >> _w;
_mW = getText(_cfgW >> "model");
_oW = createSimpleObject [_mW, [0,0,0], true];
_proxies = [
"proxy:\a3\data_f\proxies\weapon_slots\side.001",
"proxy:\a3\data_f\proxies\weapon_slots\side.002",
"proxy:\a3\data_f\proxies\weapon_slots\side.001"];
_proxy = _proxies #_type;
_woff = _oW selectionPosition [_proxy,_lod];

//Clean up and report offset values.
//Reports in format:
// "Weapon class" : [x,z,y] (Time, differentiates outputs)
deleteVehicle _oW;
_time = [systemTime #3, systemTime #4, systemTime #5];
format ["%1 : %2 (%3)",_w,_woff,_time];
GhostJB  [developer] Jul 9, 2023 @ 5:08pm 
###For gathering device offsets###
//To Use:
//Equip a laser device on whatever
//weapon will accept it. Determine the name
//of the memory point needed (e.g. "las pos")
// and run the script for it.
//If [0,0,0] is returned, double check the name
//or spelling of the memory point.

//Prepare pull
_unit = player;
_w = primaryWeaponItems _unit #1;
_cfgW = configFile >> "CfgWeapons" >> _w;
_mW = getText(_cfgW >> "model");
_oW = createSimpleObject [_mW, [0,0,0], true];

//If the memory points name is unknown,
//refer to the configFile >> CfgWeapons class
//entry for the memory points used by either
//Pointer or Flashlight. Alternatively, select
//a memory point from this array:
_woff = _oW selectionNames "Memory";

//Define name of desired memory point
_mPoint = "";

//Gather modelspace coords of desired
//memory point. Comment out this line when
//pulling memory point names.
_woff = _oW selectionPosition [_mPoint,"Memory"];

//Clean up and report offset values.
//Reports in format:
// "Device class" : [x,z,y] (Time, differentiates outputs)
deleteVehicle _oW;
_time = [systemTime #3, systemTime #4, systemTime #5];
format ["%1 : %2 (%3)",_w,_woff,_time];
GhostJB  [developer] Jul 9, 2023 @ 5:09pm 
###For manually developing device offsets###
//Begin with [0,0,0] in for device in config,
//will return running total of adjustments

// To use:
// Equip a laser device with an easily seen laser
// beam (IR HI in combination with NODs works well).
// Input adjustments and run script.
// Adjustments are cumulative, so be aware of your
// totals.
// To reset defaults, swap to another weapon and back,
// or remove and reattach device to the weapon.

//==Enter desired adjustments here==
_xMod = 0.0; //+ downrange, - towards player
_yMod = 0.0; //+ to players right, - to players left
_zMod = 0.0; //+ upwards, - downwards
//==================================

//Pull variable
_u = player;
_allOff = player getVariable ["gjb_itn_deviceOffset",[]];
_lasOff = flatten (_allOff #0);

//Prep for adjustments
_x = _lasOff #0;
_y = _lasOff #1;
_z = _lasOff #2;

//Update laser offset variable
_lasOff = [[_x - _xMod],[_y + _yMod],[_z + _zMod]];
_allOff set [0,_lasOff];
_u setVariable ["gjb_itn_deviceOffset",_allOff];

//Tally total offset
_tot = player getVariable ["totalOffsetTally",[0,0,0]];
_xMod = _xMod + _tot #0;
_yMod = _yMod + _tot #1;
_zMod = _zMod + _tot #2;
_tot = [_xMod,_yMod,_zMod];
player setVariable ["totalOffsetTally",_tot];
_tot
< >
Showing 1-3 of 3 comments
Per page: 1530 50