#arma3_scripting

1 messages · Page 177 of 1

hallow mortar
#

Just to expand on this, this is because Editor code fields don't go through the automatic pre-processor that normally removes comments before the code is executed. When you write code in external files (like init.sqf or description.ext), they do get preprocessed, so it's safe to leave comments in those.

drowsy geyser
#

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 meowsweats

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>";
};
ancient oyster
#

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;

};

royal quartz
#

Oh okay, I thought this wouldn't interrupt other functionally but just add a new keydown event to that key?

cosmic lichen
# ancient oyster I am kinda confused.. What do i have to do? Thats the scirpt i have rightnow. ...

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

ancient oyster
#

Thankyou I will test#

ancient oyster
#

Thank you very much

stable dune
# ancient oyster 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:

real tartan
#

I end up coding this

private _array = [ "a", "a", "b", "c" ];
private _first = _array # 0:
private _yes = _array findIf { _x isNotEqualTo _first } isEqualTo -1;
little raptor
#

if your array is large your own solution is better. if it's small, mine is better

faint burrow
#
(count (_array arrayIntersect _array)) == 1
little raptor
#

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

pallid palm
#

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

hallow mortar
#

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.

drowsy geyser
#

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";
};
queen cargo
#

crap ...

#

spotted em

#

me stupid

#

forget what i asked ...

torn stream
#

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?

tulip ridge
#

SQF is entirely synchronous

torn stream
tulip ridge
#

No

torn stream
#

F

#

ty anyway

hallow mortar
tulip ridge
#

That's not async though

torn stream
#

it will just run the script at the moment i call it, but it will not let other codes keep running

flint topaz
#

@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 ...

▶ Play video
foggy stratus
#

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.

flint topaz
hallow mortar
drowsy geyser
granite sky
#

Does createDisplay "RscCountdownDisplay" work?

stable dune
stable dune
#
displayUpdate _display;
stable dune
# drowsy geyser i get an error saying: probably badly formed texture name ```sqf 0 spawn { ...
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;
};
drowsy geyser
#

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";
            };
        };
    };
};
drowsy geyser
granite sky
#

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.

drowsy geyser
stable dune
# drowsy geyser error says undefined variable: `#_display displayCtrl 1345 ctrlSetText _timeText...

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;
drowsy geyser
#

thank you very much!

last crystal
#

Is there a command that grabs the first attached object it finds on an object????

#

If so TYYYY

granite sky
#

just attachedObjects _object select 0

last crystal
buoyant hound
#

To active trig by entering 3veh
Its true code for cond?
This and [v1,v2,v3] in thislist

faint burrow
#

No, you should check each vehicle.

rain mulch
#

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

https://cdn.discordapp.com/attachments/811721869480820749/1328128217025871882/Arma3_x64_2025-01-12_16-20-54.png?ex=6798084a&is=6796b6ca&hm=4ad16bf7aca01ea33426fa8a8bac90b830324c41ac9ffcfcb2744bd75a522ca7&

#

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

cosmic lichen
#

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?

rain mulch
#

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

little ether
#

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

hushed turtle
# torn stream so is there no way to run a specific script async?

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.

charred monolith
little ether
charred monolith
#

maybe try to get the type of the ammunition and only generate the ressource if the type of the ammunition is the correct one.

little ether
#

I'll have to learn how, event handlers are completely new to me, but hitpart seems to be what I need

charred monolith
#

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

ancient oyster
#

Hey how would i make the transport car drop off the troops and the drive back?

#

Dont know if theres any scripts needed

hushed turtle
proven charm
#

why isnt addMissionEventHandler "HandleDisconnect" or "PlayerDisconnected" triggered when leaving server in editor MP?

charred monolith
#

If you connect another player while hosting a game from the editor you migth see your code execute

proven charm
#

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

charred monolith
#

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.

proven charm
#

yup i test with dedi all the time.

#

I must have forgotten that the EHs wont work in editor....

charred monolith
#

Pretty much every EH works in editor, just not the ones that executed server side only

proven charm
#

and thats ok if I there is another way to detect game ending?

proven charm
#

maybe have to test

#

