#arma3_scripting
1 messages Β· Page 102 of 1
isn't your params wrong?
i did have it create the object at the projectile's post
and just attach it to the dude but if he lays down then they float
shouldn't it be _this#0 params like DartRuffian said?
nope looks like it's correct
actually I meant the projectile one
oh you were looking at the other params lol
Oh gotcha
but that aside
why do you add the hitPart EH after the entity is hit tho?
you should add it before
π€
I mean you do _dumbass addEventHandler ["HitPart" in the projectile EH
well you don't even need that
just use the projectile one
but the prokectile one doesnt return part hit does it?
sorry, on the wiki component just has nothing next to it so i didnt know what it meant lol
it's most likely the selection in hitPoints LOD
as for how to attach something there, you can do something like this:
would it just be _component#0
pls tell me its
that simple
you've been typing for a while, dont do this to me leopard

I'm typing an example code that does what you needed 
as an example ofc

Marb_Brute_FNC_Spiker = {
_projectile addEventHandler ["HitPart", {
params [ "_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_component", "_radius", "_surfaceType"];
private _dumbass = _hitEntity;
private _bruteSpike = createVehicle ["P_Brute_Spike", getPosATL _pos, [], 0, "CAN_COLLIDE"];
_bruteSpike attachTo [_dumbass, [0, 0, 0], _component#0];
_bruteSpike setDir getDir _projectile;
deleteVehicle _Projectile;
}];
};
try without the #0
aight ill try it without here in a sec
in the meantime in the screenshot you can see i added a light source to the projectile, for some reason it wont delete on impact like i wanted it to ; w;
tried without and no sauce, gonna try it with
Marb_Brute_DamagedParts = [];
onEachFrame {
Marb_Brute_DamagedParts = Marb_Brute_DamagedParts - [0];
{
_x params ["_entity", "_obj", "_pos", "_selection", "_time"];
if (time > _time) then {Marb_Brute_DamagedParts set [_forEachIndex, 0]; continue};
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = matrixTranspose [_x, _y, _z];
_pos = flatten(_m matrixMultiply _pos) vectorAdd (_entity selectionPosition [_selection, 7e15]);
_obj setPosWorld (_entity modelToWorldVisualWorld _pos);
_obj setVectorDirAndUp ([_y, _z] apply {_entity vectorModelToWorldVisual _x});
} forEach Marb_Brute_DamagedParts;
};
Marb_Brute_FNC_Spiker = {
_projectile addEventHandler ["HitPart", {
params [ "_projectile", "_entity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius", "_surfaceType"];
{
if (_x == "") then {continue};
_selection = _x;
private _bruteSpike = createVehicle ["Sign_Sphere10cm_F", _pos];
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = [_x, _y, _z];
_relpos = _entity worldToModel ASLtoAGL _pos;
_relpos = _relpos vectorDiff (_entity selectionPosition [_selection, 7e15]) apply {[_x]};
_relpos = _m matrixMultiply _relpos;
Marb_Brute_DamagedParts pushBack [_entity, _bruteSpike, _relpos, _selection, time + 10];
} forEach _components;
}];
};
my god
didn't test it tho 
ill try it whats the worst that could happen

question
is there an if then i could do to check if there is a component available then if there is do the thing and if not dont do anything?
yeah testing it rn
ok fixed:
Marb_Brute_DamagedParts = [];
onEachFrame {
Marb_Brute_DamagedParts = Marb_Brute_DamagedParts - [0];
{
_x params ["_entity", "_obj", "_pos", "_selection", "_time"];
if (time > _time) then { deleteVehicle _obj; Marb_Brute_DamagedParts set [_forEachIndex, 0]; continue};
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = matrixTranspose [_x, _y, _z];
_pos = flatten(_m matrixMultiply _pos) vectorAdd (_entity selectionPosition [_selection, 7e15]);
_obj setPosWorld (_entity modelToWorldVisualWorld _pos);
_obj setVectorDirAndUp ([_y, _z] apply {_entity vectorModelToWorldVisual _x});
} forEach Marb_Brute_DamagedParts;
};
player addEventHandler ["FiredMan", {
_this#6 addEventHandler ["HitPart", {
params [ "_projectile", "_entity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius", "_surfaceType"];
{
_selection = _x;
if (_selection == "") then {continue;};
private _bruteSpike = createVehicle ["Sign_Sphere10cm_F", _pos];
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = [_x, _y, _z];
_relpos = _entity worldToModel ASLtoAGL _pos;
_relpos = _relpos vectorDiff (_entity selectionPosition [_selection, 7e15]) apply {[_x]};
_relpos = _m matrixMultiply _relpos;
Marb_Brute_DamagedParts pushBack [_entity, _bruteSpike, _relpos, _selection, time + 10];
} forEach _components;
}];
}]
well I modified a bit during the test
the attach to component#0 worked but
if i had an if (_Component returns nothing) exitWith {} else {Do the thing}
let me modify the original
this is what happens rn 
for some reason there seems to be a selection that's not found (hence why sometimes objects end up on the ground)
let me check. maybe it uses the FireGeometry lod
ah yep
anyway, fixed it
see this code
wait
this one or
this one?
yes that
oh god oh fug
this
I edited it
okay i see i see
more selectionvectordirandup i see 
more matrices too π

two of my favourite things
so this is getting the nearest available point and sticking the sphere on it?
it gets the exact position and bone (or should I say, selection) that was hit
i see
then moves the sphere every frame according to how that pos updates relative to the bone
i also see you didnt use "CAN_COLLIDE"?
is there a reason? ; w; is it not needed here?
looks fine on my end 
this.
also just noticed I forgot to edit something else
should work now 
also if you want to test this, I've also fixed this one too
lets goooo
okay so given the context
of whats going on here
so this function is called on init of the projectile via the config eventhandler
{init = "params ['_projectile'];_projectile call Marb_Brute_FNC_Spiker;";}
i probably should have mentioned that firs
ok
im testing again rq
okay so
if i type ```sqf
Marb_Brute_DamagedParts = [];
onEachFrame {
Marb_Brute_DamagedParts = Marb_Brute_DamagedParts - [0];
{
_x params ["_entity", "_obj", "_pos", "_selection", "_time"];
if (time > _time) then { deleteVehicle _obj; Marb_Brute_DamagedParts set [_forEachIndex, 0]; continue};
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = matrixTranspose [_x, _y, _z];
_pos = flatten(_m matrixMultiply _pos) vectorAdd (_entity selectionPosition [_selection, 7e15]);
_obj setPosWorld (_entity modelToWorldVisualWorld _pos);
_obj setVectorDirAndUp ([_y, _z] apply {_entity vectorModelToWorldVisual _x});
} forEach Marb_Brute_DamagedParts;
};
player addEventHandler ["FiredMan", {
_this#6 addEventHandler ["HitPart", {
params [ "_projectile", "_entity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius", "_surfaceType"];
{
_selection = _x;
if (_selection == "") then {continue;};
private _bruteSpike = createVehicle ["Sign_Sphere10cm_F", _pos];
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = [_x, _y, _z];
_relpos = _entity worldToModel ASLtoAGL _pos;
_relpos = _relpos vectorDiff (_entity selectionPosition [_selection, 7e15]) apply {[_x]};
_relpos = _m matrixMultiply _relpos;
Marb_Brute_DamagedParts pushBack [_entity, _bruteSpike, _relpos, _selection, time + 10];
} forEach _components;
}];
}]
into the debug menu
let me rewind
okay so i get this error
however
if i type whats mentioned above into the debug menu and execute locally
then it suddenly starts working and no longer pops that error up, but it spawns double the items, sometimes tripple lol
is it because
the way the fnc is being called, its excluding the top half of the code?
so i should just add this into the fnc?? ```sqf
Marb_Brute_DamagedParts = [];
onEachFrame {
Marb_Brute_DamagedParts = Marb_Brute_DamagedParts - [0];
{
_x params ["_entity", "_obj", "_pos", "_selection", "_time"];
if (time > _time) then { deleteVehicle _obj; Marb_Brute_DamagedParts set [_forEachIndex, 0]; continue};
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = matrixTranspose [_x, _y, _z];
_pos = flatten(_m matrixMultiply _pos) vectorAdd (_entity selectionPosition [_selection, 7e15]);
_obj setPosWorld (_entity modelToWorldVisualWorld _pos);
_obj setVectorDirAndUp ([_y, _z] apply {_entity vectorModelToWorldVisual _x});
} forEach Marb_Brute_DamagedParts;
};
to call it all at once since it seems its excluding information from the top? ; w;
Marb_Brute_FNC_Spiker = {
Marb_Brute_DamagedParts = [];
onEachFrame {
Marb_Brute_DamagedParts = Marb_Brute_DamagedParts - [0];
{
_x params ["_entity", "_obj", "_pos", "_selection", "_time"];
if (time > _time) then {
Marb_Brute_DamagedParts set [_forEachIndex, 0];
continue
};
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = matrixTranspose [_x, _y, _z];
_pos = flatten(_m matrixMultiply _pos) vectorAdd (_entity modelToWorldWorld [_selection, 7e15]);
_obj setPosWorld (_entity modelToWorldVisualWorld _pos);
_obj setVectorDirAndUp ([_y, _z] apply {
_entity vectorModelToWorldVisual _x
});
} forEach Marb_Brute_DamagedParts;
};
_projectile addEventHandler ["HitPart", {
params [ "_projectile", "_entity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius", "_surfaceType"];
{
if (_x == "") then {
continue
};
_selection = _x;
private _bruteSpike = createVehicle ["P_Brute_Spike", _pos];
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = [_x, _y, _z];
_relpos = _entity worldToModel ASLToAGL _pos;
_relpos = _relpos vectorDiff (_entity selectionPosition [_selection, 7e15]) apply {
[_x]
};
_relpos = _m matrixMultiply _relpos;
Marb_Brute_DamagedParts pushBack [_entity, _bruteSpike, _relpos, _selection, time + 10];
} forEach _components;
}];
};
like this?
yeah I think it's ok
this one is old tho
this one is wrong too
you're using the outdated code
imma kms
oh wait I hadn't fixed that one in the first code π€£

