#arma3_scripting
1 messages ยท Page 68 of 1
so you see for the server there is no diffrence
a command's performance doesn't depend on scheduled vs unscheduled
ah
and the answer is yes, it can
There should be.
depends on the load/hardware of the server/client
you as a mission designer need to knwo what you are doing
It's not documented anywhere
no even if they had the exact same hardware the performance could be different
there is a lot undocumented, but you never finish something without debugging stuff and while debugging you should find such stuff
https://community.bistudio.com/wiki/Event_Scripts
And since the HC is a player -> tadaa.
guys, any idea on how to structure a select version of this: sqf private _aiFeatures = ["AUTOTARGET", "ANIM", "COVER"]; private _enabledFeatures = []; { private _featureEnabled = _unit checkAIFeature _x; if (_featureEnabled) then {_enabledFeatures append [_x];}; } forEach _aiFeatures;
_aiFeatures select {_unit checkAIFeature _x}
"And since the HC is a player"
I disagree and so does the English language
and that append is very bad... 
pushBack is a thing
Will be "updating" my scripts with this knowledge
blame BIS for the faulty naming i guess, you can rise above and call your shit from it with proper names depending on whatever your client is to do
I do.
Oh boy... coming up with the fkn language again? Retard... OOhhh i am so sry, that i don't speak english... idiot
Now you insult me for bringing up messed up language in the game? Why do you care?
remember setDammage?
Yes. Difference is that this was fixed.
Commy... you are just... lets say "special"...
BI devs are mostly not nativ english
Dscha, why am I special?
after how many years? :D
spellcheck too mainstream
I'm not a native speaker either.
makes it even worse.
How so?
oh boy
I doubt player in czech means anything that would be considered a head less client.
im struggling with one thing, so this thing I have replaces an arrow with a weapon holder then places an item in it. My question is if I wanted a trigger to go off when player picks up this item, what would I do?
Red arrow with this in the init
_wh = createVehicle ["GroundWeaponHolder", ASLtoAGL getPosASL this, [], 0, "CAN_COLLIDE"];
_wh addBackpackCargoGlobal ["OPTRE_Armored_Matrix", 1];
deleteVehicle this;
cuz the item itself is technically not placed in eden and the arrow thing is replaced when the mission start so I cant bind it to that
this is MP
do you just need a reference to your weaponholder?
well when the item is picked up
I want a trigger to turn on
I dont know if the weaponholder dissapears when the item is picked up. If so is the case then the trigger could activate when the holder disappears
the way you phrased this it sounds like you can get the trigger to work if the weaponholder had a global variable name
well maybe
if that's the case just add myWeaponHolder = _wh to the init
it really depends. Its a backpack. So when the player picks it up, they drop theirs. Idk if the weaponholder just swaps the old content with the new
Could set a variable to the groundholder and use the InventoryClosed EH
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#InventoryClosed
could I instead
make a thing that triggers if any player is carrying a specific item?
yes, you could
sure, just run a loop on the clients to check and send the response to server via remotexec if they have the item and do your stuff ^^
while {true} do {
//code
sleep 1; // So the loop doesn't run every frame
};
for the client ? initplayerlocal.sqf
Might wanna add it after this so the player is properly initialized
waitUntil{player == player};
I need my zombies attacking the door of a vehicle's driver, is this correct? sqf private _driverRelativePos = _targetVehicle selectionPosition "pos driver"; private _attackPosASL = _targetVehicle modelToWorldVisual _driverRelativePos; private _attackPosATL = ASLtoATL _attackPosASL;
no
I read a suggestion for: "OPTRE_Armored_Matrix" in weapons player
So would this work?
waitUntil{player == player};
while {true} do {
"OPTRE_Armored_Matrix" in weapons player
sleep 2; // So the loop doesn't run every frame
};
I have a feeling this wouldnt work but hey its the clue I found
I'd hope that you'd know which weapon slot that thing is in.
waitUntil{player == player};
while {true} do {
if((backpack player) isEqualTo "OPTRE_Armored_Matrix") then
{
// Code
};
sleep 2; // So the loop doesn't run every frame
};
thank you
Any idea how to transform a selectionPosition to an ATL position I can use for a _unit setDestination [_attackPosATL, "LEADER DIRECT", true] command?
setDestination takes AGL
modelToWorldVisual already returns AGL
but anyway to answer the question, you can use ASLtoATL with modelToWorldVisualWorld
Thanks! I read that modelToWorldVisualWorld takes Array format PositionRelative exactly what I needed! Thanks!
both of them do
the key was it returns ASL
Indeed! Merci mon ami!
"ELD_cover_0P13636363636363635_0P2272727272727273" regexFind ["(?<=ELD_cover_[0-9P]+_)[0-9P]+",0] trows an error: Bad Pattern
what's wrong with my pattern?
online regex testers tell me it works
(they do warn me that lookbehind is not supported everywhere, but "ELD_cover_0P13636363636363635_0P2272727272727273" regexFind ["(?<=ELD_cover_)[0-9P]+(?=_)",0] works so i guess that's not the problem
lookbehind works, but indefinite lookbehind doesn't
is this indefinite lookbehind because of the +?
is there a command that does nothing but return NaN?
no
you can get it using log -1 tho
or sqrt -1
or acos 2
basically providing a value that is not within the domain of a math function
thanks
What is the JIP compatible way of removing some units backpack at spawn? Just put removeBackpack this in the init-field of said unit?
I have some survivors with custom loadouts on the editor, multiple slots on each side. ELI5 how do I make them respawn with the loadout they have in the editor?
How to spawn LaserMarker from script?
Hi guys i just wonna know how can i make this code better. i have 2 timers 1 for delaying the cloacking and 2 timer for how much time unit is cloaked.
params ["_unit","_invis","_delay"];
private _nextCloak= _unit getVariable ["next_cloak", -1];
if (time < _nextCloak) exitWith {systemChat format ["wait for %1 seconds before Cloaking again.", (_nextCloak - time) toFixed 0];};
_unit setVariable ["next_cloak", time + _delay];
[_unit,_invis] spawn {
params["_unit","_invis"];
_unit hideObject true;
while {_invis >= 0} do {
_invis = _invis - 1;
sleep 1;
};
_unit hideObject false;
};
how do i display a mortar chart on a players screen
it needs to show when they enter the mortar
i have the text for the ranges ect but i dont have method to display it
I don't recommend that, the init-field via mission editor is executed everytime someone joins
Good morning, what would be the best way to send data to a client from the server?
I'm sending the info in an array from inidbi2 to the client so they can build an interface.
_data remoteexec ["fnc to hold data", clientid] ? If I run that from the server will it run to players?
Should I wrap if (isServer) then{} around it or something?
It is better wap with if (local this) then {}
If it's all units or something similar I recommend initPlayerLocal and check _this select 1
because unit may be local to player not server
@sullen pulsar initPlayerLocal, good call. :)
I tend to stay away from the mission.sqm stuff and only use it for placing the objects xD
_laser = "LaserTargetE" createvehicle _pos; // Create for east, west laser type is LaserTargetW
_laser setPosATL _pos;
// In client
fncToHoldData =
{
hint format ["Data received! %1", _this];
};
// In server
_data remoteExec ["fncToHoldData", -2]; // Send _data to all clients
// Use ([0,-2] select isdedicated) instead of -2 if you want this to work in the editor
On the wiki about setTerrainHeight it says Edited terrain heights are not saved inside savegames, they need to be restored manually on savegame load.. Is this even true any more? It seems to be being saved for me...
I want to double check my knowledge here.
When you use spawn with a handle
_handle = [] spawn something_fnc
If your code loops
while {condition} do {
_handle = [] spawn smething_fnc_here
sleep 1
}
The spawn wont duplicate in the while loop and only will be recompiled and ran again if the handle is clear and free of the running script?
No, a new handle is returned every time you spawn it
that code will create many spawns . if you want only one at a time use waituntil { scriptdone _handle }
// Both these will run at the same time
_handle1 = [] spawn fnc;
_handle2 = [] spawn fnc;
if you wanted to make sure you should do as GC8 says
// _handle2's spawn will only spawn after _handle1 exits
_handle1 = [] spawn fnc;
waitUntil {sleep 1; scriptDone _handle1};
_handle2 = [] spawn fnc;
And do without [], use 0.
#arma3_scripting message
You don't need create empty array
even if the handle is customdefined? rather than just _handle
you can give whatever name to a handle you want, it doesn't make a difference
_handle = [] spawn fnc;
_handle = [] spawn fnc;
Here you're just overwriting the handle so you can't access it in your script any more, but the script is still running.
but you can do
_handle = [] spawn fnc;
waitUntil {sleep 1; scriptDone _handle};
_handle = [] spawn fnc;
As it doesn't matter if you overwrite the handle of a script that is already finished
Would love to know the answer to that as well
This is utterly a waste of performance
Use call
Thank you! I'll give that a try
It runs on the machine where the EH was added - addMissionEventHandler is a local effect command, and many mission EH types are related to client-specific events.
Don't confuse mission EHs with MP EHs, which do trigger everywhere.
and are not saved in MP savegame
@meager granite
drawIcons can be be optimised quite well with new inAreaArray command
You need to update a location each frame to fit map's size then you run all your potential draw candidates against it with inAreaArray
sorry was busy this week. do you have a code sample on that please
Code from KotH:
private _location = _map getVariable "koth_map_location";
private _map_dir = _map getVariable "map_dir";
private _map_aim = _map ctrlMapWorldToScreen client_mapDraw_nullPosition;
if(_map_aim isNotEqualTo (_location getVariable "aim")) then {
_location setVariable ["aim", _map_aim];
ctrlPosition _map params ["_map_x", "_map_y", "_map_w", "_map_h"];
private _map_top_left = _map ctrlMapScreenToWorld [_map_x, _map_y];
private _map_bottom_left = _map ctrlMapScreenToWorld [_map_x, _map_y - _map_h];
private _map_top_right = _map ctrlMapScreenToWorld [_map_x + _map_w, _map_y];
private _map_center = _map ctrlMapScreenToWorld [_map_x + _map_w / 2, _map_y + _map_h / 2];
private _dir_vector = _map_bottom_left vectorFromTo _map_top_left;
if(_dir_vector select 0 == 0) then {
_map_dir = 0;
} else {
_map_dir = if([0,1] vectorCrossProduct _dir_vector select 2 > 0) then {
acos([0,1] vectorCos _dir_vector) - 180
} else {
180 - acos([0,1] vectorCos _dir_vector)
};
};
_map setVariable ["map_dir", _map_dir];
private _a = ((_map_top_left vectorDistance _map_top_right) / 2) + _scale * 1000;
private _b = ((_map_bottom_left vectorDistance _map_top_left) / 2) + _scale * 1000;
_location setPosition _map_center;
_location setSize [_a, _b];
_location setDirection -_map_dir;
};
Execute on "Draw"
Then you can do:
allUnits inAreaArray _location
and only iterate through it
client_mapDraw_nullPosition is [0,0,0]
_scale is ctrlScale _map
if(isNull(_map getVariable ["koth_map_location", locationNull])) then {
private _location = createLocation ["Name", getPosWorld objNull, 0, 0];
_location setVariable ["aim", getPosWorld objNull];
_location setVariable ["map", _map];
_location setRectangular true;
_map setVariable ["koth_map_location", _location];
_map setVariable ["map_dir", 0];
};
```On control initialization, alongside adding `Draw` EH
_map_dir can now be retrieved with 2.14's ctrlMapDir instead of doing the manual calculation
So location position calculation can be made even simplier
This code updates location to fit map's control, so it works dynamically for any sized RscMap
With some padding + _scale * 1000 so larger icons aren't cut off right away
_location setDirection -_map_dir; also covers rotating GPS
This will give you noticable performance boost if you need to draw lots of objects, instead of drawIcon'ing everything
@meager granite thank you! so in simple terms you render only those actually in the visible space, or is there even more to it that i am missing?
Yes, you cut off invisible objects with inAreaArray
invisible outside of the map view
You can test it to make sure it works by making padding negative and notice that objects no longer draw by the edge of the screen
_map drawRectangle [
locationPosition _location,
size _location select 0,
size _location select 1,
_map_dir + direction _location,
[1,0,0,0.5],
"#(argb,8,8,3)color(1,1,1,1)"
];
```Debug draw for the location to see that it follows map view exactly
I'm having some issues with using my compositions that have a script in the init field.
for example this:
[this, true, [0, 1.1, 0.8], 90, true] call ace_dragging_fnc_setCarryable;
this setVariable["ace_cargo_customName", "Guardsmen Ammo", true];
clearWeaponCargoGlobal this;
clearMagazineCargoGlobal this;
clearItemCargoGlobal this;
clearBackpackCargoGlobal this;
{
this addWeaponCargoGlobal _x;
} forEach [["ML700_Launcher_Weapon_CadianLauncher_Loaded", 2]];
{
this addMagazineCargoGlobal _x;
} forEach [["ML700_Lasgun_Rifle_B_50_Battery", 250], ["ML700_Stubber_Drum_Green", 70], ["ML700_frag_grenade_magazine", 60], ["ML700_krak_grenade_magazine", 30], ["TIOW_ig_smoke_grenade_mag", 60], ["IC_Frag_rocket_mag", 8], ["IC_Krak_rocket_mag", 16]];
it works well for boxes placed in editor running the same code (just a added check so it only runs on server)
when i use the above from the composition in zeus however nothing happens, the boxes have their original contents
Make sure the mission and/or server is configured to allow Zeus compositions to run their init scripts.
https://community.bistudio.com/wiki/Arma_3:_Server_Config_File (ctrl+f zeusComposition)
https://community.bistudio.com/wiki/Description.ext#zeusCompositionScriptLevel
that line does not exist, so will try to add it with the correct value and see
If it doesn't exist the default value is 1, which prevents init scripts
Any thoughts on why my _populate would result in [false, false, false, false, false, false]?
this is where it's defined:
what's weird, is if I use format systemchat right before the "_populate apply" section, it provides the right info
so I don't believe it's an issue with sending the data or receiving it....something is changing the info before it's being added to the interface
Call oo_inidbi ,
There you define those.
You should paste that part too.
I'm defining / reading on the server and then sending it to the client, don't think I can run oo_inidbi if the player doesn't have hte mod
so yeah, sorry, that second pic isn't where i'm defining it, it defines at mission init
You don't assign anything to _populate for it to end up being be false
You're having it as false elsewhere
Why apply instead of forEach btw?
I was just looking around and it seemed like a simpler way to do it, I was using ForEach before...was hoping apply would provide a different result xD
before the 'ButtonSetAction' area, if I use format systemchat, it provides the correct information
I think i'm losing something in translation to unpack the array
So far your code shouldn't modify your _items
Add diag_log ["_items", _items]; Right before and after _populate apply
Before and after that whole statement
diag_log ...;
_populate apply {
...
};
diag_log ...;
ohhhhhhh
now that's interesting!
10:48:19 ["_items",[[false,false,false,false,false,false],["ACM_B_NAG_Ifrit","Karatel","\acm_nagansk\ui\ACM_B_NAG_Ifrit.jpg",36,1,true],["ACM_B_NAG_Ifrit_HMG","Karatel (HMG)","\acm_nagansk\ui\ACM_B_NAG_Ifrit_HMG.jpg",31,1,true],["ACM_B_NAG_Ifrit_GMG","Karatel (GMG)","\acm_nagansk\ui\ACM_B_NAG_Ifrit_GMG.jpg",5,1,true],["ACM_B_NAG_RM70","RM-70","\acm_nagansk\ui\ACM_B_NAG_RM70.jpg",27,1,true],["ACM_B_NAG_Tatra","Tatra T810 (Covered)","\acm_nagansk\ui\ACM_B_NAG_Tatra.jpg",2,1,true],["ACM_B_NAG_UAZ_Unarmed","UAZ-469","\acm_nagansk\ui\ACM_B_NAG_UAZ_Unarmed.jpg",34,1,true],["ACM_B_NAG_UAZ_AGS30","UAZ-469 (AGS-30)","\acm_nagansk\ui\ACM_B_NAG_UAZ_AGS30.jpg",1,1,true],["ACM_B_NAG_UAZ_MG","UAZ-469 (DShKM)","\acm_nagansk\ui\ACM_B_NAG_UAZ_MG.jpg",15,1,true],["ACM_B_NAG_UAZ_SPG","UAZ-469 (SPG-9)","\acm_nagansk\ui\ACM_B_NAG_UAZ_SPG.jpg",21,1,true]]]
so the first nested array is buggered....hmm
it was the same both before and after btw
When it doubt, diag_log the hell out of it
yeah, i'm new to that command
Yeah, your apply didn't modify anything
apply should return a resulting array, but you don't assign it to anything
not a problem really, just a bit weird to use it instead of forEach
this si what I was using prior
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
{
[format ["ITEM = %1", _x]] remoteExec ["systemChat", 0];
for "_i" from 0 to (count _x) do {
_data = _populate select _i;
[format ["_data = %1", _data]] remoteExec ["systemChat", 0];
// Current result is saved in variable _x
_classname = _data select 0;
[format ["_classname = %1", _classname]] remoteExec ["systemChat", 0];
_name = _data select 1;
_image = _data select 2;
_added = _list lbAdd _name;
_cost = __data select 3;
_list lbSetData [_added, _classname];
_list lbsetTextRight [_added, _cost];
_list lbSetPicture [_added, _image];
};
} forEach _populate;
I don't think you need to iterate through _x here
(And it should be for _i from 0 to count _x - 1)
can probs remove the 'foreach' right? keep with the for "_i"
count _x would be 1 item more than array length
ahh yeah true
Your _populate apply { looks fine
omg, that's right
the first entry of the db is the total sum of logistics 'points'
that's why the array is messed up
for "_i" from 0 to (count _x) do {
_data = _populate select _i;
```Now I see why your code *sort of* worked, you iterated through each inner element of an item and then used its index to get the item again
But its totally wrong
xD
Just forEach or apply through your _items array and you're good
Your array of falses shouldn't be there in a first place
this is the data from inidbi that the info is coming from
I guess its a return of first _x = 0 calls to your _db function?
select 0 would provide all falses, as it's not finding the right criteria
Perhaps it wants indexes to start from 1
ctrlMapPositionToWorld? 
So fix it in your inidb getter
yeah
Or was it called something else
Fix until there is no array of falses in data that user gets
what a whirlwind of coffee infused craziness haha
Then just forEach through it similar to your original apply code
And btw you can replace
_classname = _x select 0;
_name = _x select 1;
_image = _x select 2;
_cost = _x select 3;
```with
```sqf
_x params ["_classname", "_name", "_image", "_cost"];
You can params any array, not just _this
oh yeah? that's awesome
a lot cleaner
That worked!!! @meager granite , thank you for the assistance!
๐
How do I check if unit is watching a position assigned by doWatch command using SQF?
vectorCos, getCameraViewDirection, vectorFromTo
when I use ppEffectCreate should I destroy the effect when its not needed temporarily? Is it ok to let it linger and use Adjust to show and hide it at any time anyway?
Gotcha, makes my life easier that way. ๐
but keep in mind that it still consumes resources a bit so if you don't need it anymore just destroy it
Alright, ill keep that in mind
I meant if there is something like assignedTarget fnc or currentCommand fnc
then no
Do I need to pass variables somehow to getOrDefaultCall? This doesn't seem to be working.
params ["_unit", "_muzzle", "_magazine"];
private _currentRoundCount = _unit ammo _muzzle;
private _magData = TRFR_magazineCache getOrDefaultCall [
_magazine,
{
private _magConfig = configFile >> "CfgMagazines" >> _magazine;
private _tracersEvery = getNumber (_magConfig >> "tracersEvery");
private _lastRoundsTracer = getNumber (_magConfig >> "lastRoundsTracer");
// Fix zero divisor
if (_tracersEvery == 0) then {_tracersEvery = 9999};
[_tracersEvery, _lastRoundsTracer]
},
true
];
can i spawn just the visuals of the zeus lightning bolt?
I currently have this in the init of my unit to make a bolt strike it as i spawn it through zeus composition.
[this] remoteExec ["FLO_fnc_lightningSpawn", 0];
params["_unit"];
_unit spawn
{
if(local _this) then { _this allowDamage false;};
private _tempTarget = createSimpleObject ["Land_HelipadEmpty_F", getPosASL _this, true];
[_tempTarget, nil, true] spawn BIS_fnc_moduleLightning;
if(!local _this) exitWith {};
sleep 1;
_this allowDamage true;
};
if i don't remote exec it the visuals of the bolt don't appear for clients, not however each of them make their own strike, so the unit gets sent flying
what sort of script would i need to add to a unit to force it to aim more left?
according to chatGPT this is a thing: sqf playerPos = getPos player; nearestCity = nearestLocation playerPos ["NameCity", "NameCityCapital"]; but nearestLocation can only take one location type at a time right?
scrambled as usual.
There is a nearestLocations which you could theoretically use for that.
regarding my question above, anyone know the locality of BIS_fnc_moduleLightning? feels odd that it would have to be sent to all clients
it's not even correct syntax 
server
well except for the light
the light is local 
the lightning object itself is global
great lol. sooo, grab the code from the module and make my own?
ok, thanks
actually it's not server
it spawns the lightning wherever the lightning object itself is local
so for the best effect, you should do that part server side
(you won't need an object anyway)
yeah, I am never trying chatGPT again. Got it working with sqf private _nearLoc = nearestLocations [getposATL _leader, ["NameCity", "CityCenter", "NameVillage", "NameLocal"], 1000, getposATL _leader]; _nearLoc = _nearLoc select {!(surfaceIsWater position _x)};
If I remember correctly, postion is quite slow? Should I use getPosASL?
dumb question in relation to this would it be possible to sync lightning modules to a trigger and have them spawned when the trigger activates
dunno
ill test it sometime ig
looks like yes
It seems getPosATL doesn't work on positions returned by nearestLocations ?
oh wait, position is correct for locations.
could use locationPosition to make it clearer.
that bottom line is all kinds of screwed up
While waiting for 2.14 with forEachReversed, what's the best way to go about deleting elements from an array as it's being iterated over?
private _currentTime = time;
for "_i" from (count TRFR_activeFires) to 0 step -1 do {
(TRFR_activeFires # _i) params ["_fireObject", "_size", "_expireTime"];
if (_currentTime > _expireTime) then {
if (_size == 0 && {random 100 < CBA_SETTING(fireGrowChance)}) then {
[getPosASL _fireObject, 1] call FUNC(createFire);
};
deleteVehicle _fireObject;
TRFR_activeFires deleteAt _forEachIndex;
};
};
This is what I am currently doing but I think it's skipping some elements 
Not sure though. The array does get empty but objects remain
Nice catch. I wonder how the array was clearing up even with that issue
Has a count issue too, start index should be (count whatever - 1)
How come that _forEachIndex wasn't printing out an error? The array was clearing up as well
because you're doing things in unschd env
unschd never shows any errors for undefined vars
as for why it was working, it was probably defaulting to 0
well don't
you're just emptying your array
just do TRFR_activeFires resize 0 after the forEach loop
It's not. expireTime can vary between entries, so it's a partial clearout.
oh it has an if 
Would still be inclined to do the deletion separately but it's not entirely unreasonable :P
that's what I recommend too
_deleted = false;
{
...
TRFR_activeFires set [_forEachindex, 0];
_deleted = true;
} forEach TRFR_activeFires;
if (_deleted) then {
TRFR_activeFires = TRFR_activeFires - [0];
}
Is there a neat way to check if the player is zoomed in through a scope, turret scope, or the + key?
you can use cameraView == "Gunner" to find if player is looking through an optic at all, but zoom check can be done only with the fov checker iirc
Hmm, any event which I could link that to, or would I have to do it on keypress?
you can use addUserActionEventHandler
and that
and i love this note on BIS wiki
http://puu.sh/l3jnv/7efa17b27f.png
Ironic a bit :p
I have a question about VLS and targeting and fire, so i have VLS spawned and on force hold fire (so it doesnt randomly shoot at any valid target).
So when player attaches/throws IR grenade at the vehicle that they want destroyed following script runs:
params["_obj", "_class", "_temp"];
if (_temp) exitWith {};
if (_class != "B_IR_Grenade") exitWith {};
[_obj] spawn
{
params["_tgt"];
sleep 60;
_vic = (_tgt) nearEntities [["LandVehicle"], 10];
if (count _vic == 0) exitWith {hint "No target"};
_vic = (_vic # 0);
west reportRemoteTarget [_vic, 5000];
_vic confirmSensorTarget [west, true];
vls fireAtTarget [_vic, "weapon_vls_01"];
deleteVehicle _tgt;
};
This works fine, as long as VLS is local to player, but when its not, its really hit or miss situation (quite literally).
As sometimes VLS will properly lock on to target and fire, missile hits vic and everyone is happy, or
VLS will fire straight off into the stratosphere and missile is never to be seen again...
When testing and it doesnt work, i notice no target is revealed on VLSs "radar",
Should i be remote executing reportRemoteTarget, confirmSensorTarget and fireAtTarget on VLS?
when using the Fired event handler, what are the variables i can apply to the projectile parameter? i can't seem to find a list of them
or rather, what would be the code i'd need to use to adjust the starting position of the bullet that's fired
By the time the EH fires, the bullet has already been created; you can't change where it gets created without modifying the weapon. However, setPosATL/ASL work on the bullet and you can do whatever you want with that.
alright, do you know if just setPos works, or only ASL/ATL
setPos should not be used in 99.9% of all cases. It's an old, slow command with a dangerously inconsistent output. You can technically use it to change the position of a bullet, but you shouldn't.
alright, i'm just trying to figure out how to make setPosATL not relative to the terrain since this would be for a moving plane
Well, that's what ASL is for
You may find the entertainingly named modelToWorldVisualWorld useful
hmmm, that might be useful
so this is the script i'm working off so far, but it doesn't appear to be doing anything, i figure something's probably wrong, but i can't figure out what
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_position = getPosASL _projectile;
_position set [2, 10];
_projectile setPosASL _position;
}];
this is being put directly onto the gunner
Well, for one thing you're setting the projectile's altitude to exactly 10 metres ASL. That's not relative to the plane or the original position, like 10 more or 10 less - it's just 10.
The other thing is that as per the Fired EH's documentation, it must be set on the vehicle, not the gunner, in order to work with the vehicle weapons. If you put it on the gunner it's looking for their personal weapons, which are obviously not doing anything.
hrmmmm
well, before i do anything crazy, i just want to make the bullets move in the first place
ok, well the bullets are at least moving to the new position when they shoot now
i've just got to figure out how to offset their position to about 20 feet left of where they normally start
Find the position of the new origin point, relative to the vehicle (in its model space). You can work this out ahead of time by trial and error or by placing a reference object and using worldToModel on it, or you can generate it dynamically using selectionPosition if there is a conveniently placed selection. Then use modelToWorldVisualWorld to turn that relative position into an ASL position, setPosASL and voila.
Note that this will not change the position of firing effects such as muzzle flash.
that's fine, i want the flash to stay on the plane, i just need the rounds to actually hit the target, and if moving them is the only way to compensate for the AI not aiming in the correct position, then so be it
You could also change the velocity of the projectiles so they always fly towards the target, if you have a specific target in mind and not just general use
so, modelToWorldVisualWorld would be
_projectile modelToWorldVisualWorld [0, -20, 0];
or something akin to that?
and unfortunately this is general use
Well, you can try doing that, but I don't know whether projectiles have roll rotation. If they do that'll probably work without the other stuff. If they don't, that adjustment won't account for the plane's roll angle at the moment of firing.
i gave it a shot, this hasn't seemed to do anything
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_position = getPosASL _projectile;
_projectile modelToWorldVisualWorld [-5, 0, 0];
_projectile setPosASL _position;
}];
I'm gonna try putting _position =getPosASL underneath _projectile modelToWorldVisualWorld
since i'm not sure which should come first
That's wrong
What you do there is save the projectile's original pos. Then you generate a relative-to-ASL pos, but don't save it or do anything with it. Then you set the projectile's pos to...the original pos you saved
ahh, ok
what would i want to do there to actually save the position i just generated?
_position = ... < this is the part that saves the output of the command into a variable called _position
got it working
You don't need to do getPosASL on the projectile since you're not using its original position at all
What about the things that ARE documented, but don't exist.
ahh, alright
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
newPos = _projectile modelToWorldVisualWorld [-5, 0, 0];
_projectile setPosASL newPos;
}];
so that should work?
since that's my new code minus the getPosASL
Like MagazineGroups
Put a _ before newPos. Without the _ it's a global variable accessible in any instance of any script; you want a local variable that's only valid in this instance of the EH code.
Thanks, discord
gotcha, gotcha
ok, well doing that appears to have stopped it from functioning
it was working without the underscore
Did you put it on both references to newPos?
no i did not, and that would be why
i'm dumb
still not working for some reason
weird, thought that would fix it
May I see the new code?
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_newPos = _projectile modelToWorldVisualWorld [-5, 0, 0];
_projectile setPosASL _newPos;
}];
That looks fine assuming that -5 is in the correct axis
it is, i've double checked, it's not that they're aiming wrong
it's just when i add the underscores, the adjustment just stops working
without them the bullets teleport and fire just fine
That shouldn't be the case, the underscores are a proper and valid use of local variables
It's exactly the same thing as _projectile, which you will note is working fine
Using local variables doesn't change the operation of the code in itself, it just prevents it overwriting or being overwritten by other scripts or instances of itself
i have no idea, i may just name it some obscenely long variable that there'd be 0 chance of it being overwritten
It would still overwrite itself if two instances of the EH happened to be operating at the same moment
(also performance. Not a lot of performance but still)
I want to specify again that this is a perfectly normal use of underscores. They shouldn't break it and the fact that they do means something weird is going on, and that needs to be fixed....if we can just figure out what it is
i don't plan to have any more than 1 of these in operation at any given time, so the first point is sort of moot, but yeah i'd like to see if i can figure this out as well
it's just so confusing
You definitely put this in the vehicle init and not the gunner or group by accident?
Can you add a systemChat str _newPos right after you define it, and see what that outputs? Maybe also a systemChat str (getPosASL _projectile) for comparison (before you setPosASL it)
We're looking for cases where it comes out with an empty array, obviously stupid array, or two of the exact same array
yeah, let me throw that in
aaaand it's working now?
#justarmathings
whatever, it's working and i have ai fired miniguns that can hit targets
thank you so much for your help
you've been beyond invaluable
Is there a way to set viewdistance for West AI or the plane that they are in, when taking remote control?
Some time ago I made a mission for air-to-air dogfighting and it's almost finished now. It has some bugs that need to be fixed for the mission to run smoothly, but I have other priorities to focus on and it would be a shame to abandon it. So I decided to leave it here for anyone who might want to continue working on it: https://github.com/PublicLounderr/A3JetsDogfightMission
You can add yourself as an author/co-author
Hi! I have an idea for a big and revolutionary mod, but don't know how to script... Would someone like to join me or even guide me?
step 1 read wiki
step 2 learn 2 script
step 3 make mod
step 4 profit
How do you profit from a mod?
mentally
metaphysically
Surprisingly what KJW said is accurate enough. You firstly need to have feasible goal. The goal should be very specific
And you need to struggle enough. Maybe years of it
me rewriting my first scripting adventure for the 6th time soon
Has anyone got any solid solutions for a way to accurately detect whether an object is colliding with another?
My usecase is I have a build menu, where you select an item and it creates it locally for the client. It spawns infront of them and they control it by moving, turning, and scroll wheel to move it up/down. I currently check if its colliding by running nearestObjects and nearestTerrainObjects with the radius being boundingBox _previewObject select 2 however its not the best solution as it allows some weird behaviour. If anyone has any better collision detection ideas that'd be appreciated, I can link the full code on github if people want to read further into how I'm using it to clarify things
private _nextPreviewPos = player modelToWorld [0,3 + _collisionZone,DT_buildElevation];
_previewObject setPosATL _nextPreviewPos;
_previewObject setDir ((getDir player) + DT_buildRotation);
private _nearbyObjects = nearestObjects [_nextPreviewPos,["AllVehicles","House"],_collisionZone,true];
_nearbyObjects append (nearestTerrainObjects [_nextPreviewPos,["TREE","BUILDING"],_collisionZone,false,true]);
private _ignoreObjects = getArray(missionConfigFile >> "Core_Settings" >> "ignoreWhenBuilding");
private _collidingObjects = [];
{
if !(_x isKindOf "CAManBase" || {(typeOf _x) in _ignoreObjects || {_x isEqualTo _previewObject}}) then {
_collidingObjects pushBack _x;
};
} forEach _nearbyObjects;
private _sphereColour = "#(rgb,8,8,3)color(1,0,0,1)";
if (_collidingObjects isEqualTo [] && {[getPosATL player] call DT_fnc_isNearFob}) then {
_sphereColour = "#(rgb,8,8,3)color(0,1,0,1)";
DT_canBuild = true;
} else {
DT_canBuild = false;
{
drawIcon3D ["\A3\ui_f\data\map\markers\handdrawn\objective_CA.paa",[1,0,0,1],(getPosATL _x vectorAdd [0,0,2]),1,1,0,getText(configOf _x >> "displayName"),0,0.04];
} forEach _collidingObjects;
};
{
_x setPosATL (_nextPreviewPos getPos [_collisionZone,10 * _forEachIndex]);
_x setObjectTexture [0,_sphereColour];
} forEach _spheres;
Thats the full collision detecting snippet
You only have 3 options:
- Spherical check (radius + distance) (fastest but too conservative)
- Bounding box check (slower but better than 1)
- lineIntersectsSurfaces check (using several lines in a pattern) this is best but it is too slow because you need many lines
So I guess I'm already doing #1 above
I guess but I didn't read it
What would 2 entail exactly?
Intersection of 2 boxes 
I may be being slow, but how exactly would I implement that?
Though in Arma maybe that algorithm turns out slower than 3 ๐
Hmmm
So for the lines, I guess I'd need to create maybe 36 lines popping out from the centre of the object in 10 degree intervals
Well if you have to ask then nvm 
You should know how convex intersection works. You can Google it tho
But like I said the algorithm is too slow in SQF
imo just go with 3
The object is 3d...
Depending on how big your object is a spherical pattern could work for you tho
But I personally recommend using something similar to the soldier collision geometry (with fewer edges and faces tho)
If you don't know what it is, unpack A3's anim data pbo then open the collision models in Object Builder (it's binarized tho)
So it could be pretty much any object with varying sizes, as its based on self-building vehicles and a FOB
And its configured by the mission maker so they can add anything they want too
Do you want to allow placing objects inside each other?
E.g can they place a radio on top of a table? Or a crate in a house?
If yes then 1 and 2 are not gonna work
Because the bounding boxes collide
Usually the smallest thing that people have is chairs, but they often get placed inside buildings and such
Ok ty
is there a limit to ppEffect index? like a max number it can climb to and slam into a brick wall.
Most likely there is. But it probably is easier to break the game first
so if an effect is being created and destroyed, unless the server/client is running for 10 years straight there is no concern of hitting said limit?
I have no confirmation though, since am not a dev, but have no experience with such limit so far
Gotcha, good to know! ๐
I am currently working on a mod that adds a lot of local particles, but some of them need to be consistent to all players. Could I avoid remoteExec etc network traffic by adding serverTime as a seed to all random values for deterministic behaviour thus eliminating the need to remoteExec? How likely is this to desync?
"The syncing is happening every 5 minutes, but you can force the next sync earlier by executing
estimatedTimeLeftcommand"
I would assume it wont be 100 percent matching as the number could be ยฑ , but would self correct every now and then. (im a newb so take me with a grain of salt)
Return Value: Namespace on the server, Nothing on clients or in single-player.
They shouldn't be able to without an exploit of some kind
Well if your mission / mod offers a route for malicious users to run code, let alone remote exec, then you've kinda done yourself in. If they can remoteExec with no restrictions then anything is possible
Input fields for example are a common place to inject code. Remote code execution is a pretty broad topic and I won't go into detail here, but the best way to ensure remoteExec safety is to use cfgRemoteExec
In Arma the usual exploits are stuff like gaining access to dev console etc. Badly made missions can pretty easily be exploited enough to get the dev console open
People carrying out these attacks is pretty rare though, I've only seen it happen once. Public zeus is probably the most common place where people do this
This is also an option, but be very careful not to break mods, etc:
https://community.bistudio.com/wiki/Arma_3:_CfgDisabledCommands
Floats do get truncated to integers though, so the time would have to desync an entire second
fair
How would I go about in finding all available images in the game? (For example: \a3\Missions_F_Orange\Data\Img\orange_overview_ca.paa) - Is there a specific link in the A3 wiki that has a collection of these? (including their paths)?
Gee thanks!
that's the one I use anyways, not sure if there are others
Disregard - I did a dumb thing!
addonFiles ".paa"
anyone know why i would be getting "could not load mission" yet the mission loads fine with no errors in .rpt?
Hi, I am spawning some units during a mission via script. Single and group units on the EAST side. Dynamic Simulation is enabled for the mission but it seems that these units do not get simulated. How can I activate dynamic simulation for spawned units?
Got it, thank you!
When we go unconscious in ACE how exactly does it prevent us from communicating and interacting? Is it by disabling global simulation or disabling user input or other method?
You can ask ACE on their Discord or eventually read the functions' code
is waitUntil { ppEffectCommitted _handle }; acceptable or should I use a sleep on the waitUntil? every example I see does not do that for this case use.
waitUntil requires to execute it every once in a while, so sleep is better IMO?
the less frequent evaluation the better
how do i run a script on a spesific player?
using their name doesn't work so i need help
@oblique pewter You can remoteexec it using the players unit object
what is a unit object
the vehicle that is the player, what "_player" would be on clientside
do all you have to go off of is the name?
yeah i only have the name
which name? The steam one?
the in game name
ok the profile one
yes sir
Can anyone help me
?
@oblique pewter ya, just writing a quick script for it, sorry its taking awhile, was multitasking
@oblique pewter Here you go:
_name = "Jeff";
[
if (name _x isEqualTo _name) exitWith {["compile preprocessFileLineNumbers 'PATH TO SCRIPT'"] remoteExec ["spawn", _x];};
] forEach allUnits - entities "HeadlessClient_F";
Thats set up to spawn an sqf file on the specific player that has the name matching the "_name" value
jip compatibility depends on where you put the code I gave, what is your goal with it?
adding scripts to players in zeus
Are players getting zeus throughout the mission? Or just defined in 3den
yes
yes to thos
hm, might be an event handler you could leverage, or just do regular checks
If i had steam id how owuld i do it
_id = "767676545767676";
[
if (getPlayerUID _x isEqualTo _id) exitWith {["compile preprocessFileLineNumbers 'PATH TO SCRIPT'"] remoteExec ["spawn", _x];};
] forEach allUnits - entities "HeadlessClient_F";
what do you need help with?
what if i want to play a sound for a specific player
use playsound and remoteexec
Anyone know how to make tasks (placed in 3den) available for all clients on a dedicated server?
A quick lil script or something?
It's in the options for the "Create Task" module I believe. You can pick from a dropdown menu to sync it to a side or all players.
Question: if I remoteexec a script on a client and in that client side script I set a mission namespace variable, will that variable be set.for other clients as all?
I do not want to use profile namespace.
If remote client will set a global variable (publicVariable it), other clients will end up getting it
{missionNamespace setVariable ["somevar", 123, true]} remoteExecCall ["call", _player2];
```Original remoteExec caller will end up having `somevar` set after some time
Could use a hand with this code. I am getting an error
if (player isKindOf "B_mas_aus_recon_TL_F_ma" || player isKindOf "B_mas_aus_recon_medic_F_ma" || player isKindOf "B_mas_aus_recon_M_F_ma" then {
player synchronizeObjectsAdd [Requester];
BIS_supp_refresh = TRUE;
} else {
player synchronizeObjectsAdd [Requester2];
BIS_supp_refresh = TRUE;
};
Thing is I want to set a variable only for that single client, not others
No ) after list of isKindOf checks
Ah, its the bool at the end. For some reason I thought it was JIP stuff. I completely missed it
{somevar = 123} remoteExecCall ["call", _player2];
// somevar is undefined here because only _player2 did that code
_doTheThing = false;
{_doTheThing = true} remoteExecCall ["call", _player2];
I assume this should make it so scripts that run on _player2 side will have the value of _doTheThing return as true, while others will have it as false, right?
Ah, localNamespace is what I was looking for
Yes
The variable is local in your example though, I guess you wanted global there
No, I actually wanted a local variable, I just didn't explain it well enough.
local variables visible only withing their scope, if you're remoteExec'ing something, it creates a new scope
Unless you're going to call something inside that remoteExec'ed scope that's gonna use that local variable
I want to set a variable on one of the clients, but not others. In a way so other scripts executed by that client can read that variable
Never heard of that
fixed it., had marker total as 185 and actually had 186.. duh
Yes, you want a scope global variable but not a network global variable
Had a jimmy neutron brain blast moment.
Im making a more linear, story-heavy scenario with a full squad that the player can control at will, because I think A2 had the best writing even if A3s voice work is superior. Problem is, that means I need each character to have a line for each situation, depending on who is in control when they do A Thing, etc.
I had whole nesting sets of switch-dos to determine who did A Thing, select their proper name and their line for my dialogue system; even trying to keep it limited this was a dozen lines of code for two, three places in each event.
I also had a whole 'move a marker to track where a piece of intel was being carried', but I was using it several times so figured, time to functionalize it.
In the midst of recoding it, I realized I could use the initial location to Select from an array of responses for each character, instead of writing whole if-thens.
But where to put these arrays? I dont want to define it every time I call the function, so Id need somewhere discreet to place them that can be easily called upon, while only referencing the unit they're attached t-
...
So anyways each of the characters now has a "DialogLines" variable in their namespace, with an array of about a dozen and growing strings, and now I have to redo all of my previous code to replace whole blocks with '_talker getVariable's and everything is totally normal.
hi there. I am using an edited version of GF Missions and I am noticing on each of the mission SQF's, there a ZEUS section of code that's generating errors. The code is
Zeus addCuratorEditableObjects [_Loc nearObjects 1000];
and the error is
Zeus addCuratorEditableObjects [_Loc nea>
21:17:19 Error position: <Zeus addCuratorEditableObjects [_Loc nea>
21:17:19 Error Undefined variable in expression: zeus
It's looking for something with the variable name zeus (presumably a curator entity) and failing because there isn't one in the mission
How 'edited' is this mission?
My assumption would be, in the course of editing it, you either renamed or removed the Zeus module.
heavily edited and I'm just going through trying to find and fix errors. I've just added the variable name to a zeus module and will test.. Thanks so much for the input guys, really appreciate it. I've been searching for a working automated and dynamic mission generator and this is the closest I've managed to locate for sometime
100% correct. with the module variable now = zeus it's all fixed ๐
Thanks legends @manic sigil and @hallow mortar
Note, that will simply quiet the voices, it will not make the delusions go away.
Or, yknow, that merely made the errors stop reporting, youll have to do extensive testing to see if the actual results are stable and practical.
diag_dumpScriptAssembly {-5}
push 5
callFunction -;
I think the bytecode optimizer doesn't catch this thing ๐ค
Is there an engine way to create custom chat commands (#mycustomcommand)
Think I may be oblivious
CBA does it with script, chat eventhandler
Ah that'll do thanks
Yeah turned out just matching the Committed value to the sleep value fixed all my odd issues. So note to everyone the provide examples for ppeffects are flawed lol
player addEventHandler ["Fired", {
private ["_shooter", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_shooter = _this select 0;
_magazine = _this select 5;
_nearestObject = nearestObjects [_shooter, ["Door"], 2];
_nearestSurface = lineIntersectsSurfaces [eyePos _shooter, eyePos _shooter vectorAdd (eyeDirection _shooter vectorMultiply 2), _shooter, objNull, true, 1, "VIEW", "FIRE", true];
if (!isNil "_nearestObject" && (!isNil _nearestSurface select 3) && _magazine == "rhsusf_5Rnd_Slug") then {
_door = _nearestSurface select 3;
if (_door == _nearestObject && locked _door == 2) then {
_door setVariable ["locked", 0, true];
hint "Door Unlocked";
[_door, 'Door_1_rot', 'Door_Handle_1_rot_1', 'Door_Handle_1_rot_2'] execVM "\A3\Structures_F\scripts\Door_open.sqf";
}
} else {
hint "Not near any door";
}
}];
``` I am trying to get my if condition and door check working but get stuck with type conversion errors and divisible by zero erros when not near any surface.
then take your code in the debug console, output variables as you go and see where the error is
but i am in the right direction yes?
no idea, that was not your original question
basically im trying to open up a door when it gets hit by a shotgun slug (as long as the player is actively viewing the door and is within 2m of it)
advice, do funnel your code
if (cond1) then
{
if (cond2) then
{
if (cond3) then
{
// hadouken code
}
else
{
// failure
}
}
else
{
// failure
}
}
else
{
// failure
};
```turns into```sqf
if (!cond1) exitWith { /* failure */ };
if (!cond2) exitWith { /* failure */ };
if (!cond3) exitWith { /* failure */ };
// stuff
so this basically boils down into getting these two to work together: ```sqf
_nearestObject = nearestObjects [_shooter, ["Door"], 2];
_nearestSurface = lineIntersectsSurfaces [eyePos _shooter, eyePos _shooter vectorAdd (eyeDirection _shooter vectorMultiply 2), _shooter, objNull, true, 1, "VIEW", "FIRE", true];
nearestObjects [_shooter, ["Door"], 2]; doors are not objects
what is a door
It's a partition on a flexible mounting that can be moved to block or unblock an entryway, but that's not important right now
no no, it's so much more then that. It's a symbol. ok anyway
guys, a call {}; inside a while loop won't exit the whole while loop right? sqf while {true} do { call { if !(alive player) exitWith {sleep 1}; if (damage player > 0.9) then {player setUnconscious true;}; }; };
yep
I am rewriting some code and whish to improve upon but don't want to do the whole work if that exitWith inside the call {} doesn't work inside the while loop.
more like "an exitWith inside a call inside a while" but yeah, only one scope
Thanks!
that's still an ugly way to do so ๐
Alternative
while {true} do {
if !(alive player) then {sleep 1; continue;};
if (damage player > 0.9) then {player setUnconscious true;};
};
you want to skip one iteration, aka continue, so you can just use continue
IMO also easier to read
Ohhh I keep forgetting that continue is a thing! Thanks!
ary # 0 is the same as ary select 0 right?
Yes
Yay.
Yeah I know, I used that as an example, I know that Event Handlers are the way to go for most things ๐
Also, is a default value always called for getVariable?
I wanna have it so if a variable is defined, use that, otherwise use a string.
(obj) getVariable ["something or other","Floor " + str((count _formatList) - _forEachIndex)]```
yes, called
hmm- probably won't matter for preformance, but any ideas on a way to improve it?
- Make sure your variable is init before getting it
- Do: ```sqf
private _val = _obj getVariable _var;
if(isNil"_val") then {
_val = call someComplexFunction;
_obj setVariable [_var, _val];
};
There is getOrDefaultCall which addresses that, but its for hashmaps, not objects
alright
plus there is the huge security risk of my elevator teleporting script
params["_plr","_floor"];
diag_log ("[ELEV_TELE]: " + str(_plr)+" _ "+str(_floor));
_plr setPosASL getPosASL _floor;
What's the use case for https://community.bistudio.com/wiki/backpacks command?
Curious who needed it and why
IDK, isn't it "just" everyBackpack backpackContainer _unit?
aaah no, maybe someone can have a backpack inside a vest or something
"ok"
items and magazines don't include backpacks in inventory, so if a player had extra backpacks in their pocket (some "backpack" items are pretty small, leg strap bag etc), there was no way to detect it
flatten(everyBackpack uniformContainer _unit + everyBackpack vestContainer _unit + everyBackpack backpackContainer _unit) apply {typeOf _x}
yeah that ^^
Does that even work? The docs for everyBackpack imply it only works on certain types of cargo space
Yeah I guess it makes sense to have a command in line with that, but I still wonder who had a use case for it
Yeah it does
I don't remember seeing it on FT, so it's probably CDLC stuff. I wouldn't be surprised if SOGPF adds individual pouches as backpacks or something
๐ค
Finally got it working as intended sqf player addEventHandler ["Fired", { private ["_shooter", "_magazine"]; _shooter = _this select 0; _magazine = _this select 5; _houses = nearestObjects [_shooter, ["house"], 10]; if (count _houses > 0) then { _house = _houses select 0; // _shooter sideChat format ["Nearest House: %1", _houses]; private _intersects = []; { _intersects = ([cursorObject, _x] intersect [ASLToATL eyepos _shooter, (screentoworld [0.5,0.5])]); if (count (_intersects select 0) > 0) exitwith { _intersects } } forEach ["FIRE","GEOM","VIEW"]; // _shooter sideChat "Found Intersect"; if (count _intersects > 0) then { _intersect = _intersects select 0 select 0; _dist = _intersects select 0 select 1; // _shooter sideChat "Checking _is_door"; _is_door = [false,true] select (["door",_intersect] call BIS_fnc_inString); // _shooter sideChat "Checking _magazine"; if (_is_door && _dist < 3 && _magazine == "rhsusf_5Rnd_Slug") then { // _shooter sideChat format ["Breaching Door: %1", _intersect]; _select_door = format ["%1_rot", _intersect]; // _shooter sideChat "Animating"; _house animate [_select_door, 1,false]; }; }; }; }];
exitWith
but GJ!
uh- any idea on how to rotate a group of objects by .012 degrees? ๐
I accidently rotated a composition and now I wanna rotate it back. xD
I'm guessing I'd need to use coding to do it
Ctrl+Z
yes but I had done this in another map
then copied it, and then realized "Oh hey, everything is actually off by .045 degrees :]
try the rotation widget
that's not percise enough xD
how do you even noticed so small change? ๐
0.1 seems to be the minimum and thats soo small change
0.1 isn't a very small change
IMO in rotation it is..
wheres that duck with sunglasses meme
offset by -0.145 then by +0.1 ๐
Can you use a normal .paa resource for a map marker without creating a mod for the markerCfg ?
no, but you can use drawIcon
it means the benchmark stopped to avoid risking taking too long and potentially blocking the game
uh, depends. Some operations are unavoidably slow in SQF.
That is a command that you should not be doing in realtime.
Any sort of high-frequency checking.
I can't imagine why you'd need to get an array of every map object within 4km of the player anyway.
player nearObjects 4000 is extremely broad. You should at least filter it down to only look for MissileBase type objects.
Are missiles registered in https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityCreated ?
If yes, then you can build an array and inAreaArray it when needed
Fired EH on vehicles seems like an acceptable solution.
Well, you can also dump all the missile into an array and then inAreaArray on the CIWS.
There won't be many missiles at once, I imagine.
I mean just have a global array of active missiles that you add them to when fired.
And then the CIWS monitor loop can do globalMissileArray inAreaArray [_ciwsPos, 4000, 4000]
It's fast. But which way around you should do this depends on how many ciws you have and how many missiles.
inAreaArray takes an array that you made yourself.
It's not like nearObjects or nearEntities.
is there a way to determine if weapon attachment is source of light ( laser or light ) via config ?
checked the type-filtered nearObjects but it's not much faster. Likely normal for the isKindOf filtering.
It's probably bad that I do nearObjects ~3 times every check, per vehicle, for my APS then ๐ค
Certainly sounds like it :P
Only 80m radius though, and no noticeable issues on Livonia with ~20 active tanks, so I'm not rewriting it now :U
oh yeah, 80m is fine.
Just use nearObjects to do a 1 time cache into a table so you have all the missiles you need indexed for faster checks?
are you joking...
mymissiles = [];
{
if (_x isKindOf "missile") then {mymissiles pushBack _x};
} forEach allMissionObjects``` ๐
plz stahp :P
You could try looking for the Flashlight and Pointer subclasses in the item's ItemInfo subclass. This appears reliable for vanilla though I'm not 100% sure how universal it is, as I don't have any CDLCs or mods loaded right now
{
private _namespace = _x;
{
_namespace setVariable [_x, 0, true];
} forEach allVariables _x;
} forEach [missionNamespace, parsingNamespace, uiNamespace, localNamespace, profileNamespace, serverNamespace, missionProfileNamespace];``` run for better fps ๐ (please dont)
they're universal yes
ProjectileCreated
Oh yeah, I remembered there was something in mission event handlers
does https://community.bistudio.com/wiki/BIS_fnc_playVideo need the video to be equal borders/ resolution to work with binary or can it be any resolution
any res should work

There's no way to remove a userAction from a door right?
I wanna have a door I can lock, but the door's modded and doesn't "come with a lock"
could try clipping an object to not allow it to pass through like a can of soda or bacon
typically you would use code like this to lock the door but dont know if it works with mod: ```sqf
bldg setVariable [format["bis_disabled_Door%1",_doorIndex], _lock, true]; // _lock = 1 is locked
what if I change simulation-
what sim?
the door is a modded door. Other doors in the mod, simulation disabled means they don't show the open/close options.
But never tried it mid-game
it does work but it disables all doors
another way is creating simple objects
oh, these are gates basically
simulation does not work on these doors :I
ok, energy shield I guess xD
a super simple object will work tho 
I needa be able to do it mid-game :P
I could replace them with the static version, but then if it's opened and I tell it to lock, then it wouldn't animate.
does the static version still have the animationsources
alternatively you could always make a compat if you want to make a mod but thats probably a massive pain
I assign a target to my AI squad and order to Fire. If I want to abort the attack and force the AI squad to stop firing then what is the best and most reliable way to do that? It seems like combatmode Green or Blue and ForgetTarget is not enough hold fire.
I tried the code below but it does not stop them from attacking a manually assigned target. Any ideas?
{
_x doTarget objNull;
_x doWatch objNull;
_x commandWatch objNull;
_x setCombatMode "BLUE";
}forEach (units group player);
Hey so I want to attach a flag pole to a vehicle in the corner of it, how do I find what is the required X and Y for the positioning?
I tried to attach it without X,Y,Z but it just in the air
You want a general solution or a vehicle-specific one?
well I a, trying to get it on an RHS MRAP and SOCOM HUMVEE
In that case just find a good point for those vehicle types and hardcode it.
Anyone familiar with creating modded intro scenarios that play in the background of the main menu? Got mine working, but when I hit the Back button after opening Multiplayer, the scenario breaks/gets lost instead of continuing. Any ideas?
What do you mean by hardcode? ๐
I am fairly new at this
They mean to guess and check until you have the correct z/y/z values that work for that vehicle in specific.
Gotcha thanks!
Guys, anyone knows the radious of sqf getEnvSoundController 'shooting', example usage: sqf (((position _x) getEnvSoundController 'shooting') < 0.9) || // recent firing around position
"around position"... how large around? ๐
Wish there was a way to JIP queue remoteExecCall, without broadcasting to current clients
Only to future ones
If you only care about code not being executed - you can broadcast the "don't actually do it" variable to the current clients first 
You can do that with isRemoteExecutedJIP check
But I just don't want to send huge array each time I add an item to it
Actually I wonder if changing an array\hashmap after JIP broadcasting will send original or updated version to JIP? ๐ค
hs = createHashMapFromArray [[1,2],[3,4]];
hs remoteExecCall ["something", 0, true];
//...some time later...
hs set [1, 100];
```What will client get after JIP? `[[1,2],[3,4]]` or `[[1,100],[3,4]]`? ๐ค
Some derping around with clients actively requesting the array may also work
Yeah, having clients request the array from server themselves would be a solution too
Thanks, i can finally get 120fps
Doesn't seem to matter:
[5000,5000,5000] getEnvSoundController "shooting"
returns the same as:
(getPos player) getEnvSoundController "shooting"
https://forums.bohemia.net/forums/topic/187202-~-arma-3-sound-modding-101-~/?page=6&tab=comments#comment-3049207
But there is still a distance limit isn't it? I mean _unit1 shooting 3000 meters away from _unit2 shouldn't increase sqf ((position _unit2) getEnvSoundController 'shooting')
The value goes from 1 when no shooting happens around and then to 0.X depending on how heavy/long the nearby shooting is... What I don't know is the distance of that "nearby" area...
Also I don't know if the command considers the source of the firing (the unit firing) or the impact location of the bullets or both?
i think it's broken
position doesn't matter, it always evaluates from player.
it does however not activate if you're too far away from the sound, so that distance is evaluated, yes, somehow.
I'm having an issue where game master modules are breaking mid mission. It's inconsistent so it's hard to pin down the cause
Does anyone know code to assign curator to players mid mission?
Run as local to assign yourself:
[player, allCurators#0] remoteExec ["assignCurator", 2]
It's a fiddly command because it needs to run on the server.
As you see from my code, I tried combatMode Blue but it does not stop them from attacking. Perhaps it is impossible to cancel the attack after manually assigning a target with fire command. At least I could not find any solution yet.
The AI has init
[this] spawn movement;
where movement is the script below
while {alive _self} do {
//When it is not dead
{
//Return the visibility between player and the anomaly
_canSee = [objNull, "VIEW"] checkVisibility [eyePos player,eyePos _self];
if (_canSee > 0.7) then {
//Disable AI movement when it is seen by player
_self disableAI "MOVE";
systemChat "Disable AI MOVE";
} else {
//Enable AI movement when it is not seen by player
_self enableAI "MOVE";
systemChat "enableAI MOVE";
};
//Repeat this for every player in the server
} forEach units player;
}
This is suppose to stop the AI from moving when a player is looking at him. It works when there is objects or particle blocking the sight. However it doesn't consider where the player is actually look at. I would want the AI to start moving when player turn around. How may I do it?
if it always evaluates from the player, then running a fnc on the server for ai units like this: sqf VAL_fn_unitsInCombat = { private _unitsInCombat = []; _unitsInCombat = (units _this) select { !(isNull (getAttackTarget _x)) || // Ai has target (((position _x) getEnvSoundController 'shooting') < 0.9) || // recent firing around position Ai unit !((getSuppression _x) isEqualTo 0) // Ai unit being shot at }; _unitsInCombat }; private _unitsInCombat = []; _unitsInCombat = _group call VAL_fn_unitsInCombat; if (_unitsInCombat isNotEqualTo []) then {{_x enableAi "ALL"} forEach units _group;}; won't truly work as intended.
But will work if run on the client for Ai units in the player's group
Hey guys, i'm trying to add some custom factions to Zeus, but i'm totally new to this. I was able to get the required tools and open up the config. I added the correct unit name to the CfgPatches, but they dont seem to show up.I'm sure there must be a missing step. Any help?
Maybe you should use some sleep and params to get it work correctly.
Have you talk with chatGpt?
hey so if there are things like
onPlayerKilled.sqf and onPlayerRespawn.sqf
is there any equivalent for player going unconscious/ revive state?
I have a few scripts set up that gives players their loadouts on respawn that they died with. And One mod takes away all mags when in revive state meaning if they die and respawn they wont have any mags. If I could get it to save loadout when the player goes down I belive that could fix it
I'll look into adding sleep to make it less resource demanding. There is only 1 parameters as the AI himself. The script would run forever after the mission initialize until the AI unit dies. At least, that's my idea on implementing it.
To assign a target to an AI unit with the doTarget command is easy. The AI will continously aim at the target until it's destroyed. But I've not found any command to unassign it if the target is still alive, like the radio command "no target".
Is it possible anyway ?
does using objnull work
https://community.bistudio.com/wiki/Event_Scripts
Thats all the evt scripts.
I dont believe there is one when going into incapacitated mode.
Perhaps you could use HandleDamage event handler to detect if unit went/is about to go down and save loadout there.
If you use ACE, there is CBA evt handler for unconcious
No, it does not work. If objnull is used then the last target gets assigned.
You could run assignedTarget and getAttackTarget in a loop and unassign them until both of them return objNull, like commandWatch objNull
can someone tell me, on ORBAT group description, what is the line for the background while viewing the group? is it
"texture =" or "Insignia =" ?
yes, I could use some sleep
also please don't recommend chatGPT.
it's evil
I was about asking have he talked with chatGpt, he's code doesn't make sense , or does in sqf _self is equal to _this.
Because he doesn't use params like
params ["_self"];
And code will run pretty fast without sleep and units player doest either make sense.
ah in that sense yes ๐
"did chatGPT give that to you?" ๐
Yeah, better
mb ๐ป
doWatch objNull is all you need
But if it's an enemy you can't stop them from firing because they retarget it
You can set their combat mode to "blue" but they won't attack anyone else either
I got it open, I am having a bit of problem, I am trying to make an orbat for the enemy faction my unit is against, and I am trying to make subordinates, but I am doing something wrong and I can't tell what is it
class CfgORBAT
{
class HQ
{
id = 0;
idType = 0;
side = "East";
size = "Squad"
type = "HQ";
insignia = "orbat\Iraq.paa";
commander = "UNKNOWN";
commanderRank = "Captain";
text = "Free Iraq Military HQ";
textShort = "Free Iraq HQ";
description = "The seadquarters squad of The Free Iraq Military, lead by current unknown commander";
class 1stArmor
{
id = 1;
idType = 0;
side = "East";
size = "Division"
type = "Armored";
commander = "UNKNOWN";
commanderRank = "Lieutenant";
text = "%1 Free Iraq Platoon %3";
textShort = "%1 %3";
description = "1st Armor Platoon lead by current unknown commander";
subordinates[] = { TEST };
class TEST
{
id = 1;
idType = 0;
side = "East";
size = "Squad"
type = "Armored";
commander = "UNKNOWN";
commanderRank = "Sergeant";
text = "TEST";
textShort = "TEST";
description = "TEST";
};
};
};
};
I am fairly new at this so take it easy on me ๐
I am trying to end up with something like this eventually
Make sure you saved the Description.ext on Eden Editor
I did ๐ฆ
It does not saved/loaded everytime you change Description.ext but when you save the mission in Eden Editor
I will try to load the mission again
Yea, it seems they do not stop attacking until the enemy is dead. Nothing works but doSuppressiveFire seems to interrupt the routine and the AI is losing the target. This might be a work around.
(Weeelll load will do the same thing but Ctrl+S simply do it)
Still the same thing
it doesn't appear
I have no clue what I am doing wrong
subordinates[] = { 2ndBCT }; // Subordinates, searched on the same level as this class.According to BIKI you don't need to have subordinates[] = { TEST };
uhm ok, but how will everything else end up like this? is it because of the size of the specific group that makes it split like that?
{
class First
{
class Second_A
{
};
class Second_B
{
class Third_A
{
};
class Third_B
{
};
};
class Second_C
{
};
};
};```Basically idea is this
ohhhhhhhhhhh
ok cool, let me try that real quick just to make sure I got it completely
aaahhhh... I somehow ended up like this, this is a learning curve for me, what am I doing wrong?
https://codeshare.io/r90lmq
No idea what you tried to create so can't say
(I need 2nd DIV to be separated)
Separated as in?
on the same row as 1st DIV, and the test squad under 1st div
How do I share like xml of the code or something? I know you can do it I forgot how
yeah haha in the link there
Am I okay to overwrite what you got entirely?
Yeah this is actually like the third time I am doing this so ๐
Therefore... you can see what's wrong with it
Yeah true
so I see you wrote third row and second row so I will keep eye on that, but just to be sure, for the 2nd DIV to be on the same row as 1st Div, I need to type the line it in the 2nd row?
This is what you mean?
Yes haha
Added the comment
I am still having trouble, I am too stupid for this, quick question though
when I move back the class line, do I need to move everything below it as well?
or just the class line
the indent itself does nothing
it is for readability
it helps you see what is inside what
This but VEEEEERY required/good to have habit
Most of the times/software you can select multiple lines and press Tab or Shift+Tab to make entire lines go up or down
thiscpp class A { class A1 { class A1_1 {}; }; class A2 {}; }; or```cpp
class A
{
class A1
{
class A1_1
{
};
};
class A2
{
};
};

Does anyone know more about knowsAbout what is the magic number in arma3?
In my testing, when it reaches 1.5, ai knows something is off and starts returning fire in general direction of a player or scans the area, but doesnt actually know where player is. At value >2 Ai will defo know where player is and start engaging player. If player is hit during that time value will climb to 4 instantly.
the brackets { do they go under the class name? or in the end ?
I literally want to get my head through the wall because I don't get it
it sounds simple
but I just cant get ittttttttttttttttttt
your - call
so it doesn't matter?
I prefer the Allman style, bracket below
Unrelated:
private _isTheConfigDefinedInTheCfg = {
params ["_cfg","_property"];
if (!isClass _cfg) exitWith {false};
count configProperties [_cfg,"configName _x == _property",false] != 0
};
[configfile >> "CfgGlasses" >> "G_Sport_Blackyellow","name"] call _isTheConfigDefinedInTheCfg;
[configfile >> "CfgGlasses" >> "none","name"] call _isTheConfigDefinedInTheCfg;```Is there any way to make it smarter to detect if the property is defined in the config? The expected return is `false` and `true` in this context
Those both are valid. But you can see which is better for you @brisk lagoon
isNull _config perhaps?
Arma doesn't actually care about the arrangement of whitespace and line breaks (except inside strings); you can do it however you like and it will work. The purpose of doing it in a particular style is to make it human-readable.
Nope - (configfile >> "CfgGlasses" >> "G_Sport_Blackyellow" >> "name") apparently returns bin\config.bin/CfgGlasses/None/name and not null
got it
You can do it all in one line if you want ๐ class A{class A_A {};class A_B{};}; spaces/newlines/tabs are just for easier human readibility, machine doesnt care, this isnt python (thank god)
Not sure if I've used the wrong terminology in my searches, but I can't find much information about the disabling of cameras in vehicles via scripting (not by config). Specifically, I'm trying to disable the camera that pilots have access to in certain jets ie the vanilla wipeout. Any pointers in the right direction would be helpful, cheers.
Can someone remind me how to clear the audio backlog when using disableAI "RADIOPROTOCOL"?
I wrote it again from scratch by the the 2nd option and this is what I get
the other 2 units disappeared
Oh no, you have broke it again 
I don't know what I am doing wrong, I really don't ๐ญ
I sorted it out
trying
still the same
๐ฉ
now it doesn't appear at all, I think if I do this "};" after a class
it won't read the rest
use https://pastebin.com/ to show your config
of course the brackets {} have to match start/end of a class, if you add one too much it closes one too much - hence proper indentation to help you see one too much
Ok I managed to make all the units again, but they are in one column still, instead of 2
(I am trying to get A Squad under 1st Div, and 2nd Div on it's own under HQ
I am sharing the code in a sec
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
well yeah, you got all under one class
You are starting classes, using {, but never ending them, so it's being read as everything being subclasses of the first class
Or, well, you are ending them but after everything else, rather than where they should be ended
Ok I think I get what you mean, so I am supposed to close the A squad class in that case?
yeah
your current classes are like that (I removed the noise):```cpp
class CfgORBAT
{
class HQ
{
class 1stArmor
{
class AlphaSquad
{
class 2ndArmor
{
};
};
};
};
};
so at one point you need to close HQ and open AlphaSquad ๐ like this```cpp
class CfgORBAT
{
class HQ
{
class 1stArmor
{
};
};
class AlphaSquad
{
class 2ndArmor
{
};
};
};
Ok I was about to ask if I did it correctly but when I paste the code to pastebin it doesn't look right
all the spacings are weird, and on Notebook ++ its looks normal
was I doing something wrong this whole time? maybe how I write it? lol
maybe you're mixing tab's with spaces
press that button.
Tabs are arrows, spaces are dots
so this is how my notebook ++ looks like
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
And that's here
Usually you decide for one style
either only tabs, or only 2-space indent or 4-space indent
yeah you're mixing tabs and spaces
oh... lol
The width of a tab, depends on the editor/tool/website you view it in.
A tab may be 4 spaces wide, or 2 spaces, or in case of pastebin apparently 8 spaces wide
is there a way to fix it, or I need to do it manually for each line now?
In Notepad++ you can select a block of lines and tab them (or untab them) all at the same time
So select everything, shift+tab until it's flat, then select blocks and apply the correct number of tabs
Also, if you go to Settings > Style Configurator, select C++ in the Language box, and add ext in the User Ext. field, you'll get syntax highlighting in description.ext
Ok yeah I fixed it thanks
So did I write it correctly?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
reminder (I am trying to get A Squad under 1st Div, and 2nd Div on it's own under HQ)
oh wait, I sapced 2nd div too far by accident
Well you've put Alpha inside 2nd Div, not 1st Div, and 2nd is now a top-level element and not under HQ
oh oops you right
I think there might be a few more organisational levels between Squad and Division btw
no yeah I am aware this is all testing because I have no idea how to do that haha..
I fixed it ( I think)
but it still doesnt do what I want it to do
now only hq and 1st div shows
There is probably a }; in the wrong place, but I can't see the new code so I don't know where
updated the code now
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
maybe the one that closes the HQ?
do I need to delete it?
(I have no idea what I am talking about btw, I am a rookie lol)
You don't need to delete it, you need to move it to after the close of 2nd Div, because currently you close HQ and leave 2nd Div outside it
Also, Alpha is still in 2nd Div
ahhhh frick, let's keep it there for now, I want to first separate the divisions
so it just moves down, did I get it right?
to the bottom I mean
You need to move the }; that closes HQ to after the }; that closes 2ndArmor, so that 2ndArmor is contained within the HQ class
ALMOST THERE ๐ฎ
I messed up something though
lol
maybe, A squad needs to go after 1t div line?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
so right now the class is under 2nd div, but same column as 1st div
The horizontal spacing in Notepad++ is for human readability and does not influence how the game interprets it
see this @brisk lagoon
this is why indentation matters, and why Notepad++ / VSCode highlight brackets to see "where is what" and where objects end
The config classes follow the same hierarchical structure as what is displayed in the end, it's just...sideways, compared to the game's visual presentation
I DID IT YAY
my goodness, it took me one hour and a half, I really REALLY appreciate all your help and patience
all of you that helped me, thank you sincerely
now time to test more stuff with it and hopefully not break it
anytime! (but not too often ๐)
the channel is here for that, don't hesitate ๐
the only good style
contact, all man, 100m, front
Look DAD(s) I AM DOING IT ALL BY MYSELF
now I have just 2 questions
how do I sort the units under the company to look like this? does it do it on it's own when I will expand it?
and I looked at the ORBAT Arma page but I didn't really understand how do I add a background
You have added 47th platoon as a subclass of the 22nd platoon, and 99th platoon as a subclass of 47th. Since I assume platoons are not meant to be subunits of other platoons, what you should do is add each of them as a parallel subclass of 1st company - the same way you previously had the 1st and 2nd divisions as parallel subclasses of the HQ.
ohhh
(Note: platoons are typically numbered within their company, so you would have, say, a separate 1st through 4th platoons within each company, and never reach numbers like 99)
You are completely right I thought about making regiments and in the same time created platoons
I understand what you mean but I got blacked out and forgot what I am supposed to do
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
that's what I did
class platoon1;
class platoon2;
class platoon3;
//instead of what you are currently doing, which is:
class platoon1 {
class platoon2 {
class platoon3;
};
};```
No, don't do that
This is correct, it's a hierarchical structure that's supposed to have subclasses
I mean it's a little bit wrong but mostly correct
as in for the platoons
Move everything in the 1st company class right by one tab. This is not a functional thing, but it will help you to see that the 1st company is at the same level as the command squad, and that you have closed the 1st company class but not the FIM class.
beautiful ๐
thank you
Ok now I will try to expand with another unit and will try to add assets as well
You could check cursorObject on each player every second or so. If it's an AI that should freeze, then do so. You'll probably need to remoteExec the disableAI.
But isn't cursorObject needs to be exactly pointed at the AI?
ah, you want (in field of view) and (not obscured)?
Yes, similar to scp-173 if you know the reference
there is https://community.bistudio.com/wiki/worldToScreen, but you need to check for multiple points too (e.g an arm showing behind the cornerโฆ)
I did a pseudo-slenderman in A2 with that ๐
A very complicated way would be using eyeDirection +-90 degrees and check if player is facing ai. But youd have to do this locally on each client and then compile all results on machine local to ai and then decide to move it or not
And youd still have to test LOS
I would:
- run checks on each player (let's trust player's machines sometimes!)
- if the player view changes, have it call a function on the server with
remoteExec - make the server do all the stuff through that function
I think I'll look into the eyeDirection function after my arma 3 game since that seems a more direct and easy approach. It's good to see that it works even in A2 tho. Now I know it must work in A3.
ok so
I thought it will be easy because I figured it out but now I am missing something again
I need the motorized infantry separate as well
I tried to type the class below the 1st armor co. and it didn't work
I tried also to do it after the 1st armor co. and the Pt's. and it didn't work
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I'll look in to this flow later. Since I just started learning scripting in Arma 3 for few hours, I'll need more time to learn how this work. But theoretically works like a charm. Thanks for the advice 
It is still inside the closing }; of the 1st company class
Welcome aboard the mad train!
I noticed just before you said it ๐
I am actually figuring it out, I am getting excited like a kid in a candy shop hahaha
Sure it is a mad train. Had to spend 30 minutes just to call a function I wrote ;D
Id do:
Server would remoteExec a function on all clients in theoretical view distance, that function would check, every N time:
If player is facing general direction with eyeDirection +- FOV/2
If that passes id then run:
[objNull, "VIEW"] checkVisibility [eyePos player, getPosASL _veryNotMovingAi] != 0 (or some threshold like 0.1)
remoteExec result true/false on server into a function which would control AI movement, containing array of all players and true false visibility check. If any is true then hold AI if all are false do movement.
If you put the cursor next to a { or }, Notepad++ will automatically highlight its matching counterpart at the other end of the class. You can use this (along with correct indentation) to keep track of where things need to go.
thank you. I'll see which method works best. but first i need to understand what's special with remoteExec
I am doing it ๐
like riding a bike
now the only thing I am curious is how do I replace the logo (Top logo)
and add a logo to the background
what does the doc say? ring-ding-ding-ding-ding-diding
texture = "\ca\missions_f\data\orbat\customTexture_ca.paa"; // Custom texture, will replace icon set by 'type' param.
``````cpp
insignia = "\ca\missions_f\data\orbat\7thInfantry_ca.paa"; // Unit insignia, displayed in ORBAT background and in tooltip
```https://community.bistudio.com/wiki/Arma_3:_ORBAT_Viewer
so I will surprise you now, I did it haha
The Insignia worked, but it didn't replace the top logo, it added a picture under text when you hover it
and the texture, in the bottom of the page it says it needs a directory path
and I tried it and it didn't work as well, probably did something wrong
nah, it is explained at the bottom of the page
use __EVAL
so I do "__EVAL C:\whatever\whatever\image.paa" ?
nooo no no no nooo
try this please?```cpp
__EVAL(getMissionPath "someFolder\SomeImage.paa");
So this did change the top logo, but no background still
and I do have insignia
so I wonder what is missing
Ah whatever, not first priority for now, I will try to add assets to the unit now
Does the end of this line supposed to be } or }; ?
assets[] = { CFP_O_IQARMY_T55_01, 2 }, { CFP_O_IQARMY_T72_01, 2 }
or I might not even type it correctly
As the documentation shows, the line is ended with the line end character, ;
put another pair of {} assets[] = {{ "CFP_O_IQARMY_T55_01", 2 }, { "CFP_O_IQARMY_T72_01", 2 }};
trying
and quotes
I am here yet again because I am missing something, sorry in advance lol
so I did it for each of the Motor Squads, and it shows that only on the third one, any clue why?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
This is hypothetical because it's not documented, but it could be that the ORBAT viewer expects assets to be detailed at the lowest possible level on the chart. For example, if you list a tank company and all its platoons, the tanks would be shown at the level of the platoons where they're assigned, not at the company level.
Since you've set up your 2nd and 3rd squads as sub-units of the 1st, it probably thinks that's what you're doing.
I'm trying to use BIS_fnc_guiMessage that is called upon clicking a RscButtonMenu that I created and added in the escape menu (RscDisplayInterrupt). The issue is that it just crashes the game. I tried using spawn , but it still just crashes...
fnc_sendReview.sqf
private _editBox = uiNamespace getVariable [QGVAR(sendBoxCtrl), controlNull];
private _listbox = uiNamespace getVariable [QGVAR(sendBoxListboxCtrl), controlNull];
if (isNull _editBox || isNull _listbox) exitWith {};
private _message = ctrlText _editBox;
if (_message == "") exitWith {};
[] spawn {
_result = ["Are you sure? You won't be able to send a new review during this playthrough of this mission.", "Confirm", true, true] call BIS_fnc_guiMessage;
};
playSound "3DEN_notificationDefault";
class ga_adminMessages_sendBoxButtonBase: RscButtonMenu {
...
action = QUOTE(call FUNC(sendReview));
...
};
It works if I call that same piece of code from the debug console
From Wiki about fnc_guiMessage:
This function internally utilizes suspension (waitUntil to be specific) and therefore has to be executed in a scheduled environment.
https://community.bistudio.com/wiki/BIS_fnc_guiMessage
https://community.bistudio.com/wiki/Scheduler#Scheduled_Environment
It is executed in scheduled in the code they posted
yeah, it is inside a scheduled env ๐
put a sleep 3 before the BIS_fnc_guiMessage call ๐ค
Can anyone tell me why I get this error when executing this function:
_psrTechnicalSpawn = createMarker position player; _psrM2H = createVehicle ["B_PSR_M2HB_High", getMarkerPos "psrTechnicalSpawn", [], 0, "NONE"]; _psrM2H disableCollisionWith this; _psrM2HPos = [0,-1.4,0.68]; _psrM2H attachTo [this, _psrM2HPos]; createVehicleCrew _psrM2H; createVehicleCrew this;
despite the code working flawlessly when put into the init field of a 3den object?
I'm trying to get it to execute through event handlers every time a certain unit is created
You didnt give the name to the marker and you are looking with getMarkerPos Name of the marker.
In an Editor object's init field, this is a magic variable that refers to the object in question.
In other contexts (such as event handler code), this can mean something else or nothing at all
["Are you sure? You won't be able to send a new review during this playthrough of this mission.", "Confirm", true, true] spawn BIS_fnc_guiMessage;
if you need the result (return value/handle?), you may need a different approach
that aside does it really no longer crash if you disable that line/code block?
Ohhhh yeah that will make sense
we are trying to draw a frontline on the 2d map using map markers
plus to fill the area "inside"
however we didnt manage a more complex frontline as we cannot figure out how to define the area if a point is twice on the y axis
or in general terms how to define an area (or better multiple) that should be filled with a different color inside?
If I disable the whole spawn block, it doesn't crash
what different approach would you suggest? I need something to prompt the user and I do need to get a response from that
note that this is running when the escape menu is open
You might need to set the correct parent display. By default it uses display 46, but the pause menu is (probably) 49.
hmm, i'll see
there are multiple pause menus, they all have the same id? (RscDisplayMPInterrupt, RscDisplayInterruptEditorPreview, RscDisplayInterrupt, RscDisplayInterruptEditor3D, RscDisplayMovieInterrupt)
Didnt pythia allready do that https://steamcommunity.com/workshop/filedetails/?id=1751569185 ?
idd is unique, so no
I looked at https://community.bistudio.com/wiki/Arma_3:_IDD_List when I wrote my message, but you'll have to check.
with findDisplay you need to determine the context you are in
yep, but using Python and "advanced" libraries - not in pure sqf ๐ฌ
Myb you can open thier github and see how they did it and apply it to sqf
I assume you are drawing the line with POLYLINE markers, but what do you fill the area with?
Or he can ask the author how he did it ๐
(don't worry, he already did)
And besides, that code is not on github
Oh didnt see the code is not on github but here is also a good thread for a "Fog of war" myb you could also use this https://forums.bohemia.net/forums/topic/232213-bearing/?tab=comments#comment-3427907 for map markers frontline filling.
How do I play Bearing? Filter your server browser for Bearing. Currently, there is a single server with a limited number of slots. The server is online most of the time, unless there are issues with the game or server. Bearing - An Orienteering RPG One billion people missing. A global communicati...
any script for import objects to editor ?
Yeah, the guy did a magnificent job here, by implementing it all in sqf. I can't even think how many gray hairs doing so must have caused
Yea i can imagine.
yep polyline + setMarkerShapeLocal "RECTANGLE";
checking
yeah was quite an impressive project by the engineer guy
I seem to recall seeing these shapes when I was investigating contour computing algorithms, myself
Bro what the hell, I some how managed to break the file without touching anything/
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
As someone who is taking a computer graphics lecture this semester I can tell you that it should be possible to use rasterization to fill the area. However, the rasterization algorithm I know only works for convex shapes.
But there is also https://community.bistudio.com/wiki/inAreaArrayIndexes, and it seems to work with polygons, so that might be a much better option.
I figured it out, thank god I saved again before doing something
If I would have lost all of that I would gave lose my mind
actually no
I didn't figure it out
did I just lose all my progress that I made in that scenario?
I have no way to really test this, I'm curious if using getPlayerVoNVolume _unit will return 0 when used on a player you have 'muted' via the player menu. If a player mutes someone ingame, I also want to hide all the chats they send as well, and I'm curious if checking getPlayerVoNVolume == 0 would be a quick and easy way to accomplish this.
Wtf does that mean, I am losing my mind, I tried to resave a different mission and it pops up again
I think it something related to the ORBA file, because it saved when it was out of the folder
I found the problem god this game is so stupid, I had a # in the file somehow
this game is so stupid, I had a #
yep that's the game's fault alright
your iconText or iconType function is not returning anything
Guys, most modded solutions found on the workshop for the very common "Ai units firing though walls" use a combination of linesIntersectWith and/or onEachFrame and other loops on every unit which seem very expensive. Can something like that be achieved with the "EpeContactStart" Event Handler for a less performance intensive solution. Here is what I got so far: sqf VAL_fn_epeContactStart_Ai = { params [ ["_unit", objNull, [objNull]] ]; if !(local _unit) exitWith {false}; if !(alive _unit) exitWith {false}; if (isPlayer _unit) exitWith {false}; _unit removeAllEventHandlers "EpeContactStart"; _unit addEventHandler ["EpeContactStart", { params ["_unit", "_object", "_selection1", "_selection2", "_force", "_reactForce", "_worldPos"]; if !(alive _unit) exitWith {_unit removeEventHandler ["EpeContactStart", _thisEventHandler];}; // optimization if (_object iskindof "building"๏ปฟ) then { if (_unit call VAL_fn_isTouchingBuilding_Ai) then { _unit disableAI "WEAPONAIM"; private _contactPos = getPosATL _unit; 0 = [_unit,_contactPos] spawn { params["_unit","_pos"]; waitUntil {sleep 1; (!alive _unit || _unit distance _pos > 2)}; _unit enableAI "WEAPONAIM"; }; }; }; }]; true };
and
VAL_fn_isTouchingBuilding_Ai = {
params [
["_unit", objNull, [objNull]]
];
if !(local _unit) exitWith {false};
if !(alive _unit) exitWith {false};
private _building = nearestObject [_unit, "building"];
if (eyePos _unit distance _building > 2) exitWith {false}; // clearly not touching the wall
private _touchingWall = false;
private _relPos = _building worldToModel (getPosATL _unit);
private _boundingBox = boundingBox _building;
private _min = _boundingBox select 0;
private _max = _boundingBox select 1;
private _relX = _relPos select 0;
private _relY = _relPos select 1;
private _relZ = _relPos select 2;
call {
if ((_relX > (_min select 0)) and (_relX < (_max select 0))) exitWith {_touchingWall = true;};
if ((_relY > (_min select 1)) and (_relY < (_max select 1))) exitWith {_touchingWall = true;};
if ((_relZ > (_min select 2)) and (_relZ < (_max select 2))) exitWith {_touchingWall = true;};
};
_touchingWall
};
no
Due to Epecontact working only on unit on unit / unit on veh?
it won't work on units
and I don't see how that's related to shooting thru walls?
that bug is related to something I reported a while ago in #arma3_feedback_tracker
and I doubt anyone can fix it because those commands use the same algorithm
If Ai is touching wall then: _unit disableAI "WEAPONAIM";
oh that's what you mean by firing thru walls
well it still won't work because units are not PhysX objects so they won't ever make Epe contact with anything
Ohhh... sad that that "small detail" is not exposed on the event handlers biki page ๐ฆ
anyway I thought this is what you meant by firing thru walls:
#arma3_feedback_tracker message
and I've seen it a lot
Attaching a small physixs enabled item to the unit could make epe contact fire? If there is such object of course
Yeah, on some buildings it is specially prevalent, like those military buildings
then that attaching will waste performance 
Of course not, I just know I am stupid with this stuff since I am a rookie so I have to shake it off a bit ๐คฃ
Yeah... so there is no "Event handler" way to do it then... therefore the loops on the workshop "workarounds"
well there is a way I use in Super AI but I ain't teaching it ๐
I will just wait for the super ai then ๐
It isn't released yet, right?
I guess I can teach the inferior way ๐
onEachFrame {
someAI setVelocity [0,0, -1]
}
AI won't be able to pass thru walls with that
but if you use it like that they will wobble on slopes
so you can try it like this too:
if (isTouchingGround someAI) then {someAI setVelocity [0,0, -1]};
nope