i tried addMissionEventHandler ["Ended" but i guess that only triggers when the end commands are called

#

same with "MPEnded"

hushed turtle
#

If I am not mistaken you can also run two instances of the game at the same time

charred monolith
#

But you need a good config to run arma twice at the same time and host a dedicated server.

hushed turtle
#

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

jade abyss
#

hm, can you intercept the put and Take (and exchanging the item?)

#

@queen cargo Agree 😛

granite sky
#

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.

last crystal
#

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 :((

hushed turtle
#

I would never place this in init

last crystal
#

Lmk if that’s possible

hushed turtle
#

You know for what "Variable Name" text box is for?

last crystal
#

and the script doesn’t see that automatically

#

_01 and so on

hushed turtle
#

You want to have multiple bombs?

last crystal
#

and it’s working great it just doesn’t explode each warhead

#

but if I set a variable name

hushed turtle
#

nothing really wrong with naming them like drone_1 and so on

last crystal
#

And then set dmg

#

It works

#

But only for the first one

hushed turtle
#

I think there are more thinks wrong, it looks like more advanced issue, which you don't have skills figure out yet

#

wait works?

last crystal
#

its not that but ok lol

hushed turtle
#

ok, that's great!

stable dune
# last crystal I was thinking of setting a getting the variable name then setting the dmg that ...
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

last crystal
#

almost got discouraged 🫤

last crystal
#

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 👍

ancient oyster
#

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

last crystal
#

@stable dune GOT IT 👍

stable dune
#

Glad it worked

tulip ridge
stable dune
#

I bet he's talking about new china Deepseek AI

neat bloom
#
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.

hushed turtle
#

Want to move all groups to closest map marker?

neat bloom
#

so almost every group will have their own marker

hushed turtle
#

Would give them waypoint rather then move command

neat bloom
hushed turtle
#

wait

#
{
  private _nearestMarker = [ allMapMarkers, leader _x ] call BIS_fnc_nearestPosition;
  _x addWaypoint [ markerPos _nearestMarker, -1];
} forEach AllGroups;
neat bloom
#

Ill try it now

granite sky
#

Should be markerPos not getPos

#

getPos works on locations but not markers.

hushed turtle
#

Thanks

neat bloom
#

Thanks you both very much

neat bloom
#

because i was always getting error that types are incorrect

hushed turtle
#

no need to check if unit is alive. It wont be in group nor in AllGroups

granite sky
#

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.

neat bloom
#

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)

hushed turtle
#

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

neat bloom
hushed turtle
#

There was position instead of markerPos

granite sky
#

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).

hushed turtle
#

sqf is sometimes kinda weird with order of execution

neat bloom
hushed turtle
#

Yes, you've talked about changing marker colors

#

awit

neat bloom
#

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

hushed turtle
#

Nevermind, you are talking about some checkpoints and not makers

neat bloom
#

it is like frontline

hushed turtle
#

I've imagined markers for some reason

neat bloom
#

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

hushed turtle
#

@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.

granite sky
#

forEach isn't really a control structure. It's just a binary command.

#

SQF doesn't really have control structures :P

ancient oyster
#

So far worked very well for me

#

to fix my issues

hushed turtle
#

It might not be the best solution, but it can work

stable dune
hushed turtle
last crystal
#

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 🫡🫡😴😴

fair drum
#

can the HandleChatMessage EH fire on # server commands?

dusk gust
# fair drum 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

fair drum
#

off to make my own skimmer then with a custom macro for players to use

radiant lark
#

Hey, any way to do a sort of AttachTo and enable collision to the object being attached?

granite sky
#

You mean collision with the object it's attached to?

open hollow
#

there is a script/mod that solves this?

warm hedge
#

No script. Mod maybe

open hollow
#

there is no way to change that "angle" via script?

granite sky
#

what, like prevent units from aiming upwards when prone?

open hollow
#

but also want to know if is posible to define that "angle" via script for the zeroG script from Jerry

radiant lark
#

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

warm hedge
#

It is a feature. Not something you can alter

radiant lark
neat bloom
# hushed turtle How do you change marker colors?
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

cosmic lichen
#

It's blufor btw😄

cosmic lichen
lime rapids
neat bloom
#

not remain

cosmic lichen
#

You can copy them

neat bloom
#

I dont really understand

cosmic lichen
#

But the name doesn't matter in the end does it?

neat bloom
#

Maybe, in first line of script i sent, change private_zones to search not "frontbox_", but "blufrontbox_"

neat bloom
cosmic lichen
#

But you still need to loop over all of them to update the status, don't you?

neat bloom
#

Yes

#

i recall same script each 5 seconds in init.sqf

cosmic lichen
#

So why do you need to check the closest first?

neat bloom
cosmic lichen
#

I see

neat bloom
#

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

cosmic lichen
#

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.

hushed turtle
#

I don't see variable _allUnits used anywere and allUnits only returns alive units, so no need to check if alive

neat bloom
hushed turtle
#

I wish sqf had structs, so we could put multiple related variables into struct, rather than putting it in arrays

faint burrow
faint burrow
neat bloom
faint burrow
#

Yes.

neat bloom
#

Thanks

hushed turtle
neat bloom
stable dune
#

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 ..

neat bloom
#

It didnt even come to me that it is possible

#

Yes, no more error

stable dune
#

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?

hushed turtle
#
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

neat bloom
#

are checkpoints some special arma 3 objects?

hushed turtle
#

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

hushed turtle
#

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

ancient oyster
#

only thing is the // explation

winter rose
#

yeah don't use ChatGPT (see pinned messages).

stable dune
bold rivet
#

Someone knows if a event handler exists, that triggers when a player is controlling a drone?
(couldnt find one in the EH list)

atomic niche
#

VisionModeChanged iirc

little raptor
#

See the mission event handlers

bold rivet
atomic niche
#

Oh yeah ur right thats for NVG toggle

bold rivet
#

Im gonna try Player view change, thanks

#

seems to work, thanks

proven charm
#

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

granite sky
#

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.

proven charm
#

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)

