#arma3_scripting
1 messages · Page 159 of 1
Also there is https://community.bistudio.com/wiki/setDriveOnPath
I have no idea how it works, I suck with AI
how doi disable ai
disableAI, read the wiki
no idea if disabling AI mid-drive will keep vehicle drying, maybe they'll just stop at once
I'm just guessing, you'll need to test it yourself
setDriveOnPath could be what you want, try it first
setDriveOnPath won't normally run into other vehicles, only map objects.
disableAI + setVelocity might be a better bet.
Thanks, that was it!
I requiring assistance in learning how to do some basic coding
So, basically, I want to be able to use as a Blufor UAV Specialist, Redfor UAV terminals and connect to their UAV.
Just this basic stuff.
They're just different tools, use a PFH if you need something to happen each frame
Also it has the advantage of running unscheduled
They only way would be to recreate UAV crew to your side
but this will make everything attack them
and all waypoints will be lost
Otherwise you could script your own "hacked control" system but that's way out of your ability
It is, yes
I guess I'll trust lady Luck and my trustworthy MG42 with full tracers to hopefully damage it just enough for it to smoothly land somewhere and hack it manually
If on the other hand you want to sleep for one frame in the scheduled environment you might do something like _frame = diag_frameNo; waitUntil { _frame != diag_frameNo };
ok I think I don't understand something. I have a situation where I need to add some editable groups to the Zeus without knowing the module's varname, it's created on fly I believe (using the Zeus Wargame mod). Why does
_zeus = allCurators select 0;
_zeus addCuratorEditableObjects [units myGroup,true];
not work but
if (isServer) then
{
0 spawn
{
while { true } do
{
{
_x addCuratorEditableObjects
[
entities [[], ["Logic"], true /* include vehicle crew */, true /* exclude dead bodies */],
true
];
} count allCurators;
sleep 60; // change to whatever fits your needs
};
};
};``` works?
2nd is taken of the wiki but I want to add specific group(s) like in the first example.
how do I get the first element of the command syntax if I know the zeus's group name/unit varname?
yeah just found it I wonder though why count allCurators works but allCurators select doesnt
maybe something creates an extra curator? Does allCurators only return one result for you there? Because when i run your first example in the editor with a single group and single Game Master module - it works alright.
my head hurts when I touch SQF...
and does units myGroup return what's expected for sure? And is the command run on the server? I can't think of any other points of failure here
yes, an array of units in the group
So I am getting this error, saying im missing a ; but im not. 🤔 ```sqf
[] spawn {
while {true} do {
// Notify the player that a new wave is starting
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
sleep 15;
// Spawn units for the current wave
for "i" from 1 to waveCount do {
unit1 = enemyGroup createUnit ["O_Soldier_F", spawnPosition, [], 0, "NONE"];
unit1 move (getPosASL EnemyObject);
};
// Spawn vehicle every 5th wave
if ((waveCount % 5) == 0) then {
truck1 = createVehicle ["O_G_Offroad_01_armed_F", spawnPosition, [], 0, "NONE"];
//Driver assgin
driver = enemyGroup createUnit ["O_Soldier_F", spawnPosition, [], 0, "NONE"];
driver assignAsDriver truck1;
driver moveInDriver truck1;
//Gunner assgin
gunner = enemyGroup createUnit ["O_Soldier_F", spawnPosition, [], 0, "NONE"];
gunner assignAsGunner truck1;
gunner moveInGunner truck1;
//Moving truck1 to objective
truck1 move (getPosASL EnemyObject);
};```
I found out you can derictly assgin a vehicle to a group, right? you have to assgin a driver and put the driver in the group?
driver & gunner are reserved variables / commands
and you can't name your variables such
oh so id have to call it driver1 & gunner1, somnething like that, justy not defualt?
yea
oh do you mind elaborating?
no
😛
since they are commands you run to trouble using them as variables: https://community.bistudio.com/wiki/driver
e.g
driver _myCar; // orange Discord = command
_guy setDamage 1;
setDamage = 42; // nope
ahhhh okay, its making sense
commands were actually protected only… during Arma 2's lifetime 😬 before that you could do something like true = false or player = objNull, etc
whoa lol
waitUntil isn't guaranteed, it'll execute at most once per frame, not at least once per frame.
so my code only spawn one truck at wave 5 but not two at wave 10?
no, one each x % 5 == 0 step
10 % 5 = 0
one at 5, one at 10, one at 15
correct ya okay ill look it up and see
not odd, even
this should work
[spawnPosition, getPosASL EnemyObject] spawn {
params ["_spawnPosition", "_destination"];
private _group = createGroup [opfor, false];
private _waveCount = 0;
private ["_soldier", "_vehicle"];
while { alive player } do
{
_waveCount = _waveCount + 1;
for "_i" from 5 to 1 step -1 do
{
cutText [format ["Wave %1 in %2...", _waveCount, _i], "PLAIN"];
sleep 1;
};
// notify the player that a new wave is starting
hint format ["Wave %1 start!", _waveCount];
systemChat format ["Wave %1 start!", _waveCount];
// spawn units for the current wave
for "_i" from 1 to _waveCount do
{
_group createUnit ["O_Soldier_F", _spawnPosition, [], 0, "NONE"];
};
// spawn vehicle every 5th wave
if (_waveCount % 5 == 0) then
{
_vehicle = createVehicle ["O_G_Offroad_01_armed_F", _spawnPosition, [], 0, "NONE"];
_group createVehicleCrew _vehicle;
};
// move everyone
_group move _destination;
sleep 25; // 30s each
};
};
Can someone help me with a script that spawn a unit after the "A" unit was shot and add the eventhandler for the damage to this one
which script i should use to increase my player outgoing damage?
Yes i know that but it's more accurate than sleep 0.01 or something which may or may not pause at all
ye ... or just use sleep 0.0001
it will sleep then for at least one frame
unless you got a 1k framerate
i might be being silly or just cant wrap my head around, i made a mission last year which i made a vehicle spawner, i tried doing the same method and it doesnt work...... have something change? alot has seem to change in the workbench editor
Are we supposed to guess the "same method"? Also this is an Arma 3 channel, Workbench is a Reforger tool.
You can increase the "outgoing damage" only in weapons configs. If you want a script, you would have to increase the incoming damage on all enemies with handleDamage event handlers.
That's way too generic of a question. You can spawn a vehicle with createVehicle
i know im confused too as before i put down vehicle maintance prefab with a entity spawner adn that worked it doesnt now......
As honger said this is the A3 channel
Use Reforger channels instead
oh sorry some reason i did click on reforger channel
but that would make my teammates also do more damage to the ai right?
It's up to you. You can script it so that it only affects your shots
im interested in that
You can use the FiredMan event handler to set a variable on your shots to distinguish them from other shots
would be something like: player addEventHandler?
You mean how to add the EH? Yes
yes, also how it should be written
The EH code and the stuff you need to do in them is the important part
I'm currently on mobile so I can't write the code for you
But you should do this:
- Add FiredMan EH to player, grab projectile, set some variable on it (e.g. "my_isPlayerShot", true)
- Add HandleDamage EH to every unit, in its code check if they're enemy and if so, get the dealt damage and multiply it by whatever factor you want (which is
_damage - _currentDamagewhere damage is the EH damage and current damage is the hit point damage/total damage), then add the dealt damage back to current damage and return it in the EH
if (_vharr = isClass (configFile >> "CfgVehicles" >> typeOf _vharr >> "Components" >> "TransportPylonsComponent" >> "Pylons")) then Getting "Parse Error: syntax error, unexpected =, expecting )" here. If I am corrent the code should check if class pylons exist to continue with then [command lines] and if returned false it should skip to else [further in the code]
Remove the assignment
ooof, im going to try
im not experienced with it
but i'll give it a shot and see if i can do it
if I remove "=" then it's against syntax and getting new error of unexpected operator
Leo said remove _vharr =
Hello. I'm trying to setup an artillery position with barriers and such by using modelToWorld. The barriers is floating and I'm already using a code to counter that.
My code:
for "_count" from 1 to 3 do {
private _barrier = createVehicle ["Land_HBarrier_Big_F", markerPos "ghost_spot" , [], 0, "CAN_COLLIDE"];
switch (_count) do {
// Front barrier
case 1 : {
_barrier setPosATL (arty1 modelToWorld [0,7,0]);
_barrier setDir (_barrier getRelDir arty1);
};
case 2 : {
// Side barrier
_barrier setPosATL (arty1 modelToWorld [7,0,0]);
_barrier setDir (_barrier getRelDir arty1);
};
case 3 : {
// Side barrier
_barrier setPosATL (arty1 modelToWorld [-7,0,0]);
_barrier setDir (_barrier getRelDir arty1);
};
};
_barrier setVectorUp (surfaceNormal (position _barrier));
};
Is there a way to fix that without the use of like _barrier setPosATL (getPos _barrier vectorAdd [0,0,-3]);?
You want to make them stick to the ground?
yes
intersect commands are your first resort. lineIntersectSurfaces etc
not sure how to apply that, but by using _barrier setPosATL (getPos _barrier vectorAdd [0,0,0]) it really did the trick even with the modded arty.
vectorAdd [0,0,0] literally means nothing
I know
Sorry, of course did not work lmao. But how do I apply intersect for this kind of problem?
https://community.bistudio.com/wiki/lineIntersectsSurfaces
This actually calculates/gets the intersection(s) between position A to B (both ASL)
If there is an intersect, result can have both position in ASL and surface's vector normal
Which you can use in this case
So, using this I can get a x position (from the first element of the returned value) and I can use this to correct the height of the object?
Basucally that's the idea
Note that simply setting the ATL Z coordinate to 0 will anchor the vast majority of objects to the ground.
Urm, that is also an idea
your modelToWorld calculations probably have a non-zero Z result.
Sometimes the orientation gets weird, but _object setVectorUp surfaceNormal _pos generally fixes that.
so like, _barrier setPosATL [x,y,0]?
something like that, yes.
yes, but doesn't do anything
That's only for orientation, not floating.
Only matters for some objects on very non-flat terrain.
which shouldn't be an issue here because I assume your artillery is sitting on flat terrain.
I think you can use the new setWaterLeakiness command to stop objects floating 
Positions are always pain anyways
is their a move aggesive "move", the enemies keep laying down and I wounder if there is a force combat walk?
I would also like to modify the asset list in warlords mode, is that done by creating a description.ext file?
You could use https://community.bistudio.com/wiki/setUnitPos
oh ya that is gonna work, also having an issue with the randomSelect, should random index an arry, ya? ```sqf
infantryPositions = [getPosASL personalSpawn, getPosASL personalSpawn_1, getPosASL personalSpawn_2];
//==== Infantry Spawn ====//
[] spawn {
while {true} do {
// Notify the player that a new wave is starting
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
infantryPositions = selectRandom infantryPositions;
// Spawn units for the current wave
for "i" from 1 to waveCount do {
unit1 = enemyGroup createUnit ["O_Soldier_F", infantryPositions, [], 0, "NONE"];```
ty community for da help btw
What issue with selectRandom
And your selectRandom overwrites itself
Yeah
You're declaring infantryPostions as an array, and then changing it to be a random element from that array
Which means, as far as we could assume, it will work only for once
So then on the next loop you try to do selectRandom [x, y, z], and then kn the next loop you do selectRandom x (or any of the elements)
You basically go:
[[0, 1, 2], [3, 4, 5]]
[0, 1, 2]
2 // error
infantryPositions = selectRandom [getPosASL personalSpawn, getPosASL personalSpawn1, getPosASL personalSpawn2];
//==== Infantry Spawn ====//
[] spawn {
while {true} do {
// Notify the player that a new wave is starting
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
infantryPositions = selectRandom infantryPositions;
// Spawn units for the current wave
for "i" from 1 to waveCount do {
unit1 = enemyGroup createUnit ["O_Soldier_F", infantryPositions, [], 0, "NONE"];```??
I don't even see what you changed
You're not getting the point is what I see
Clearly, Like I just stated I am pretty new at this.
infantryPositions, is, in fact, contains no position after the first iteration because of this
But no, instead of doing infantryPositions = selectRandom infantryPositions, just make a new variable
private _position = selectRandom infantryPositions;
I'm not blaming you anyways
okay I see, so does this look any better gentlemen? ```sqf
infantryPositions = selectRandom [getPosASL personalSpawn, getPosASL personalSpawn1, getPosASL personalSpawn2];
//==== Infantry Spawn ====//
[] spawn {
while {true} do {
// Notify the player that a new wave is starting
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
infantrySpawnpoint = selectRandom infantryPositions;
// Spawn units for the current wave
for "i" from 1 to waveCount do {
unit1 = enemyGroup createUnit ["O_Soldier_F", infantrySpawnpoint, [], 0, "NONE"];```
That works, but you're currently making all of those variables global, but do they need to be?
Ya nah all good, I am just so new so of this quick zoots over my head.
You're good
I think suggesting global or local makes only headache for today
well, only the infantry will use this spawn so I soppuse it doesn't
You're not wrong lol.
And the people who don't learn end up making random global variables like return, or unit, etc.
Always start with local (and also use the private keyword when you initialize the variable)
Local variables always start with an underscore
And if you do need to make a global variable, you should give it a "tag", or prefix so you don't accidentally conflict with some other script
Well even though you're true
It still seems to be a stage of "at least my garbage is working"
I wouldn't say garbage
I have seen far worse
Hundreds of lines of getter commands instead of just getting it once and checking against an array
That specific example is from one of WebKnight's mods, who is pretty well known for poorly written scripts
ahhh okay okay
But anyways I guess you may need to keep it into a corner of your mind
Well it didn't work, I got the same error, so I tried this, ```sqf
[] spawn {
while {true} do {
// Notify the player that a new wave is starting
spawnOne = getPosASL personalSpawn;
spawnTwo = getPosASL personalSpawn1;
spawnThree = getPosASL personalSpawn2;
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
infantryPositions = selectRandom [spawnOne, spawnTwo, spawnThree];
infantrySpawnpoint = selectRandom infantryPositions;
// Spawn units for the current wave
for "_i" from 1 to waveCount do {
unit1 = enemyGroup createUnit ["O_Soldier_F", infantrySpawnpoint, [], 0, "NONE"];
unit1 move (getPosASL EnemyObject);
unit1 setUnitPos "UP";
};
if (floor(waveCount) >= 5) then {
heavyGunner = floor(waveCount / 5);
for "_i" from 1 to heavyGunner do {
unit2 = enemyGroup createUnit ["O_Urban_HeavyGunner_F", infantryPositions, [], 0, "NONE"];
unit2 move (getPosASL EnemyObject);
unit2 setUnitPos "UP";
};
};
``` maybe I dont need infantrySpawnpoint = selectRandom infantryPositions; anymore and just call infantryPositions
still getting this, maybe Im using getPolASL incorrectly?
infantryPositions is already a position array
you then do selectRandom on it again which returns random number from the array
When it doubt, add debug hints/chats/logs
Also for unit2 you still use infantryPositions
ya I saw this, thank you
infantryPositions = selectRandom [spawnOne, spawnTwo, spawnThree];
systemChat str ["infantryPositions", infantryPositions];
infantrySpawnpoint = selectRandom infantryPositions;
systemChat str ["infantrySpawnpoint", infantrySpawnpoint];
you'll see what's going on
had no success in doing it properly
Post code
okay so it's grabbing the coordinates?
player addEventHandler ["HandleDamage", { params ["player", "", "50", "player", "bullet", "-1", "player", "CfgWeapons", "true", 0]}];

you're selecting random number out of coordinate array
oh! well, I need just a random index of the arry
don't be surprised, just started yesterday lol
same brother
still have a lot to learn
Oh with how you changed it, you're doing a selectRandom twice
Also the spawnOne = ..., spawnTwo = ... aren't really doing anything for you
You can just leave it like you had it before
infantryPositions = [
getPosASL personalSpawn,
getPosASL personalSpawn1
// etc.
];
wait, okay that make sense becuase once it indexs the arry the first time, it'll only be a single int?
oh well, i'll try a quick search to fix this mess of a code i made
Yep
Your first selectRandom is grabbing a random position array (which is what you want), but the second one just picks a random coordinate from that position
I feel like my brain synapsis has made a ton of connections today lol. wow. is this... learning?
it worked! just in the air? lol
setUnitFreefallHeight?
Are the objects you're using as spawnpoints in the air?
no they are the transport pods on the ground
That just lets you change when a unit starts freefalling, i.e. the laying flat with arms and legs out animation
It doesn't look like they're even over the objects, could you share your full script?
Preferably in something like a https://pastebin.com/ if it's long
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.
Oh actually it's because createUnit takes a position / position2D, not a positionASL
damn brother how do you know all this?
type: String - classname of unit to be created as per CfgVehicles
position: Object, Group or Array format Position or Position2D - location at which the unit is created. In case of Group position of the group leader is used``` ahhhh okay okay.
So you could actually simplify your code a decent bit by just using the object's variable names themselves, rather than getting their position
I am reading it but I dont see it
Don't see what?
position2D
position2D is not a command you can use. It is just a "format" of an array which contains two numbers
You could try just doing:
infantryPositions = [
personalSpawn,
personalSpawn1
];
Which would (should) just spawn the units on the object
I'm not sure what position format it uses when just using an object, but may work better for you
okay ya lost me, I am looking at the docs so I get that it just takes the x and y and assume Z
but how do I tell it to assume Z?
could I do this?
Start with some basic scripts first
setPosATL or others are more reliable and safer way
A Position2D is just an array of two numbers, [x, y]. There is no z coordinate because it's well, 2D
It probably just spawns it at terrain height in that case
right, but I need to know the x and y corrs for each
About Ghost, indeed EHs IS complicated to understand in your first day. You seriously better to forget your idea for now, and start from very simple and reliable command. Like, just do Hello World
i got one working for adding a magazine everytime i reload a gun
lol
The x and y would be the same for any position command, you would just need to then remove the last element in each of them
It would probably be easier to try just putting the objects themselves in your infantryPositions variable and see where the game spawns them
If it spawns them in the right spot, great
thats what is happening.
Currently, or at least in the last code you sent, you're using their ASL positions, not just passing the object
That's a different position type (there's several, it will be confusing at first)
(It still is to me)
But createUnit doesn't accept a PositionATL
thank yall so much
createVehicle/createUnit takes PositionAGL

So the rightestest would be ASLtoAGL getPosASL ...
or just do set [2, 0] after any getPos*
does medium right work?
@meager granite private["_damage"];
_damage = 100;
private ["_hit"];
_hit = [];
_hit addEventHandler ["Hit", {if (player == _this select 0) then {if (isNil {"CIV_Man" find in (_this select 1)} == false) then {_this setDamage _damage}}];
what is wrong with it now?
increase the damage done by my player
lol no surprise so far
i'll see if dart is gonna take that one before i answer
we really should be better with making threads here
A couple of things
- Just use the inline private keyword, not the array version. It's slower and annoying to work with
private _varName = ...;
- You're trying to use
addEventHandleron an array and not an object - You can use https://community.bistudio.com/wiki/params to make variables out of passed arguments (or any array)
_this select 1(i.e._sourcefrom https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Hit) is an object, not an array- You reference
_damagein your event handler code, but event handlers run in their own scope, so this variable is undefined isNil {"CIV_Man" find in (_this select 1)} == falsewhat are you even checking here?
also, it looks like you tried to use params here
you need to have underscores _ before the variable names when using params, and you might need to revisit what it does.
okay, i need to take this very slow, so i'll make a thread here
How to increase the player damage
Do a create a description.ext if modify the warlords sset list?
Question, I have a script that adds ACE Self Interactions. However, if I put it in initPlayerLocal.sqf, it doesn't do anything (Not in SP atleast), and if I put it into init.sqf for some reason, only I had it, and noone else did.
_mgmaction1 = ["MGM","MGM","",{},{true}] call ace_interact_menu_fnc_createAction;
_mgmaction2 = ["Check Camouflage","Check Camouflage","",{
_mfcoef1 = player getUnitTrait "CamouflageCoef";
hint format["Your camo coef is %1 good luck",_mfcoef1];
},{true}] call ace_interact_menu_fnc_createAction;
_mgmaction3 = ["Adjust Eyes 1","Adjust Night Sight","",{
setAperture 3;
},{true}] call ace_interact_menu_fnc_createAction;
_mgmaction4 = ["Adjust Eyes 2","Concentrate Night Sight","",{
setAperture 1;
},{true}] call ace_interact_menu_fnc_createAction;
_mgmaction5 = ["Adjust Eyes 3","Day Sight","",{
setAperture 0;
},{true}] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], _mgmaction1] call ace_interact_menu_fnc_addActionToObject;
[player, 1, ["ACE_SelfActions", "MGM"], _mgmaction2] call ace_interact_menu_fnc_addActionToObject;
[player, 1, ["ACE_SelfActions", "MGM"], _mgmaction3] call ace_interact_menu_fnc_addActionToObject;
[player, 1, ["ACE_SelfActions", "MGM"], _mgmaction4] call ace_interact_menu_fnc_addActionToObject;
[player, 1, ["ACE_SelfActions", "MGM"], _mgmaction5] call ace_interact_menu_fnc_addActionToObject;
I can execute module while ingame/zeus, but its I dunno, its always perfect. Especially when players rejoin
works for me
params ["_player"];
private _mgmaction1 = ["MGM","MGM","",{},{true}] call ace_interact_menu_fnc_createAction;
private _mgmaction2 = ["Check Camouflage","Check Camouflage","",{
private _mfcoef1 = player getUnitTrait "CamouflageCoef";
hint format["Your camo coef is %1 good luck",_mfcoef1];},{true}] call ace_interact_menu_fnc_createAction;
private _mgmaction3 = ["Adjust Eyes 1","Adjust Night Sight","",{
setAperture 3;},{true}] call ace_interact_menu_fnc_createAction;
private _mgmaction4 = ["Adjust Eyes 2","Concentrate Night Sight","",{
setAperture 1;},{true}] call ace_interact_menu_fnc_createAction;
private _mgmaction5 = ["Adjust Eyes 3","Day Sight","",{
setAperture 0;},{true}] call ace_interact_menu_fnc_createAction;
[_player, 1, ["ACE_SelfActions"], _mgmaction1] call ace_interact_menu_fnc_addActionToObject;
[_player, 1, ["ACE_SelfActions", "MGM"], _mgmaction2] call ace_interact_menu_fnc_addActionToObject;
[_player, 1, ["ACE_SelfActions", "MGM"], _mgmaction3] call ace_interact_menu_fnc_addActionToObject;
[_player, 1, ["ACE_SelfActions", "MGM"], _mgmaction4] call ace_interact_menu_fnc_addActionToObject;
[_player, 1, ["ACE_SelfActions", "MGM"], _mgmaction5] call ace_interact_menu_fnc_addActionToObject;
via initPlayerLocal.sqf
I copied your exact code, and it doesnt work for me
make sure you dont have spelling errors for initPlayerLocal.sqf and make sure that file is also fireing put like
systemchat "Test"``` and see if you can see that msg in chat when you load in game.
if you copy exactly don't forget to define player properly again 😛
Otherwise _player would be undefined.
Nvm: https://community.bistudio.com/wiki/Event_Scripts#initPlayerLocal.sqf
params ["_player"]; is already enough.
Yee.....it doesnt hmm
okay now it works
Try with only CBA & ace loaded
fiddled with some code, the code above the one I posted wasnt well. It was working. But for some reason game doesnt execute stuff under it
You could share your content, easier ppl help you out
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 part you should use in initServer.sqf
if (!isServer) then {
...
Then you can be sure that it will be executed on the server, and server only.
And stuff after that doesn't execute?
Actually thats the thing, it does execute (I think). That script is essentially show server fps and other stuff, like how many scripts are running and stuff. It doesnt give any errors and when u open the map you can see all the data
So you said I should create initServer.sqf and put it there?
Hmm yes.
For server part
Rest, if you create markers every client , non local , those will show up every one.
You want everyone see own ? Or only server see x ?
Don't know what you want achieve with your event
Ideally I would want 2 things. To see how much stuff I got running on the server, 2nd to see how much stuff I got running on the client. But I think server is more important.
So essentially when I (or any player) opens the map, they see server FPS and all other stuff that script displays
is there a command to get these values for Eden camera? get3denCamera gives only the object name
would be faster than double clicking the camera icon each time I need to get these numbers
https://community.bistudio.com/wiki/get3DENAttribute maybe can help
_this get3DENAttribute "position";
_this get3DENAttribute "rotation";
hmm returns [] for each for some reason
I need to run a sleep function to delay some code in the init field of a unit I'm trying to spawn in Zeus via a composition. When the object spawns, I need it to wait 10 seconds before executing its code.
But normally, sleep is not allowed in this context according to the error I always get. How can I bypass this issue?
For example let's say my code is like,
this setGlobalTexture "whatever.paa";```
the ability to reference the spawning thing `this` is important for the code to work as a composition. What I'm doing is more than `setGlobalTexture` but I'm not gonna dump a page of junk on you.
call your code in scedueld enviormente https://community.bistudio.com/wiki/spawn
I tried that before but the code stopped working.
I know that spawn is definitely the way to do it, but not sure why I can't get anything to happen.
[this] spawn {
params ["_obj"];
sleep 10;
_obj setObjectTextureGlobal [0, "whatever.paa"];
};
Okay that looks like it'll solve my issue. I couldn't figure out params when looking at the wiki so I'll try that.
That seems to have done the trick! Thank you.
This is the full version of what I'm doing.
Hi! I am new script development in arma 3. I would like to ask you, when and why should I binarize the config and create the texheader? Also I would like to ask you if you know any way to verify that the texheader is correct.
I don't know how much difference there is between binarizing and not binarizing.
I have read the article thank you, I was looking for information about your experience
I dont usually binarize my files. https://pmc.editing.wiki/doku.php?id=arma:binarize_tutorial I dont do big mods that need that kind of things myb somebody else can tell you more about their expirience.
also this is pmc link for binirizing that is talking about it more.
okay thx!
btw I believe this is modding, not scripting 🙂 see #arma3_config
posting here to if there is a possibilty to create a script..
Is it possible to "set up a base" when playing? like raising a flag, get a box of ammo/weapons and maybe 2 vehicles?
pick one channel only, no crossposting - I removed the one in #arma3_editor
You mean making a base dynamically wherever you want?
Are there any eh I can trigger when a logic entity is deleted in Eden (& in Zeus secondarily)
Hey can somebody help me with this script? Trying to make a new radio using TFAR but its not even making the item to begin with, any help is appreciated thanks. Also please don't just link me the wiki, I've already read over the parts I'm confused about but it don't understand
I'm using the USAF MOD, more specifically, the KC135, I'm having issues keeping the AI to stay in the vehicle after a unitCapture, they just keep getting out after they've embarked the aircraft. This is what i used but I'm not sure if I'm doing something wrong.Pilot moveInDriver KC135_1; CoPilot moveInGunner KC135_1;
hi, that's not script, that's config
see #arma3_config 🙂
try this?```sqf
_pilot assignAsDriver _vehicle;
_pilot moveInDriver _vehicle;
_copilot assignAsGunner _vehicle;
_copilot moveInGunner _vehicle;
For the third person "boom opperator", i'm not entirely sure what the vehicleIndex is so i used moveInAny KC135_1;
I'll try, thank you
I'm trying to use setHit (or setHitPointDamage) to apply damage to specific parts of a vanilla vehicle.
getAllHitPointsDamage confirms "hithull" is an existing hit selection and has an associated hitpoint. However:
_unit setHit ["hithull",0.5];
_unit getHit "hithull"; // returns 0```
The vehicle has damage allowed. I have also tried a different type of vehicle, and a couple of other hit selections that the vehicle allegedly has (e.g. "hitengine", "hitturret") - still no effect.
I'm confused. This command......works, right?
Well, one issue would be that getAllHitPointsDamage returns hitpoint names first and selection names second, not the other way around
sleep n^-x isn't guaranteed to pause at all for higher x, at least when i tested it in a2oa, might be different in a3 can't speak to that.
How would I make a projectile detonate prematurely or otherwise spawn an explosion? I've seen it happen in mods with airburst munitions, I want a mortar round or something similar to look like its detonating mid air. Apparently there are explosion types in cfgAmmo, can I find a list of those somewhere?
triggerAmmo is the most straightforward way of setting off the projectile. Detecting when to set it off is more complex :U
So...moveInDriver takes you to the driver seat
moveInGunner takes you to the Co-pilot seat
What is the script for the boom operator's ?
Turret maybe
I did try that but nothing happened
You'd have to get the turret path correct
Get in the seat and do vehicle player unitTurret player; and see what it returns
It returned a [1]
then I used this player moveInTurret [_plane, [1]]; and it worked. thank you
Is there a limit to how fast attached objects can be moving? I have a script to attach a vehicle to an MLRS after launch, so the missile launches, the vehicle spawns, and doesn't move from its spawn position with the missile. Going in it confirms the vehicle thinks its going 806 kmh where it's not moving at all. This issue doesnt seem to happen with slower stuff like mortars or static artillery
attachedTo confirms it's still attached to the rocket itself but the vehicle itself does not move from the spawn position
It could depend on simulation type
All in all, attaching object to a projectile is a bad idea
Mortars probably use shotShell while MLRS is shotMissile
I'm guessing you're attaching a camera, the better idea would be setting position each frame to visual position of the projectile
nah artillery only works with shotshell
so mlrs would be a fake missile shotshell
class R_230mm_HE: SubmunitionBase
{
shotSubmunition I guess, same diff
Oh yeah, getText(configFile >> "CfgAmmo" >> "R_230mm_fly" >> "simulation") => "shotShell"
Maybe you don't re-attach after submunition change then?
yeah thats the issue
the rocket artillery change half way through flight
(rocket engine burning out etc)
so you need like a submunitioncreated eventhandler or w/e
I think lean would be playing animation. and for looking up and down you would create a invisible target for ai unit and with lookAt or dowatch you would make him look.
No
i'm wondering, is there a way to increase the threat of all WEST players, to like the threat of a Tank, so ai EAST shoot RPG,s at you Arma 3 ofcorse
or em i going about this the wrong way
These values are defined in config and cannot be edited via scripting.
Is there a way i can use "disableCollisionWith" or some other command to disable an objects collision with all AI? Im trying to make some AI friendly tenches and because AI doesnt behave well with the trench objects from base game im trying to make it so i have invisible VR blocks for collision because AI navigates around them really well. I just need the trench objects there for looks without them effecting AI
After 2.18 update you can use setPhysicsCollisionFlags
If I want to set up a map location based action, how would I go about doing that? Say like how Simplex works with clicking on map to select support locations or SOG with the Radio Support system it uses? I want to build something similar myself that is mission specific and can be tailored for my own needs instead of working off someone elses work
Thanks 👍
Using arrays as keys is such a convenient feature, wish you could do that with hashmaps too
Hmm, what if there was a way to get hashValue out of reference? 🤔
hashValueRef?
Nevermind my stupid ideas, won't do what I need anyway
Being able to use hashmaps as keys could've been useful though
to save on hashValue'ing keys and values manually
Wondering if the using setPhysicsCollisionFlags imediately on a body with the killedEH would prevent the infamous "launch to high orbit" of vehicles. Perhaps also between vehicles applying setPhysicsCollisionFlags to one of them with epeContactStart
I have it set up to attach a drone (to create the visual of a C-RAM attacking mortar fire) that attaches it after a fixed time. It doesn't matter if I attach it half a second or 5 seconds later, it creates the vehicle on the current position of the projectile and doesnt move after that.
I probably do just need to have an eachFrame handler update the position of the drone, it's just kind of a crummy solution performance wise. But it should be limited
i dont understand whats the thing with Roadway LOD because it cant be disabled. but i dont know what Roadway really does lol
You said it works with mortarts, maybe it is indeed and issue of submunition
But still setting position manually each frame is a better approach and gives you much more control
Its the geometry that characters can walk on
otherwise they get stuck and arma'd
i thought it was something like that just dont know why cant it be disabled
Disabled where?
i mean disableCollisionWith doesnt disable the roadway
Command was probably introduced for debug purposes and they didn't care about roadways
[nil] in createHashMap => false
createHashMap set [[nil], 123] =>
21:31:32 Error in expression <createHashMap set [[nil], 123]>
21:31:32 Error position: <set [[nil], 123]>
21:31:32 Error Type Nothing, expected Number,Bool,Array,String,Namespace,Not a Number,code,Side,Config entry

hashValue works with nils properly though, why not let us have nil keys?
[hashValue [getPos nil], hashValue [name nil], hashValue [nil]] => ["HoH7344jsWU","UCA8SAEuf3Y","hOdp56wcI/s"]
new command setPhysicsCollisionFlag also does not disable roadways, so I think there's a technical reason. I vaguely recall Dedmen discussing it not disabling roadways but I don't remember if he said why
That's just MP physx mess
You can use the MapSingleClick mission event handler to detect clicks on the map
Yes, that would be the best solution
so I am making a script to keep track of killed planes. I figure the easiest way to do this is to attach an eventhandler to each plane and when it does decrement a variable:
pseudo code:
_alive_planes = 2
for i from 1 to 2{
create plane
plane addMPEventHandler["MPKilled",{_alive_planes = _alive_planes -1}]
}
this has an issue though I noticed, _alive_planes is local to the surrounding script and so is not accessed by the eventhandler
I dont think SQF has anything like JS closure so the only way to access that variable is to declare it global right?
the actually script has a lot more busy work so I figure pseudo code is probably better. My specific question I need help with is really using the same variable. I don't think I can reference it without it being global?
maybe I could work around it in a cleaner way by adding all the planes to an array and doing an isAlive check
use global variables or namespaces https://community.bistudio.com/wiki/Namespace
thats sort of what I was figuring
Hello everyone !
Can anyone tell me the function called when talking with Task Force radio?
(basically when you keep pressing the push to talk button).
I would like to integrate this into a button on one of my interfaces, because we are blocked when a dialog is open.
you can look here for it: https://github.com/michail-nikolaev/task-force-arma-3-radio/wiki/API%3A-Functions
Do you create you dialog with createDisplay "xx" or createDialog ?
With CreateDialog (I know that I had display and cutRSC we can move, but suddenly I no longer have access to my buttons ^^)
cant turn player via mouse and click ui at the same time but you should be able to read keyboard input
Yep, that's why I'm looking for the TFAR push to talk function, in order to either bind the function directly by putting an onKeydown, or by putting the function on a button on my interface
thx R3vo for telling me i did not know that
Is it known if setPos messes with stuff besides the normal movement of objects? I'm trying to attach a drone to a projectile and make it invisible, I can't use attachTo for this (discussed above), so it's set up as this:
addMissionEventHandler
[
"EachFrame",
{
private _projectile = _thisArgs#0;
private _drone = _thisArgs#1;
_drone setPos getPos _projectile;
},
[_projectile, _drone]
];
//_drone attachTo [_projectile, [0, -1, 0]];
_drone hideObjectGlobal true;
The problem is, the drone despite being hidden after the EH is added is still clearly visible. It can be fixed by putting the hideObjectGlobal inside the eachFrame handler, but I'm worried it will have a hit on network traffic and performance with a decent amount of players (15-30) and multiple projectiles up at once.
setPos/getPos are ancient and do a lot of unasked stuff
Just use setPosWorld/getPosWorld
would anyone happen to know spectrum device display id?
its not in here? https://community.bistudio.com/wiki/Arma_3:_IDD_List
Usually not. It is defined in CfgInGameUI (Or RscInGameUI, can't tell rn)
its not
ill check
It also depends on your goal
nothing specific wanna mess with display a bit
Greetings,
I´ve been trying to set the identity of specific units using the EntityCreatedMEH.
My attempts have been unsuccessful.
if ((Array_of_Units findIf {_entity isKindOf _x})>=0) then {
_entity setIdentity "orks"; //does nothing
};
the only parameter for this MEH is:
params [
"_entity"
];
||https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityCreated||
What am I doing wrong?
Post your entire EH
params [
"_entity"
];
if ((Array_of_Orks findIf {_entity isKindOf _x})>=0) then {
_entity setIdentity "orks";
};
That´s the entire EH.
The creation of all EHs is done through another script using:
{
...
private _fileName = format["eventhandlers\mission\eh_%1.sqf",_name];
private _file = preprocessFile _fileName;
["Adding mission event handler: %1 with file %2", _name, _fileName] call BIS_fnc_logFormat;
private _id = addMissionEventHandler [_name,_file];
...
} forEach (configProperties [missionConfigFile >> "gamemode" >> "missionEventHandler"]);
Have you checked if the condition actually returns true?
I have copied this condition from another of my EHs:
_idMEH = addMissionEventHandler ["EntityKilled",{
params ["_unit", "_killer", "_instigator", "_useEffects"];
if ((ADALIB_airvehicle findIf {_unit isKindOf _x}) >= 0) then{
_unit spawn {
sleep 360;
deleteVehicle _this;
}; // could create a more sufisticated function
};
}];
which does return true.
(different mission and EH creation setup tho)
R3vo's point still stands. Are you suresqf ((Array_of_Orks findIf {_entity isKindOf _x})>=0)is true
Also what is Array_of_Orks
Is "orks" a valid config in CfgIdentities?
init.sqf
Array_of_Orks = [
"TankBusta1_OP",
"StormBoy1_OP",
"Naked1_OP",
"ShootaBoy1_OP",
"New_Orks_Loota_BA_1",
"New_Orks_Burna_BA_1",
"ArdBoy2_OP",
"Boss2_OP",
"New_Orks_FreeBoota_1",
"New_Orks_NOBZ_ES_1"
];
yes, works if I do it manually
Ok.
Am I having a namespace brainfart here ?
Also effect is local so you need remoteExcec
Not sure though what's the locality of entityKilled EH
ignore the EntityKilled EH, that one works flawlessly for now
This one is giving me major issues
We still don't know this
understood, brb
tested like this:
hint format ["%1",((Array_of_Orks findIf {"TankBusta1_OP" isKindOf _x})>=0)];
in the ESC Debug console.
It returns / hints true
That's not the suggestion. Test the code in the EH and let it print the result
I put it verbatum into the MEH and it returned true for all units in the array.
params [
"_entity"
];
hint format ["%1",((Array_of_Orks findIf {_entity isKindOf _x})>=0)];
if ((Array_of_Orks findIf {_entity isKindOf _x})>=0) then {
_entity setIdentity "orks";
};
wait its working now 🤖
you need to save the mission for description.ext changes to be considered
It was a human error in my testing, I locally spawned the wrong Units originally I think. Thx for yalls help! I appreciate you guys <3
And sorry for taking up your time
the editor should have reload description.ext button..
Hello. Is there a better way than this to detect if a player is in a forest?
nearestTerrainObjects [player, ["FOREST SQUARE", "FOREST TRIANGLE", "FOREST", "TREE"], 20]]
I was thinking of getting those objects under a variable and then use count. If there are more than n objects in the array, the player is in a forest.
the weird thing is that according to the wiki those FOREST objects dont exist in any map
You could try getAllEnvSoundControllers
so you would have to use "TREE", "SMALL TREE" etc
(or *Env3D*)
okay, that's a nice idea, testing now. But what about modded maps?
Question. using doWatch, lookAt, glanceAt; the AI seems not to look at the correct position. Is there any other command to make an AI unit "aim" at?
all those functions make them look at a position. They look with their eyes technically, so they will not always turn their whole body or even head. doTarget makes them turn fully.
_unit lookAt unitAimPosition player is what I am using most of the time to make them actually look at something, but it's not always a body turn.
Does anyone know if its possible to set a script to make TFAR seem like its being jammed? To cut comms to a selection of frequencies?
Got it. I'm trying to make an AI watch the player's position using binos, from a distance.
then doTarget might be the best since binos are essentially a weapon
it works, but the AI get it's weapon to fire at me lmao
then make them hold fire
the problem is that the AI is switching weapon. I can still use setDirbut meh
maybe disable autocombat? Or other AI functions for the timebeing
yeah, it's disabled already
also targetting
¯_(ツ)_/¯
if you turn them careless, they should not "understand" what they see but still follow the doTarget ?
Set the tf_sendingDistanceMultiplicator / tf_receivingDistanceMultiplicator variables on the unit you want
adding that information here so maybe the Biki can be modified : the BIS_fnc_fadeEffect does block every sound played once the player is fully blind (even the one from the end mission effect) (if the fade out time is set to 3 for example, the sound can be heard during those 3 seconds). It's not an information that the Biki has (and it took me too much time to figure out what was wrong with my sound script because of it)
they still follow, with primary weapon
Can't you change their loadout so their only "weapon" are binoculars ?
Remove their weapon.
Could also blind them with disableAI "CHECKVISIBLE"
does this feature interferes with the command checkVisibility?
nope
- All weapons removed
- using doTarget
- Using CBA's PFH
Just to confirm to make a custom sound in-game you have to have this in your mission's description.ext flie...right?
sounds[] = {};
class EngineStartUp {
name="EngineStartUp";
sound[]={"Sound\KC135 Engine Startup.ogg", 0.5,1};
titles[] = {};
};```
I have this in mine and when i try to play the audio `playSound "EngineStartup";` nothing happens, i get no error but in the console it returns `NOID <no shape>` and I'm not sure what that means, can someone tell me what I'm doing wrong
The console return is just the return from playSound - a reference to the sound emitter object it just created, which is a nameless invisible object that doesn't even have a 3D model, hence "no shape". References to such objects don't translate very well into human-readable text.
Your cfgSounds is missing a closing }; for the EngineStartUp class
Tried this, having setPosWorld getPosWorld doesn't seem to change any behavior; the drone is still visible after being teleported. Anything else I should try before I just brute force hide it each frame?
if you force global hide it every frame, you will absolutely toast your network performance; which you have already acknowledged.
even changing its position every frame, the position will not update that fast over the network. it will look choppy on clients
Ugh. Got the intended result working at least; have an invisible object that updates its position every frame to the shell, attach the drone to that invisible using attachTo, and hide the drone
I'm gonna do some more testing, but for my specific use case the clients shouldnt need to see the object itself, just maintained server side so the stream of fire is updated
The idea is that I want to create the visual of a C-RAM intercepting incoming fire. The way I'm currently doing it, which is working (albiet with some difficulties) is attaching a drone (any aircraft works, just need something big enough to get picked up by radar from kilometers away) to the fired mortar projectile. The radar and Praetorian (CRAMs) will try to engage the drone and the projectile will explode in mid air a few seconds before it hits the ground to look like it's been intercepted.
Drone is just there because I need some kind of aircraft for the guns on the ground to target, it doesnt actually do anything besides follow the shell
It's working pretty well right now; I'm probably going to try a firedNear EH to blow the projectiles once they're targeted with a few shots, and figure out why ground radars simply refuse to pick up an aircraft as high as an artillery round or MLRS rocket. My main concern is performance though
if its literally not for function, just visual, you can just aim the gun at a location and simulate its movement by moving the turret, then firing manually into the air
movement rate is just math of a point on a circle
with radius distance from cram
lockCameraTo may do it. But IIRC it's terrible because the "inertia" for AI aiming is always a case
still struggling with this, I'm trying to run a script in debug globally, it should waitUntil typeOf cursorTarget in _list then action = player addAction "Click Me!"
but every way I write it, it won't wont
only if im staring at the object when i run it
would I have to put it inside a while{ ?
you mean it quits the waitUntil even when the cursorTarget is not in List? more details please
while {true} do { waitUntil {(typeOf cursorTarget == "My_Object") && (player distance cursorTarget < 7)} action1 = player addAction ["Click Me!", { hint "working" }]; };
did you try the Pook Sam Pack?
Quick sanity check for me- does BIS_fnc_apply not have support for _forEachIndex, continue or continueWith?
missing ; behind waitUntil {}
your pasting that in dbg console in editor?
would it be possible to add a server script where a player is temporarily banned after dying?
Sanity check. What do you mean by BIS_fnc_apply
large respawn delay??
https://community.bistudio.com/wiki/apply exists,
https://community.bistudio.com/wiki/BIS_fnc_apply does not
and indeed, no index or anything, just _x
or that yeah
thinking of doing it for an antistasi server
you can config this in the description.ext of the mission
Whoops, apologies. I did mean apply. I just assumed that since it was made by Bohemia that would be it's full name like other commands I have seen. Promise you I am not using ChatGPT and taking made up functions haha 🙂
Thank you for the sanity check I appreciate it!
ah nice ill have a dig through it thanks
Indeed apply doesn't have _forEachIndex or _applyIndex (I wish TBH)
I think for the sake of @winter rose being one of the only ones who interface with the community- I am just gonna blame him 😈
i think dbg console is running it non sheduled.. you may need to put a spawn {} around it just for testing
heyyy!
Listen!
d-did you just Navi me
This would actually be huge though. I know apply is pretty fast so not sure how much adding implementation for those would slow it down but sounds like it would be a really nice QoL 😄
Actually. I would concern the performance. But... I guess, not sure
it will quit in non sheduled because you cant sleep or waitUntil afaik
for some reason i remember apply skipping elements on continue, but i'm not sure at all
can i use, BIS_fnc_selectRandom inside an Eventhandler
Yes. selectRandom is better though
ah ok thx m8
I tried testing with this but no luck unfortunately 😦
// array is 8 objects
i = 0;
array apply {
i = i + 1;
if (i % 2 isEqualTo 0) then {continue};
_x
};
wow that was fast thx you
You should use select.
Sorry I don't understand do you mean like within my apply?
I understand select, I am just not sure where you are saying that I should use it. Are you talking about syntax 6?
You should use select instead apply. And yes, example 6 is OK for you.
Ahhh I gotcha thank you sorry just wanted to make sure I was understanding correctly. Would select allow for usage of _forEachIndex, continue and continueWith?
and remove the while. It will just cause the addAction to be executed endlessly if youre on target
If you need to fetch some values out of an array with _forEachIndex, it is actually better to use forEach actually. With pushBack... I guess
I really appreciate the help guys thank you. I think I kinda just planned poorly. Initially I was using apply because it was working in the context in the scope of what I was initially trying to do and I wanted it to be fast with what I am doing being on server. Just sucks that I may have to turn it back to a forEach anyways but might see if I can give a whirl of select first.
Also last question I will yap in here- but do you know why this is? My understanding was that they were both the same thing, one was just it's tagged function library name and the other was just a short version for it. Would it be because the actual script name could potentially change but the alias likely wouldn't or is one faster than another?
BIS_fnc_selectRandom requires few more steps to execute just a selectRandom
Is it because with BIS_fnc_selectRandom you would have to call it with parameters opposed to just naming the script directly?
And yes selectRandom is faster (commands are faster than functions)
tldr, A function is made of bunch of commands
Ahhh wow that actually makes so much sense. Thank you guys for bearing with me, I really appreciate the responses I learned a lot this morning.
I know I did say last question so apologies but had a thought. I can think of a few different scripts where we have to run code on every frame for the sake of what we are wanting to do. Within that file we call a bunch of other files. Would there be a significant performance difference if I instead of calling those files- created commands for them instead?
You can't create commands
They're built into the engine
Calling stuff every frame is ok as long as it never exceeds a few hundred microseconds at worst (ofc the faster the better, and you should try to optimize it as much as your can)
Use the code performance button in debug console to measure how fast your code runs
My bad you are right. I've seen people create almost what looks like commands with defines but I suppose those really aren't commands. Thank you 🫡
Yes they are called macros. They just get expanded and replaced inline by the preprocessor.
You can define commands but not via SQF. You can use Intercept and use C++ for that (it's not officially supported tho)
A Command is a direct instruction to the game engine. They're the native language of the game. We can use them, but we can't change them.
A Function is a collection of commands wrapped up into a single name for easy access.
Generally, if a command and a function do exactly the same thing it's because the command didn't exist when the function was made. Like-for-like, commands are faster (because the purpose of a function is to use multiple commands to do things).
If you have a lot of SQF files that are being invoked repeatedly with e.g. execVM, you should consider making them into functions with CfgFunctions. If you do that, they'll be compiled once on mission start, instead of being compiled again every time you execute them, leading to better performance in the long run. (Also lets you use call to run them "inline", and keep them unscheduled when required, unlike execVM which always creates a new scheduled thread)
it does support continueWith/continue. or it should atleast.
Yay that is awesome
Wait
For apply not select?
I wanted to move _forEachIndex from a variable into a command.
Which means zero performance cost if you don't use it. But higher cost if you actually use it. meh.
The new optimizations with simple VM can also see if you use it, and skip setting it if you don't
all loops should support continue
your code works for me
That's so strange. I may have honestly just hard trolled and returned the original array or something then- not sure why else I would be getting different results. I really appreciate it 🙂
Also this does sound like it would be seriously awesome 🙏
Note that while this structure "removes" alternating elements, it still leaves a <null> in place of the removed element, so your array will still be 8 elements long, and those <null>s will be picked up when you operate on the final array. So while it works on its own, it may not work with whatever code you use the result with.
That's one way in which the select or forEach/pushback methods would be a bit better - they'll automatically produce an array containing only the chosen elements and nothing else, rather than having to specifically filter out byproducts.
Right now I am really just storing data from certain events that are occurring from within an eventHandler for logging purposes so I don't really need to actually do anything with that data but might be worthwhile perhaps if I still checkout select. I kinda liked the idea of it keeping the <null> return so I could tell exactly how many skips were being performed but if there is a larger performance difference between that and select I may just use that instead
Perhaps it could be different command for different loop too?
Same as it would've been _applyIndex and _selectIndex if there was an index in these loops
useApplyIndex; // Next apply only
[100,200,300] apply {_applyIndex;};
``` => `[0,1,2]`
uff
no need when simpleVM can detect it anyway
problem is, non-simpleVM contents, pay the price when they don't need it then.
But they are already much slower anyway, so probably doesn't matter much
Just create a variable 
Using a command is a terrible idea
Hey! Where can I find AAF ORBAT code?
kinda surprised that variables are faster than nular commands.
Commands create variables
made the changes, but still no luck
whats going wrong exactly?
I have no idea xD If I knew I'd fix it
^^ the action not showing up?
yep
waitUntil {systemChat (typeOf cursorTarget); ((typeOf cursorTarget) == "My_Object") && (player distance cursorTarget < 7)};
use that and watch your chat.. and check if the type of cursor target is what you want
if its okay but still not working try systemChat str (player distance cursorTarget); to see if the distance is right
if everything is correct but still not working you know your error is on the usage of addAction
Hello, so I found this one script for laser designation mission. How would I make this work on a server? ive tried many things but no results
//----------------- Laser Strike --------------------
sleep 4;
0 = 0 spawn {
_loop = true;
while {_loop} do {
_targ = laserTarget vehicle player;
systemChat format ["targ %1",_targ];
if not (isNull _targ) then {
if (cursorObject isEqualTo enemytruck) then {
[Radio_man, "Target_Found"] remoteExec ["sideRadio",0];
deleteVehicle Check_Block;
_loop = false;
};
};
sleep 1.5
}
};```
CursorObject and player command doesn't work on a dedicated server.
This needs to run on the client that should identify the target.
how can I make it run on a client?
it is expected a single specific player will carry the laser designators. So if this could reliably run just for them then that would be satisfactory
if not you still know where the problem lies
the addAction looks right but the waitUntil also does... id suggest using more brackets
((player distance cursorTarget) < 7)
what should be changed in this code, to affect all kinds of AI, but not players?
[] spawn {
while {true} do {
{
_x setVariable ["HAF_spawned",true];
_x addEventHandler ["handleDamage", {1}]
} forEach (allUnits select {isNil {_x getVariable "HAF_spawned"} && side _x == EAST});
uiSleep 2;
};
};
isPlayer
where?
In allUnits select {} part
change "isNil" to isPlayer?
No
...Well, I'd like to ask, do you know how select or even a boolean works in this context?
Boolean is set to true or false right?
The select is defined by the _unit to be selected in the param
This is what i understood, at least
But feel free to correct me on any wrong answers
I actually asked that because you don't really seem to fully understand your code. tdlr:sqf [] spawn { while {true} do { { _x setVariable ["HAF_spawned",true]; _x addEventHandler ["handleDamage", {1}] } forEach (allUnits select {isNil {_x getVariable "HAF_spawned"} && side _x == EAST && !isPlayer _x}); uiSleep 2; }; };Even though this code is not really optimized/preferred anyways, this is the idea
would this result in every ai being killed in a hit, but none of the player?
also, it would only be applied to my player?
yes, the code is not mine, i found it online, posted by a fellow named Pierre, thought it was really useful for what i wanted
and you are correct, i don't fully understand the codes and their logic, im studying bit by bit with the limited time i have now lol
but i truly appreciate the help and the correction, i think i understand, the player was not defined in the code
that's why it wasn't fully working as it should
let me know if i am mistaken on this statement
player is not something you define. I'd take some time to explain but I don't have time
where are you calling this code currently?
no problem at all, i appreciate the help
what was it? the brackets?
(Allunits -allplayers)
forEach (allUnits select here?
Foreach ((allunits - allplayers) select {...
If I run a command on group player and there are multiple player groups on a server, does it choose a random one or run it on all of the individual groups? Or will it not work at all lol
yep
Depends. It is a local getter command which means player means player himself in their computer. If dedicated server, it is objNull
Trigger activates a script, within that script is this code
What do I use to check a dead unit's inventory?
Same way with alive unit
yes you can
ok cool
this is probably really stupid coding but im not used to working with findif. I'm trying to make a script that finds any dead unit with a 'common' variable, not a 'gambler' variable, has a anprc152 in their inventory, and isn't within 150m of another player, and I assume this is the wrong way to do it since I've been trying to fix it for a while now
_deadPlayer = allDeadMen findIf
{(_x getVariable ["common", false])
&&
!(_x getVariable ["gambler", false])
&&
("TFAR_anprc152" in [assignedItems _x])
&&
([_x, 150] call CBA_fnc_nearPlayer)} == -1;
one thing I noticed is that "TFAR_anprc152" in [assignedItems _x] should be "TFAR_anprc152" in (assignedItems _x)
lol I had that initially but thought it was wrong, didn’t change anything
_index = allDeadMen findIf {
(_x getVariable ["common", false]) && { !(_x getVariable ["gambler", false]) }
&& { "TFAR_anprc152" in (assignedItems _x) } && { !([_x, 150] call CBA_fnc_nearPlayer) }
};
_deadPlayer = if (_index >= 0) then { allDeadMen select _index } else { objNull };
The problem is that it's not detecting a dead unit that passes all of those checks
ok nevermind wtf
it just worked
fucken ok then
ty for re-fixing that for me lmao
actually nevermind i did a dumby
does not work i just made it fire when those conditions weren't met on accident
fuck
Make sure that radio classname is exactly correct; in is case-sensitive
Also, I'm pretty sure TFAR makes individual radios unique by having a huge number of hidden classes of the same radio, that just have a unique ID (like TFAR_anprc152_1, TFAR_anprc152_2 etc). So the item in the inventory may not be just TFAR_anprc152, if it's been initialised into a unique radio.
If you're just concerned over whether or not they have a radio, I think this fnc should work
Though maybe not for dead units
Or this one if the other doesn't work, just toss the assigned radio into it and it'll return true if it's a tfar radio
hi, all people
I face a very strange issue when a unit is owned by an HC client, and I need you advice
if a unit is owned by the HC, the returning unit's position is different from the dedicated server or a classic client !!
let's say, you have created a unit and then transferring the ownership (setGroupOwner) to the hc and the you execute **globally **the code below, you don't get the same position !!
{
diag_log [name _x, getpos _x];
} foreach (units west)
I've got the following result
log from dedicated server (same result on client)
13:50:01 ["Liam Anderson",[8524.19,25016,0.00141907]]
13:50:01 ["Chris Taylor",[8516.94,25031,0.00115967]]
13:50:01 ["Lucas Campbell",[8518.13,25031.9,0.00171661]]
13:50:01 ["Gillian Martinez",[8540.17,25055.6,0.00149536]]
13:50:01 ["Alexander Robertson",[8534.6,25018.1,0.00144958]]
13:50:01 ["Spencer Clark",[8447.86,25100.6,0.000762939]]
13:50:01 ["Harry Stewart",[8446.98,25099.5,0.0018692]]
13:50:01 ["pSiKO",[23585.8,18697.4,0.00143886]]
13:50:01 ["Jabr Noori",[23578.5,18628.1,0.00143886]]
log from the HC client
13:50:01 ["Anderson",[8524.19,25016,0.00117493]]
13:50:01 ["Taylor",[8517.09,25031.3,0.00102234]]
13:50:01 ["Campbell",[8518.11,25031.9,0.00175476]]
13:50:01 ["Martinez",[8540.38,25055.5,0.00156403]]
13:50:01 ["Robertson",[8534.6,25018.1,0.00143433]]
13:50:01 ["Clark",[8447.86,25100.3,0.000930786]]
13:50:01 ["Stewart",[8446.99,25099.5,0.00167084]]
13:50:01 ["pSiKO",[23585.8,18697.4,0.00143886]]
13:50:01 ["Noori",[23581.2,18668.3,0.00143886]] <--- owned by the HC
look at **Noori **unit (owned by the hc), you see a different position and even the name return is different
and I don't understand why 🙂
if someone can tell me what's wrong ?
note, the HC and dedicated server are started with exactly same parameters
https://community.bistudio.com/wiki/setName
Sets the name of a location or a person (person only in single player).
I smell this simple execution is messy already...
that not the name that annoy me but the position, because that lead to distance/ distance2D issue
on the hc, the unit is closer than when it's owned by the dedicated server
Yeah I get the point. But I simply find it is terribly strange to see
yes !, I'm not new to arma scripting, and the code running fine when no HC are in use,
but the position difference lead to error in distance calculation
and it's very unusual !
I try different approach, getposATL/ASL, distance from object or position, and I always got the same error
the distance seem to be the half on the HC (roughly)
if it may help, the dedicated run on linux, but the hc run on window
@warm hedge did you know a way to force an update of unit position across the network ?
Is the Linux port working well for you?
yes running solo dedicated on linux run fine
You could have the server tell the headless where the units are, but if you are checking regularly this isn’t great
But at that point just do the maths on the server
I'll try a
_unit setPos (getPos _unit);
on the hc,
and the unit seem to be rested to the previous location
like if the location is not updated...
How far away is the headless client from these units?
As I know that can cause weird issues
very close < 50m
Really strange
indeed !
Like I’d get a little bit of deviation due to floating point maths etc
But those numbers aren’t even close sometimes
I order the unit to move, but the unit 'jump' back to his original location
is there a lot of latency between the HC and the server?
I can live with some minor difference, but actually it's a huge one!
24ms
the hc run on my pc and the dedicated run on hosted ser'ver (<30ms delay)
yes
I can share sample code to reproduce the issue if interested
I have to agree you have found a very strange behaviour
Sure
My only thought is due to Linux vs Windows
But like maths is maths
Seems strange they would be different
Nah, is actually my answer unfortunately
An aside, but while you are here I was wanting to get a DLL whitelisted soon, is there any requirements I should follow for this or is it more just a try and see regarding getting it approved?
This is also no. I've never wrote a DLL even
Interesting alright
// on Altis salt lake
// execute on **server **only
_pos = [23581.2,18668.4,0.00143886];
_grp = createGroup [west, true];
_unit = _grp createUnit ["B_Soldier_unarmed_F", _pos, [], 0, "NONE"];
sleep 1;
_grp setGroupOwner (owner HC1);
sleep 1;
diag_log (groupowner _grp);
};
note: my headless name is HC1, you can change the value by the netid manually
// execute on **client **only
// cursor on the unit created above
[cursorobject] joinSilent (group player);
// execute globally
{
diag_log [name _x, getposatl _x];
} foreach (units west);
now check the rpt log for unit position
//dedicated
15:16:16 ["pSiKO",[23583,18672,0.00143886]]
15:16:16 ["William Turner",[23592.6,18649.1,0.00143886]]
// hc
15:16:15 ["pSiKO",[23583,18672,0.00143886]]
15:16:15 ["Turner",[23582.4,18668.9,0.00143886]]
ok, the issue occur when I order the unit to join my group
like if having a remote unit in my group mess with the object info on the network
(but it work fine when the unit is remote but on the server)
Having Issue with a line of code that will not show up.
this addAction
[
"It's just a weather balloon, agent Mulder",
{
[0, [0, 0, 0]] remoteExec ["setFog", 2];
},
nil,
1.5,
true,
true,
"",
"true",
3
];
Suppose to display the action but does not seems to show.
What object is this action added to? I think the object is so big that the radius is too small.
Its a telecommunication hub. I will try to switch object.
Try to increase the radius.
Where Is the range sir? Also thank you for the response.
When I change the object It worked.
3 is the radius in your case.
Did not even know this was a thing. Getting tired of this #*$&#^$ game.
lol thank you sir.
You should read BIKI: https://community.bistudio.com/wiki/addAction
Greetings,
I am getting the error: "expected object (...) given type array" for this:
private _ChaosPortals = [
ChaosBase,
EastGate,
SouthGate,
WestGate,
NorthGate
];
{
_x params ["_gate", "_target"];
[
_gate,
format ["Teleport to %1", _target],
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa",
"(_this distance _target < 10)",
"_this distance _target < 10",
{},
{},
{
_this setPosAtl (getPosAtl _target); //Error here
},
{},
[],
2,
0,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, true];
}ForEach [
[ChaosBase, EastGate],
[ChaosBase, WestGate],
[ChaosBase, NorthGate],
[ChaosBase, SouthGate]
];
The _target is the destination of the teleport.
How do I go about adding the _target for this using my ForEach ?
I am getting the error: "expected object (...) given type array"
Which line?
_this setPosAtl (getPosAtl _target);
marked with //Error here
Yes, _this is an array.
How do I go about adding the _target for this using my ForEach ?
Pass througharguments: https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
_this |#|setPosAtl (getPosAtl _target);
that´s where the error is
using _caller fixed it.
actually nvm: New problem:
_caller setPosAtl (getPosAtl _target);
Always teleports to the position of ChaosGate
That's because _target is not a gate.
_x params ["_gate", "_target"];
...
}ForEach [
[ChaosBase, EastGate],
[ChaosBase, WestGate],
[ChaosBase, NorthGate],
[ChaosBase, SouthGate]
];
But it should be ?
ohhh lmao i think i have to rename it
No, _target is a gate in forEach scope, not in codeCompleted scope.
As I wrote, you should pass a gate through arguments param of BIS_fnc_holdActionAdd.
I shall try! Thx for your help
@tribal lark btw, this command was added in 2.14 that's much better than assignedItems for the radio check: https://community.bistudio.com/wiki/getSlotItemName
seems to be affecting the ai as well, they just one shot each other
Uh, what are you trying to achieve?
That handleDamage applies to all damage sources. If a unit is damaged, they die.
increase the damage taken by Ai units, but only from my player, vehicles and structures are not to receive the increase
Is this singleplayer?
But only one player, who is the host?
me
but two friends of mine will join me
Change the handleDamage EH code from {1} to this:
{
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"];
[_damage, 1] select (_instigator == player);
}
reduced-readability version:
{ [_this#2, 1] select (_this#6 == player) }
like this?
...probably
gonna test it out
put the event handler outside the loop
Has anybody used say3D with simulateSpeedOfSound on recently? I tried last night, and added one argument at a time [sound, maxDistance, pitch, isSpeech, offset, simulateSpeedOfSound]
It worked as I added each, but when I set the speed of sound arg to q or true I got the error "6 elements expected, 1 provided"
edit, clarification
So something like
_object say3D ["mySound", 1000, 1, 0, 0] works, but
_object say3D ["mySound", 1000, 1, 0, 0, true] or
_object say3D ["mySound", 1000, 1, 0, 0,1]
Gives that error.
from what I know, this will add the EH for those units in each loop, it will accumulate over time
no?
did it like this now
Nah, it sets the HAF_Spawned variable to prevent re-adding.
In that one you're missing the close bracket on the addEventHandler.
simulateSpeedOfSound isn't supported in the current version.
That'd do it, thanks.
in the last one i sent?
yes.
also a comma.
I can't fix it because you're pasting pictures rather than text.
my apologies
[] spawn {
while {true} do {
{
_x setVariable ["HAF_spawned",true];
_x addEventHandler ["handleDamage" { [_this#2, 1] select (_this#6 == player) }]
} forEach (allUnits -allPlayers select {isNil {_x getVariable "HAF_spawned"} && side _x == EAST && !isPlayer _x});
uiSleep 2;
};
};
here
EH line should be:
_x addEventHandler ["HandleDamage", { [_this#2, 1] select (_this#6 == player) }];
oh, i see now
makes sense, but what if used with MEH "entityCreated"? to avoid the loop
Feel free.
side question, what does this uiSleep 2 is for?
uiSleep is identical to sleep unless it's singleplayer.
That makes the loop pause for 2 seconds before doing its next iteration. Without a delay like that, loops will iterate as fast as they can, multiple times per frame, which causes performance problems.
==delay/wait
oh i see, that is very interesting
like a mouse macro
where you set a delay in the code
talking about this, is that bad to use commands like while waitUntil, like, we should always avoid to use them?
btw, thanks for the help guys
No, you don't need to avoid them (although if an EH is available instead, it is slightly more efficient), just be careful and use safeguards to stop them running out of control.
Got it. thanks.
hmm, but doesn't the EH checks in each frame in the "background"?
I'm not sure exactly how EHs work internally - but they do work internally, in the engine code rather than in SQF, so it's way way more efficient than continually checking an SQF condition
aaa okay
I mean, "way way more" in terms of tiny fractions of a second, unless your condition is awful
Any loops you put inside an EH will only happen on the frame in which the event is triggered, so unless your loop takes more than about 1/60th of a second, nobody is likely to ever notice.
In computer time, that's forever.
I trsted this back in like 2014 having a loop that would calculate a square root of some arbitrarily huge number and ran it 1000 times every frame, worked fine.
I have a question regarding EH'S, specifically EachFrame.
I'd like to do something like
_myObject = <someObject>;
_mySecondObject = <someOtherObject>
addMissionEventHandler ["EachFrame", {
drawLine3D[getPos _myObject, getPos _mySecondObject,[1,1,1,1,]];
}];
But the objects return nuls.
According to the wiki you can pass variables to the event ha dler, but, according to the wiki
"Only arguments of simple types get proper serialization. Objects, Groups etc will not serialize and appear as NULLs on game load."
just to clarify, with this, my friends and other Ai won't cause the that effect on bots, just me?
Correct.
perfect, i can't thank you enough
Serialisation is for the save/load system. If you're not dealing with that then you don't need to worry about it. It's not what's causing your nulls here anyway - that's because the scope where you define the variables is a different scope to the EH code scope. You need to pass variables as arguments if you want to transfer local scope variables to the EH code.
Ah, okay. Reading the wiki made me think it wouldn't work.
Thanks
By the by, is there a language syntax you can use in discord to make sqf pretty like you can with lua
Str = "See, pretty pretty colors"
Tab = {"this extends","to tables","and numbers",0,45}
Str="and even functions"
Local function thisIsAFunction ()
Str="more pretty colors"
Return str
End```
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Hmm, that doesn't seem to work as I rememeber...
Wait a minute, you already used the SQF highlighting like 3 messages ago :U
Discord doesn't show syntax highlighting on mobile
something something too busy ruining the username system to make their actual useful features work properly
Huh, I thought it used to when I wrote a bunch of scripts for DCS (hence the lua).
Oh well.
Apparently they briefly added it to a limited beta branch 3 years ago and then never mentioned it again
That checks, that's when I was heavy-heavy into scripting.
funny thing about the script, it works on everything perfectly, but not on the Antistasi mod
the first shot removes the helmet (???) then the second knocks them out
it removes the helmet even if i shot the let or chest lol
In other news,
I have a simple respawn script for my AI units (for reasons) and currently it just respawns them where they started, and then I essentially cheat to teleport them where needed (either my group or a high-command group)
Does anyone have a canned script to instead handle respawns by spawning a helicopter, then spawning the u it in the helicopter, then having the helicopter drop them off an despawn?
I could write one myself but it's a lot of work somebody has probably done already.
how can I convert the getDir value to a XYZ vector without the actual target position? For whatever reason camPrepareDir does not work and, and camSetDir does not accept the direction value anymore.
It's a script thing from antistasi
antistasi has it's own way of handling AI
My goal is to convert the position and angle/direction of 3den camera to the "cinematic" camera without the hassle of placing target helpers around.
that's exactly what i was thinking
core/functions/Revive/fn_handleDamage.sqf
https://community.bistudio.com/wiki/BIS_fnc_rotateVector2D can probably do what you need (keep in mind the note at the bottom). Though you might struggle to get an XYZ (3D) vector from a 2D direction command.
managed to grab this with https://community.bistudio.com/wiki/vectorDir, seems pretty on point
Hey, does anyone know what the types available are for nearestObjects? Thanks 🙂
Pretty much everything CfgVehicles has to offer
Specifically, I'm looking for all bridge_asphalt_02_center_f objects. But I'm not sure what it falls under - or if there's a different way to search for them.
If that's the classname of the object then that's what you should use to search for it
[configFile >> "CfgVehicles" >> "bridge_asphalt_02_center_f", true] call BIS_fnc_returnParents;```
That returns an empty array. I might have to just manually search aha
Thanks for the help anyway guys 🙂
Objects that are part of the map and not Editor-placed might not be detected by nearestObjects, and also they aren't always properly associated with a config class. Sometimes they're a more "raw" object - even if a config class version of that object also exists.
It's detected, it's the same way that I've done it before - my dumb ass just can't remember how I did it lol. But I appreciate it mate 
makes a lot of sense, thanks for the explanation
Antistasi has its own handleDamage handlers. Only one can override damage.
Similar if you were running with another revive mod, or ACE.
any workaround for that?
like deleting that line of code
side question, how can i disable things i don't want in ACE?
statement="[this,'WBK_exo_take',25] spawn EPSM_PlaySounds; this playActionNow 'Exo_Gest_ACTIVATEEXO'; this setVariable ['WBK_AdvancedArmor',100,true]; this setVariable ['WBK_JumpPackPower',100]; this spawn WBK_EPSM_AdvancedArmour_Load;";``` Im having trouble finding where it constitutes what "WBK_AdvancedArmor" is and how I would add something to it. Would anyone have any idea? if not, how would I have it check for a specific piece of equipment instead? like " If _unit Player has Exo_Suit_Variant2 "
Medic On Me: we Got A Man Down
The settings, or making your own custom build of ace
like unpacking, removing the things i don't want and packing it back up?
You wouldn't need to unpack anything, you shouldn't touch anything inside the pbos themselves
You can likely achieve what you want via settings though
Depending on what it is
mostly remove ui stuff, wind dispersion and whatnot
could also just remove the pbos
Just disable those in the settings
but if i join a friend that has those on, wouldn't change
There's an option to force settings on servers / missions
even if im not the host?
If it's a per client setting, then it would use yours unless the mission or server forced it to a certain value
If it's a global setting, ask the host to change it
i'm going to take a look at it
Question, once a player has been killed and sent to the "select respawn" screen, is there a means to close that interface and give them control of the dead body again?
I have 2 scripts that needs to have info in the init file. how do I fix so both scripts work?
/ I don't know shit about scripts haha
Run two scripts so it will run two scripts
If you seriously don't know how it works, tell your current script. Otherwise the answer remains the same. Run these two
I have no idea to fix this.. this is the scripts I have and the one thats named "script1" is supposed to be in the init file but I already have info in the init
exactly, I dont know how to add to the init so the script1.sqf is working
[] execVM "respawnmkr.sqf";
[] execVM "script1.sqf";```
thanks! that worked! Now i have to fix the script it self haha
The line of code we have does not seems to work. It Is suppose to remove the fog but the only thing we see Is the action button with no action. The line of code Is down below...
this addAction
[
"It's just a weather balloon, agent Mulder",
{
[0, [0, 0, 0]] remoteExec ["setFog", 2];
},
nil,
1.5,
true,
true,
"",
"true",
3
];
First thing first, make it sure the code is actually running. Just hint or systemChat etc
no need for fog (but needed for clouds, rain etc)
POLPOX selectRandom Works perfect in the addMissionEventHandler Thx for you help
I have a script that I cant get to work, anyone who can help me?
You need to tell how it is not working
sorry! haha
I get the function in the scroll wheel menu, so I can choose "recruit", but it wont show up any reinforcements around me
do you mean "Call Reinforcements"? recruit isnt even mentioned in that script
Are you sure the action is not working
yes, sorry, meant "call reinforcements"
aint no one showing up haha
could it be connected to these two?
yes
instead of calling script1.sqf in your init just run the spawnReinforcements.sqf
so, like this?
(bear with me, I'm really REALLY new with scripts)
correct
Does anyone have an idea how to make it so that an action that is tied to a memory can only be displayed if you look at the selection with that memory?
I want to make the same behavior for addaction as for door actions from the configuration.
Try hiding actions unless you have needed selections in the middle of the screen or something?
No guesses at all
haha! I'm exploding now... now it wont even show up haha
is respawnmkr.sqf working?
and spawnReinforcements.sqf is in the same folder as that and init.sqf?
I need me to look only at the door.
Now the actions appear even if I don't look at the door.
yes, both respawn and no stamina works
Does the firedNear EH work when a bullet is shot with its trajectory near a unit, or does it have to be the weapon itself firing near the unit?
All of my testing seems to confirm it's the latter, is there a another way to to replicate the former?
most likely with the "suppressed" EH yes
dose anyone have any code that uses a trigger zone to teleport? Working with a small group where we want to respawn on ships and want it to be able to copy and paste between maps.
That's just a player setPosASL (getPosASL <someObjectName>) in the trigger
@granite sky bro, i don't know why, but the script its not working anymore, gives me no errors, but it doesn't work at all
the script that adds a magazine once i shoot the last bullet works
but the damage one is not working, it was working before and now just stopped
since both scripts are in the same file, and one of them is working, then i have no solution so far to what is the problem
We have the fog on for players to get a break from air pilots. We also gave the players the ability to turn It off as well by getting to a site and activating It If they do not want to wait the 40 mins or so.
I am sorry, I did not quite understand where to place this.
Within your addAction
He meant that forceWeatherChange is not needed for changing fog, not that you don't need fog
Purely curious, but does anyone know why some instances are spelt dammaged, like the EH, for example?
Someone in the early days of Arma development wasn't very good at spelling
BI is a Czech company, so for many of the developers, English isn't their first language. These days they've standardised more on developing in English, so devs are better at it and there are more English-speakers around to catch mistakes, but back then it was a smaller operation and working in English wasn't necessarily required (see: selection names being in Czech).
(also, as a smaller and less mature company at the time, in a games industry that was much less mature than it is today, things would've been done more ad-hoc, with less oversight and QA)
plus everything has to have a diff name
Does anyone know of a script that allows you to select and spawn on other members of your group?
I have one sorted for spawning on the SL and Commander but would like to have one for each group member in case the SL goes down...
Similar to Battlefield style of respawn system, and if it can check for hostiles nearby and disable it with a message thatd be even better.
If there is no such readily avaible script could someone point me in the right direction on where to go to create one?
Also if the respawn position is created how would I get it to have the name of the Player?
it was a reply to someone else
Is there a way to check what team a unit is in?
assignedTeam (https://community.bistudio.com/wiki/assignedTeam) doesn't work on units not in the local player's group although when you leave and region a group, the assigned team is not forgoton / does not change. Is there any other place this information is exposed?
Players on the same group all know each other's team, so it seems odd that it's limited to that.
It definitely is synced to some extent, as you can join a non-local player's group and access the teams there (if defined)
no SW mention/media, thanks
I was asking for scripting help big rip
see attachTo 🙂
is there no way to add like weight to stop it flying like crazy? idk im not a scripter and dont really want to attach it to anything
you could attach it to something invisible, e.g a game logic
otherwise see setMass perhaps
alright I will try it thanks
Is there a way to prevent the AI from acquiring targets on its own? I've tried turning off AUTOTARGET but the drone it's disabled on (disabled for the AI crewman inside as well as the vehicle, not sure if they're linked) will still spot targets and engage them
Do you use it on the drone itself or its driver/gunner?
The idea is that it only "sees" targets I reveal and assign with a script. But it might be easier to just disable the weapon until it sees the right target
It's in the editor right now, so I can only use it on the drone. in initServer I disableAI on the drone. checkAIFeature on both the drone and the crewman returns false
You could turn off CHECKVISIBLE but I expect that'd prevent it shooting even once units are revealed.
Well, they definently still shoot....these are AA guns and radars, so it's probably something to do with the radars, but they still have a bit of spotting capability on their own
forgetTarget in every frame should work. there is new command also coming for this
open heart surgery with a hammer huh
Vehicle with integral radar?
Yeah it has internal radar. I can actually probably just disable it and all datalink, just have targets get revealed by script.
Did some tests. CHECKVISIBLE does normally prevent firing even after reveal 4 by both foot troops and those in 50cal turrets.
They'll turn towards & aim but won't shoot.
Would be a lot better if that was two separate flags. Then you could do your own target-list management easily.
tried setting its behaviour to force hold fire?
* combat mode, not behaviour
driver this setCombatMode "BLUE";```
yeah, that's an alternative to do it manually but not exactly what im looking for. think I have a better solution
How does one properly set up sqf functions and and event handlers because I am having trouble getting my script working
The function is supposed to use the reload and firedman event handlers to execute the script when a certain magazine is fired but it isn’t executing
I have debug hints after each event handler but neither are being triggered
The function is viewable in the function viewer and when run in game with the advanced developer tools mod it doesn’t pop up with any errors
In the config I have
cfgfunctions class -> tag -> function root -> then the function init {}
Extended preinit EH for the player controlled variables which is working
And then the cfgammo and cfgmagizines classes that are both working as they should be
Not entirely sure from that where you're installing the event handlers.
You can't install Reload or FiredMan from a preinit function directly because units don't exist at that point.
where would I need to install it is that something that is done in the config like inserting it into the base soldier class right now I only have things in the sqf file with _player addEventHandler
~~I have a wild idea, and I don't know if anyone has already looked into this.
https://steamcommunity.com/workshop/filedetails/?id=2915485125
https://community.bistudio.com/wiki/Reaction_Forces/Modules_and_Functions#Wildfire
Imagine a mission wherein certain weapons fired into certain areas had the capabity to spark a fire using the Wildfire module. Anyone who's played Far Cry 3 may recall a mission where you go through a weed farm and torch the place. I'd like to replicate that idea in ArmA 3, but I haven't the foggiest idea where to get started.
I'd be willing to pay anyone who can make a proof of concept. Current bounty is a modest $50 but if you think you can pull it off and want to ask for more on success, DM me to ask about it. I got too much on my plate right now to investigate the idea myself.
I would like to use the wildfire module mainly because you can also extinguish those fires, but I'd be willing to hear out other solutions or existing mods, I just won't pay the bounty for those.~~
Just use CBA's extended event handlers, the setup itself is purely config
That would almost guarantee to break the EULA
What?
Why on Earth would that break EULA? I'm not asking for things to be ripped. I'm asking to use existing assets and modules.
Whoever did it would probably write their script and test it in arma
That or you'd be paying for untested script(s)
hey guys
can somebody tell me why my script gives a "missing ]" error ? I can't find any syntax error
this addAction ["Commencer la mission", {player setPos (getPos rr)}; titleText ["<t size='5.0'>In the grim darkness of the far future</t><br/><t size='5.0'>there is only war</t>", "BLACK IN", 0.5]; ];
so putting it in the Extended_Init_EventHandlers -> CAManBase -> reference to script?
you can't separate arguments with ;
It's missing a ] in the addAction command
this addAction ["Commencer la mission",
{player setPos (getPos rr)}];
then you get an extra ]; in the last line. Doesn't make sense in general then 
just remove the last ]
there is a closing ] at the end of the script for that, because I want the addaction to have multiple fonctions
ah
then why are you closing the } in the second line?
this addAction ["Commencer la mission",
{player setPos (getPos rr);
titleText ["<t size='5.0'>In the grim darkness of the far future</t><br/><t size='5.0'>there is only war</t>", "BLACK IN", 0.5];
}];
I mean just using Extended_Reloaded_EventHandlers, or whatever other relevant EH
Here's a GetIn example from the CBA XEH wiki page
class Extended_GetIn_Eventhandlers
{
class XYZ_BRDM2
{
class XYZ_BRDM2_GetIn
{
scope = 0;
getin = "[] exec '\xyz_brdm2\getin.sqf'";
};
};
};
doesn't make sense to me, but at least it seems to work, thanks
the second element from addAction is a code, that begins with a {and closes with }, you were closing the code in the second line in your script.
this addAction ["someName",
{SOME_COMMAND; ANOTHER_COMMAND}]
makes more sense now, I thought the { was only for setpos, thx
gotta figure out now the structured text, it's giving me a bit of trouble but I think I can handle
the setPos is a command that can be put into a {code}
hmm ok when I read through that part of the wiki I missunderstood that part will play around with it
Hi, i wish to create a script compat mods between PiR and Zeus Enhanced:
For the hurting part :
/*----- Hurt Unit -----*/
function hurtUnit
{
params ["_unit", "_shooter", "_selection"];
_unit = unit name;
_selection = "head";
_shooter = _unit;
_unit setDamage 0.9;
if ((!(PiR_DamageAllow_on) && (str (isDamageAllowed _unit) == "true")) or (PiR_DamageAllow_on)) then
{
if (isplayer _unit) then
{
[_unit, _selection, _shooter] remoteExecCall ["PiR0", 2];
} else
{
[_unit, _selection, _shooter] remoteExecCall ["PiR", 2];
};
};
};
/*---- ZEN SIDE ----*/
private _hurtAction = [
"[PiR] Hurt Unit",
"Hurt selected unit",
"\a3\ui_f\data\igui\rsctitles\mpprogress\timer_ca.paa",
{hurtUnit (selectedUnit, player, "head")}
] call zen_context_menu_fnc_createAction;
[_hurtAction, [], 0] call zen_context_menu_fnc_addAction;
First the script looks good ?
I'm good on code but not with A3 directly (for differences)
Second, how i need to create/organize my mod ? I'm not really understand about cpp and minimum requirements
Third, can i try my code in game ?
Even the script for damage has to be set in a init.sqf file inside the mission folder?
uh
Im asking cause ive set that init inside a mod that loads every time i enter a mission
You can spawn something in preinit (well, preferably postinit) that waits for the player object to exist.
That would be the easiest option, although not entirely ideal.
Could be the cause why is not working properly
Sometimes it works and the bullet kills, sometimes it just takes 5 to 6 shots to kill
So im guessing the way i implemented it is very wrong
Also because the script im using affects the units that spawn
Side question, should i delete the progress made in a mission every time i make a change in the script?
I created it :
class CfgPatches {
class PiR_ZEN_Compat {
units[] = {};
weapons[] = {};
requiredVersion = 1.0;
requiredAddons[] = {"zen_context_menu"};
};
};
class CfgFunctions {
class PiR_ZEN_Compat {
class Functions {
file = "\PiR_ZEN_Compat\scripts";
class healUnit {preInit = 1;};
class hurtUnit {preInit = 1;};
};
};
};
But when i start in game, it give the error: Script \PiR_ZEN_Compat\scripts\fn_healUnit.sqf Not Found
Simple, either the path in your addon is wrong, or your script path is wrong
If it's this, then the cause is because you're just defining code in mission names pace, not creating a distinct file for the function
so yes, i fiixed this part
I create files for heal and hurt
Show your folder setup
Preferably in something like vscode to show files inside of folders
now i have an error line 3, it's about params, but i don't understand the order he want
Just do something like systemChat str _this to see what arguments are passed
it's directly when i enter in 3den, i've the error
#arma3_scripting message code here
Then those parameters are nothing like what is being passed
The parameters you can actually access are listed in https://zen-mod.github.io/ZEN/#/frameworks/context_menu?id=statement-and-condition
Then that's very wrong, because there is no function command in sqf
And you wouldn't create a variable for the function in itself, that's what CfgFunctions is for
so how i organize my code, if i unput the function, where i need to put the zen call part ?
It would be better to have a separate function that creates the context menu actions, which would then call their functions in their statements
So something like:
// fn_initActions.sqf
private _action = [..., {_this call PIR_ZEN_Compat_fnc_hurtUnit}];
[_action, [], 0] call zen_context_menu_fnc_addAction;
Then you just have that one function run in preinit
lets go try
23:30:27 Error in expression <_shooter", "_selection"];
_unit = unit name;
_selection = "head";
_shooter = _u>
23:30:27 Error position: <name;
_selection = "head";
_shooter = _u>
23:30:27 Error Missing ;
23:30:27 File PiR_ZEN_Compat\scripts\fn_hurtUnit.sqf..., line 5
23:30:27 Error in expression <_shooter", "_selection"];
_unit = unit name;
_selection = "head";
_shooter = _u>
23:30:27 Error position: <name;
_selection = "head";
_shooter = _u>
23:30:27 Error Missing ;
23:30:27 File PiR_ZEN_Compat\scripts\fn_hurtUnit.sqf..., line 5
23:30:27 Error in expression <les\mpprogress\timer_ca.paa",
{healUnit (selectedUnit)}
] call zen_context_menu_>
23:30:27 Error position: <(selectedUnit)}
] call zen_context_menu_>
23:30:27 Error Missing ;
23:30:27 File PiR_ZEN_Compat\scripts\fn_initActions.sqf..., line 6
23:30:27 Error in expression <les\mpprogress\timer_ca.paa",
{healUnit (selectedUnit)}
] call zen_context_menu_>
23:30:27 Error position: <(selectedUnit)}
] call zen_context_menu_>
23:30:27 Error Missing ;
23:30:27 File PiR_ZEN_Compat\scripts\fn_initActions.sqf..., line 6
this kind of logs
error in expression it was with talked before (https://zen-mod.github.io/ZEN/#/frameworks/context_menu?id=statement-and-condition) ?
no
i forgot some ;
This is wrong:
_unit = unit name;
Why
I don't know what it's supposed to do. unit could be global variable but shouldn't be. name is a unary command.
Hi 🙂 I love this mod but... When mod is loaded on dedicated exile server it overides server time and sets it to 12:00. This has been tested with no mods other than cba and PIR. I cannot tell when this behaviour started since I dont have access to older versions. Is it possible that you could send...
it's the original sharing
It's wrong.
Well that code is just wrong
Ha
As we don't know what the functions "PiR0" or "PiR" expect, we can't fix it.
You get the array of units that are selected for the action, so you'll (presumably) want to do X thing to every unit in that list
i've the 2 functions
PiR & PiR0 have the exact same params part
IF (!isServer) exitWith {};
params ["_unit","_selection", "_shooter","_shans", "_anim", "_armor"];
// Назначение действий на попадание ИИ
IF ((str ([".p3d", (str _unit) ] call BIS_fnc_inString ) == "true") && !(alive _unit)) exitWith {
remoteExecCall ["", PIRjipId];
[_unit, {
_ehId = _this getVariable ["hitPartEhId", -1];
IF (_ehId >= 0) then {_this removeEventHandler ["HitPart", _ehId];}
}] remoteExecCall ["call"];
};
IF !(_unit getVariable ["dam_ignore_injured0",false]) then {
_unit setVariable ["dam_krov_statys",0,true];
_unit setVariable ["dam_ignore_HealEffect0", 0,true];
...
Well, you can see there that _unit is supposed to be an object, not a string.
so _unit
Ah I see, the example isn't complete code. You're supposed to be setting those three inputs yourself.
during my call with zen action
God knows whether any of this ancient trash is correct though.
str (isDamageAllowed _unit) == "true", really
i didn't judge, i try to adapt a compat with no documentations and as my first sqf
yeah maybe not the place to start :P
i've 10yo of C, so it's not a problem, i need to adapt how the arma needs
and also, this compat is a big need
well, if you want to use that first chunk of code as a function, just remove the three lines after the params.
// Create heal unit action
private _healAction = [
"[PiR] Heal Unit",
"Heal selected unit",
"\a3\ui_f\data\igui\rsctitles\mpprogress\timer_ca.paa",
{healUnit, _hoveredEntity}
] call zen_context_menu_fnc_createAction;
// Create hurt unit action
private _hurtAction = [
"[PiR] Hurt Unit",
"Hurt selected unit",
"\a3\ui_f\data\igui\rsctitles\mpprogress\timer_ca.paa",
{hurtUnit, _hoveredEntity, _hoveredEntity, "head"}
] call zen_context_menu_fnc_createAction;
// Add both actions to the context menu
["Custom Modules", "[PiR] Heal Unit", _healAction] call zen_custom_modules_fnc_register;
["Custom Modules", "[PiR] Hurt Unit", _hurtAction] call zen_custom_modules_fnc_register;
["Custom Modules", "TEST HINT", {hint str _this}] call zen_custom_modules_fnc_register;
[_healAction, [], 0] call zen_context_menu_fnc_addAction;
[_hurtAction, [], 0] call zen_context_menu_fnc_addAction;
I'm blocked here, looks like that the module ZEN doesn't recognize it
It’s really not easy to start script for A3 in 2024, lot of documentations who everyone is against everyone 
To create a custom module it would be something like this in InitplayerLocal.sqf
["Custom Modules", "[PiR] Heal Unit", {
params [["_pos",[0,0,0]],["_object",objNull]];
if (isNull _object) exitWith {
["You have to place this on Vehicle or Unit", []] call zen_common_fnc_showMessage;
};
_object setDamage 0;
hint format ["%1 has been heald",_object];
},"x\zen\addons\modules\ui\truck_ca.paa"] call zen_custom_modules_fnc_register;
You can read more here: https://github.com/zen-mod/ZEN/blob/master/addons/context_menu/functions/fnc_createAction.sqf
And here:
https://zen-mod.github.io/ZEN/#/
and where i put this InitPlayerLocal ?
In your mission folder
it's a mod i've
you are makeing a mod or a mission ?
a mod
What works and what doesn't here?
what works, i don't know.
What doesn't here, the module inside the Zeus Menu
Do the context menu actions work?
where's supposed to be the context menu ?
Right-click.