can you just
okay new post it lmao
since i cant see time of edit only (edit)
but also this appears to only work on people
this one is ok now I guess
let me just test once

well it won't work if object has no selections
it should work on building windows for example
but not on the walls
is there an if check on selections?
if there is then i can just do the code i had earlier to spawn an object on the bullet's last pos and direction
if (is kindOf armaMan) {do the thing} else {spawn on last post and dir};
kinda thing?
sorry "isKindOf CAmanBase" should work
_unitOrClass isKindOf "CAManBase"
yea thats the one
looks like alternative syntax for createVehicleCrew does not work.
https://community.bistudio.com/wiki/createVehicleCrew #syntax 3
It's 2.14
@rancid lance
https://sqfbin.com/evaqobileterozumideq
btw the script adds the object locally, so if you need to see it globally it still needs some modification.
but this is just for testing anyway
i have increased my presence in code::blocks
weird
hello, any of you guys know how to disable commander seat for bobcat?
it wont let me send the thing
lockTurret?
https://sqfbin.com/icasipufegasufeferiw
added my lil if then thing that makes it smack walls 
whats the params?
I guess:
obj lockTurret [[1], true]
if not try 0 too
what I posted works with walls already
the new one with the sqfbin link?
yes
i didnt try that one yet and wanted to try it on my own 
im trying to impress you father

it works but imma try yours now