granite sky
#

With abort?

proven charm
#

not sure

#

locally hosted has "save & exit" button (which takes you back to the lobby)

old owl
proven charm
hushed turtle
#

Disconnects should not fire when you just go back to lobby. Nobody is disconnecting

#

You just got back to lobby

proven charm
old owl
proven charm
#

would need new EH just to run that command

old owl
#

Ahh client hosted game?

proven charm
proven charm
old owl
# proven charm 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?

proven charm
#

just for the server to run one final operation before shutting down

old owl
#

Is this a sync like operation that can also kinda be ran at any time or is it exclusive to shut down?

proven charm
#

need it for shutdown

old owl
#

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.

proven charm
#

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

old owl
#

Are you intending for any client in mission to be able to abort and end the mission for all connected clients?

proven charm
#

no

#

well admin can ofcourse

old owl
#

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?

proven charm
#

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 🙂

old owl
#

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

stable dune
#

Triggered when the server switches off from "playing" state (mission ends, server closes, etc.

proven charm
#

maybe but id prefer non hacky solution for this. the user could also just alt + F4

stable dune
#
addMissionEventHandler ["MPEnded", {
    // no params
}];
proven charm
old owl
#

That does look like that would work for your intended situation

proven charm
#

lemme try that again

#

nope cant get it to trigger

#

hopefully thats just me... but idk

old owl
#

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
    }];
};
proven charm
#

i can try that

#

aah that works! 😄

old owl
#

Yay!!!

proven charm
#

at least i get rpt report

#

u sure that runs only in game end though? not when you open some dialog or something

granite sky
#

It'll run when the main game display is closed. Certainly not when you open dialogs.

granite sky
#

If you quit a mission while it's still on the briefing screen then it might not fire.

proven charm
#

wasnt sure when main display can close/open

granite sky
#

(because display 46 never opened)

old owl
#

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.

proven charm
#

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

proven charm
#

@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 🙂

proven charm
vapid dune
#

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.

faint burrow
#

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.

proven charm
vapid dune
proven charm
vapid dune
proven charm
#

ok

vapid dune
old owl
proven charm
remote cobalt
#

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.

cosmic lichen
#

PersianHead_A3_02 -> Jalali

vapid dune
halcyon creek
#

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"];```
faint burrow
halcyon creek
#

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?

faint burrow
# halcyon creek I miss understood what Hide on use meant

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

halcyon creek
#

so lets say the unit was called "Jason" it would be "Jason" removeAction 0;

#

as that would be Jasons only action?

faint burrow
#

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.

halcyon creek
#

Alright cheers

jaunty ravine
#

