#arma3_scripting
1 messages · Page 177 of 1
guys can you please tell me how to display the countdown on a tv screen (ui on texture) instead of hint, i cant figure it out 
0 spawn
{
[10] call BIS_fnc_countdown;
while {([true] call BIS_fnc_countdown)} do
{
private _remainingTime = [0] call BIS_fnc_countdown;
hint parseText format ["<t size='2.0' font='LCD14' shadow='2'>%1:%2</t>", floor _remainingTime, ((_remainingTime % 1) * 100) toFixed 0];
sleep 0.1;
};
hint parseText "<t size='2.0' font='LCD14' shadow='2'>00:00</t>";
};
I am kinda confused.. What do i have to do? Thats the scirpt i have rightnow. _tanks = nearestObjects [getPosATL thisTrigger, ["Tank"], 1000];
if (count _tanks > 0) then {
_tank = _tanks select 0;
_bombsInWave = [5, 15, 20, 20];
{
_bombCount = _x;
spawn {
for "_i" from 1 to _bombCount do {
_randomPos = [
(getPosATL _tank select 0) + (random 100) - 50,
(getPosATL _tank select 1) + (random 100) - 50,
50
];
_bomb = "Bo_GBU12_LGB" createVehicle _randomPos;
sleep random 2 + 1;
};
};
sleep 1;
} forEach _bombsInWave;
};
Oh okay, I thought this wouldn't interrupt other functionally but just add a new keydown event to that key?
private _nearestTank = nearestObjects [thisTrigger, ["Tank"], 1000] param [0, objNull];
if !(isNull _nearestTank) then {
_nearestTank spawn
{
params ["_nearestTank"];
private _bombsInWave = [5, 15, 20, 20];
{
_bombCount = _x;
for "_i" from 1 to _bombCount do {
_randomPos = [
(getPosATL _nearestTank select 0) + (random 100) - 50,
(getPosATL _nearestTank select 1) + (random 100) - 50,
50
];
_bomb = "Bo_GBU12_LGB" createVehicle _randomPos;
sleep random 2 + 1;
};
sleep 1;
} forEach _bombsInWave;
};
};
Untested
Thankyou I will test#
Works very well!!
Thank you very much
And if you see differences to your code.
_nearestTank spawn { //defining args and pass those (_nearestTank)
params ["_nearestTank"]; // use defined args in spawn
..
Local variables declared in the main scope are not available in the spawned code. You have to pass them as parameters:
Thankyou very much!
I end up coding this
private _array = [ "a", "a", "b", "c" ];
private _first = _array # 0:
private _yes = _array findIf { _x isNotEqualTo _first } isEqualTo -1;
you can also do:
count (_array - (_array param [0, 0])) == 0
if your array is large your own solution is better. if it's small, mine is better
(count (_array arrayIntersect _array)) == 1
I guess it should be <= 1, since his code would work for empty array (mine does too)
also this might be slower because it's O(n2). mine is O(n). His is O(1) to O(n) in worst case
wow holy cow you guys are Awsome holy C++
you guys get a A+ for C++ he he
now next is C# oh Sh*t
None of this is C++. Arma 3 uses some C variant for its internal engine code, but we're working with SQF, a proprietary language designed specifically to work as the user-accessible scripting layer for the engine.
please some help
i get an error saying: probably badly formed texture name
0 spawn
{
private _displayTexture = "#(rgb,1024,1024,1)ui('RscCountdownDisplay','CountdownText')";
tablet1 setObjectTexture [0, _displayTexture];
[60] call BIS_fnc_countdown;
while {([true] call BIS_fnc_countdown)} do
{
private _remainingTime = [0] call BIS_fnc_countdown;
private _timeText = format ["%1:%2", floor _remainingTime, ((_remainingTime % 1) * 100) toFixed 0];
(uiNamespace getVariable "RscCountdownDisplay") displayCtrl 1345 ctrlSetText _timeText;
sleep 0.1;
};
(uiNamespace getVariable "RscCountdownDisplay") displayCtrl 1345 ctrlSetText "00:00";
};
How does sqf scripting works? do codes run async by default, if not is there a way to do it? like if i have a while loop running a check, does it slow the flow of a heavily scripted scenario with heavily scripted mods?
SQF is entirely synchronous
so is there no way to run a specific script async?
No
That's not async though
it will just run the script at the moment i call it, but it will not let other codes keep running
@foggy stratus, @open hollow This is my update to you guys regarding the zero gravity script and it's progress. You can hopefully see the further improvements since last time
https://www.youtube.com/watch?v=dXO_vM-euW0
Again if you view the description of the video you can see what things I want help with, so any help in that regard would be greatly appreciated
Also this is my next major problem I want to resolve so any ideas how to solve this would be appreciated
How can I adjust a player’s (weaponDirection) aka up/down (pitch) aim direction in Arma 3 while they are attached to an object, so that only their torso rotates—just like normal free-aim—without moving their feet or the entire character model?
Currently, when a player is attached to an object, their aim direction is “locked in,” and using commands like setDirAndUp rotates the entire body (including the feet). I’m looking for a way to replicate the natural behaviour where only the torso rotates up and down, while the player remains attached to the object and their feet stay planted.
DISCLAIMER: The music used in this video is not owned by me. This is a non-commercial usage, and all rights remain with Bungie
Song Used: Deep Stone Crypt Lullaby - Bungie. All rights reserved.
Advanced Zero Gravity Script Development for Arma 3
I am currently developing an advanced zero-gravity script for the game Arma 3. While this project ...
That looks amazing, fantastic work. One possibility for torso moving while aiming is to mod a new invisible vehicle that has a standing gunner position (like in the back of trucks). Force player to mount the invisible vehicle as gunner, and your movement code moves the floating vehicle.
Also are you attaching to an object or a game logic? When I attach AI to an object, their animations get wonky. When I attach AI to a game logic, the animations are clean. Maybe with player there might be some difference also.
Currently it attaches the player to a PhysX object that’s just not got a ViewGemotry or RenderLOD but still has a PhysX and other lods to cause normal collisions
It is what Arma has in place of async. If you want to do things that are async-like, understanding the scheduler is where you need to start.
awsome work dude
Need some help here 😵💫
Does createDisplay "RscCountdownDisplay" work?
Your Ctrl is rscText control or rscStructuredText Ctrl?
You are missing command for update your UI
displayUpdate _display;
0 spawn
{
private _displayTexture = "#(rgb,1024,1024,1)ui('RscCountdownDisplay','CountdownText')";
tablet1 setObjectTexture [0, _displayTexture];
[60] call BIS_fnc_countdown;
while {([true] call BIS_fnc_countdown)} do
{
private _display = uiNamespace getVariable "RscCountdownDisplay";
private _remainingTime = [0] call BIS_fnc_countdown;
private _timeText = format ["%1:%2", floor _remainingTime, ((_remainingTime % 1) * 100) toFixed 0];
_display displayCtrl 1345 ctrlSetText _timeText;
displayUpdate _display;
sleep 0.1;
};
private _display = uiNamespace getVariable "RscCountdownDisplay";
_display displayCtrl 1345 ctrlSetText "00:00";
displayUpdate _display;
};
i have the below inside description.ext:
class RscTitles
{
class RscCountdownDisplay
{
idd = -1;
duration = 99999;
movingEnable = 0;
enableSimulation = 1;
fadein = 0;
fadeout = 0;
onLoad = "uiNamespace setVariable ['RscCountdownDisplay', _this select 0];";
class Controls
{
class CountdownText
{
idc = 1345;
type = 0;
style = 0;
x = safezoneX;
y = safezoneY;
w = safezoneW;
h = safezoneH;
font = "LCD14";
sizeEx = 1;
colorText[] = {1, 1, 1, 1};
colorBackground[] = {0, 0, 0, 0};
shadow = 2;
text = "00:00";
};
};
};
};
error says undefined variable: #_display displayCtrl 1345 ctrlSetText _timeText;
Displays don't use RscTitles, do they?
You just dump their config straight into the root.
If it doesn't work with createDisplay then it's not going to work with ui-to-texture.
yes youre right, it does work that way
it doest found you display on start, but if you wrap
0 spawn
{
private _displayTexture = "#(rgb,1024,1024,1)ui('RscCountdownDisplay','CountdownText')";
tablet1 setObjectTexture [0, _displayTexture];
[60] call BIS_fnc_countdown;
while {([true] call BIS_fnc_countdown)} do
{
private _remainingTime = [0] call BIS_fnc_countdown;
private _timeText = format ["%1:%2", floor _remainingTime, ((_remainingTime % 1) * 100) toFixed 0];
private _display = uiNamespace getVariable "RscCountdownDisplay";
_display displayCtrl 1345 ctrlSetText _timeText;
displayUpdate _display;
sleep 0.1;
};
private _display = uiNamespace getVariable "RscCountdownDisplay";
_display displayCtrl 1345 ctrlSetText "00:00";
displayUpdate _display;
};
No error anymore
with
sizeEx = 0.45;
thank you very much!
Is there a command that grabs the first attached object it finds on an object????
If so TYYYY
just attachedObjects _object select 0
AHHHHHH TY
To active trig by entering 3veh
Its true code for cond?
This and [v1,v2,v3] in thislist
No, you should check each vehicle.
Looking for some help on keeping modded keybinds to a certain class of vehicle. We have a script that is supposed to check if the helicopter can deploy a hoist hook which works for using the ACE interactions for the hoist. But if a player uses the modded keybinds we've added for the hoist hook, they can deploy it on any helicopter
I have this line
if !(_vehicle iskindOf "vtx_h60_base") exitWith {};```
I tried putting it in that script that checks if it can deploy the hook but still doesn't work
I've also tried with _heli
Gotta provide more than just a snippet of code.
How does the modded keybinds play into this? I understand that you are using the ace interaction system?
So this is the canDeployHook script that was made to make sure only our helicopter can use the hoist
/*
* Author: Ampersand
* check if heli is able to deploy hook
*
* Arguments:
* 0: Helicopter <OBJECT>
*
* Return Value:
* 0: Success <BOOLEAN>
*
* Example:
* [_heli] call vtx_uh60_hoist_fnc_canDeployHook
*/
params ["_heli"];
//if !(_heli iskindOf "vtx_h60_base") exitWith {};
private _hoist_vars = _heli getVariable ["vtx_uh60_hoist_vars", []];
if !(_hoist_vars isEqualTo []) exitWith{false};
if (_heli animationSourcePhase "hoist_hook_hide" != 0) exitWith {false};
true```
We've normally had the hoist be utilized through ACE Interactions but recently we added the Arma modded keybinds to replace CBA keybinds
The ACE Interactions still function as intended but we added the modded keybinds for better HOTAS support
But when a player uses the modded keybind in something that isn't our helicopter, it still functions so it deploys a hook like on the Apache above
Would anyone have any clues on how I could go about having an object detect if it is hit by a specific weapon or round? I want to create a mining/salvage system but can't find anything that would be specific enough as even a starting point
If you need to run loop to check for something on repeat.
You can use spawn command to spawn new thread for your loop, so the rest of the script can run at the same time.
And you can use sleep command inside of loop to pause on each iteration, so it doesn't eat to much performance.
Like mine/salvage when you only have a specific weapon ? You could just check that if the player has the specific type of weapon you want in hand they can mine/salvage.
Or you can maybe detect the projectile and get its type ? I know that with the EventHandler HitPart you can get the projectile Object https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart
Yeah something like that, but I was hoping to not have it as an action dependent on a weapon or trait, more that we have a laser weapon that would work perfectly as a "mining/salvage" laser and was hoping to have it so only THAT weapon shooting the object would generate the resource
maybe try to get the type of the ammunition and only generate the ressource if the type of the ammunition is the correct one.
I'll have to learn how, event handlers are completely new to me, but hitpart seems to be what I need
Maybe there is another function or EventHandler that could do better than HitParts. I'm mostly use Hitpart to show that you can get the projectile Type. You could do you own eventHandler with CBA.
This goes a bit beyond my capabilities xD
Hey how would i make the transport car drop off the troops and the drive back?
Dont know if theres any scripts needed
Transport crew in the separate group, give them transport unload waypoint and then move waypoint
Okay thanks
why isnt addMissionEventHandler "HandleDisconnect" or "PlayerDisconnected" triggered when leaving server in editor MP?
If i'm not wrong I believe those EH are Server executed. when you host a game from the editor, your client is the server. So by disconnecting the server doesn't execute. It's like it disconnected itself from itself. That's my understanding of it but I might be wrong.
If you connect another player while hosting a game from the editor you migth see your code execute
yeah you are right but I was hoping they would still trigger when the editor server closes... I tried switching to single player to "shutdown" the server but still nothing happen
Honestly if you want to test MP script use a Dedicated Server. You can host one on your own machine, I belive it's far better for MP testing than host in Editor.
yup i test with dedi all the time.
I must have forgotten that the EHs wont work in editor....
Pretty much every EH works in editor, just not the ones that executed server side only
and thats ok if I there is another way to detect game ending?
Maybe you could use missionEnd : https://community.bistudio.com/wiki/missionEnd
maybe have to test
i tried addMissionEventHandler ["Ended" but i guess that only triggers when the end commands are called
same with "MPEnded"
If I am not mistaken you can also run two instances of the game at the same time
Yes you can. There two tutorial on how to with a Self-Hosted and Dedicated https://community.bistudio.com/wiki/Multiplayer_Scripting#Player-Hosted_Server
But you need a good config to run arma twice at the same time and host a dedicated server.
I meant one instance running listen server and one being connected client. That should be possible
Listen server is still server, it should still run all the server side code. Heck even command isServer returns true even in singleplayer
I guess listen server shuts itself down immediately upon host's disconnect. That is likely why you don't see EH HandleDisconnect being fired when host disconnects
hm, can you intercept the put and Take (and exchanging the item?)
@queen cargo Agree 😛
I don't think I ever convinced localhost+client on the same machine to connect. DS+client is fine.
I think Leopard said localhost+client worked fine for him though, otherwise I'd have assumed it needed loopback=true, which you can't set.
I currently don’t have Wi-Fi in my pc so imma have to send this in a bogus ass way. I apologize before hand.
First one is drone script second one is bomb script
The bomb attaches perfectly fine BUT upon the drone getting destroyed “killed” mine doesn’t detonate :((
I would never place this in init
I was thinking of setting a getting the variable name then setting the dmg that way.
Lmk if that’s possible
Running right now! I had to try it. Now I might test my mission playing as client if it works. I am on Linux though, maybe that has some correlation 😀
You know for what "Variable Name" text box is for?
Yes to set the variable but as I place more instances of the object that variable is updated
and the script doesn’t see that automatically
_01 and so on
You want to have multiple bombs?
Multiple drones with one bomb
and it’s working great it just doesn’t explode each warhead
but if I set a variable name
nothing really wrong with naming them like drone_1 and so on
I think there are more thinks wrong, it looks like more advanced issue, which you don't have skills figure out yet
wait works?
its not that but ok lol
ok, that's great!
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
}];
So you need use
_closestUAV setVariable ["AttachedBomb", _closestBomb]; //Will save you object that you want destroy
_closestUAV addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
private _bomb = _unit getVariable ["AttachedBomb", objNull]; //will get your object from UAV
if (!isNull _bomb) then {
_bomb setDamage 1;
};
}];
Or you can get same way from attached object your bomb object.
private _bomb = attachedObjects _unit select 0;
if (!isNull _bomb) then {
_bomb setDamage 1;
};
_unit references object where you have added eventhandler.
params is way to get args what is used in events
Bro Tysm LOL
almost got discouraged 🫤
Bruh it was just workin Wtf
idk what I did now I gotta default back to my old script rq and apply what u said
ilyk if it works again 👍
Also guys theres a new ai bot that is really smart.. the bot fixed my issue in 2 tries
Its becoming more viral and people say that its better than chatgpt
SAY THEM NAME 😭🙏🙏🙏🙏
@stable dune GOT IT 👍
Glad it worked
If you mean that SQF specific ChatGPT thing, it's still ass
It doesn't even consider not as a valid thing in SQF
I bet he's talking about new china Deepseek AI
private _zones = allMapMarkers select {_x find "checkpointbox_" == 0};
{
private _unit = _x;
if (!alive _unit) exitWith {};
private _destination = position [allMapMarkers, _unit] call BIS_fnc_nearestPosition;
private _grp = group _unit;
private _desttogo = position _destination;
_grp move _desttogo;
} forEach allUnits;
Hello people. I am creating mission, in which mostly people move from one checkpoint-marker to another. I ve made logics for it, and now I am trying to make AI go from one checkpoint to another. I always get some error, could anyone please explain where is error? I want to make bot find the closest checkpoint(it is rectangle marker), and go there. Then repeat everything.
Game always says that some functions return incorrect types, but I think it is not only reason.
I am sorry for this horrible code, I am beginner.
Want to move all groups to closest map marker?
I want every group to move to the one which is the closest to THEM
so almost every group will have their own marker
Would give them waypoint rather then move command
I tryed it, had some problems. Is it AddWaypoint?
wait
{
private _nearestMarker = [ allMapMarkers, leader _x ] call BIS_fnc_nearestPosition;
_x addWaypoint [ markerPos _nearestMarker, -1];
} forEach AllGroups;
Ill try it now
Thanks
Thanks you both very much
maybe it was my error
because i was always getting error that types are incorrect
no need to check if unit is alive. It wont be in group nor in AllGroups
If you want to filter down the marker list then the line at the top is correct, I think:
private _zones = allMapMarkers select {_x find "checkpointbox_" == 0};
And then use _zones in the loop rather than allMapMarkers.
also, is it possible to check if some marker's color is not group team's color? Ive made it so, that When some group enters checkpoint, checkpoint's color changes to team's color(for example, if OPFOR then red, BLUEFOR is blue). Is it possible to go through all checkpointboxes but use only the ones which aren't in team?
So bots will go to not controlled checkpoints(if we say, that checkpoints colored in red, and team is OPFOR, then checkpoint is captured)
thanks
Your code could work, but there is no need to go through all units one by one and give it's group move commnad. More than one unit might be in the group. So you would give same move command multiple times to any group, which has more than one unit
I was getting error about incorrect type of _destination (in my code which I sent)
There was position instead of markerPos
That part also had incorrect precedence. It would have done (position [allMapMarkers, _unit]) call BIS_fnc_nearestPosition;
Unary commands (single parameter) are executed before binary commands (two parameters).
You can check marker color with markerColor
sqf is sometimes kinda weird with order of execution
you mean, like check marker color?
I think i know how to make it, but i dont know how to write so arma skips captured checkpoint, and looks for another closest one(i hope it is understandable), and check again if it is not captured
I dont know how to do that skip to another checkpoint
Nevermind, you are talking about some checkpoints and not makers
Ive connected it
it is like frontline
I've imagined markers for some reason
black arent captured by any team
red are captured by OPFOR
And this is situation now - that red squad on map has reached closest marker(i have done it so that marker is like a object, which is destination for squad), and it want go anywhere, because they are already at closest checkpoint
@granite sky These days one can do groups opfor, but this code was written before groups command was added into the game.
{
// Do something with opfor groups
} forEach (opfor call allGroupsSide);
To me it's bit weird that () need to be used in this case, since there is one possible way this code could get successfully executed. Hovewer rules say something else.
forEach isn't really a control structure. It's just a binary command.
SQF doesn't really have control structures :P
yep
So far worked very well for me
to fix my issues
It could be done based on marker color
It might not be the best solution, but it can work
Depends a lot on how it will fix those.
Chatgpt gives different solutions but those aren't good ones, so what did you ask and what did it answer?
How do you change marker colors?
The script was giving issue when I spawned in more than 20 so I ended up integrating the script with another drone mod using the explosive device as a charge
Idk if u can see it but
If u look VERY closely the mine is still attached. When the heat round goes off so does the AT mine
You can change the main explosive to what ever you want even a human being 💀
I changed the placement. ALRIGHT GOODNIGHT AND TY ONCE AGAIN 🫡🫡😴😴
can the HandleChatMessage EH fire on # server commands?
The HandleChatMessage event triggers when messages are received, not sent.
If I recall correctly, the chat commands only return something to chat on the person who sent the message, but I'm not sure if it triggers the event.
Edit: It does not trigger the event, just tested it with #login
off to make my own skimmer then with a custom macro for players to use
Hey, any way to do a sort of AttachTo and enable collision to the object being attached?
You mean collision with the object it's attached to?
there is a script/mod that solves this?
No script. Mod maybe
there is no way to change that "angle" via script?
what, like prevent units from aiming upwards when prone?
yea something like that
but also want to know if is posible to define that "angle" via script for the zeroG script from Jerry
https://steamcommunity.com/sharedfiles/filedetails/?id=2043707566
Something like this?
yep
thank you
Uhhhh no, the object being attached also doesnt have any collision / physics afaik. Will show later today
Its a vehicle being attached to a vehicle, basically a towcar towing a truck. It attaches the truck to the towcar but the truck loses the ability to collide. Which we make a use of
Its not solid anymore, anything can get thru it
Cant send code because I am not the lead programmer at all and I dont do the SQF of the server, im just tryna help out
It is a feature. Not something you can alter
Damn alright, ty tho
private _zones = allMapMarkers select {_x find "frontbox_" == 0};
// BLUEFOR then OPFOR then NEUTRAL(USED AS "IN BATTLE")
private _colorBlue = "ColorBlue";
private _colorRed = "ColorRed";
private _colorNeutral = "ColorWhite";
private _allUnits = allUnits select {alive _x};
{
private _marker = _x; // name for current marker
private _inZoneUnits = [];
{
if (_x inArea _marker) then {
_inZoneUnits pushBack _x;
};
} forEach allUnits;
private _teams = _inZoneUnits apply {side group _x}; // shitcode, all teams in checkpoint
private _uniqueTeams = _teams arrayIntersect _teams; // shitcoooode
if (count _uniqueTeams == 1) then {
private _team = _uniqueTeams select 0;
switch (_team) do {
case west: {
_marker setMarkerColor _colorBlue;
};
case east: {
_marker setMarkerColor _colorRed;
};
};
} else {
if (count _uniqueTeams > 1) then {
// in battle
_marker setMarkerColor _colorNeutral;
}
};
} forEach _zones;
[] spawn {
while {true} do {
execVM "scripts\check_marker.sqf";
execVM "scripts\ai_move.sqf";
sleep 5;
};
};
init.sqf
I though that maybe it could be possible to rename checkpoints(markers) after someone captures them, for example frontboxBLUEFOR_1, but I didn't find anywhere information how to rename objects
It's blufor btw😄
What do you mean? The markers are not deleted
in this household we call it WEST
You can copy them
I dont really understand
But the name doesn't matter in the end does it?
Maybe, in first line of script i sent, change private_zones to search not "frontbox_", but "blufrontbox_"
so it looks for closest blufrontbox object
But you still need to loop over all of them to update the status, don't you?
So why do you need to check the closest first?
I want AI to be able to find closest marker(square, checkpoint) too him, which doesn't belong to his team
I see
Now i only know how to make it go to closest square, but problem is, that when it reaches it, it wont move anywhere, because when looking for new closest square, bot will stay in already captured square as it is closest one to bot
I'd store the markers together with their current status (blu, opfor, neutral) in an array and sort it by distance.
You need to only look for none captured points.
I don't see variable _allUnits used anywere and allUnits only returns alive units, so no need to check if alive
thanks
maybe i simply forgot to remove it when changing code a lot of times
I wish sqf had structs, so we could put multiple related variables into struct, rather than putting it in arrays
_closestMarker = _markers select 0;
_distanceMin = _unit distanceSqr (getMarkerPos _closestMarker);
{
_distance = _unit distanceSqr (getMarkerPos _x);
if (_distance < _distanceMin) then {
_closestMarker = _x;
_distanceMin = _distance;
};
} forEach (_markers select [1]);
_inZoneUnits = allUnits inAreaArray _marker;
is it instead of
{
if (_x inArea _marker) then {
_inZoneUnits pushBack _x;
};
} forEach allUnits;
?
Yes.
Thanks
Why to sort by distance? Dude has multiple groups. Don't see how having it sorted helps
One could have 2D array of two columns, first column for marker and second one for side. Each row would be one marker.
And then just loop through all groups and the 2D array of markers and give each group waypoint to closest marker, which does not have same side
tbh I dont know how to do both of those variants, i tryed to make another array of distances and then try to connect them(horrible idea, but it is the only way I have ideas of doing ).
Ive done it, but i get errors about "distance:distance:distance:distance etc at line 11"
i bet you cannot get group position in pos distane check.
so you should use:
private _currentLeader = leader _x;
private _ranges = [];
{
_ranges set [_forEachIndex, _currentLeader distance (getMarkerPos _x)];
} forEach _zones
and you can use _forEachIndex which is current index in forEach loop.
0 is 1st, 1 is 2nd , 2 is 3rd etc ..
Oh maybe, i check it now
It didnt even come to me that it is possible
Yes, no more error
Thanks
and you can use apply
private _currentLeader = leader _x;
_ranges = _zones apply {_currentLeader distance (getMarkerPos _x)}
but where do you even use _ranges?
That is private inforEach AllGroups, and you arent using that in current scope?
checkpoints = [];
{
checkpoints pushBack [ _x, sideUnknown ];
} forEach allMapMarkers;
// To get first checkpoint: private _checkpoint = checkpoints #0;
// marker of _checkpoint: _checkpoint #0
// side of _checkpoint: _checkpoint #1
[] spawn {
{
private _checkpoint = _x;
private _cpMarker = _x #0;
private _cpSide = _x #1;
// Check for sides of units in area of _cpMarker
// If only one side is in area then set the side of checkpoint and it's marker color
// _checkpoint set [ 1, _newSide ]; // sets side of checkpoint
// set the color, whatever is the code
sleep (5);
} forEach checkpoints;
};
[] spawn {
{
private _group = _x;
if(currentWaypoint _group == count (waypoints _group)) then { // checks if group has no active waypoint
// Find out which checkpoint of different side is the closest, get his marker and save it into _nearestMarker
// Schatten's code could be used here to loop through checkpoints,
// but it's needs to be edited, since it does not check for side
_group addWaypoint [ markerPos _nearestMarker, -1 ];
};
sleep (5);
} forEach allGroups;
};
@neat bloom Finish this code and place bunch of groups and markers in the editor and they will move from checkpoint to checkpoint
Thanks you very much
i dont really get checkpoints
are checkpoints some special arma 3 objects?
It's just array, for example like this:
checkpoints = [
[ marker1, blufor ],
[ marker2, sideUnknown ],
[ marker3, opfor ]
];
I just named it checkpoints, because that's what we are putting into it
marker1 has side of blufor and so on
See?
Each row in array holds info about one checkpoint, it's marker and it's side
Thanks
I've just realized that to get element from array in sqf either select 0 or #0 can be used, but not combination of both. Will fix that
I asked the same thing that u guys gave me and the bot has a function to think about the question and talk to it self but it takes max 20sec and then the bot explained about the sleep in the code and gave me the right code
only thing is the // explation
yeah don't use ChatGPT (see pinned messages).
That is new,
Deepseek from China.
He earlier mentation that is better than Chatgpt,
But like the result shows up, it isn't
Someone knows if a event handler exists, that triggers when a player is controlling a drone?
(couldnt find one in the EH list)
VisionModeChanged iirc
See the mission event handlers
that one only triggerd when i switched to NVG/Thermals inside the drone, not when i took controll of it
Oh yeah ur right thats for NVG toggle
is it possible to somehow detect when the game ends, which would work in SP/MP ? client hosted games and dedi. but without the endMission stuff
Depends what "when the game ends" means.
There's Ended and MPEnded in the mission event handlers. Also a trick there for detecting the disconnection case at the client end.
yeah tried those but they wont trigger... disconnects checking only works in dedi i think
what i mean by game end is that you host mission locally, start it and get back to lobby (game ends)
With abort?
not sure
locally hosted has "save & exit" button (which takes you back to the lobby)
Would getClientState work for what you are intending?
i really doubt because when the game ends there is no longer any script running that could use getClientState
Disconnects should not fire when you just go back to lobby. Nobody is disconnecting
You just got back to lobby
yes but the EH does trigger for players and server
Maybe getUserInfo then? Looks like you would be able to return that from another client or server.
it doesnt matter what command to try if all scripts stops from running when game ends
would need new EH just to run that command
What is your environment? Just kind of confused you mentioned MP earlier and thought you meant you were running a dedicated server.
Ahh client hosted game?
testing with local host from the host server menu right now. none of the EHs work with that one. dedi has disconnect EH working
yes
Ahh okay I can see why you are struggling to find a solution. In the case that client isServer like that it is a little tricky to handle that. I guess then my follow up question is what do you need it for?
Like are you trying to perform some sort of end clean-up procedure or something?
just for the server to run one final operation before shutting down
Is this a sync like operation that can also kinda be ran at any time or is it exclusive to shut down?
need it for shutdown
Hmmm. That is tricky. I was going to suggest a key event handler for the escape key for syncing but if it is exclusive to a shutdown specific procedure that is a little tough.
The escape menu is able to have additional custom buttons. Kinda wonder if you could modify the existing abort to perform a clean-up first? Never tried anything like that though.
I did that for one another thing 🙂 but this ones different
and that would only work with local server, need it to work with dedi also
where the server can shutdown at any moment
Are you intending for any client in mission to be able to abort and end the mission for all connected clients?
How do you currently handle it in the event you are running it as a dedicated server? Does it automatically perform it after a certain time or is it only performed by admins?
i mean discon EH would work for that
I guess only option here is to ask for new EH from the devs. like "onMissionShutdown" EH 🙂
Kind of a hacky solution but would you be able to add a button to the escape menu based on the players admin level and where isServer isEqualTo true to handle the exit procedure? After clicked it could have a confirmation dialogue and then after pressed it would handle everything then end mission?
You would be able to perform the task with the intended ease and it would only be available when the player is hosting the mission
Triggered when the server switches off from "playing" state (mission ends, server closes, etc.
maybe but id prefer non hacky solution for this. the user could also just alt + F4
addMissionEventHandler ["MPEnded", {
// no params
}];
i havent got that working
That does look like that would work for your intended situation
lemme try that again
nope cant get it to trigger
hopefully thats just me... but idk
Are you also trying to handle client code? This might be what you need maybe?
0 spawn
{
waitUntil { !isNull findDisplay 46 };
findDisplay 46 displayAddEventHandler ["Unload",
{
// code here gets executed on the client at end of mission, whether due to player abort, loss of connection, or mission ended by server; might not work on headless clients
}];
};
Yay!!!
at least i get rpt report
u sure that runs only in game end though? not when you open some dialog or something
It'll run when the main game display is closed. Certainly not when you open dialogs.
i know
If you quit a mission while it's still on the briefing screen then it might not fire.
wasnt sure when main display can close/open
(because display 46 never opened)
You will want to have it in the MPEnded event handler too. Since you are also running this in a dedicated environment though I would have checks if isServer and if the player is an admin for the stuff you are doing just since cheaters are crafty.
hmm getClientState in the unload is "BRIEFING READ". not much use for that
though init.sqf runs only once and I have to exit lobby and restart for it to work again. man i have been deving arma for long but still dont get this thing 😄
ok in editor init.sqf runs everytime, weird
@old owl well anyway that must be some arma bug then. just wanted to say thx for the help! I have something to work with now 🙂
i missed your message. well cant have everything i guess 😉
Hey there, how do I prevent player corpses from deleting upon disconnecting? We use disableAI = 0 because we want to preserve player's character if he disconnects for some reason. But when player dies and then disconnects his body gets deleted because it is owned by that player. I've tried to use _unit setOwner 2 in debug console after player death, and it works fine, but if body is in ragdoll it is freezes midair. Also I don't know how to apply this automatically for each player on death - it is either freezes midair if called in MPkilled EH, or gives me an error if called in HandleDisconnect EH. So, how do I preserve player corpse upon disconnect and not freezing it's ragdoll.
Side note: we do not use any corpse manager and we do not care about performance impact.
have you tried https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed at server?
AFAIR, player corpses are not deleted by default upon disconnecting, scripters add custom code to HandleDisconnect EH to delete corpses. So find this code and delete it.
Also check https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#HandleDisconnect wiki states: Override: if this EH code returns true, the unit, previously occupied by player, gets transferred to the server, becomes AI and continues to live, even with description.ext param disabledAI = 1;.
Is it different in that situation? I assume it is called when someone is killed, and then transfers object, I think It'll have no difference with MPkilled EH. But we'll check it tomorrow
that was just a guess, honestly. it might act differently
We tried it, this works only when player is alive, it does nothing for corpses (if AI is enabled)
ok
Hmmm, we didn't thought about it, we always played with cba, ace and a few zeus mods. We'll try it with bare arma
You are very welcome! SQF is a fun but interesting language to say the least haha
nice language but its the arma engine that's full of mysteries 😉
Hey folks,
I have a problem with the Civilian Presence Module.
I wanted to edit the loadouts for the Units to create a more fitting look for civilians.
So I wrote little function and call it in the Civil Presence Module in "Code On Unit Created".
Call in Civilian Presence Module:
[_this] call kndzAmb_fnc_civPresLooks;
Function:
params ["_unit"];
_unit setUnitLoadout selectRandom ["CUP_C_TK_Man_05_Waist", "CUP_C_TK_Man_03_Waist"];
removeHeadgear _unit;
removeGoggles _unit;
_unit addHeadgear selectRandom ["CUP_H_TKI_Lungee_Open_01","CUP_H_TKI_Lungee_Open_02"];
_unit addGoggles selectRandom ["CUP_Beard_Black","CUP_Beard_Brown","None"];
_face = selectRandom ["Bahadur","Jalali","Sabet"];
[_unit, _face] remoteExec ["setFace", 0, _unit];
For the Outfits it works but it doesn't work for the faces, even in local testing. I read that setFace has to be handled differently for Multiplayer but I thought I was on the right track with the remoteExec call.
Can anyone help with this?
Okay, forget it, I just saw my mistake. Sorry for the inconvenience.
https://community.bistudio.com/wiki/Arma_3:_CfgIdentities#Faces Use the correct classes
PersianHead_A3_02 -> Jalali
I didn't expected that ace would do this. And somehow more that 20 peoples ignored this setting, I'm amazed... Thank you
trying to get this addaction to remove its self after it has been triggered once but cant seem to get it to work, I thought the first "true" should remove it but it remains
["Speak to the man","informantintel.sqf",[],1,true,true,"","_this distance _target <2"];```
addAction doesn't support self-deletion, you should do this in your script: https://community.bistudio.com/wiki/addAction.
I miss understood what Hide on use meant
if I wanted to make it one time whats the best way?
removeAllActions wouldnt work as its on a unit and not a player right?
hideOnUse: Boolean - (Optional, default true) if set to true, it will hide the action menu after selecting it. If set to false, it will leave the action menu open and visible after selecting the action, leaving the same action highlighted, for the purpose of allowing you to re-select that same action quickly, or to select another action
https://community.bistudio.com/wiki/removeAction + params passed to your script.
so lets say the unit was called "Jason" it would be "Jason" removeAction 0;
as that would be Jasons only action?
No since removeAction requires an object as first param, not string.
Plus, as I wrote, I would use variables already passed to your script, because your action index may not be equal to 0.
Alright cheers
Is it possible to add target lead indicators in rifle optics via script/configs or do you have to have an actual vehicle?
how to determine last iteration? _time can be different, mostly integer
private _time = 10;
private _step = 0.15;
private _total = _time / _step; // 66.66666
for "_i" from 0 to _total do
{
systemChat str _i;
if ( _i isEqualTo _total ) then { /* ... do something ... else */ };
/* ... do something ... */
sleep _step;
};
Determine to do what?
some other logic in loop
Not sure why that code is not satisfying your goal
if ( _i isEqualTo _total ) then { /* ... do something ... else */ };
this does not work, as _i at last iteration is not equal to _total ( rounding error )
Then what about _i > (_total - _step)
Hey guys, this might be a question for a different channel but is there a script or something where I can set turrets on vehicles to be turned?
So like hull facing bearing 0 and the gun facing say. Bearing 150
Turrets with AI in them or not?
no just empty tanks for set pieves
pieces
Not really my thing but IIRC you use animateSource
another question is, is it possible to make AI ram into a target on purpose? such as a pchela drone flying by then nosing down into a building or something
hey all! im modding a wasteland server and looking for new missions and a bit of help editing some of them, ive tried to add a hostile jet formation using the heli mission for a template but it breaks the game eventually and when i add jets to the heli mission i assume they spawn in and fall to their death with no thrust, basically looking for someone to help us setup our server better and happy to pay for your time if you know how to make or even have files with these missions already, ive seen them on many wasteland servers so either owners are making the same thing just their own version or you can get them from someone else
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
hello, im want to assamble and dissamble turrets like .50 with only the gun backpack
i did an addaction to create the vehicle if you have the backpack... but my problem is how to perist ammo
with my current code, if you assamble it, and dissaamble it, ammo is restored...
i dont know how the base game keep track of the turret
Store it in backpack object.
hello ArmA 3 m8s: can you guys help me with the correct format of this code ```sqf
parsetext format ["%1 %2",name _instigator, "Destroyed Cache"] remoteExec ["systemChat"];
You can make single backpack item deployables, or can you not use a mod?
format ["%1 Destroyed Cache",name _instigator] remoteExec ["systemChat"];
I mean, the only thing that was "wrong" was the parseText
Making the format simpler is just that, making it simpler
Do you really need parseText?
ummm not really
Then this solution should work: #arma3_scripting message
nice thx again guys
wow awsome guys love you guys
the parsetext was left over when i had color in the text
but thx again Guys and again and again and again
im so Thankful to have such awsome guys like you guys helping us, Works totaly awsome Thx again
There is a mod already done?
Backpack deployable weapons are a vanilla feature
agree
you do know the fix to some things in not just downloading a Mod
look in the game 1st @open hollow
class Weapon_Bag_Base;
class TAG_weapon_backpack: Weapon_Bag_Base {
scope = 2;
author = "You";
class assembleInfo {
assembleTo = "TAG_weapon";
base = "";
displayName = "Weapon";
dissasembleTo[] = {};
primary = 1;
};
};
class HMG_02_base_F;
class TAG_weapon {
scope = 2;
author = "You";
class assembleInfo {
assembleTo = "";
base = "";
displayName = "";
dissasembleTo[] = {"TAG_weapon_backpack"};
primary = 1;
};
};
There's your single backpack deployable
Want to use RHS ones, but afik there no way to do it
Trying to remove large area of grass, this possible with Logic Entity?
Thank you, Ill do it with a mod then
Hey! Noob to scripting here...
I'm trying to create a mission file where a waypoint is created for a helicopter by an addAction I made.
Works fine, but I can't seem to figure out how to make this newly created waypoint into a "LAND" waypoint instead of a "MOVE" waypoint.
Any help is truly appreciated ❤️
Add new waypoint: https://community.bistudio.com/wiki/Waypoints#Land
If there is something you don't know. Ask someone with the knowledge!
You're a god sent! 
I know, and this article helped me at one time.
Trying to skip time in minutes rather than hours, does the following code make sense?
[0, "BLACK", 5, 1] spawn BIS_fnc_fadeEffect;
sleep 5;
titleText ["<t color='#ffffff' size ='5'>10 Minutes Later...</t>", "Black Faded", -1, true, true];
skipTime 1/60;
sleep 2;
[1, "BLACK", 5, 1] spawn BIS_fnc_fadeEffect;
from what I understand here it should? https://community.bistudio.com/wiki/skipTime
Example 2:
skipTime (5/60); // be sure to use parentheses, otherwise here (skipTime 5)/60 will happen
You are missing () around your calculation
Just caught that myself and was about to edit, but I was correct the (*/60) is in minutes rather than Hours
Yes, but 10 minutes is 10/60 or 1/6, not 1/60.
Plus in MP skipTime should be executed on server.
I was going to place the whole script into a trigger once I had it working from an SQF originally, as far as I understand this should be Server executed?
(I find it easier to type larger scripts outside the game before placing them into triggers)
Only if you checked this in trigger settings.
I shall be honest, I have never quite gotten the hang of making MP scripts vs making SP
Hey
To add an inventory item to one of units of enemy i use on init.sqf:
( uniformContainer james ) addItemCargoGlobal [ "Laptop_closed", 1 ];
But when i check inventory of that unit its more than one item of added one
Also the trigger that detect that item are in player inventory wont workk
Any guid?
hello Arma 3 friends does CBA_A3 mess with my missions that i have built, like my EH and stuff, or is it a good deal to get CBA_A3
init.sqf is executed on every machine at mission start, as well as on machines that join in progress. So the command is duplicated.
You should use initServer.sqf or an if isLocal or if isServer check to ensure it only runs on one machine.
Other things to consider:
- you could simplify by using
addItemToUniform - some inventory items of this sort are actually magazines, so you need to check for their presence using commands that include magazines
agree'
It will add some dependencies in your mission (that can removed), but a lot of mods require it for good reason. It has a lot of scripting utilities to make development easier
i see
so that means i dont get it
i wanted to get 1 m16 in my game and it wants CBAs so i guess no go then
Anyone know why a music mod might be having an issue where it's saying there's
No entry 'bin\config.bin/CfgPatches/MyMusicMod.units'?
invalid CfgPatches entry
I'm pretty sure (almost) all entries are mandatory (only skipWhenMissingDependencies is marked "Optional") in the wiki (doc available at https://web.archive.org/web/20241119222316/https://community.bistudio.com/wiki/CfgPatches as the wiki seems to be down) 
That resolved it. Thanks. I removed those entries because someone told me they were unnecessary.
Say I wanted to move a unit to an empty marker to ensure they are at the correct place how would that look?
carter setPos (getMarkerPos Jascarter);
Something like this?
I think the bare minimum is requiredAddons, Weapons, and units
carter setPos (getMarkerPos "markername"); @halcyon creek
perfect I shall try that
Works perfectly, however the units are all halway through the floor 😂 back to the drawing board
Cause getMarkerPos returns 0 height and setPos is weird with height. Better to use setPosATL, but you still need to give it height, which is above the surface you want your unit to be placed on
what are the default values forcamouflageCoef used in setUnitTrait command? 1?
There is an alternate syntax for getMarkerPos that does return height. I'd usually suggest using ATL or ASL positioning, but if markers are more convenient for your workflow in the Editor then it is possible to use them.
Probably best to convert from the AGL format returned by getMarkerPos to ATL or ASL, and then use setPosATL or setPosASL, though. As Jouklik said, setPos uses an awkward different format that doesn't convert very well.
Wait, do markers have height? 😀
Yes.
For Editor-placed markers, it used to be always 0 by default, but script-created markers can be set to any height, and now that markers are visible in 3D in the Editor, they can also be given non-0 heights there, too.
I see
Example:
_unit setPosASL (AGLtoASL getMarkerPos ["someMarkerName",true]);```
I got it with getUnitTrait , default value is 1 🙂
It was added in 2.18 in October last year. Always good to read the change notes!
It's likely that's a multiplier against the unit's own camouflage value, which comes from its config.
According to what I see on wiki one needs to use:
getMarkerPos [ "someMarker", true ]
To get PositionAGL.
Whoops, yes, that's correct. Mentioned the alt syntax then immediately forgot to use it 🙃
yeah thats wierd that they changed the marker hight
but you can see a empty marker in 3D so i guess its cool
Does anybody know how to assign a spawned mine to a specific player? When i place a mine and somebody dies, it counts a kill for me saying "Player A killed player B". But when somebody dies on a script-spawned mine, it just says "Player B died". Is it possible to set the "owner" of this mine so that the game count kills to the specific player, even though he didn't place it?
THANKS A LOT! I've been trying to find this for half an hour, but couldn't figure out how to ask google 😆
Find one mine command that you remember, hope it's a category :P
Well, it makes sense. I thought that eventually i will have to use HitPart EH + setHit with "_killer" parameter... Would make it much more complicated
Probably a bit of a simple question, just trying to find my feet with sqf. I'm trying to use an if function inside initplayerlocal.sqf that calls a variable set inside a playable unit. I only get a undefined variable error for the initplayerlocal.sqf script, though if I understand initilisation order correctly, the object's init should be first? Once I control the unit, I can get the variable's value out with a player getVariable "_interpreter"; which outputs a 1.
I'm sure I'm missing something super obvious or taking the most roundabout way to a simple problem so please take pity on me 🙏
Unit's initline:
this setVariable ["_interpreter", 1];
initplayerlocal.sqf:
if (1 in _interpreter) then
{
["fr","du"] call acre_api_fnc_babelSetSpokenLanguages; ["du"] call acre_api_fnc_babelSetSpeakingLanguage;
};
You forgot to extract the variable using https://community.bistudio.com/wiki/getVariable.
Yep
Plus, since _interpreter is not an array, you should use ==, not in.
Script should be
if (1 == (player getVariable "_interpreter")) then
{
["fr","du"] call acre_api_fnc_babelSetSpokenLanguages; ["du"] call acre_api_fnc_babelSetSpeakingLanguage;
};
Ahh I see, I think I understand. I'll give it a crack, thank you :)
I see where I've gone wrong, and yes that works. Appreciate the help!
Best would be
this setVariable ["tag_interpreter",true];
And in local
If (player getVariable ["tag_interpreter",false]) then {
...
...
So you don't need compare to 1,
And if the unit doesn't have your variable set,
It will return the default value (false)
Hey guys, I was just wondering how preoccupied I should be with trying to script something to solve the ammo in vest error that seems to flood the RPT? Is there an excessive cost on resources having this error consistently show up across the native Opfor, BluFor and Indie factions? I've gone down the rabbit hole of trying to strip and reload the AI at spawn but it doesn't fix things and my log shows there's still room in the uniform and vest.. If there's no real processing / stability cost, I think I will leave it well alone?
logging errors to the rpt is not very performance intensive
ah sweet ok, thanks @lime rapids maybe I leave well enough alone then 🙂 all day with not script fix that works
21:33:13 "[GLX] Loadout applied to O Alpha 2-3:1 (O_soldierU_TL_F)"
21:33:13 "[GLX] Initial uniform capacity: 40"
21:33:13 "[GLX] Initial vest capacity: 120"
21:33:13 "[GLX] Items added to uniform:"
21:33:13 "[GLX] - FirstAidKit"
21:33:13 "[GLX] - 30Rnd_65x39_caseless_green"
21:33:13 "[GLX] - 30Rnd_65x39_caseless_green"
21:33:13 "[GLX] - Chemlight_red"
21:33:13 "[GLX] - Chemlight_red"
21:33:13 "[GLX] Remaining uniform capacity: 39.2"
21:33:13 "[GLX] Items added to vest:"
21:33:13 "[GLX] - 30Rnd_65x39_caseless_green"
21:33:13 "[GLX] - 30Rnd_65x39_caseless_green"
21:33:13 "[GLX] - 16Rnd_9x21_Mag"
21:33:13 "[GLX] - 16Rnd_9x21_Mag"
21:33:13 "[GLX] Remaining vest capacity: 119.733"
21:33:13 "[GLX] Primary weapon magazines: [""30Rnd_65x39_caseless_green"",""1Rnd_HE_Grenade_shell""]"
21:33:13 "[GLX] Handgun magazines: [""16Rnd_9x21_Mag""]"
21:33:13 "[GLX] Uniform magazines: [""30Rnd_65x39_caseless_green"",""Chemlight_red"",""Chemlight_red"",""30Rnd_65x39_caseless_green"",""30Rnd_65x39_caseless_green"",""16Rnd_9x21_Mag"",""16Rnd_9x21_Mag"",""30Rnd_65x39_caseless_green""]"
21:33:13 "[GLX] Vest magazines: [""30Rnd_65x39_caseless_green"",""Chemlight_red"",""Chemlight_red"",""30Rnd_65x39_caseless_green"",""30Rnd_65x39_caseless_green"",""16Rnd_9x21_Mag"",""16Rnd_9x21_Mag"",""30Rnd_65x39_caseless_green""]"
Thank you
yeah the some mags were not stored in vest and other containers erra is a pain in the arse
Just make the containers bigger or put stuff in a backpack
it also say some stuff was not stored in backpack also
iv looked into this and people say theres nothing we can do about this
but i dont think thats true
There's nothing you can do about it through scripting.
It's caused by the default config loadout of some unit classes, in this case vanilla ones. That loadout is applied before any scripting stuff can happen on the unit.
In theory, you could make a mod to adjust the loadout of those specific classes and avoid the error, but that's annoying work and basically unnecessary since this issue only causes a few lines in the RPT.
Ideally BI would fix the classes in question themselves, but it's likely a very low priority for them, for the same reasons.
You can overfill backpacks because they're objects
An arma won't try and fill backpacks with stuff from a unit's items, magazines, etc. anyway
ah ok i see thx m8s good stuff
yes but can't we remove all mags items and all stuff, then add the stuff back we want
and what about if we use B_Unarmed_Soldier_F and add stuff to them
does anyone know if the vanilla arma 3 radar functions are accessible and what pbo they are in? I want to see how BI handles the whole radar as im working on some mods that change how targeting vehicles work. Also wondering if there is a command to lock a target for a player. Because I cant find one.
tab key for ground to air lock
im looking for a command to do it not a key to press
via code.
i see well i hope you find it
Yes you can
There's plenty of removeX commands, and you can easily change loadouts via config
For scripting though, those warnings will still be logged before those scripts run
ok i see thx Dart
oh wow i used O_Soldier_unarmed_F and it did not show erra on any missing ammo
i guess theres no way to off the talking Of blufor and keep the talking Of Opfor is there, Maybe theres away
by using ace and contact drone entity stuff I got an error while testing who was spammed endless into my rpt:
_command = {
[_moduleScience_1] call bin_fnc_scan;
};>
19:39:46 Error position: <_moduleScience_1] call bin_fnc_scan;
};>
19:39:46 Error Undefined variable in expression: _modulescience_1
19:39:46 ["ace_cargoLoaded",["ACE_Wheel",1d2999ee040# 2929850: virtualsound_01_f.p3d DroneScanBeamSound_01_End_F]]
19:39:46 Error in expression <s] call bin_fnc_bezier) # 1;
_result = linearConversion [0,1,_progressPos,_valu>
19:39:46 Error position: <linearConversion [0,1,_progressPos,_valu>
19:39:46 Error Type Any, expected Number
19:39:46 Error in expression <all bin_fnc_addRotation;
Is that fixable by me in any way?
It based on this code:
[drone, getPosATL drone, nil, nil, nil, 16, 16, 5] call BIN_fnc_setObjectGrid;
[drone] call BIN_fnc_soundDrone;
// Variablen definieren
private _drone = drone; // Referenz auf die Drohne
private _behaviorName = "Research"; // Name des Verhaltens
private _terminateBehaviour = true; // Soll das Verhalten terminiert werden
private _interrupt = true; // Soll das Verhalten unterbrochen werden
// Array für die Behaviors
private _parameters = ["Avoid", "Light", "Research", "Reposition", "Investigate"];
// Verhalten setzen
[_drone, _behaviorName, _parameters, _terminateBehaviour, _interrupt] call BIN_fnc_setBehavior;
I think the drone tries to scan an ACE_WHeel loaded in a vehicle nearby and getting an error on this
basically thats my question for you guys^^
omg fsm are beond me
i dont know much m8 im just a simple scripter
now Dart is the guy you want
he a pro
and others too
#define BEHAVIOR_PATH "a3\Functions_F_Contact\Behavior\Drone" Thats the path of all fsm files.
Poorly the BI Wiki Documentation is not really helpful for contact alien stuff:
https://community.bistudio.com/wiki/BIN_fnc_behaviorInit
https://community.bistudio.com/wiki/Arma_3:_Alien_Entity_Behavior
https://community.bistudio.com/wiki/BIN_fnc_setBehavior
i find wiki is hardly ever helpful but the guys in here like Dart and others are awsome
darttruffian?
AT Dart shows me 20+ DART in this discord ^^
@tulip ridge
thx
I know ^^
Arma doesn't use "real" C++, it just uses it a config language
But FSMs for AI are their own thing, and not something I've touched
nope arma script and sqf for most modification and c of some type for config files
You dont have any idea to prevent the drone from researching in vehicle cargo? (Maybe the crates or Vehicleparts from ACE are spawned under the map under the vehicle and the drone just see it 😦
wow i did not know that holy cow
ACE Cargo just attaches them really low under the vehicle yeah
And the drone still trys to pick it up and rotate it in some way 😦
and i was thinking i was learning some things but now im back to Zero lol
so Arma 3 uses sort of the same code as G and M code like on CNC mach.s
eh its pretty easy to learn and the operators are all pretty easy to find
yeah i was machinst 25 years
- generally a large amount of support here for any weird code one could be doing
ah ok
but i retired now woohoo
you mean operators as in C++ no no just kidding lol
im having too much fun lol
ur g lol im just looking here between test results
copy that m8
I've used scripted FSMs. The editor is kinda fun but in the end they're not good for performance.
the closest arma gets to visual coding lol
In theory you can dig out the Contact FSM that's busted, fix it using the FSM editor (or directly, if you can handle a lot of wack syntax), and use your fixed one instead or replace the Contact one.
though if you want movement similar to contact for a drone its easier to script it coming from someone whos working on something like it
i can't handle any wacky syntax lol
though its painful but not too hard with setvelocitytransformation + a lot of math
oh i like math
just try to program a ark in G Code omg lol
really thats how i got into Arma 3
you know XYZ
wait nevermind reading conversation shows im an idiot who just yaps about my dumb mod with too much math
anyone who could help with that? :/
surly not me
wish i could help
i don't have any thing go wrong in my game i don't use any mods at all
i stopped useing mods 20 years ago
and man does my game run fast
when people join my missions they think something is wrong its so fast
and i only have a i5 labtop
Mods are not the problem, badly made mods are the problem.
Arma without mods is rather bland and would have been long dead.
Hello guys me again, still trying to wrap my head around adding and then removing an action heres my code, just cant seem to get it to work.
Unit with the variable name JasonMonoma
Init ```sqf
_actionID = JasonMonoma addAction
["Speak to the man","informantintel.sqf",[],1,true,true,"","_this distance _target <2"];
informantintel.sqf
```sqf
["TaskSucceeded", ["Meet with Informant","Meet with Informant"]]call BIS_fnc_showNotification;
"TLF1" setMarkerAlpha 0;
[ 0, 0, false ] spawn BIS_fnc_cinemaBorder;
/// REST OF SCRIPT NOT IMPORTANT
JasonMonoma removeAction _actionID;
[ 1, nil, false ] spawn BIS_fnc_cinemaBorder;
};
Everything in the script works besides the removal of the addAction
Where am I going wrong
_actionID is unavailable in informantintel.sqf. Use vars passed to the script by the command: https://community.bistudio.com/wiki/addAction.
I dont follow, could you please explain it to me like im 5?
If you open and read the article, you will find out that the command passes useful variables to the script: _target, _caller, _actionId and _arguments. Use these variables.
So similar to Example 4?
_actionID = JasonMonoma addAction
["Speak to the man","informantintel.sqf",[_actionID],1,true,true,"","_this distance _target <2"];

if the docs says you need to use params ["_target", "_caller", "_actionId", "_arguments"]; - you need to use params ["_target", "_caller", "_actionId", "_arguments"]; to get those variables 
No, I wrote about your script, not init field.
Your script should contain these lines:
params ["_unit", "", "_actionId"];
_unit removeAction _actionId;
I see, and _unit doesnt need to be specified? as in I dont need something like _unit = JasonMonoma
It's already specified.
Read what params does: https://community.bistudio.com/wiki/params.
https://community.bistudio.com/wiki/Magic_Variables#this can probably provide a bit more context. And at least one of https://community.bistudio.com/wiki/call/execVM/spawn 
Ill do some more homework then, still trying to learn the ins and outs past the basics, I shall try adding the above code to the script and see if that sorts it too
@sharp grotto in your opinion
Well, the second part. The first part is true. Mods don't necessarily have a performance cost.
well yes if the mod is made perfect
It's not like vanilla Arma is made perfect :P
well yes but is darn good tho
its funny he said Arma 3 would be Bland, he has no idea what all can be done vanilla Arma then
i started playing Arma way back in OFP
i find the vanilla Arma way way fun
iv been tho all them mods and stuff over the years
i mod the game the way i see fit but i have no down loaded mods if thats when you call mods
came across this when i was looking at some code
0 = [_id, "onEachFrame", "H8_fnc_moveBody",[_unit,_player]] call BIS_fnc_addStackedEventHandler;
what is 0 doing in this context?
what is being defined?
right but why define 0
you could put 78587346476 =[]
right its just "defining" it could have been anything they just chose 0
get rid of it dont need it
its not defining 0
you can put nul =[] or 0 =[] or remove it
wasnt going to use it anyway, i was just wondering why they chose 0, was there a reason or was it just "the thing". its just "the thing"
well in a field of a trigger people use it
I figured it used to be necessary in some ancient version of Arma.
or maybe just a cargo cult.
thats kinda what i was thinking
good
old voodoo left over from times gone
like i used to put exit at the end of all my scripts lololol
On the other hand, 0 spawn { // code here } is legit.
for the old sqs stuff lol
It's slightly cheaper than an empty array.
its zero right not O
sure
its just away to be cool i guess lol
i guess
actually might not be because empty arrays are pretty cheap too, but it's a valid option at least :P
like i said in some triggers i saw nul = [] and stuff like that
if you have an empty array dont it mean [this]
is that correct
not sure, i always define my stuff
only thing i define is Hight
but im not the best ofcorce
i think it should be a law that you must play vanilla Arma for 1 year befor you DL any Mods lol
he he
just kidding
this would force you to look into the game and see all the things in there
but what do i know not much
you know who would know what 0 = did. Mr Lou Montana
thats why i mention him. hes the guy
well yes he is the guy but there other great guys in here also
right but i want to know what he knows
i want to know what Dart knows
i cant even name all the great people in here theres so many
so many great people helped me in here my missions are awsome cuz of them guys
imo lol
well any way lots of people say my missions are awsome not just me
and remember i use no mods
like for Exsample Dart, he helped me with my chopper command and it works Awsome, on DED MP and SP
my Chopper Comand is 6 scripts that cover all things needed for the use of a chopper
and that includes water extraction and insertion
it would of never came to be without Mr Dart
hes my hero
i love them guys that helped me
here you go m8
Ive seen many people doing this, even in some BIKI article comments and even in articles themselves, like this: null = [] call myfunction; 0 = [Hello, World, 42] execVM someScript.sqf; I wonder why. If a function does not return anything, I dont have to assign it to anything - simple as that, isn...
The HandleDamage return value thing is kinda legit but it's better to make it explicit and just have a line with nil; at the end in current SQF.
agree
hey brother hope this helps
the problem your haveing is that
_actionID = JasonMonoma addAction
["Speak to the man","informantintel.sqf",[],1,true,true,"","_this distance _target <2"];
/*is that*/ _actionID /*is being declared on the object and is local to the object, you need to return it. i sujest trying*/ setVariable and getVariable;
//good luck
There used to be an issue where Editor code fields would freak out if you didn't "dump" the return from execVM or spawn to a variable, even if you didn't actually need to use it. However, that issue's been fixed for a few years now, so it's no longer necessary to do that (and it was never necessary to do that in non-Editor contexts). But a lot of stuff was written before the fix, and some people didn't understand why it was like that so it persists as a sort of urban legend.
yes sir thx @hallow mortar
urban legend i like that lol
i should of made that my name lol
i always learn stuff when NikkoJT is around
yes sir hes one of the great guys in here
legit
agree
wait im wrong! ```sqf
setVariable and getVariable;
/we can just pass the ID through the addaction/
_actionID = JasonMonoma addAction
["Speak to the man","informantintel.sqf",[_actionID],1,true,true,"","_this distance _target <2"];
/and inside informantintel.sqf we can just select 0 to get the ID back/
//inside informantintel.sqf
_actionID = _this # 3 # 0;
dont know why i didnt think of this at first but hey its how it goes
It won't be _this select 0 because there are several auto-generated parameters that are provided first, before the custom arguments
Hello, I didn't know in which section to ask, so I'm asking here. Many of you probably know the game squad, my question is: is there any mod for arma 3 so that the freelock camera (alt) can be as in squad, so that when I press alt, my character moves in the direction I was looking?
your right
https://community.bistudio.com/wiki/addAction
And one of those auto-generated parameters is in fact the action ID, so you can just retrieve that and not worry about passing it as a custom argument.
@terse tinsel dont need a mod theres a key bind for that m8 , if im understanding what your asking, i think its called something like center view but i have not look into the controlls lately cuz i always save my profile
oh, I didn't know about it, thank you very much, I'll check it out soon
The issue you're going to run into is doing this in multiplayer. The action ID can be different on different machines, and action-related commands are local effect.
This is where saving the action ID to the object's namespace with setVariable is actually useful, because with a correctly-designed pair of functions, you can have each machine save their own local ID, and then later have them each retrieve their own local ID.
I'm not sure there is such a keybind. I think your question was misunderstood.
The default behaviour in A3 is that when you toggle off freelook, your camera snaps to where your character was aiming. If I understand it right, you want to change to a behaviour where when you toggle off freelook, your character's aim snaps to where the freelook camera was pointing. Is that right?
but couldnt we have the calling player just return their ID through the addaction? because every instance of the script is "its own". or would it just get lost in translation?
unfortunately, I can't see anything except "look", the camera allows me to look around when I press alt, but when I release the alt button it returns to its previous position. the point is that when I'm looking around with the alt key pressed, when I release it, the soldier (character) is heading in the same direction I was looking at when I released the alt key.
I wrote below what I mean exactly, sorry for my English ;p
i just hit free look off and turn my guy to where i want to go
exactly as you wrote :). can this be done?
but isnt there a center view bind
The action code provides the action ID on the machine that used the action. You can use this to remove the action on that machine - but it's up to chance whether that same ID also works on other machines, because for them, there could be a different ID for this action. So you can reliably remove it on the activating machine with that method, but not others.
Yes. and this is the standard behavior of the camera in the A3. and I would like to play the same way as in squad, as NikkoJT wrote
Headtracking can give you freelook and aim at the same time, but takes some effort to set up
I don't think so. We don't have direct scripting control over where players aim, and I don't think there's an engine setting for it.
It would be difficult to do it properly anyway, because you can point the freelook camera in directions that would be "out of bounds" for aiming - for example, if your aim is restricted by having your bipod deployed or by being in a vehicle.
you would have to make sure the addaction is ID'd correctly on all machines by making sure what order its all called in
I understand, so you don't know anything about the existence of a mod or script that has already been created by someone and is ready for download??? OK thank you for replying to you. I'll get tired somehow and try to solve this problem
ok, I understand, thank you for your answer and best regards
yeah its called center look
Not that I've seen so far, for converting the freelook behaviour
Opentrack is the cheapest way to try headtracking if you feel like that, neural net tracker needs only a webcam setup above your monitor
It is essentially impossible to do this, because there could be any number of scripts and mods and whatever else running, completely out of your control.
This is why it's best to have a function that locally adds the action and saves its ID on each machine, and another function that can then locally retrieve that ID. That's how you can reliably know you have the right ID.
heehhehe. without exaggeration. I was just asking out of curiosity. because it would be better to play, but in general it's not a problem for me because there is no such option ;p
you could tho, when you delete the addaction you have to recall it on the users machine and if you set up your addaction right it could redeclare its ID to its var and then it wouldnt matter how many times its added or removed
how big the array gets
It's not about how many times this action is being added or removed. It's about some other action being added in a different order on different machines, making it so that the ID is different, so you can't use only the ID from the machine that used the action.
heres the thing tho if 2 players call this addaction it goes to the same script, but its two different instances of the script if you get the ID from the addaction and the addaction call is local to the player would it not return the right ID from both players no matter how big the ID array is for each player
i believe i've seen a non-action-id-containing variable used as a "flag"/signal for deleting the action with actual act of deletion being handled within action's condition. Something like if (_originalTarget getVariable ["TAG_DeleteAction", false]) then {_originalTarget removeAction _actionId} 
so you want the gun to move to where you are looking
insted of the looking to move to where your gun is
@terse tinsel
(if checking said variable every single frame is worth it is another question)
EXACTLY yes, 😉 just like in the squad game It's not essential to my life, but it would be nice eheh
well i never played squad but let me see if i can come up with the correct set up
Example of a safe way to do it:
// Function 1
params ["_object"];
private _ID = _object addAction [ ... ];
_object setVariable ["my_action_ID", _ID];
// Execution:
[_object] remoteExec ["my_fnc_addAction", 0, "my_action_jip_" + netID _object];
// Function 2
params ["_object"];
private _ID = _object getVariable ["my_action_ID", -1];
if (_id > -1) then {
_object removeAction _ID;
};
// Execution:
[_object] remoteExec ["my_fnc_removeAction", 0, "my_action_jip_" + netID _object];```
or are you saying if a addaction is removed before this addaction is removed the array will resize and thuse the index moves meaning the removeaction would "miss"
Well, that's disgusting
Unfortunately, I don't have the squad game installed right now to send you the video :(. but I'll try to find it on the Internet. If you could make it in your free time, you would be great and I would thank you very much 🙂
ill do my best
is there a chance of action id being reused in the future when some other gets added?
i understand
Let's say on one machine your action is the first action added to the object, so it gets ID 0. But on another machine, some random other action gets in there first, so yours gets ID 1.
The action is activated by the player on machine 0. They try to use their action ID to instruct all other machines to remove the action. Unfortunately, on machine 1, ID 0 refers to the other action, so that action is removed instead, and yours persists.
hes completly right
IIRC the action IDs are re-used, so you should clear the variable when you do the removeAction. Might be misremembering though.
this is why context of the mission file is key. i see what your saying
i'm up to actionID of 8.5e6 in my dirty add-print-remove loop testing, so it should be safe without resetting 
I wrote you a PM because I don't want to spam the general chat. thanks again and best regards.
I'm gonna guess that at 16m it just breaks rather than wrapping.
How can I change this sound file to be under CfgSounds instead of CfgMusic?
{
name = "[SFX] Space Marine Dialogue";
sound[] = {"Escape40k\folderwithtracks\Space Marine Dialogue.ogg",db+0,1};
duration=34;
musicClass = "Escapek";
};```
Define it in CfgSounds?
Also #arma3_config, not scripting
Oh, ok. Sorry about that
dont be sorry be happy he he
Hiya, Im searching for the possiblity of using the debug console to add zeus to a mission that doesn't have it active on a dedicated server. Is it still possible with use of a script that can be excuted either server side or globally?
Reason I ask is, I saw a really old post that said it was possible once but no actual script to go with it. Thanks
Hi, see https://community.bistudio.com/wiki/Description.ext#enableDebugConsole to enable debug console
Hiya, thanks for the resource. But my request was for zeus 😅
Debug console is active, I just wanna know the right path for adding zeus via the debug console
mb, misunderstood the request
you can yes, let me check
I would assume:
create a curator module
assign to a player using assignCurator
????
profit?
Haha profit indeed.
Thanks I'll give it a shot
private _json = [_jsonStr] call CBA_fnc_parseJSON;
private _wounds = _json getVariable "ace_medical_openwounds";
_json setVariable ["ace_medical_openwounds", _wounds apply {
_x params ["_class", "_bodyPartIndex", "_amountOf", "_bleeding", "_damage"];
[_class, _bodyPartIndex, _amountOf, 0, _damage];
}];
I have an issue
I'm getting type location expected array
how ever the ace should provide the array
idk
Do I need to set up a code or something to set up the respawns?
nope
if you are making mission go to
Your error is because _wounds is a location
You also need to enable respawn in the multiplayer settings for the mission and preferably name the respawn so it's consistent what it respawns
ik but is there a way to make it only string?
cuz I forgot
since I only need the ace string for the heal
If you're using apply, a string wouldn't do you any good
Are you just trying to heal the unit?
yeah this is for AI script that heals certain part of the body from the ace system
so AI has to heal other AI like a player would
That's removing all wounds there, or rather just setting the number of bleeding wounds to 0
AI medics already treat AI units in their group
this is for any AI
so normal rifleman goes to downed unit
and patches them up
when unit gets downed closest unit will try to help it
and he gets normal heals like player would
basically AI overwork from ace itself to make AI more working with other units then just medics helping everyone
I haven't messed with CBA's json stuff, but I'm 99% sure its because ace_medical_openwounds on a unit is a hashmap, so when saving / parsing it, CBA uses a location
ik that
but I kinda don't know why is says array
So then why are you trying to use apply on a location and not an array / hashmap
The error is pretty spelled out, apply: Type Location, expected Array,HashMap
ik
the _wounds gets the variable of openwounds
and then I use the wounds to apply the params
But _wounds is another location
It's not an array of every single wound
Your params is also wrong
yeah ik working on it rn
If you just want to iterate over all the wounds, you'd want something like:
private _jsonStr = cursorObject call ace_medical_fnc_serializeState;
private _json = [_jsonStr] call CBA_fnc_parseJSON;
private _wounds = _json getVariable "ace_medical_openWounds";
{
private _bodyPart = _x;
{
_x params ["_type", "_amountOf", "_bleedingRate", "_damage"];
[_type, _amountOf, _bleedingRate, _damage];
} forEach (_wounds getVariable _bodyPart);
} forEach allVariables _wounds;
Hey, is there a way to get the player that execute a script inside a console ? I tried this and _this but it didn't work. I know there is player but I'm afraid it will execute on every player if I do a global exec
Also not really relevant towards functionality but could probably even replace the CBA function with newly added gameValueToJson 🙂
I wouldn't execute anything globally you are not sure about if it is risky but you could do achieve this a few different ways. If you only need to execute on yourself use the local execute- global is only for code you want ran on every client. If you want to add an exception to that though this is how you could go about that.
if (getPlayerUID player isEqualTo "your PID") exitWith {};
Or in your watch type player to get your player object. Will be named whatever unit slot you joined in lobby. Then:
if (player isEqualTo <insert previous object name>) exitWith {};
I think what you mean is remoteExecutedOwner
It gives you the client that remoteExeced something
I know there is
playerbut I'm afraid it will execute on every player if I do a global exec
Maybe you should explain what you're trying to do.
If you runplayeron the PC that executes something, it gives you their player, and you can send that via remoteExec
Thanks to both of you for answering ! I'm just trying to create a curator module for myself on my server. I made only one spot and it's already taken, and I cant restart the mission so I have to create one on the fly. But I don't want to give it to everyone
Then yeah what you want is Milo's answer
Ok thank you ^^
for _i from 1 to 5 do {
_angle = _angle + 72; // 72 degrees for 5 jumps around the circle
_cameraPos = [
(position _target select 0) + _distance * cos _angle,
(position _target select 1) + _distance * sin _angle,
_height
];
_camera camSetPos _cameraPos;
_camera camSetTarget _target;
_camera camCommit 0.2; // Fast commit for the jump
sleep 0.2; // Adjust sleep for beat timing
};
Error: Undefined variable in expression: _i
IIRC _i is the enumerator and arma should allow that?
Example from wiki:
// will output 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 (the to value being inclusive)
for "_i" from 1 to 10 do { systemChat str _i; };
oop nevermind found my mistake
What can cause getPlayerUID to return empty string if the parameter passed in is confirmed not null?
And is a player for sure (it was grabbed from allPlayers).
player in limbo with ACE?
allPlayers doesn't just return player units
Returns a list of all units controlled by connected clients. This includes:
- Normal human players (including dead players)
- Virtual Entities (see Systems → Logic Entities → Virtual Entities in the Eden Editor)
- Headless Clients (
HeadlessClient_F)
Virtual Curators (VirtualCurator_F,*_VirtualCurator_F) - Virtual Spectators (
VirtualSpectator_F)
If you just want player units, you should use BIS_fnc_listPlayers or CBA_fnc_players
I'm still trying to persuade the triumvirate of evil to put this into the upcoming ACE update.
I love you to @tough abyss
thanks for help
hi i just wanna ask what could be the cause of my custom menu loading screen scenario just being static or frozen, like a pcture but the scripts are still working
my uneducated guess is because i have 4 objects/vehicles loaded in? haha. like 1 boat, 1 banner, 1 AI on ambient animation and 1 supply box
the scenario loads since my custom cfg music runs when i load in the menu. its just that, nothing moves
or is it a possibility of me ahving a 8 yr old hdd
Well, I don't have any of those and the problem is real players are connecting and it's not getting their player uids, just getting empty "". Is that a possibility when battleye or steam is down for maintenance or something?
@formal grail From https://community.bistudio.com/wiki/getPlayerUID:
Prior to Arma 3 v2.02, in some cases the identity of certain player units could fail to propagate to other clients and the server, which caused isPlayer and getPlayerUID to incorrectly return
falseand""respectively, where the affected units were not local. [...] This was supposedly fixed, but you should remain vigilant toward false negatives nonetheless.
I guess that wasn't fixed completely then 🤷♂️
Probably worth a ticket on the Feedback Tracker if you can reliably reproduce it.
Can't. It's just occasionally failing on server startup.
And sometimes I think it chokes the server.
is there an event handler to track if variable on namespace/object was set/changed ?
e.g. track this change
_object setVariable [ "TAG_var", 0, true ];
missionNamespace setVariable [ "TAG_variable", 0, true ];
In theory, addPublicVariableEventHandler, but there are a lot of limitations.
Usually you can use remoteExec or a Scripted EH to do essentially the same thing.
@hallow mortar hey man can u help me with a simple script?
Not right now, sorry.
If you have a question about scripting, post it here. There are a lot of people here who can help and it's what the channel's for.
I'm trying to use regexReplace to replace the beginning and end of a substring with two different new strings, and keep everything inbetween. Specifically, I'm trying to replace # someText(linebreak) ((linebreak) is an actual linebreak by the way) with [h1]someText[/h1]. Is this even doable with regexReplace? I'm not very well versed in regex and specifically how the output formatting works, and I can't really wrap my head around the BIKI examples.
So you want to replace # someText with [h1]someText[/h1]?
regex is a standard method. You want to look it up elsewhere.
Yes, or rather replace
someOtherText```
with
```[h1]someText[/h1]
someOtherText```
The first delimiter is '# ' and the final delimiter is (linebreak).
Try this:
_string regexReplace ["# (.+)\n/gi", "[h1]$1[/h1]\n"];
Works like a charm! Thanks! 👍
or rather, ["# (.+)\n", "[h1]$1[/h1]\n"] from before the edit worked. What's the point of /gi?
ah, so without /g
otherText
# secondText
otherOtherText```
would be
```[h1]firstText[/h1]
otherText
# secondText
otherOtherText```?
Correct.
You can play here: https://regexr.com
thanks commy
hello!!
I have 0 knowledge with scripting and my dev is very new to arma 3 dev stuff! Have ambitious plans to get some unique scrips/abilities on vehicles.
To not spam a big ass paragraph, gonna be making a thread with my rant. If anyone is familiar or has knowledge im all ears.
To summarize, trying to get abilities on vehicles that use Shields. and while shields are deployed they are using the vehicles fuel as the "ammo/fuel" for the shield. If no fuel, shield cannot be used.
This fuel concept will also be used for other abilities, like a heal and repair
Anyone able to assist plz do so D:
i dont know why yet... but i did a circular loading screen
that little white pixel is addoying af... but i sont find a way to get rid of it :/
is there any way i can create a trigger in zeus? or use a script to effectivly do the same thing whislt in zeus?
I'm trying to make units spawn, switch simulation on and off, spawn vehicles etc when players are near
You can create a trigger in script, certainly.
how would i go about doing that?
ty
so does it mean, if you create a trigger Global it will be created on all mach.s ?
and Local will only be on the Mach where the trigger was created
is that correct ?
IIRC the trigger object is global regardless, but the trigger code only checks & runs locally if you set it as local. Might be misremembering though. It doesn't seem to be documented.
Hey guys, is there a way to count the total amount of HE grenades a mortar has left? This is what I have right now but it only counts the magazine. I would like the player to be able to check on map the amount of HE shells he can still can call in before the on map artillery is out of rounds
magazinesAmmo would be your starting point, but identifying HE magazines is fairly tricky.
eh the stupidity is contained there so its best to just let mods deal with it or do a lil trolling that wont get one banned though thats offtopic for here
copy that
Is anyone aware of a way to "merge" units between clients/the server? For example, if Ai blue existed on a client and Ai Red existed on a different client, could I combine them into a single Ai that was properly synced between the two clients?
I know I could technically delete both local versions and create a global one, but I don't want to do this, I need it to be synced between client one and two without it existing on clients 3 and 4
What information do you want to sync?
The simple answer is "absolutely not" but you could bounce stuff like target lists across.
I want to sync the actual ai unit. Stuff like its position, animation, life state, etc. Wasn't sure if someone knew a cheeky way to do this with ownership or something
Is it critical that it does not exist on clients 3 and 4, or would existing but invisible be OK? (hideObject)
hello Arma 3 friends: So lets say my groups name is USMC=group this; and i want a newly spawned in group of Ai to join my group how do i go about that,, and when the Ai join my group will thay be named as USMC aslo
Would not be ok. Unfortunately hiding an ai unit and disabling its ai features isnt nearly as performant as it not existing at all
When you say group name, do you mean group ID or variable name?
ID i mean
In general working with the group ID is doing it wrong. You want to store the group object somewhere.
hmmm im not sure what u mean
There's no command that will give you the group object from the group ID. You'd have to loop through all the groups looking for the right one.
then i guess i mean variable name?
But then if you say "my group" then you know it's the one with player in it, at least locally.
(and then you can just do group player)
hmm ok i see let me try that
This may be more for #arma3_gui, but does anyone know how to define a Display Unique Name? Specifically where it's defined in the config.
For what purpose?
Is this UI-on-texture stuff?
Yep
As far as I know the unique name is created and only exists for that purpose.
So it's not in config anywhere.
The procedural texture declaration also declares it
It's just a way to refer to your texture-display later.
So the "displayClassName" in this definition would be the RscTitles classname, correct?
#(rgb,width,height,mipCount)ui("displayClassName","uniqueName","texType")
No, because it doesn't use RscTitles.
It's the one you'd use for createDisplay or createDialog.
Okay
They're placed in root config for some reason. Messy as hell.
You can try RscDisplayMain etc to see how it does even work
so what going on is my groups name is USMC=Group this, and i can get the Ai to join my group but when i do my loose trigger shows mission faild {alive _x} count units USMC <=0;
how can this be ?
oh sorry i had typed it wrong this is what i ment ---> USMC=Group this
Whitespace has meaning in SQF. group is a command that takes one input, on the right.
If you wanted to set a variable, you'd do USMC_Group=this
What's this? :P
ah ok
If it's a unit, then USMC_Group=group this would be correct. Probably.
that is in the init of each of my soldiers
well, you don't need to set the variable for each soldier...
And the group has its own init.
well thats where i have it yes
ok let me try more see if i can get it right ok m8
thx you for trying to help me m8 ok
ill let you know how i make out or if i fail
lol ok
haaaaaaa i got it wooohoo
all i had to do is change my loose trigger to {alive _x} count units (group player) <=0;
i had everything else correct
for some reason i could not give the name USMC to The spawned in Ai
wounder why
@granite sky thx for trying to help me m8 it got me to work harder to get it right
love you brother
so now i can spawn in as many Ai as i want and they will all be in the player group WooHoo
hell yeah Arma 3,,,!!!
i love this game so much
its the best game ever
and what's really cool is now that i changed my loose trigger to {alive _x} count units (group player) <=0; it will work even better for my Team Respawn script even if Ai are included
ofcorse you have a chose to pick from all the diff Respawns i have in the Params
but my fav is Team Respawn
oh and btw my Team respawn script is 24 lines of code, took me for ever to get that correct he he
I really need a global script for despawning idle vehicles that have no units or any type of inhabitants inside, that are either spawned by Zeus or modules from Mods.
(Same applies for despawning crates/boxes/equipment/etc from Zeus or the Modules. Butdespawning should not apply for fences/walls/fortifications/etc.)
Would these specifics be possible to put in a file of the mission folder?
getting this error and its 100% a mistake from my side 
but where can I get info about what script it is?
Hey new to creating a amra 3 server. im trying to have dagger island training complex in my server. what would the mission name be_
this is the scripting channel, try #server_admins with some more details please
ah cheers
Blanking a bit, How would one find a vector between 2 objects that are on diff altitudes, specificly making the object point towards another both directional and up/down
Which vector
Is is possible to make my UAV invulnerable to rope from it?
Usage setPhysicsCollisionFlag or disableCollisionWith on rope model with no success can't understand what cause damage
rope kills the UAV?
search for the code string from your files, with some editor
it damage the Darter's tail rotor when rope start too close to UAV
can make its start a little away from UAV, but when taking off Darter will take damage
ropeCreate [My_Darter, [0,0,0],0.5,nil,nil,nil,1];
with this code UAV take damage when take of
ropeCreate [My_Darter, [0,0,-0.3],0.5,nil,nil,nil,1];
rope to UAV? no
usually attach commands disable collision between the two
is it possible to set arma 3 spawn location on buildings. everytime i attempt it, my i go to spawn on it and it puts me on the floor under them. also would this be in onplayerrespawn.sqf
What about setPosATL right after spawn?
If you are spawning on marker, do you got that market on top of building?
what do you mean?
how are you creating the respawn positions?
The spawns work ok they do, they just put me below the building rather than on them every time. I’d have to check when I get home if you want the scipt side of it
@proven charm
so script adds the positions?
Just put the respawn position module and delete the respawn_west markers and edit the module by your need
ya it allows to set the Z
Is there a way to display text on a sign without using an image?
Yes, with limitations: https://community.bistudio.com/wiki/Procedural_Textures
Note that not all sign objects have selections for retexturing.
If it's not showing you a filename then it's code in an event handler or similar. How many uses of parseSimpleArray do you have anyway?
Thank you
Hi guys!
I am trying to create a screen that, when interacted with, cycles between "helmet cams" on each unit's head.
So far, I seem to have successfully created a "helmet cam" on each unit's head, got the screen to display a new texture and got it to display a unit's camera feed. However I have created a function that should cycle the camera feeds (iterate over them) and it is not working. I am not sure where I am failing. I will provide the script below. I can provide more files or the entire mission if needed for further debugging as well.
params ["_screen"];
// Ensure the screen is turned on before cycling
if !(_screen getVariable ["FK_ScreenPowered", false]) exitWith {systemChat "Screen is powered off. Cannot cycle feeds.";};
// Retrieve or initialize the current feed index
private _feeds = missionNamespace getVariable ["FK_HelmetCamFeeds", []];
private _currentIndex = _screen getVariable ["FK_CurrentFeedIndex", 0];
// Ensure we have valid feeds
if (_feeds isEqualTo []) exitWith {systemChat "No helmet cams available.";};
_cameraCount = count _feeds; // Store the size of the camera array
if ((_currentIndex + 1) == _cameraCount)
then {_currentIndex = 0;} // Reset index if it exceeds the count
else {_currentIndex = (_currentIndex + 1);}; // Increment index
private _newFeed = _feeds select _currentIndex;
// Store the new index
_screen setVariable ["FK_CurrentFeedIndex", _currentIndex, true];
_str = "Current index is: " + str(_currentIndex) + " and the count is: " + str(_cameraCount);
systemChat _str; // Debugging line
_screen setObjectTexture [0, "#(rgb,8,8,3)color(0,0,0,1)"]; // Black screen
sleep 0.1; // Wait for the screen to clear
// Render the camera feed to texture
"rtt" setPiPEffect [0]; // Ensure no post-processing effects
_newFeed cameraEffect ["Internal", "BACK", "rtt"]; // Render camera to texture
_screen setObjectTexture [0, "#(argb,512,512,1)r2t(rtt,1)"]; // Apply texture to screen
true
I am almost certain the issue lies in the last few lines (where it should be updating the camera texture), but I cannot figure out why its not updating. Feel free to ping me if you can help!
Thanks in advance!
it seems you need to _oldFeed cameraEffect ["terminate", "back", "rtt"]; beforehand for _newFeed cameraEffect ["Internal", "BACK", "rtt"]; to take effect 
Dude you're a savior 🥹
Thank you so much!
no need to mess with setObjectTexture while switching feeds in that case as well, it seems
How do you mean?
I tried removing that line, no longer brings up the feed
private _cam1 = "camera" camCreate ((ASLToAGL getPosASL L1) vectorAdd [0, 0, 2]);
_cam1 cameraEffect ["Internal", "Back", "rtt1"];
L1 setVariable ["MUH_attachedCamera", _cam1];
private _cam2 = "camera" camCreate ((ASLToAGL getPosASL L2) vectorAdd [0, 0, 2]);
_cam2 cameraEffect ["Internal", "Back", "rtt1"];
L2 setVariable ["MUH_attachedCamera", _cam2];
S1 setObjectTexture [0, "#(argb,512,512,1)r2t(rtt1,1.0)"];
MUH_cameras = [0, [_cam1, _cam2]];
MUH_cycleCamera = {
MUH_cameras params ["_oldIndex", "_cameras"];
private _newIndex = (_oldIndex + 1) % count _cameras;
MUH_cameras set [0, _newIndex];
_cameras#_oldIndex cameraEffect ["terminate", "back", "rtt1"];
_cameras#_newIndex cameraEffect ["Internal", "Back", "rtt1"];
};
player addAction ["Next Camera", MUH_cycleCamera, [], 1.5, false, false];``` the entirety of code i've used in testing. And `MUH_cycleCamera` is the entirety of switching logic. No `sleep`, no touching `setObjectTexture`, just "terminate one feed, start next" 
interesting to see how the hangar LOD changes when the camera close to it is rendered ;D
nice catch, i've never bothered to look that way 🤣
is [] spawn{}; called many times while object is in game? Or only one time when it spawns?
Put that code in init.sqf or in initServer.sqf
There is no reason to run that code multiple times
ok, thank you
trying to attach an EH to an agent, throws an error. any special rules about agents / can i attach eh's to them?
code/error?
"HandleDamage" EH works on agent for sure 
type error team member, expected object, group
that answers half of the question. What about the code?
{
_x addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
[
_unit,
"Hack Laptop",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{},
{},
[],
12,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _unit];
}];
} forEach agents;
sorry, mid game of cs 😄
was just using the example to see if it worked
agents does not return an object's array 😉
notice how the example uses agent _x in its loop 
have i been a fool and thought it just returned all the agents like units
agent _x
see the example indeed at https://community.bistudio.com/wiki/agents
i mean, that's one pretty solid gotcha 🤣
son, I am disappoint
happens to the best of us (and I)
i nearly escaped
"get over here!!!"
i will never emotionally recover
cheers guys! (i will be no doubt back in 10 minutes with more issues)
you are SQF-scarred for life
come back anytime 😄
could you send me an example? cant even get it to systemchat str the unit
i've tested with something like sqf private _agent = createAgent ["B_Soldier_F", getPosATL player, [], 0, "NONE"]; _agent addEventHandler ["HandleDamage", {systemChat "kek"; 0}];
hmmm, was hoping to just add an eh to all agents
agent (agents#0) addEventHandler ["HandleDamage", {systemChat "kek";0}] equally works 
so should {(agent _x) addEventHandler [...]} forEach agents;, i suppose
yes, {agent _x addEventHandler ["HandleDamage", {systemChat "kek";0}]} forEach agents is working on my machine
cheers, that works
im just a fool
you need to "convert" them from "Team Member" to "Object" with agent indeed - that agent system is… confusing, yes
just a side-note, having 8000 instances of the same action is likely not desired 🤣