it worked. thanks
does it still work if you open the door?!
just one more question
private _lightSource = "#lightpoint" createVehicleLocal [0, 0, 0];
_lightSource attachTo [_projectile, [0, 0, 1.5]];
_lightSource setLightColor [1, 0, 0];
_lightSource setLightAmbient [1, 0, 0];
_lightSource setLightBrightness 5;
_projectile addEventHandler ["HitPart", {
params [ "_projectile", "_entity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius", "_surfaceType",];
deleteVehicle _lightSource;
the light wont die ;-;
do i need to do a```sqf
[_lightsource] spawn {params ["_lightSource"]; deleteVehicle _lightSource};
i want it to get deleted when the bullet hits somethin but for some reason its resisting me
because it's not defined
would i put it in the params of the EH?
object EHs don't take params
oh i had to assign it to a variable first? >->
or you could just do: attachedObjects _projectile apply {deleteVehicle _x}
im so dumb i forgot attachedObjects existed bro kill me
tho neither of these are correct (I meant where the code runs...
)

you should use the deleted EH to remove the light source
sometimes a projectile may never hit anything
https://sqfbin.com/mivohugiyakahumofavi
I guess this is final now 
well I forgot to remove the getVariable line but...wutev
s'all good already wrote it, tho i put the deleted eh at the bottom 
also like I said since the beginning, this is just for testing
you shouldn't really use the onEachFrame command
preferably use the draw3D event handler
also if you want this to work in MP you need to make some adjustments
or "EachFrame" MEH. And get different parts of your ass bitten by physics/render scopes in both cases π
the reason is that projectiles have lifetime. if it expires they just get deleted/explode
yes
or EachFrame but I don't think it'll make much different for your case
also make sure you add something to prevent duplication...
basically something like this:
if (isNil "Marb_Brute_DamagedParts") then {
Marb_Brute_DamagedParts = [];
addMissionEventHandler ["Draw3D", {
Marb_Brute_DamagedParts = Marb_Brute_DamagedParts - [0];
{
_x params ["_entity", "_obj", "_pos", "_vup", "_selection", "_time"];
if (time > _time) then { deleteVehicle _obj; Marb_Brute_DamagedParts set [_forEachIndex, 0]; continue};
if (_selection == "") then {
_obj setPosWorld (_entity modelToWorldVisualWorld _pos);
_obj setVectorDirAndUp (_vup apply {_entity vectorModelToWorldVisual _x});
continue;
};
_entity selectionVectorDirAndUp [_selection, 7e15] params ["_y", "_z"];
_x = _y vectorCrossProduct _z;
_m = matrixTranspose [_x, _y, _z];
_pos = flatten(_m matrixMultiply _pos) vectorAdd (_entity selectionPosition [_selection, 7e15]);
_obj setPosWorld (_entity modelToWorldVisualWorld _pos);
_obj setVectorDirAndUp (_vup apply {_entity vectorModelToWorldVisual flatten(_m matrixMultiply _x)});
} forEach Marb_Brute_DamagedParts;
}];
};
my baby smooth brain cannot grasp the purpose of isNil
it means like is nothing right?
var doesn't exist
yeah. it means it has no data/is undefined
basically the whole purpose of that if block is to do that thing once
which also prevents duplicating the EH too (previously it just created the var once)
Hey im trying to scale objects such that it stays that way in multiplayer
Anyone know what to do?
oh hell yea i got it right then
use simple objects. if you have many, preferably use local ones
Alright, is there a way to turn something like a VR object into a simple object?
Isn't that not supposed to be used in multiplayer?
Says so on the wiki page for it
Okay so what do I do to change the objects scale for multiplayer then?
how many objects?
Quite a lot of them
Nope theyre just static
wait a second
are you using them for like a lil holographic thing and need to scale them down?
I guess you have them in 3den?
this is also a good question
Well theyre VR objects, blocks and slopes that are being used to create cover
they have lil vr bits for cover but, you can attach them to something and then scale them down and that will stick in mp
so long as you dont move them via zeus afterwards the size will remain
(and will ruin FPS)
wdym exactly?
This is what it is in 3den editor
do you want to scale the whole thing down/up?
No so see the little cover peices like the vertical slopes and blocks
Theyve been scaled down from their original size
but in multiplayer they revert back to their larger normal size
ah those. right
So any ideas?
hey leopard i never tested addforce + addtorque together for the capital ships stuff
guess whos going back down that buggy rabbit hole again later
{
_pos = getPosWorld _x;
_o = createSimpleObject [getModelInfo _x#1, _pos];
_o setVectorDirAndUp [vectorDir _x, vectorUp _x];
_o setObjectScale getObjectScale _x;
_o setPosWorld _pos;
deleteVehicle _x;
} forEach getMissionLayerEntities "myLayer"#0;
place those objects into a layer called myLayer, then try that code in initServer.sqf
I am very new to this so do you mind explaining how to put them in a layer and then how to put that code in initserver.sfq
nope
ok
then rclick on it and rename it
Leo, is this a script just to replace objects wwith simple objects?
then select the objects in 3den and drop them into the layer
umm yeah
I remember hearing somewhere that simple objects are not great for MP; is that true or nah?
Hi, I donΒ΄t want ot interrupt the flow. But how can I find the current ammo class name? So I can then get some its cfg properties?
so they're under the layer now? like this?
yup
well if you make them local only they're actually perfect π
but no they're not any worse than, say, houses for example
but rn we're just testing
So both simple objects and local only?
currentMagazine or something similar
then from mag class get the ammo
anyway, now go to Documents\Arma 3\missions (or mpmissions, depends where you saved it) and find the mission folder
yeah
yep
local only objects allowed me to create a completely custom map for mp with 90fps as a baseline on my server
then create a new txt file, and rename it to initServer.sqf. make sure file extensions are on in explorer
so that you won't make a .txt file by mistake
I know some objects have an option in attributes menu to make them local only, but how can I make them local only via script, modifying Leo's script above?
createSimpleObject has local param
the createSimpleObject command has a local arg
createSimpleObject [shapeName, positionWorld, local]
so just throw true] on the end
Ah. What I get for being lazy and not checking biki
bear in mind you dont want everything to be local only (things that players walk on etc)
they can be local too, if they're static, or you update all instances at once for everyone
tho you may be able to get away with it
just has some issues with setunitfreefallheight when i did it
Like this?
no
.sqf not sfq
sqf
Yeah yeah. Its mostly we're doing a campaign with lotta trench fighting. So Im just gonna make all the barricades and trenches local simple objects.
probably would work for them all
How do I make a txt file?
you already made one it seems
ok now open it with some text editor
like notepad (but not something like Word...)
or notepad++ if you have that
ok
And then put this?
yes
well first try in SP just in case
Alright
if it's ok in SP then just test in MP afterwards
also just to make sure you did things right, test this in the debug console: getMissionLayerEntities "myLayer"
How do I get to the debug console?
I just edited the script. copy paste it again
Is there any weapon changed or similar event handler?
I have looked through the BIKI and have not found any command for extracting the ammo type without usign getText (configfile >> ); command.
if running cba there is
I have an event handler FiredMan that shows _ammo type as a param. So I go and extract some data from the _ammo class. Then I use the number. As long as the ammo is the same, I dont have to go to the config file again. But I have to catch those weapon changes. so maybe check it every time FiredMan event occurs, but only when they are 5 or more secs away from each other or something like that. Maybe the animChanged is a better way.
push ammo type into hashmap with the data you extract
As long as the ammo is the same, I dont have to go to the config file again. But I have to catch those weapon changes.
you can also check those in the FiredMan EH
if that's the only place you need them
I hope that one if statement when people go full auto with their weapons is not that performace heavy. Like _ammoLast == _ammoCurent.
//in postinit
RC_ammoInfo = createHashmap;
//in eh
private _theammoinfo = if ((RC_ammoInfo getOrDefault [_ammoClass, []]) isEqualTo []) then {
//get the info out of config
RC_ammoInfo set [_ammoClass, _ammoInfo];
_ammoInfo
} else {
private _ammoInfo = RC_ammoInfo get _ammoClass;
_ammoInfo
};
I have not worked with hashmaps yet up to this point. π I don't even know what it is. π€£
think of them like an array where the index is replaced with a key you look up
It's basically a way of mapping a "key" to a value
It's called a dictionary in some other languages
private _hash = createHashmapFromArray [["yourmum",[123456]],[69,420],["wagwan","hi"]];
_hash get "yourmum" //returns [123456]```
that may be wrong im taking a shit so i cant tell
No it's right
amazing
Still haven't figured out a fix a for the issue I described here
Tl;dr - If player dies while remote controlling a unit, full control is not returned to the player when they respawn
Not my original script, was given permission to make edits to it
// Controlling Start
// Switch camera
if (cameraOn != (vehicle _unit)) then
{
(vehicle _unit) switchCamera cameraView;
_unit enableStamina false;
_unit forceWalk false;
};
// Give control of the unit to the player
objNull remoteControl driver _controller;
player remoteControl _unit;
// Controlling end (player dies, unit dies, etc.)
// Switch camera
if (cameraOn != (vehicle _controller)) then
{
// Reset camera view to player
(vehicle _controller) switchCamera cameraView;
};
objNull remoteControl driver _unit; // Reset control
player remoteControl _controller;
There's more to it, but these are the parts relevant to remote controlling
Is there any way how to diagnose the performance impact of my scripts apart from the debug console? Or any guides on which types of executions and commands do decrease the performance the most?
I have succesfully replaced all of my cycles by events. But some of those events are fired very often, namely, AnimStateChanged, FiredMan, KnowsAboutChanged (this one gets fired even if AI sees an empty dynamic object, like a lamp).
"Is there any way how to diagnose the performance impact of my scripts apart from the debug console?"
There's diag_codePerformance
"Or any guides on which types of executions and commands do decrease the performance?"
There's the Code Optimisation page
Can I put infinite load capacity on a bulletproof vest?
no, and you certainly cant with script
iirc doesnt work on vestcontainer with inventory
tried messing with it so i could do something with two primary weapons weights
Sets maximum load limit for a uniform/vest/backpack containers, vehicle cargo, supply boxes and weapon holders.
Sounds like it does?


Hadn't seen that emoji used before, love it
π€·ββοΈ
vestContainer player setMaxLoad 9e25;
vestContainer player addMagazineCargoGlobal [currentmagazine player, 9999];```
Average star sim loadout
breaks. Nothing can fit there.
https://community.bistudio.com/wiki/setUnitTrait's loadCoef as well, probably
"I am the Virtual Arsenal now"
Putting it in your backpack so people can easily grab stuff 
Putting it in your vest so people have to pay you with drugs 
get paid with tourniquet on the neck βοΈ
I wonder if there's actually a PR for that on ace
There is not
Time to make one, surely it will get included to the ace mod
its in KAM
advanced choking environment
i would do it in my medical expansion if i knew what was happening with ace airways pr
if its not merged by next update then more work for me woo
Is this statement better with the curly brackets or does it work only with &&? I need just one of the 3 variables to be true to exit.
if ( _isTargetSpotted or { _isGunshotHeard or { _isFootstepsHeard } } ) exitWith
{
//_isDetected = true;
};
without is faster
well if the first two are false
It works but if the conditions are plain bools then it's usually not worth it.
The code brackets have a cost.
theres no point doing lazy eval if youre not actually evaluating the condition and just pointing to it
curlies can only get faster when the actual calculation is happening inside them π€·ββοΈ
What about this? This one has some evaluation going on.```sqf
if ( (_distance <= _spotDistance) && (_visibilityHead > 0.65 or _visibilityBody > 0.55) && (_angle <= CFG_spotAngle) ) then
too simple usually. Depends on the condition probability though.
Like if you have one condition that would usually shortcut the rest of the condition then that might be worth some code brackets.
its a simple variable comparison, not much overhead at all
but something like
if (_var isNotEqualTo objNull || {allMissionObjects select _var}) then [...]```
you would want curly braces there as allmissionobjects is a slow command
slower than the braces
(probably)
Is there any better/more optimized way to do this? Basically to find those three letters in the animationState string? Also how good it is to define functions as a variable regarding performance (it is called only once though).
//Determines the unit's pace from the animation state string
getPace = {
params ["_anim"];
private _toArray = toArray _anim;
_toArray deleteRange [0,9];
_toArray resize 3;
private _toString = toString _toArray;
if (_toString in ["stp", "tac", "wlk", "run", "eva", "spr"]) exitWith
{
_toString;
};
"stp"; //Default return value
};
private _toString = _anim select [9, 3];
OK then. I did not know this works for strings too. π
If you're using it a lot then you should pre-declare the array.
kinda gross because there isn't any way of doing it except as a global, but it is quite a bit faster.
Hmm, I was thinking about it, but this code could be potentially used multiple times at the same time.
I mean the ["stp", "tac"...] array
Oh, I see now.
Also converting it to a hashmap makes the in a bit faster but I'm not sure it makes much difference for six elements.
This code gets executed basically every time a player starts or stops moving, changes stance, moves mouse and stops, etc (animstatechanged event). Every second once very easily.
actually const_hm getOrDefault [_toString, "stp"] is quite a bit better here.
can reduce your whole function to one line :P
Time to level up to hashmaps I see.
hashmaps are great
I just wish they had an A minus B command.
They make complete sense in SQF because the language is so slow that the hashing overhead is irrelevant :P
What do you think, is it better to pass an array of same arguments to multiple functions or to define those vars as an array in an object outside, and fetch them inside the functions with getVariable? Pass or getVar?
array defined once or multiple times?
Is this a rhethorical question? π
no
Every instance of the code, there will be a unique array that will be then passed to few functions. It will happen many times.
I mean are you doing this:
_args = [a, b, c];
_args call fnc1;
_args call fnc2;
or:
[a, b, c] call fnc1;
[a, b, c] call fnc2;
So it is basically what has the bigger overhead, passing vars repeatedly;or getVar and selecting repeatedly. And I am not sure what's better.
So can someonr help me . Im trying to make a faction with Alive orbat and i got it into a pbo and even loaded it through local mod and it shows up on downloaded mod but when i open eden editor the unit isnt there /
Hello, new to arma modding so any help would be greatly appreciated. β€οΈ
My intent is to make a mod that displays some buttons on the map when the player double clicks on it (will be displayed alongside the marker creation menu). I have managed to display the buttons I made using the GUI editor through the debug console (createDialog "ui") but am struggling to make them appear by double clicking the map.
I am currently trying to use this:
https://community.bistudio.com/wiki/onDoubleClick
But I am not finding much documentation.
Here is my current init.sqf code:
if(isDedicated) exitWith {};
if(!hasInterface) exitWith {};
["QuickMapMarker", "onDoubleClick", {
createDialog "ui";
}] call BIS_fnc_addStackedEventHandler;```
I am not even sure that my init.sqf is being execute to be honest, any tips on debugging? I placed a `systemchat` command at the top and it doesn't seem to get executed...
*I should specify this is an addon, not mission scripting.
Marked as "some old editor command"
Not listed in addStackedEventHandler anyway.
You'd probably need to add a UI event handler to the map display or control.
ah I see, I swapped with OnMapSingleClick (which also didn't work) in the hopes it would be that simple, but alas. I gather i'll need to figure out another way to detect a double click from the player.
OnMapSingleClick generally does work.
yeah, I assume I've got something else wrong somewhere
is systemchat a viable way of debugging if a sqf file is actually being executed from the config?
thank you for your help by the way
I have now fixed the issue! (missing preInit in the cfgFunctions) and decided to opt for an easier to code Alt+click for the time being. If I may ask another question. How would I go about getting GUI elements to display next to the cursor, and not in the center of the screen where I created them? I have found getMousePos (https://community.bistudio.com/wiki/getMousePosition) but am unsure how to then create the dialog using it as reference. Hope this makes sense, thanks again.
You should be able to just use ctrlSetPosition to set the control's position to getMousePosition
Thank you! will give it a go.
Assuming getMousePosition returns it in screen percentages
Also don't forget to ctrlCommit the changes once you make them
Can anyone tell me a script that will automatically kill an AI when they activite a trigger?
{
if (!isPlayer _x) then {_x setDamage 1};
} forEach thisList;
in trigger activation
i named the ai that i want killed "target" would i put that somewhere in the script?
the script kills any AI that enters the trigger
could i just make it so that it only kills the ai that i named "target"
what would be the script for that?
you can change the activation condition to this && { target inArea thisTrigger}
and the activation code to: target setDamage 1
Thank you
Also one more thing
Is there a script that could spawn an ai player when a trigger is activated?
and that would also spawn the trigger that comes with the ai player?
the trigger reveals the location of another ai player
im trying to spawn it on top of a building
im basically just trying to make it spawn a sniper ai player on a building when bluefor activates a trigger
well I still need more details. is this supposed to be dynamic? or do the enemies always spawn in specific locations?
well its just one enemy that is spawning
if it's the former, it's a bit complicated, if the latter, you can just create the trigger and the AI in 3den, and disable their simulation and hide the AI
and unhide/enable sim when the first trigger activates
so as soon as a humvee full of bluefor hits the trigger the sniper on top of a roof is supposed to spawn
like I said, just put the sniper in 3den and hide it and disable its sim
how do i hide it and make it appear?
which one?
the sniper ai
I mean hide or unhide?
just one guy
like how do i have it hidden and then when the trigger is activated it appears
you can hide it in object attributes in 3den
as for how to unhide:
sniper hideObject false;
and for enabling sim:
sniper enableSimulation true;
would i just put the enable sim command right under the top one?
for the object attributes, do i just right click the ai sniper and then click on attributes?
and just to make sure i put those commands in the on activation box in the trigger right?
yes
ah thank you it worked
but the trigger that comes with the ai sniper will still work right when the ai appears?
and the waypoint too for the ai sniper?
Anyone know why the mission.sqm object position info angles[] is different than vectorUp when used in game?
mission.sqm - angles[]={0,0,0.017453292};
In-Game(vectorUp) toFixed 9; - [-0.017452406,0.000000000,0.999847710]
Those look like basically the same numbers though, just in a different order and with a little precision error
Like that (-)0.01745... is probably not a coincidence
that's because at very small angles: sin x ~= x - x^3 / 6 +... and cos _x ~= 1 - x^2 / 2 (iirc)
from its taylor expansion
Let's pretend I understood that and move on
in this case it is a coincidence (the angle happens to appear in the vector, because it was small)
It may also be something like Euler Angles
The Euler angles are three angles introduced by Leonhard Euler to describe the orientation of a rigid body with respect to a fixed coordinate system.They can also represent the orientation of a mobile frame of reference in physics or the orientation of a general basis in 3-dimensional linear algebra.
Classic Euler angles usually take the inclina...
here's some stuff from back when I was messing with it
they are Euler angles yes
Thank you very much for that, saved me a bunch of time lol
@dusk gust
if you're trying to convert the mission.sqm angles to vector dir and up use this matrix
vectorDir is the 2nd column, and vectorUp is the 3rd column
what you read from mission.sqm will be the [a, c, b] angles (in radians tho, you need to convert them to degrees)
Hi I've got this script running on a bunch of containers to add money stacks to them
this addItemCargo ["Money_stack", 3];
Problem is I'm wanting to run this mission on a server and this doesn't work when running on a server.
I could remote execute a script and uniquely name almost 100 containers with money in them (it's for a gamemode), but I wanted to know if there is some way to modify this so this works on a server while still running within an objects init.
addItemCargoGlobal
but within an objects init that would be wrong
you should only run it once when using the global variant
how can I detect if the player is within radius of a light source? I'm trying to implement different apertures for the "lighting" conditions as setApertureNew behaves wild sometimes and brute setAperture may help, but i need some kind of a 0-1 value if player is being lighten up or not
I remember there's such value for AI to detect enemy in bright light conditions better but I can't find it on wiki
there is a lighting info command, but its not a simple 0-1
getLighting does not work for artificial light sources right?
Couldn't solve this issue, i can't figure out where and how to execute it so that the deletion of the objects and creation of new objects are the same for everyone
can userActions be auto executed upon the condition being met (think of it as trying to emulate events)?
Are you doing this ENTIRELY on the client?
seed your random
that way you always get the same randomization happening for everyone
or randomize on the server and send that as a parameter to your function
Yea, you're getting different randoms. Random is different each time it's called and for each person who calls it.
I'd go with server randomization, but idk if these are local only objects or what
...remoteExec? Or am I missing something
It's being called on every client
if such is the case seeding it should be enough, randomize the possible seed in the server and send the whole function with the random seed, guarantees randomization on the broader level while making the "internal randomization" be synced
RemoteExec would be sending from 1 client, to every other client, but for every client.
I mean, generate the random stuff on server to have single source of truth and either publicVariable the results to clients and do the processing on them or just remoteExec the whole thing with the values as a parameter (e.g. in an array)
oh yea, that could be done. But again, might be weird if the objects are local only. (idk why they would be but π€·ββοΈ xD)
if the deletion and creation of everything is global then performance for this type of scripts is actually worse especially with bigger samples since besides the operations there is a huge bandwidth cost for sync. If you create local versions for everyone including the server with the equal conditions, its actually faster since you avoid sending large data packs over the network and you skip the syncing required both for player and ai interaction if it already exist in all the environments
for example, doing that type of scripts with +1mil objects syncing with everyone takes >1 min on my machine, while doing it locally for everyone takes < 15sec
you never know when you require barren maps :x
I haven't checked RNG in A3 for a good while, so I guess it's possible to send just the seed to clients for consistent results then?
yes, that is a very good way to do so
Ah, well then it's a no-brainer almost
This is applied to an object in the Eden editor, will the subtitles appear for everyone or just the client that executes the action? Just verifying, my guess is clientside.
The seed functionality in SQF is bad though.
best you can do is use the _seed random [x,y] form and increment one of the values, but then you only get 0-1 results.
i have a weighted seed random function that barely works
its really not a very helpful command
On the other hand, the random N form is bugged anyway so just multiplying the result isn't much worse.
that's not fixed in 2.14, right
I'm not sure how that's useful. Normally you want more than one random value from one seed.
i dont
random N bug: https://feedback.bistudio.com/T168113
i use it for determining blood type based off steam uid
It's a pain in the arse because you have to do stuff like this:
_randomIndex = (floor random count _array) min (count _array - 1);
Yeah you +1 the seed and run it again
Or rather, you do the same as what the engine does
func RandomValue()
_seed = NextRandom(_seed);
return _seed
but we don't have NextRandom
Just a normal PRNG
Not like any PRNG I used :P
But I don't understand why wiki says it needs to be integer
Sorry not PRNG but LCG.
https://en.wikipedia.org/wiki/Linear_congruential_generator
Which I thought the wiki mentioned but doesn't
Ah I see why integer..
Dang we should fix that
(Syntax 3?)
Right, I think the worst LCG I used before had 64 bit state and you only used 32 as output.
yes, and I see why
internally seed is stored as integer.
The output result you get is
seed*(1/ ((1U<<31)-1))
which turns the integer, into a float
right
but it doesn't support to do the conversion back.. I don't see why, would be pretty simple to do.
But it wasn't implemented and I guess whoever added that script command didn't want to spend 10 minutes on implementing it properly
For random N it's just multiplying that by N, right?
yeah
hence the bug. Can round up to N with the precision loss.
So its just a wiki bug then
Well, ideally it wouldn't return N because that's extremely annoying to deal with.
I wonder if we can still fix seed random N without BWC break π€
Probably not
wait, did random N get silently fixed in 2.12
Can find no reference to FT ticket, so shouldn't
is the angular velocity thingy likely to be changed at all if i ticket it dedmens
i would imagine it wouldnt be changed for bwc
iirc i had the issue quite consistently in my radiation mod
but i resolved it somehow and idk how
...then rewrote the radiation calculations like 2 days after releasing the mod and didnt have the problem
Shouldn't be hard to add
shall i ticket it or is leopard angular velocity commands ticket enough
I haven't seen dunno
SQL _wp0 = group chopper addWaypoint [ getPosATL player, 50]; getting an error type string expected object. Anyone have an Idea why. Was working fine yesterday
Make sure chopper is definitely a living unit (e.g. the helo pilot), and not anything else (e.g. the helo vehicle)
Also, A3 scripting is SQF, not SQL :P
DELETE FROM 3den WHERE chopperDead
SQF yes.. Typo
group _vehicle does work as long as it does currently have a group.
That sounds perfect, but you need to find a way to remind me at a point when I have time to process it. Would be nice if I had a assistant that I could ping now
adding to the list of bot commands to do π
!remindDedmen 7d do stuff
Congratulations, you were promoted into Assistant!
I wanted to build that. But I didn't want to have to mess with database and making sure it doesn't forget things
Nu
How would I make the radius of a light source smaller? Like the actual circle
less power
Which function would you use for that?
what do you use to create it?
_light = "#lightpoint" createVehicleLocal (getPosAtl vehicle player);
_light setLightBrightness 0.5;
_light setLightAmbient [0.75,0.53,0.18];
_light setLightColor [0.75,0.53,0.18];
_light setLightFlareSize 1;
Yeah, I tried using brightness it didn't work well
Can't get either of those to work
I'm basically just trying to create a small, chemlight size light
that's for reflectors, not points
all I have regarding lights is that tuto https://community.bistudio.com/wiki/Light_Source_Tutorial
_light setLightAttenuation [0.01,4, 4, 0, 0.5, 1.5]; then 
setLightAttenuation is definitely what you want for that
How can I make it so that no matter the ai will only stand up?
_unit setUnitPos "UP";
You might need to make a loop to do it regularly, because sometimes (especially with AI mods) they can decide to change stance again later
thanks
Hey I'm definitely doing something wrong. This doesn't work. Throws up an error saying I'm missing a ;
do {
this setPylonLoadout {'STA3', 'FIR_GEPOD30_P_330rnd_M',true};
this setPylonLoadout {'STA5', 'FIR_GEPOD30_P_330rnd_M',true};
}
}
];```
Maybe someone here can help. For context I want my guns pods to not be limited to 330 rounds of ammo, but I've found other methods of infinite ammo scripts (such as setting ammo to 1) are extremely jank and are not working right for one of various reasons. Repeating the setPylonLoadout script is the only way I know of to do it reliably.
The problem is I can't get the addaction to work right.
do doesn't belong there π€·ββοΈ
just remove it and the second pair of curly brackets {}
Oh I see the problem
gatling_plane setPylonLoadout {'STA3','FIR_GEPOD30_P_330rnd_M',true};
gatling_plane setPylonLoadout {'STA5','FIR_GEPOD30_P_330rnd_M',true}
}
];```
That got rid of the error.
Now to see if it works.
Okay so progress, but new error. Expecting array?
Change {} from the "setPylongLoadout to []
{} shows its code, [] is for an array
oooh
That did the trick, thanks!
So I use a modified ITN in my unit. And something we ran into is that IR lasers do not draw like beams, they draw like a normal laser does. Would an equation in the code for adjusting Draw thickness based on humidity from ACE Weather be causing the beams to not draw, when ACE Weather is disabled?
today i learnt that coding sqf with comic sans makes the most sense because of how wack the language is with random issues
playing the game with comic sans font is also canon because it's wack too
what would be the fastest way of making an array of CfgFaces? There are some mods that mess with the face randomization on units and when you open their attributes the face field is empty - so when you save the custom attributes the unit will always have some single default face instead of what was randomized. I wanted to make my own function to work around this issue but I don't feel like writing them down into array manually
Do you mean you want a custom identityType or whatever its called?
I need an array of faces I can apply through setFace. I'm using modded identities so their amount is significantly bigger than vanilla so generating it somehow from the cfg would be better than writing them down
yes, the Man_A3 subclasses specifically
Oh wait. This actually doesn't show where it gets the values from.
and I thought I just don't understand what's written here 
Hey. I have just woken up and only had half a cup of coffee π
Stop having a coffee, develop.
oh and another thing, can I enable multiplayer chat in a singleplayer mission? Need the possibility to type in it for certain purposes
I could just make a multiplayer mission for a single player but I know people appreciate pause when in Esc menu
Are you developing a DOS game?
Jokes aside I don't think there is a way to do it past and present. You may need to have a GUI

configproperties [configfile >> 'cfgfaces' >> 'Man_A3','isclass _x'];
I'd put apply configName there and joinString endl so one line one classname
if (_displayName == '' || getnumber (_x >> 'disabled') == 1) then {continue};
This is the additional condition to filter out the crap
Im kinda of super stupid, but i cant hide or delete modules
Like show/hide object modifiers arent working nor deleteVehicle
WIthout knowing what exactly you've done, nothing can be told
Literally like, a module in edan is called x
a trigger with deleteVehicle x;
or like just 2 show/hide modules, one showing initally and a trigger to hide it
can be any module, say like fire module idk
Deleting a module does not necessary mean that it will stop its work
Really depends on your intention/work/module/want
ok so, theres a waypoint module for some zombies in a mod right
if theres 2 waypoints, they go to one and not the other, so when they get to one, delete that one and go to the other
thats my intention
Like otherwise i can do marker positions and set orders to the whole side sure, but the module is supposed to do that for me
Uh, I don't see any reason to delete a module here? Is it because I don't know what βWaypoint moduleβ you mean?
cant use waypoints because dudes will be spawning in continuously
Cant send pics but its literally a waypoint
thats it
It is not a module
No
And you can after you verify and accept the rules
Thanks
You said it is literally a waypoint but it is not, okay...
I said a waypoint module
And I had no idea what it was
A module that acts like a continous waypoint\
Like thats it
The waypoint is there because if new zombies spawn in
then they'll have directions on where to go
Otherwise i wouldve just done move orders and be done with it
when theres more than one, they clash
So i want there to be one at a time by deleting them when they reach a waypoint
Okay so let me clarify
- Zombies spawn via a module
- And the Zombie Waypoint sets the waypoint automatically
- But you want to multiple of it, so those zombies will run two ways
- And the module itself is not designed to have multiple of it
Then you should just have a script upon the spawn of zombies, if you can have a βinitβ for the zombie or something
each trigger will delete the module that its on idk why hiding doesnt work, it used to for modules
I said you shouldn't rely on the Zombie Waypoint module
...As far as I heard. I'm not a user of that Mod
I don't know what was funny, but everything has limitation
Yea so im asking, can you delete or hide a module
can you have it not function until triggered
It really depends on the module
This wont work for like even a smoke grenade module
Ok so why does hiding a module work, and not showing it
Show hide works on objects as they should
They hide modules
but not show
Which module you talk about? And as I said, every module has its way to how it works
Dont worry about it
?
Anyone got any bright ideas on how to check if a unit is wearing a plate carrier? i.e they have protection over their chest
Would ideally like to avoid using armour values but will take what I can get atp
vest + armour value or uniform + armour value
isnt there not a simple way of getting armour value
iirc its super convoluted
although i do suppose looking straight at vest >> "ItemInfo" >> "HitpointsProtectionInfo" >> "Chest" >> "armor" would determine if the unit has protection over their chest π
don't forget uniform (e.g CSAT) also does that
yeah but could give cpr onto that uniform
(its to block units from doing cpr straight onto a plate carrier)
you can only guess
or spawn a vest, trace to see if there is something near the heart, then despawn π¬
running that for a condition probably isn't the best π
though when have I ever made the best π
you could have a loading at first that would collect all this info in the first seconds of the mission
possibly though imo just easier to have chest armor read off of
as doing a trace would only detect there being something
so, a hi vis vest
@grizzled cliff I like what you're doing with carma2
Inb4 helmet with pelvis protection 
ive got sidetracked and am now writing code to read the biki
I'm trying to whitelsit all Air vehicles to pilots within the d_pilot global variable in a modified version of xeno's domination
fn_setupplayer.sqf
d_vec_role_pl = [];
player addEventhandler ["getInMan", {call d_fnc_getinmaneh}];
player addEventhandler ["getOutMan", {call d_fnc_getoutmaneh}];
player addEventhandler ["SeatSwitchedMan", {call d_fnc_seatswitchedmanvs}];
Getinmaneh.sqf
d_player_in_base = false;
d_vec_role_pl = assignedVehicleRole player;
if (d_player_canu) then {
d_player_in_vec = true;
if (d_isvdreduced) then {
d_isvdreduced = false;
};
if (d_vec_role_pl isNotEqualTo [] && {d_vec_role_pl # 0 != "cargo"}) then {
private _vp = _this # 2;
if (_vp isKindOf "Car" || {_vp isKindOf "Tank" || {_vp isKindOf "Motorcycle" || {_vp isKindOf "Ship"}}}) then {
if (d_ViewDistanceVec != viewDistance) then {
setViewDistance d_ViewDistanceVec;
setObjectViewDistance d_ViewDistanceVec + 100;
};
} else {
if (_vp isKindOf "Helicopter" || {_vp isKindOf "Plane"}) then {
if (d_ViewDistanceAir != viewDistance) then {
setViewDistance d_ViewDistanceAir;
setObjectViewDistance d_ViewDistanceAir + 100;
};
};
};
};
call d_fnc_vehicleScripts;
} else {
d_player_in_vec = false;
};
Vehiclescripts.sqf
private _enterer = param [0];
private _position = param [1];
private _vec = _this # 2;
private _turret = param[3];
private _vecnum = _vec getvariable ["d_vec",0];
if (((_position == "driver") || {(_turret select 0 == 0) && {_position == "gunner"}}) && {!([str _enterer,_vec,_vecnum] call d_fnc_isPilotCheck)}) exitWith {
//player action ["getOut", _vec];
moveout player;
_vec spawn {
sleep 0.1;
if (local _this) then {
_this engineOn false;
} else {
[_this, false] remoteExecCall ["engineOn",_this,false];
};
};
};
Checkispilot.sqf
private _enterer = param [0];
private _vec = param [1];
private _vecnum = param [2];
if ((_vec isKindOf "Air") && {!(_enterer in d_pilot)}) exitWith {hint "You need to be a pilot to fly this aircraft";false};```
However i'm getting this error:
13:31:56 "_vec: 1, _vecnum: <null>"
13:31:56 Error in expression < this chopper!";
false
};
if ((_vec isKindOf "Air") && {!(_enterer in d_pilo>
13:31:56 Error position: <isKindOf "Air") && {!(_enterer in d_pilo>
13:31:56 Error iskindof: Type Number, expected String,Object
13:31:56 File C:\Users\ezhpo\Documents\Arma 3 - Other Profiles\Wombat\missions\Legandary_Domination.Altis\client\fn_ispilotcheck.sqf..., line 35
Here's the eventhandler debug
"Event handler data: [""d_legend_8"",d_chopper_2,3002]"
It's a string in the array but does have extra quotes. Any ideas?
private _enterer = param [0];
private _vec = param [1];
private _vecnum = param [2];
``` Do you know that this is equal to (and slower than) ```sqf
params ["_enterer", "_vec", "_vecnum"];
Error iskindof: Type Number, expected String,Object
That error is pretty clear. If you had type checking in your params you would've seen that you call it with wrong arguments
Sorry, fairly new. Will correct that thank you o7
call d_fnc_vehicleScripts; you aren't passing any parameters.
Yes that works but oof you really shouldn't be doing that.
You are passing these args https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetInMan
It would be helpful to name them the same and add a comment so people know that you're doing that.
You can add diag_log _this; to log the arguments you get in your functions, to be able to follow it through and see where it goes wrong
"Here's the eventhandler debug"
Where is that from, where is that logged in your scripts?
I'd assume at the top of Getinmaneh.sqf
please use https://sqfbin.com/ next time π
Oh lordy, i'm sorry for the text wall
no worries
t h i s t i m e
π
ah- I can't remove variables from objects, can I?
It will be the last i pinky promise!
set to nil
I used diag_log format ["Event handler data: %1", _this]; within the checkispilot.sqf at the start
To remove a variable, set it to nil (see Example 5) - note that this does not work on Object and scripted Location namespaces (the variable will be set to nil but will remain listed by allVariables).
Okey then add it to your other functions too, and check where it starts to go wrong
ah for allvariables stuff
Willdo boss !
wait, if I don't change the value on an object, it doesn't save the eden attribute right?
So- how would I remove the attribute from an object- xD
set it to default?
Default is false. And that still makes it have the value in the mission file.
then you're screwed
darn it-
I have 409 objects that I unknowningly was copy+pasting.
6 of those objects are true.
Hmm-
I wonder-
Question is it possible to script a missile to shoot up 200m before going to target ?
Does anyone know if this is still working? Could any recent updates cause this not to work. I would like to make a You tube video on how easy this is but it doesnt seem to want to work now. https://forums.bohemia.net/forums/topic/172795-release-t8-units-a-less-dynamic-ai-creator/
Hey all, I wanted to share my script, I use to spawn units in coop missions, with you. I first started developing this somewhere during the A3 beta. Playing around with BIN_taskPatrol by Binesi, BangaBobs EOS and similar things somehow caught my interrest in scripting and I started to create a sc...
Is there a fix or workaround?
if by shoot up you mean explode before reaching target then yes
see distance and triggerAmmo
clear3DENAttribute
Horray!!
weeeeee
although, interestingly, running it seems to always give a false? Unless I'm missing something
ah ha! I mean, it's not really much of an improvment, but I went from 8,020 Kb mission file to a 7,897 Kb! :D
I was thinking I'd need to go through each object, make a new object, and copy all attributes except the one I wanted to remove. xD
Maybe could still use the code I had started making for it. But instead, see if I could remove any default values?
Hi guys quick question how i can get _instegator of a unit who destroyed a object ?
so i am using Killed EH. But for the name i have Error unit not found when i destroy object with C4. How i can get player name ?
_radio addEventHandler ['Killed',{
params ['_killed','_killer','_instigator',''];
[[blufor, "BLU"],format ["Player (%1) has destroyed Radio Tower!",name _instigator]] remoteExec ["sideChat"];
}];```
Works here. Are you using ACE or something?
Na vanilla
yes
hello guys, could any of you help me, I have the following problem when I configure the pylons in the editor, and when I go to the server, the configuration disappears and remains with the one that comes by default, I need a script that helps me force the configuration I want to leave the helicopter. Thank you very much if you can help me. Good day to all.
I have a question: When using getObjectID, the game returns a string. But this string is made of a number. Will this number always be of the size of an int or can it be of the size of a long ?
How do I have my dialogs and text stay consistent in size across aspect ratios?
What do you think "int" and "long" mean here?
Normally neither is relevant in SQF and it's the maximum int representation in a single-precision float that matters.
I'd hazard a guess it can be at least as long as the maximum number of objects that can be placed in the terrain editor. Not sure how many that is though.
Altis appears to have about 1.7 million.
its a unsigned long long (8 bytes), but sqf internally doesn't support 8 byte primitive types. It only supports the floats. Hence why that command returns a string
Thank you very much π
Anyone point me to a place which explains how I can use a number that is passed through a script to dictate the memory point with an attachto command.
For more explanation, I want to lets say be able to pass the number 1,2,3 etc through a script (As a parameter of the call command) then use the passed parameter to assign which memory point the item is attached to (All memory points are essentially Point_1, Point_2 etc and I want to be able to have the number of the mempoint in the attachto command be dictated by the parameter passed when executing the script.
Also as a secondary note I would like that number passed to also set a variable as true, for example I have Variable_1 = False and then if 1 is passed, it'll set the memory point to Point_1 and set Variable_1 to True and so on
// receive passed number
params ["_memPointNumber"];
// generate the mempoint name by inserting the number into the template name
private _memPointName = format ["Point_%1",_memPointNumber];
// generate the variable name by inserting the number into the template name
private _varName = format ["NB_Variable_%1",_memPointNumber];
// set the variable and attach the thing
missionNamespace setVariable [_varName,true,true];
object1 attachTo [object2, [0,0,0], _memPointName, true];```
Perfect
just don't forget to fix _memPoint vs _memPointName
Alright so basically Im using this script "sniper reveal target"
And so I watched this video and did everything right but whenever i activate the trigger for the sniper to reveal the target the sniper just gets out his range finder and never shoots at the target
What should I do?
Duck
question, CUP vehicles when set to simple objects in editor or with BIS_fnc_replaceWithSimpleObject behave as on the screenshot below - the default insignium is displayed and lights enabled (but they do not produce actual light, just the beam + bright lightbulb texture). I doubt I will ever see this fixed or at least in next 5 years so I wonder if there is any script-wise solution to make them behave as normal vehicles do when set to simple object?
You can place them via editor in your mission.sqm and then lock them via the attributes so players can't use them.
it's more about saving performance than keeping player away π
inb4 https://community.bistudio.com/wiki/Arma_3:_Simple_Objects#BIS_fnc_simpleObjectData and the matching creating function 
I tried adjustSimpleObject on them but nothing happend, at first I thought I just do it wrong but now I think that it does not work because the models or their config is borked. Will try creating the simple object instead but I'm fairly certain it might not work at all either
adjustSimpleObject with the data collected with simpleObjectData?
I loaded Polpox's mod to get the animation names and values, then started the mission without it and applied them manually
Q: I see commands that add inventory, items and such, to vehicle cargo, but there are no remove commands? or do I need to clear and build it back up again in the revised counts?
also, are any of the BIS_fnc_invXYZ functions helpful in this behavior? BIS_fnc_invRemove, for instance?
thanks...
There are no commands to remove items from containers/vehicles sadly.
You have to read the inventory, remove the stuff you want and then re-write the inventory
yeah, simpleObjectData only seems to extract data from the config (which is obviously borked), not from the real vehicle 
so nothing to do but wait till they fix it?
I wish I knew at least what causes that behavior in the config, but honestly no idea. It's not the only mod doing that, I noticed similar behavior with SOG when applying simple object function in editor would not to anything in preview mode and then loading back to editor would cause the vehicles to go back to the simulated state
There are some vehicles that don't have this issues, don't remember which ones.
so along the lines, clear and add ...
it's the entirety of class SimpleObject in the vehicle config not being populated correctly (or at all), i'm afraid
yes, sadly 
fair enough, thanks...
some style of collecting all animation/texture states from the real vehicle in editor, storing that data in the mission/script and reapplying onto the freshly created borked simple object can be jury-rigged, i assume
like, literally collect with sqf MUH_state = [ animationNames cursorObject apply { [ _x, cursorObject animationPhase _x ] }, getObjectTextures cursorObject ] and set with sqf {cursorObject animate (_x + [true])} forEach MUH_state#0; {cursorObject setObjectTextureGlobal [_forEachIndex, _x]} forEach MUH_state#1; π€·ββοΈ
Can some one help me . Im trying to make a faction using Alive orbat and i put it into a pbo and even download it as a local mod but when i open up the game the faction dosnt show up (please mention me if you can help)
can someone clarify, as far as I could determine, weaponsItemsCargo loaded magazines also appear to be included among getMagazineCargo. maybe there are "reasons" for this, mass or otherwise, I don't know. can anyone clarify? possibly for the same reasons that a weapon, launcher or other, 'loads' when removing it from inventory back into unit possession. in any event, it makes it a bit tricky, or maybe I just take this into account, when connecting the dots during an inventory management UI. thanks...
It's your friendly noob again:
https://sqfbin.com/esejogoviveganozazok
Looking for help on why moveout player is not occurring after fn_ispilotcheck.sqf checks the player is not in an global array
ufff, no syntax highlight because #
and, huh, could you perhaps reduce the code to the strict minimum for people to debug plz? (next time)
https://community.bistudio.com/wiki/moveOut aG eG
moveOut @ line 97
well, no idea where you script runs, player might be null, or something else is wrong
Trying to figure out what COIN stands for...capture of incognito neanderthals :/
coop invasion?
What is the simplest and fastest way to find if var _weapon contains one of these substrings ["arifle", "hgun", "launch", "srifle"]? I would like to avoid for or foreach cycles to do this. But I have not find a way how to do it with commands like in, findIf and find.
[...] findIf {_x in toLower _weapon} > -1 
Will scripting in Arma 4 be the same as in Reforger? Does Reforger use Enforce script? How does mission making in Reforger work?
You are probably better asking here #enfusion_scripting #enfusion_scenario.
or a coin flipping simulator
How long is the distance is the command βsniper reveal targetβ good for?
Like how many meters?
That stuff is just hidden selections (likely 'light_l', 'light_r', and 'clan' ). BIS_fnc_simpleObjectData and BIS_fnc_adjustSimpleObject combined or creating with BIS_fnc_createSimpleObject would probably take care of it. But they are provided in the return for BIS_fnc_simpleObjectData nonetheless if you are curious.
Alternative approach is to just hide the selections yourself:
['light_l','light_r','clan'] apply {
mySimpleCupTruck hideSelection [_x,true];
};
I cut down the paste to hopefully make it easier to see what's happening, the bebug log results at each step i commented in also
https://sqfbin.com/etacomuninogagesejig
The unit groups are initiated in init\fn_preinit.sqf
Maybe i should move that elsewhere?
Someone told me that BIS implemented a new command to decrease the knowledge level of AI (reveal only increases it) - is this true?
@thin pine just to be sure - you dont mean https://community.bistudio.com/wiki/disableRemoteSensors , do you?
What happens if you try this: ```sqf
if (((_position == "driver") || {(_turret select 0 == 0) && {_position == "gunner"}}) && !([str _enterer,_vec,_vecnum] call d_fnc_isPilotCheck)) exitWith {
Nah I'm literally talking about an inversed version of 'Reveal' - I couldn't believe it when he told me it....i went looking for it on dev branch changelogs, couldn't find it....he said he may've read it on a twitter message -_-
It seems too good to be true :p
The move out player now works! Getting errors on the datatype being a number instead of a string/object
Within the ispilotcheck.sqf
It's being fed these params:
"_enterer: d_rifleman_1, _vec: d_chopper_2, _vecnum: 3002"
11:30:57 Error position: <isKindOf "Air") && {!(_enterer in d_pilo>
11:30:57 Error iskindof: Type Number, expected String,Object```
Where would I ask questions about extensions.
Main question being, what are the possibilities
Add debug logging to _vec in fnc_vehiclescripts.sqf, it is a number probably then. You probably refer to a wrong variable here (private _vec = this # 2;) π
#arma3_tools, but to ask your question directly, you can do pretty much anything (that you can figure out with a string output from the game and string input back to the game)
Ohh ok, so it is basically just... uh... well it doesnt expose new things for the game, but things outside the game can be useable
Mh Maybe add more diag log's in the isPilotCheck.
Clearly it is not a number at the start, but then becomes a number later on.
Add logs between every section, theny ou should see it suddenly switch at some point. And then you know where the problem is at
If your logging is correct, we know the error is between L89 and L131 (of your sqfbin)
Narrow it down further
You can feed stuff to the game via the string input from anywhere (like an external web API), so you can actually create "new" cool things if you're creative enough π
Isn't _vec a number from the start there (most likely)? If you look at the variable usage, it doesn't get assigned a new value anywhere (if I read it correctly with my sleep deprived brain)
It comes from a eventhandler which passes a object.
And the diag log also prints non number
Indeed, missed that debug log
@thin pine cant you just set knowsAbout to 0 ?
_foo reveal [_bar, 0]; ?
i might misinterpret https://community.bistudio.com/wiki/reveal , but it seems to me that "0" means⦠no knowledge.
reveal description: "The knowledge level can only be increased, not decreased by this command. "
Just back at my pc, will do more debugging and let you guys know. Thanks for your eyes and time, much appriciated 
Have placed a diag log before the ifkindof to see what params it gets, but it's still an object in the debug output.
13:48:16 "_enterer: d_rifleman_1, _vec: d_chopper_2, _vecnum: 3002"
A proper mystery
sus
Maybe its called twice? once with working correct, and a second time with fail?
But you should notice the second diag log then
anyone know how to get if a player is being suppressed? cant see any commands and hoping i dont have to look for some jank workaround like counting if bullets go nearby
firedNear eh
thanks
Is someone able to enlighten me on whether the 2nd part of this also applies to public variables? https://community.bistudio.com/wiki/Array#Array_properties
As in using X set [Y, "something"] on a variable reflects to all as long as the setVariable has been trued (is public)?
setvariable[.........,true] does not make the variable public for its lifespan, it only updates its value over the network on that one instance
So it's modified by reference, but the change isn't reflected over the network?
So now I have an array that differs?
If you change the array after the global setVariable, yes.
That's confusing and annoying, but thanks
Same with publicVariable. The value at that point is published. Future changes to the variable will not be.
are hashmaps the same case john or are those global regardless
i.e do you need to setvariable a hashmap again to make it network update
Same.
It's a rare reason not to use hashmaps in some cases, because they can't be selectively updated. You push the whole thing or nothing.
Wait that's confused me
if i getvariable of hashmap and make changes without setvariable again, are those changes network broadcast?
you mean get?
im so confused
whatever, there's no automatic broadcast.
π§ or you remoteExec the code to make the similar update on all clients
i global event the change to the hashmap (its an array which also has a hashmap) and put that in the big hashmap locally
Hi! I'm looking for a way to avoid divers to spawn bubbles when using a rebreather system
Just started using the debug console performance tester and had a quick question. Is the time displayed the average time out of the cycles that ran?
How long is the distance is the command βsniper reveal targetβ good for?
How many meters can an ai reveal a target?
Uh, there's no range limit.
reveal just hard-sets the target knowledge.
Whether they'll shoot at them is another matter.
Hello, is there some function for adding a ModuleStrategicMapMission_F during play? I'm trying to set up a "rallypoint" type system where people can teleport from the base to a placed down respawn tent.
It might work if you do it the same way people create zeus modules live.
Ideally this would be done purely in the mission, i.e. no additional mods.
For a zeus it's just:
private _group = createGroup sideLogic;
private _zeus = _group createUnit ["ModuleCurator_F", [0,0,0], [], 0, "NONE"];
plus some setVariables if you want non-default params
Alright, appreciated, thank you.
allVariables on an editor-spawned one might be helpful there.
Say, if I wanted an overlay to show up over a UAV feed and display an image, how would I go about doing that?
I really haven't messed around with displays/overlays or anything at all, yet.
Is it possible to get allVariables with a specific TAG?
what's a TAG
It just returns an array of (lowercased) strings. You can do what you like with it.
If a mod actually tagged all its variables properly then yes, you can isolate those.
allVariables, toLowerANSI, select, etc
allVariables _unit select { _x select [0, 3] == "ace" } for example.
What does [0,3] mean?
_string select [0, 3] returns a new string containing the first three characters of _string.
You can do something like "ace_" in _string instead but that might have false positives.
Okay thank you for clarifying it
(select has a lot of different syntaxes)
Is this correct?
`_playerVariables = allVariables player select { _x select [0, 4] == "para" };
{player setVariable [_x, nil];} forEach _playerVariables;`
tried it?
Unfortunately not, i didn't had the opportunity to test it yet
@blazing zodiac Yes, the average run time over the number of shown iterations
hello I need help I want to make a small trigger that whenever a drone flies in it deletes the AI on the drone
I found that I can use the deletevehicle crew command since UAV ai is a unit
I thought of modifying the no fly zone script
condition
(vehicle player in thisList) && {vehicle player iskindof "Drone"}
will write the activation soon
Activation
_drone = vehicle player;
deleteVehicleCrew _drone;
}```
no need to spawn, also thisTrigger is not used
there was something tho 
isAutonomous?
ah unitIsUAV
omg leopard is green now
he got forced into bis basement
*bisment
I see the jokes have seeped through you
unitIsUAV vehicle player
tho I really doubt it works
because the player is never really in the UAV
simple to do in 2.14 π
I just want to simulate a UAV jammer
(vehicle player in thisList) && {unitIsUAV vehicle player}```
dont use vehicle player then, just check vehicle crew is uav and delete it if so
just set fuel of any UAV entering to zero?
oh that works
or yes delete crew so connection is lost
so then
{unitIsUAV vehicle player} && {alive jam1}
jam1 is the comms mast in the compound
vehicle player will return a vehicle
just do something like
private _drones = thisList select {_x isKindOf "dronebaseclass"};
{
deleteVehicleCrew _x;
} forEach _drones;```
or just filter thislist in the condition for _x isKindOf "dronebaseclass"
{ deleteVehicleCrew _x } forEach (thisList select { unitIsUAV _x });
```or something
is my condition correct tho?
no
and may not even return uavs either
if you want any UAVs to trigger, just leave this as condition and set it to trigger on anything
I want it to happen only for blufor UAVs
I try to help a friend build something
so should I add a side check in your line
{ deleteVehicleCrew _x } forEach (thisList select { unitIsUAV _x } && {side _x == west});
yes, but not like this
{ deleteVehicleCrew _x } forEach (thisList select { unitIsUAV _x && side _x == west });
```like this
I see and this when a blufor UAV goes in the trigger the controls die and the player is ejected from command
it should
will test
thank you
with a alive jam1 condition so in case they destroy the jammer it flies normal
so the UAV didn't cease working
didn't use the condition so to check if it will work
uav may not stop working but just lose control
activation: anything
repeatable
just set repeatable ok
no, not just that
activation: anything
try and thou shalt see