Is it possible to add target lead indicators in rifle optics via script/configs or do you have to have an actual vehicle?

real tartan
#

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;
};
warm hedge
#

Determine to do what?

real tartan
#

some other logic in loop

warm hedge
#

Not sure why that code is not satisfying your goal

real tartan
#
if ( _i isEqualTo _total ) then { /* ... do something ... else */ };

this does not work, as _i at last iteration is not equal to _total ( rounding error )

warm hedge
#

Then what about _i > (_total - _step)

dapper cairn
#

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

granite sky
#

Turrets with AI in them or not?

dapper cairn
#

pieces

granite sky
#

Not really my thing but IIRC you use animateSource

dapper cairn
#

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

upbeat tulip
#

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

lime rapids
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
open hollow
#

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

faint burrow
#

Store it in backpack object.

pallid palm
#

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"];

tulip ridge
stable dune
#
format ["%1 Destroyed Cache",name _instigator] remoteExec ["systemChat"];
pallid palm
#

oh wow awsome

#

man i was way off

#

thx m8

tulip ridge
#

I mean, the only thing that was "wrong" was the parseText
Making the format simpler is just that, making it simpler

faint burrow
#

Do you really need parseText?

pallid palm
#

ummm not really

faint burrow
pallid palm
#

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

open hollow
tulip ridge
#

Backpack deployable weapons are a vanilla feature

pallid palm
#

agree

#

you do know the fix to some things in not just downloading a Mod

#

look in the game 1st @open hollow

tulip ridge
# open hollow There is a mod already done?
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

open hollow
finite tusk
#

Trying to remove large area of grass, this possible with Logic Entity?

open hollow
quick rose
#

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 ❤️

faint burrow
quick rose
faint burrow
#

I know, and this article helped me at one time.

halcyon creek
#

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; 
stable dune
#

You are missing () around your calculation

halcyon creek
#

Just caught that myself and was about to edit, but I was correct the (*/60) is in minutes rather than Hours

faint burrow
#

Yes, but 10 minutes is 10/60 or 1/6, not 1/60.

halcyon creek
#

Thank you!

#

That also makes total sense

faint burrow
#

Plus in MP skipTime should be executed on server.

halcyon creek
#

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)

faint burrow
#

Only if you checked this in trigger settings.

halcyon creek
#

I shall be honest, I have never quite gotten the hang of making MP scripts vs making SP

buoyant hound
#

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?

pallid palm
#

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

hallow mortar
#

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
pallid palm
#

agree'

tulip ridge
pallid palm
#

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

raw vapor
#

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'?

pallid palm
#

looks like you dont have the mod installed correctly

#

but i dont know much so....

south swan
raw vapor
halcyon creek
#

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?

tulip ridge
pallid palm
#

carter setPos (getMarkerPos "markername"); @halcyon creek

halcyon creek
#

perfect I shall try that

#

Works perfectly, however the units are all halway through the floor 😂 back to the drawing board

hushed turtle
#

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

split ruin
#

what are the default values forcamouflageCoef used in setUnitTrait command? 1?

hallow mortar
#

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.

hushed turtle
#

Wait, do markers have height? 😀

hallow mortar
# hushed turtle 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.

hushed turtle
#

I see

hallow mortar
hushed turtle
#

I noticed markers in eden in 3D lately, so that's vanilla

#

Thought it was mod

split ruin
#

I got it with getUnitTrait , default value is 1 🙂

hallow mortar
hallow mortar
hushed turtle
hallow mortar
pallid palm
#

yeah thats wierd that they changed the marker hight

#

but you can see a empty marker in 3D so i guess its cool

urban bluff
#

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?

granite sky
urban bluff
granite sky
#

Find one mine command that you remember, hope it's a category :P

urban bluff
steady spindle
#

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;
};
faint burrow
faint burrow
#

Plus, since _interpreter is not an array, you should use ==, not in.

exotic flame
#

Script should be

if (1 == (player getVariable "_interpreter")) then
{
    ["fr","du"] call acre_api_fnc_babelSetSpokenLanguages; ["du"] call acre_api_fnc_babelSetSpeakingLanguage;
};
steady spindle
#

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!

stable dune
#

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)

hazy turtle
#

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?

lime rapids
hazy turtle
#

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""]"

pallid palm
#

yeah the some mags were not stored in vest and other containers erra is a pain in the arse

tulip ridge
#

Just make the containers bigger or put stuff in a backpack

pallid palm
#

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

hallow mortar
#

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.

tulip ridge
pallid palm
#

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

royal quartz
#

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.

pallid palm
#

tab key for ground to air lock

royal quartz
#

via code.

pallid palm
#

i see well i hope you find it

tulip ridge
#

For scripting though, those warnings will still be logged before those scripts run

pallid palm
#

ok i see thx Dart

pallid palm
#

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

ruby turtle
#

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;
pallid palm
#

nice

#

so ace is the mess up right ?

#

lol

ruby turtle
#

I think the drone tries to scan an ACE_WHeel loaded in a vehicle nearby and getting an error on this

pallid palm
#

hmmm i see

#

so whats the fix ?

ruby turtle
#

the behaivor based on research.fsm

#

from contact

ruby turtle
pallid palm
#

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

ruby turtle
pallid palm
#

i find wiki is hardly ever helpful but the guys in here like Dart and others are awsome

ruby turtle
#

darttruffian?

pallid palm
#

no i think its Just DART

#

hes like a super pro on C++

ruby turtle
#

AT Dart shows me 20+ DART in this discord ^^

pallid palm
#

@tulip ridge

ruby turtle
#

thx

pallid palm
#

rgr m8

#

rgr = roger

#

m8= mate lol he he

ruby turtle
#

I know ^^

tulip ridge
pallid palm
#

omg what Arma 3 dont use C++ huh ?

#

oh no

lime rapids
ruby turtle
pallid palm
#

wow i did not know that holy cow

tulip ridge
#

ACE Cargo just attaches them really low under the vehicle yeah

ruby turtle
#

And the drone still trys to pick it up and rotate it in some way 😦

pallid palm
#

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

lime rapids
#

eh its pretty easy to learn and the operators are all pretty easy to find

pallid palm
#

yeah i was machinst 25 years

lime rapids
#
  • generally a large amount of support here for any weird code one could be doing
#

ah ok

pallid palm
#

but i retired now woohoo

#

you mean operators as in C++ no no just kidding lol

#

im having too much fun lol

lime rapids
#

ur g lol im just looking here between test results

pallid palm
#

copy that m8

granite sky
#

I've used scripted FSMs. The editor is kinda fun but in the end they're not good for performance.

pallid palm
#

really

#

good to know

lime rapids
#

the closest arma gets to visual coding lol

granite sky
#

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.

lime rapids
#

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

pallid palm
#

i can't handle any wacky syntax lol

lime rapids
pallid palm
#

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

lime rapids
pallid palm
#

lol no no your ok m8

#

i can tell

ruby turtle
pallid palm
#

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

sharp grotto
#

Mods are not the problem, badly made mods are the problem.
Arma without mods is rather bland and would have been long dead.

halcyon creek
#

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

faint burrow
halcyon creek
#

I dont follow, could you please explain it to me like im 5?

faint burrow
#

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.

halcyon creek
#

So similar to Example 4?

_actionID = JasonMonoma addAction 
["Speak to the man","informantintel.sqf",[_actionID],1,true,true,"","_this distance _target <2"];
south swan
#

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 blobdoggoshruggoogly

faint burrow
#

Your script should contain these lines:

params ["_unit", "", "_actionId"];

_unit removeAction _actionId;
halcyon creek
#

I see, and _unit doesnt need to be specified? as in I dont need something like _unit = JasonMonoma

faint burrow
#

It's already specified.

south swan
halcyon creek
#

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

pallid palm
#

@sharp grotto in your opinion

granite sky
#

Well, the second part. The first part is true. Mods don't necessarily have a performance cost.

pallid palm
#

well yes if the mod is made perfect

granite sky
#

It's not like vanilla Arma is made perfect :P

pallid palm
#

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

flat eagle
#

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?

pallid palm
#

dont need it

#

you can put anything there

flat eagle
#

right but why define 0

pallid palm
#

you could put 78587346476 =[]

flat eagle
#

ohh

#

kinda lame

pallid palm
#

its not defining 0

#

you can take it away

flat eagle
#

right its just "defining" it could have been anything they just chose 0

pallid palm
#

get rid of it dont need it

#

its not defining 0

#

you can put nul =[] or 0 =[] or remove it

flat eagle
#

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"

pallid palm
#

well in a field of a trigger people use it

granite sky
#

I figured it used to be necessary in some ancient version of Arma.

#

or maybe just a cargo cult.

flat eagle
pallid palm
#

good

flat eagle
#

old voodoo left over from times gone

pallid palm
#

like i used to put exit at the end of all my scripts lololol

granite sky
#

On the other hand, 0 spawn { // code here } is legit.

pallid palm
#

for the old sqs stuff lol

flat eagle
#

why 0 tho

#

selection?

granite sky
#

It's slightly cheaper than an empty array.

pallid palm
#

its zero right not O

flat eagle
#

sure

pallid palm
#

its just away to be cool i guess lol

flat eagle
#

i guess

granite sky
#

actually might not be because empty arrays are pretty cheap too, but it's a valid option at least :P

pallid palm
#

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

flat eagle
#

not sure, i always define my stuff

pallid palm
#

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

flat eagle
#

you know who would know what 0 = did. Mr Lou Montana

pallid palm
#

yeah is good

#

i like Lou

#

he helped me alot and other great guys in here also

flat eagle
#

thats why i mention him. hes the guy

pallid palm
#

well yes he is the guy but there other great guys in here also

flat eagle
#

right but i want to know what he knows

pallid palm
#

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

granite sky
#

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.

pallid palm
#

agree

flat eagle
hallow mortar
# pallid palm https://forums.bohemia.net/forums/topic/173485-why-are-people-assigning-function...

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.

pallid palm
#

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

pallid palm
#

agree

flat eagle
#

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

hallow mortar
terse tinsel
#

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?

hallow mortar
pallid palm
#

@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

terse tinsel
hallow mortar
#

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.

hallow mortar
# terse tinsel oh, I didn't know about it, thank you very much, I'll check it out soon

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?

flat eagle
#

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?

terse tinsel
terse tinsel
pallid palm
#

i just hit free look off and turn my guy to where i want to go

terse tinsel
pallid palm
#

but isnt there a center view bind

hallow mortar
terse tinsel
dusty steppe
hallow mortar
# terse tinsel exactly as you wrote :). can this be done?

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.

flat eagle
#

you would have to make sure the addaction is ID'd correctly on all machines by making sure what order its all called in

terse tinsel
terse tinsel
pallid palm
#

yeah its called center look

dusty steppe
hallow mortar
terse tinsel
flat eagle
#

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

hallow mortar
#

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.

pallid palm
#

oh i see now what you were asking

#

@terse tinsel

flat eagle
#

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

south swan
#

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} tanking

pallid palm
#

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

south swan
#

(if checking said variable every single frame is worth it is another question)

terse tinsel
pallid palm
#

well i never played squad but let me see if i can come up with the correct set up

hallow mortar
#

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];```
flat eagle
#

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"

terse tinsel
pallid palm
#

ill do my best

south swan
hallow mortar
# flat eagle or are you saying if a addaction is removed before this addaction is removed the...

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.

flat eagle
#

hes completly right

granite sky
#

IIRC the action IDs are re-used, so you should clear the variable when you do the removeAction. Might be misremembering though.

flat eagle
south swan
#

i'm up to actionID of 8.5e6 in my dirty add-print-remove loop testing, so it should be safe without resetting blobcloseenjoy

terse tinsel
granite sky
steel pond
#

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";
};```
steel pond
pallid palm
#

dont be sorry be happy he he

hidden jacinth
#

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

hidden jacinth
winter rose
#

I would assume:
create a curator module
assign to a player using assignCurator
????
profit?

hidden jacinth
#

Haha profit indeed.
Thanks I'll give it a shot

main pasture
#
        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

vivid pumice
#

Do I need to set up a code or something to set up the respawns?

main pasture
#

if you are making mission go to

vivid pumice
#

and I just place it?

#

and it’s done?

tulip ridge
dusty steppe
# vivid pumice and I just place it?

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

main pasture
#

cuz I forgot

#

since I only need the ace string for the heal

tulip ridge
#

If you're using apply, a string wouldn't do you any good

#

Are you just trying to heal the unit?

main pasture
#

so AI has to heal other AI like a player would

tulip ridge
#

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

main pasture
#

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

tulip ridge
#

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

main pasture
#

but I kinda don't know why is says array

tulip ridge
#

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

main pasture
#

ik

#

the _wounds gets the variable of openwounds

#

and then I use the wounds to apply the params

tulip ridge
#

But _wounds is another location

#

It's not an array of every single wound

#

Your params is also wrong

main pasture
tulip ridge
#

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;
charred monolith
#

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

old owl
old owl
# charred monolith Hey, is there a way to get the player that execute a script inside a console ? I...

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 {};
little raptor
#

It gives you the client that remoteExeced something

#

I know there is player but 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 run player on the PC that executes something, it gives you their player, and you can send that via remoteExec

charred monolith
little raptor
#

Then yeah what you want is Milo's answer

charred monolith
#

Ok thank you ^^

molten drift
#
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

formal grail
#

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).

split ruin
#

player in limbo with ACE?

tulip ridge
#

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

trail rose
#

I'm still trying to persuade the triumvirate of evil to put this into the upcoming ACE update.

I love you to @tough abyss

jovial aspen
#

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

formal grail
willow hound
#

@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 false and "" 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.

formal grail
#

And sometimes I think it chokes the server.

real tartan
#

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 ];
hallow mortar
#

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.

mint flame
#

@hallow mortar hey man can u help me with a simple script?

hallow mortar
#

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.

dire island
#

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.

faint burrow
#

So you want to replace # someText with [h1]someText[/h1]?

granite sky
#

regex is a standard method. You want to look it up elsewhere.

dire island
faint burrow
#

Try this:

_string regexReplace ["# (.+)\n/gi", "[h1]$1[/h1]\n"];
dire island
dire island
faint burrow
#

In particular, without g flag only first occurrence will be replaced.

dire island
#

ah, so without /g

otherText
# secondText
otherOtherText```
would be 

```[h1]firstText[/h1]
otherText
# secondText
otherOtherText```?
faint burrow
#

Correct.

agile pumice
#

thanks commy

pallid palm
#

my new fav word is = propagate

#

he he

orchid geyser
#

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:

open hollow
#

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 :/

tender sparrow
#

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

granite sky
#

You can create a trigger in script, certainly.

tender sparrow
#

how would i go about doing that?

granite sky
tender sparrow
#

ty

pallid palm
#

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 ?

granite sky
#

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.

coral oracle
#

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

granite sky
#

magazinesAmmo would be your starting point, but identifying HE magazines is fairly tricky.

pallid palm
#

@granite sky copy that m8

#

omg don't go to gen chat omg its nuts

lime rapids
pallid palm
#

copy that

opal zephyr
#

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

granite sky
#

What information do you want to sync?

#

The simple answer is "absolutely not" but you could bounce stuff like target lists across.

opal zephyr
hallow mortar
#

Is it critical that it does not exist on clients 3 and 4, or would existing but invisible be OK? (hideObject)

pallid palm
#

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

opal zephyr
granite sky
pallid palm
#

ID i mean

granite sky
#

In general working with the group ID is doing it wrong. You want to store the group object somewhere.

pallid palm
#

hmmm im not sure what u mean

granite sky
#

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.

pallid palm
#

then i guess i mean variable name?

granite sky
#

But then if you say "my group" then you know it's the one with player in it, at least locally.

pallid palm
#

hmmm

#

ummm

granite sky
#

(and then you can just do group player)

pallid palm
#

hmm ok i see let me try that

wind flax
#

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.

warm hedge
#

For what purpose?

granite sky
#

Is this UI-on-texture stuff?

wind flax
#

Yep

granite sky
#

As far as I know the unique name is created and only exists for that purpose.

#

So it's not in config anywhere.

warm hedge
#

The procedural texture declaration also declares it

granite sky
#

It's just a way to refer to your texture-display later.

wind flax
#

So the "displayClassName" in this definition would be the RscTitles classname, correct?

#(rgb,width,height,mipCount)ui("displayClassName","uniqueName","texType")
granite sky
#

No, because it doesn't use RscTitles.

#

It's the one you'd use for createDisplay or createDialog.

wind flax
#

Okay

granite sky
#

They're placed in root config for some reason. Messy as hell.

warm hedge
#

You can try RscDisplayMain etc to see how it does even work

pallid palm
#

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 ?

granite sky
#

I don't know what USMC Group=this is.

#

It's not SQF.

pallid palm
#

oh sorry i had typed it wrong this is what i ment ---> USMC=Group this

granite sky
#

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

pallid palm
#

ah ok

granite sky
#

If it's a unit, then USMC_Group=group this would be correct. Probably.

pallid palm
#

that is in the init of each of my soldiers

granite sky
#

well, you don't need to set the variable for each soldier...

#

And the group has its own init.

pallid palm
#

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

pallid palm
#

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

pallid palm
#

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

glossy trench
#

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?

gleaming onyx
#

getting this error and its 100% a mistake from my side meowsweats
but where can I get info about what script it is?

dense topaz
#

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_

winter rose
#

this is the scripting channel, try #server_admins with some more details please

dense topaz
#

ah cheers

formal stirrup
#

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

warm hedge
#

Which vector

patent goblet
#

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

proven charm
#

rope kills the UAV?

proven charm
patent goblet
#

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];
proven charm
#

idk about those nils if they work

#

but have you tried ropeAttachTo ?

patent goblet
#

rope to UAV? no

proven charm
#

usually attach commands disable collision between the two

haughty sand
#

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

hushed turtle
#

If you are spawning on marker, do you got that market on top of building?

proven charm
haughty sand
#

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

fleet sand
#

Just put the respawn position module and delete the respawn_west markers and edit the module by your need

proven charm
#

ya it allows to set the Z

summer nymph
#

Is there a way to display text on a sign without using an image?

hallow mortar
granite sky
warm fern
#

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!

south swan
#

it seems you need to _oldFeed cameraEffect ["terminate", "back", "rtt"]; beforehand for _newFeed cameraEffect ["Internal", "BACK", "rtt"]; to take effect blobdoggoshruggoogly

warm fern
#

Thank you so much!

south swan
#

no need to mess with setObjectTexture while switching feeds in that case as well, it seems

warm fern
#

I tried removing that line, no longer brings up the feed

south swan
#
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" ![blobdoggoshruggoogly](https://cdn.discordapp.com/emojis/748124048025714758.webp?size=128 "blobdoggoshruggoogly")
hollow thistle
south swan
#

nice catch, i've never bothered to look that way 🤣

neat bloom
hushed turtle
#

There is no reason to run that code multiple times

neat bloom
tight cloak
#

trying to attach an EH to an agent, throws an error. any special rules about agents / can i attach eh's to them?

south swan
#

"HandleDamage" EH works on agent for sure blobdoggoshruggoogly

tight cloak
south swan
#

that answers half of the question. What about the code?

tight cloak
#
{ 
    _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

winter rose
#

agents does not return an object's array 😉

south swan
#

notice how the example uses agent _x in its loop blobdoggoshruggoogly

tight cloak
#

have i been a fool and thought it just returned all the agents like units

winter rose
tight cloak
#

oh dear

#

whats happened to me

south swan
#

i mean, that's one pretty solid gotcha 🤣

winter rose
tight cloak
#

starts new job
forgets everything about sqf

winter rose
#

happens to the best of us (and I)

tight cloak
#

i nearly escaped

winter rose
#

"get over here!!!"

tight cloak
#

cheers guys! (i will be no doubt back in 10 minutes with more issues)

winter rose
#

you are SQF-scarred for life
come back anytime 😄

tight cloak
south swan
#

i've tested with something like sqf private _agent = createAgent ["B_Soldier_F", getPosATL player, [], 0, "NONE"]; _agent addEventHandler ["HandleDamage", {systemChat "kek"; 0}];

tight cloak
#

hmmm, was hoping to just add an eh to all agents

south swan
#

agent (agents#0) addEventHandler ["HandleDamage", {systemChat "kek";0}] equally works blobdoggoshruggoogly

#

so should {(agent _x) addEventHandler [...]} forEach agents;, i suppose

#

yes, {agent _x addEventHandler ["HandleDamage", {systemChat "kek";0}]} forEach agents is working on my machine

tight cloak
#

im just a fool

winter rose
#

you need to "convert" them from "Team Member" to "Object" with agent indeed - that agent system is… confusing, yes

south swan