#arma3_scripting

1 messages Β· Page 201 of 1

winter rose
#

why must you hate me for being superior

#

(fun fact: I agree factually, I just disagree aesthetically πŸ˜„ I myself write + ""\n+ ""\n+ "" strings)

meager granite
#

Truly superior would be using image and setAttributes, bet its faster than parseText format

pallid palm
#

i agree with Lou

magic dust
#

Is there a command to "attach" a waypoint to a unit, that update waypoint positon when the unit moves?

waypointAttachVehicle didnt work, or I have to use setWaypointPosition in a loop?

winter rose
magic dust
#

The visual position of waypoint do changes, but the unit still goes to original position

_enemyGroup = createGroup [west, true];
_enemyPos = player getPos [50, random 360];
_enemyClass = "B_Soldier_A_F";
_enemyUnit = _enemyGroup createUnit [_enemyClass, _enemyPos, [], 0, "NONE"];

[getAssignedCuratorLogic player, [[_enemyUnit, player], false]] remoteExec ["addCuratorEditableObjects", 2];

[_enemyUnit] joinSilent _enemyGroup;
_enemyWp = _enemyGroup addWaypoint [[player], 0];
_enemyWp waypointAttachVehicle player;

player setPosATL (player modelToWorld [0, 100, 0]);
winter rose
#

try perhaps another type of waypoint? Search And Destroy to track, Get In for a vehicle, etc

magic dust
#

changewaypoint type have no effect, BIS_fnc_stalk worksπŸ‘Œ

versed belfry
#

Is there a way to get the turret of a vehicle as an object / prop? I tried just using the tank and setting the object textures for the hidden selections to "" but that doesn't hide the tracks :(

tulip ridge
#

But no, you can't separate out the model like that

versed belfry
delicate hedge
#

when i use addEventHandler does it adds globaly or i need to remoteexec it? and CBA_fnc_addEventHandler too?

#

and how does the Killed event triggers? only where object is local?

hushed turtle
#

Event handler added by addEventHandler fires on the machine where event is local

tulip ridge
delicate hedge
#

or can i use MPKilled added with addMPEventHandler, and than just check locality?

tulip ridge
#

Local to where, the machine running the rest of the script? Local to the object itself?

delicate hedge
tulip ridge
drifting badge
#

got a bit of a problam with a script that lets the unit continuously fire for as long as they still have more than 10 rounds of ammo left

for "_i" from (_number) to 10 step -1 { 
//code for continuous firing dependent on the _number of ammunition left
}```
The above works fine and the units shoot away very happily, but I somehow want to be able to manually stop their firing (i.e. "break the loop" via addaction) if needed - but how best to achieve it? I thought I had it just using ```disableAI "FIREWEAPON"```, which stops the shooting of course, BUT I did notice that the ```for from to``` loop continues on, because as soon as I switch ```enableAI "FIREWEAPON``` back on for those guys, they will immediately pick up where they have left off in that loop and continue their shooting from before. So I need to find a way to somehow end that loop.

Hope that made sense.
radiant lark
#

If somebody struggles with BE (BattlEye) Filters, just create a script.txt file on the same directory as your BEServer.cfg & BEServer.dll with the following content inside of it:
1 ""

It will now enable the filters, and start logging exceptions from which you make the filters.

drifting badge
#

@thin fox - Thanks mate, exitWith did the charm!

agile pumice
#

I hate when discord doesnt load the recent chats properly and I comment on something super old XD

pallid palm
#

this stops that stupid stuck Anim when you Para Drop into the water, i found you only get stuck sometimes

#
if (surfaceIsWater getPosASL _player) then 
{
    _player SelectWeapon "arifle_SDAR_F";
    sleep .5;
    _player switchMove "amovpercmstpsraswrfldnon";
};

//or this whatever your ueing for  player
if (surfaceIsWater getPosASL player) then 
{
    player SelectWeapon "arifle_SDAR_F";
    sleep .5;
    player switchMove "amovpercmstpsraswrfldnon";
};
#

i use it at the end of my ParaDrop Script, Or just after player enters water from ParaDrop Script:

edgy dune
warm hedge
#

Of course, why not

#

...If you mean store same value on two keys

hushed turtle
#

Only keys must be unique

#

Maybe he is asking if hashValue can return same value for two different objects

edgy dune
#

I dont think I understand, lets say I have two units could their hashValue be the same?

#

or say two projectiles

warm hedge
#

Hm I think I didn't understand your point. No it won't (it likely not to be exact)

hushed turtle
#

Even if it can return same value. Chances of that are likely very slim

warm hedge
#

It will happen, it may happen, there is a chance, are all different topic

drifting badge
#

I am using an eventhandler on the player to see if his animation is "weapon raised" (i.e. aiming and ready to shoot) and wanted to automatically adjust his stance (CTRL+W) with playmoveNow. While this does work and the stance is adjusted accordingly, I ended up with a few seconds of being unable to move or do anything each time this adjustment happens?

Thought that this is weird, because if you manually adjust your stance, you are always able to move/do stuff right away. Could not really be the animation itself, as it is very short? So why is it happening, what is causing this and can this short "delay" be fixed or prevented?

still forum
#

And it could somewhat easily be tested out by just running a couple thousand creator id's and object id's through it and seeing if there is a collision, or where the first one happens

In practice in multiplayer you maybe have a hundred, or couple hundred creators.
And couple hundred objects each.

pallid palm
#

i don't like squeezing data, WooHoo Arma 3 hell yeah πŸ™‚

hushed turtle
#

At that point one could copy bits from these two 32 bit IDs into one 64-bit number and use that as a key.

#

IDs are unique don't they?

little raptor
little raptor
#

but anyway, I think Dedmen added some kind of unique string ID to objects? (was it netID?) I haven't been following the development recently

old owl
#

NetID is the best way to go for objects which are not players imo. For players I like to use getPlayerUID instead as then data isn't reliant on unit slot but that's just personal preference- also kinda just depends on what you're building too.

brisk lagoon
#

yo

how do I make players who join the server for the first time, to load in with the loadout I set the unit with without defeining the loadout?
or do I have to define it..

#

just came back to arma after couple of years so go easy

hallow mortar
#

If you've set the unit's loadout in the Editor, then it should still have that loadout once a player takes control of it. If it changes, you have a mod or script interfering with it.
Otherwise, it'd be handy to know what you mean by "defining the loadout".

brisk lagoon
#

initPlayerLocal - I assume that I need this, because I wanted to do unit deletion after respawn but gives me error message in game after respawn

Those 2 I assum they work because I do spawn with the loadouts I gave them but, when you first spawn the spawn selection is not showing and just spawns where unit is
onPlayerKilled
onPlayerRespawn

and
description.ext

hallow mortar
#

These are all script (or config) files which can contain almost anything. It's nice that you have them, but that doesn't really tell us what they're actually doing.
If you're working with respawn, you should look at this: https://community.bistudio.com/wiki/Arma_3:_Respawn
and this: https://community.bistudio.com/wiki/Description.ext#Respawn/Revive
You need to set a number of settings to make respawn work how you want - that's up to you.
By default, units don't keep their loadout when they respawn. The new unit is...a new unit, and is created with its base class loadout. If you want the loadout to persist across respawn, you'll need to script it, and how you script it depends on how exactly you want respawn to work.

brisk lagoon
#

Imma be honest, it's all gibbrish for me right now, can I share the sqf so you can peek at them and see what I am doing wrong...?

pallid palm
#

@brisk lagoon Can you tell us how you are tring to save the loadOuts on the playable Units, ?: and also why not just let the games corpseManagerMode get rid of the dead uints

stable dune
pallid palm
#

he wants them to respawn at base with the same loadout i think But i think maybe NikkoJT may have already helped him

#

that would be some explaning i wounder if he has a mic

ruby turtle
#

Does anyone have any idea how to realise a script where civilian player only get opfor aggro when they enter different trigger areas around the map or if the enemy ai see them with weapons? I would appreciate every help. I am a good mission designer my but scripting skills are worse. πŸ™‚

pallid palm
#

giving the Civ player a Opfor loadOut would be the easy part , but the other part hmmmm id have to think about that

hushed turtle
#

Change his side and his setCaptive when needed

#

Unit's side depends on side of his group

#

So can put civ in blufor group and he will be treated as blufor unit

#

Use setCaptive true to make other units ignore him and then set it back to false to make them shoot him again

ruby turtle
#

don't hate me for using chatgpt as a helper cause as I said, i have no idea about scripting. But this chatgpt gives me:

// initPlayerLocal.sqf

// Liste aller Zivilspieler (optional: oder einfach [player])
private _civPlayers = allPlayers select { side _x isEqualTo civilian };

// PrΓΌft Sichtbarkeit und Waffenbesitz
[] spawn {
    while { true } do {
        {
            private _player = _x;
            
            // Standard: Zivilisten sind unsichtbar fΓΌr OPFOR
            _player setCaptive true;
            
            // Wenn Spieler bewaffnet und von OPFOR gesehen
            private _hasWeapon = (primaryWeapon _player != "" || handgunWeapon _player != "" || secondaryWeapon _player != "");
            private _spotted = false;
            
            if (_hasWeapon) then {
                {
                    if (side _x isEqualTo east && { _x knowsAbout _player > 1.4 }) exitWith { _spotted = true };
                } forEach allUnits;
            };
            
            // Spieler wird angreifbar
            if (_spotted) then { _player setCaptive false };

        } forEach _civPlayers;

        sleep 2;
    };
};

I know that gpt often writes bullshit

tulip ridge
#

Just don't use it
If you're trying to do something, try just going through the logic in your head

Then you can come here and ask about writing the actual sqf

ruby turtle
#

You're just one of many people who have already tried to teach me how to do scripting myself. I couldn't do it back then, and I'm not going to be able to do it now at my age. I've been doing missions since Arma 2, including some very good ones. My strength has always been designing missions rather than the scripting behind them. I will continue to rely on the helping hands of others in the future.

thin fox
#

like I've already said in the other channel, some stuff you need to learn to be able to do other stuff, indirectly

ruby turtle
#

Don't you think that after 16 years of mission building, I've read enough? I've never really understood scripting. These kinds of answers don't really help. No offense intended.

thin fox
sage heath
#

so say in a trigger if the condition to activate if a unit is dead is !alive, then what do i put in if i want the trigger to activate if a unit is still alive?

#

basically for context, i got a scripted thing where a jet gets shot down by a SAM system, but testing reveals that sometimes the SAM miss, so i put in a failsafe where an explosive charge detonates and destroys the jet but i don't wanna make it overkill if the thing does get hit

#

wait im stupid

#

just remove the ! lmao

eternal spruce
#

I'm trying to create a random air patrol with a Loiter WP for a helicopter/plane but it seems as to be an issue if there are more than one loiter waypoint for the given unit it only sees the first one even when i have the wp completed on a timer. Maybe I'm doing this wrong but how would i go about creating a random loiter patrol on different locations

eternal ingot
#

can someone help me with a little code? i have been trying to find it and i cant do it

#

@thin fox would u be free? u seem to be active and educated

eternal spruce
#

@thin fox thank you i didn't know that's how the Loiter wp worked, I'll have to use a script to get the result i want.

eternal ingot
eternal spruce
#

I now know that if a waypoint is added after a loiter waypoint it becomes a move wp, so how do i get this unit to move to the next loiter waypoint.

_wp setWaypointType "MOVE";

_wp1 = group F4E_1 addWaypoint [[68301.5,135312,0], 0];
_wp1 setWaypointType "LOITER";
_wp1 setWaypointLoiterType "CIRCLE";
_wp1 setWaypointLoiterAltitude 2000;
_wp1 setWaypointLoiterRadius 8750;
_wp1 setWaypointTimeout [120, 180, 200];

_wp2 = group F4E_1 addWaypoint [[55000,154608,0], 0];
_wp2 setWaypointType "LOITER";
_wp2 setWaypointLoiterType "CIRCLE_L";
_wp2 setWaypointLoiterAltitude 4000;
_wp2 setWaypointLoiterRadius 15000;```
thin fox
eternal ingot
#

@thin fox it's about a chat.sqf file being triggered after a certain task is finished and then the trigger gets activated by Blufor

#

Idk if it's an eventhandler or waituntil

#

I'm not the best at scripts

tacit lion
#

Is there a way to show/hide the USS Liberty? The module for it isn't working, just on the things on the boat.

warm hedge
#

Liberty and Freedom are done by using multiple objects. The "core" object should have a variable that stores all parts

tacit lion
#

Syncing a hide module directly to the core object doesn't seem to do it. Maybe a trigger area instead?

warm hedge
#

Use script

tacit lion
#

I'm not sure where to start, sorry ^^; My immediate thought is something to do with a forEach loop?

#

I'm mostly a config monkey not a scripter sorry

warm hedge
#

I can't tell what it was called rn, but systemChat str allVariables this in USS's init to see which variable is used in it

tacit lion
#

"bis_carrierparts" showed up

#

But that doesn't make sense because it's not the carrier

warm hedge
#

It doesn't matter

#

It uses same function to spawn parts

#

Use liberty getVariable "bis_carrierparts" and forEach and hideObject

tacit lion
#

liberty being a variable I assign to the ship in the editor?

warm hedge
#

Ye

eternal spruce
#

can someone please explain to me what _grp means in deleteWaypoint [_grp, 2]; and is it referring to the callsign that is assigned to a unit when its placed in the editor or the variable name?

tacit lion
#

Haven't tested in game yet but thinking

private _bigBoat = liberty getVariable "bis_carrierparts";
{ _x hideObject} forEach _bigBoat;
hushed turtle
#

Local variable refering some group. Example you've sent will remove waypoint of index 2 from the group

eternal spruce
#

In this picture the group would be Alpha 2-3?

fair drum
fair drum
eternal spruce
#

can you send me the wiki link as a refference, please

hushed turtle
eternal spruce
#

@stable dune No I ment a reference a group datatype

eternal spruce
hushed turtle
#

That name is gonna be global variable and you can use it anywhere you wish

edgy dune
edgy dune
#

with playSound3D I can give a path to a sound to play, is there something where I can pass in a soundset?

edgy dune
raw vapor
#

How can I set a flag texture and have it show up for all clients? Previously I tried to use setFlagTexture but it only seems to show up for the client who triggered it.

#

I have a feeling it has something to do with remoteexec but maybe someone can answer this before I'm done trying to figure it out myself. smilethonk

#

[flag_var, "flag/texture.paa"] remoteExec ["setFlagTexture"]; maybe?

raw vapor
#

Thanks!

stable dune
#

ups

#

wrong ZDo aafh 92.x

raw vapor
#

I was gonna say, setGlobalTexture doesn't work on flags

stable dune
pallid palm
#
_grp //is a local variable where _grp can be used in scripts
//over and Over again
//like this here
while {{alive _x} count (units _grp)  > 0} do 
{
    {_x setSpeedMode "LIMITED"} forEach units _grp;
    {_x setBehaviour "SAFE"} forEach units _grp;
};
#

WooHoo im totaly Re-vamping all my Missions with call and spawn WooHoo Arma 3 hell yeah, and also my Chopper Command WooHoo πŸ™‚

#

i was using to much execVM and after NikkoJT explane alot of stuff, i got jiggy with it WooHoo πŸ™‚ man i love this game its so much fun πŸ™‚

ornate whale
#

Hello guys, is it possible to consume a return value like this:
0 = [a, b] call aFunction;. Thanks.

still forum
#

[a, b] call aFunction; nil;

balmy kayak
#

Hi guys, does anyone know if it's possible to make a function with a button for CBA to change RVMAT and texture on a certain hide selection on a helmet model?
I want to try to make the Helstar strobe change texture and RVMAT so that I can turn on the lights at night. Or maybe it's possible to do this somehow in the config? Or a proxy, I don't know what options are acceptable at all?

kindred zephyr
balmy kayak
kindred zephyr
#

you can swap the classname that the unit is wearing (for that classname to have its different rvmat and texture), yes, what im not sure about is that you are able change the rvmat of a same classname in real time for helmets, as that ability is limited to CfgVehicles classnames afaik

tulip ridge
#

Yeah you can't change what texture/rvmat a helmet uses like you can with uniforms (or rather the unit wearing it) / objects.

Best you could do is multiple helmet classes and just equipping a different one.

balmy kayak
#

Oh πŸ˜” I got it, thank you very much🫢

jagged creek
#

i am trying do breaching with ace how to i lock doors on building that already in

idle remnant
#

for modelToWorldVisualWorld is the modelPos argument relative to the model centre with rotation? I'm trying to get a point in front of a projectile as it's travelling

#

or should I use velocityModelSpace, does that have the same caveat?

hallow mortar
#

Model space coordinates are in model space. The X, Y, Z axes are the X, Y, Z axes of the model. So yes, rotation is included.

idle remnant
#

thank you

tulip ridge
drowsy atlas
#

Hi folks ive been really struggling to get a reinsert via C47 script to work for a pole what will happen is I can get the plane to spawn and move me into the plane with a parashute but the plane just tries to land at an airfield instead of flying off and self deleting

#

in addition im trying to get it so I click on the map and the plane flies in that direction with the player in the back

drowsy atlas
#

im able to get the plane to fly spawn with me in it once i use the pole but the damn pilots keep flying to the corner of the map or try to land

ruby turtle
#

can anyone help me to find my syntax problem?

setAggroFlag = {
    params ["_unit", "_state"];
    if (!local _unit) exitWith {};
    _unit setVariable ["zoneAggro", _state, true];
};
player addEventHandler ["Fired", {
    params ["_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile"];
    if (!isNull _projectile && isPlayer _unit) then {
        _projectile addEventHandler ["Hit", {
            params ["_projectile","_target"];
            if (!isNull _target && side _target == east && isMan _target) then {
                missionNamespace setVariable ["civForceAggro",true];
            };
        }];
    };
}];

[{
    [player] call wlz_aggro_fnc_checkAggro;
}, 2] call CBA_fnc_addPerFrameHandler;

I get the following error:
1:35:18 Error in expression <target && side _target == east && isMan _target) then {
missionNamespace setVari>
1:35:18 Error position: <_target) then {
missionNamespace setVari>
1:35:18 Error Missing )
1:35:18 File C:\Users\LiquidBlaze\Documents\Arma 3 - Other Profiles\Walzmine\mpmissions\widerstand_in_niedersachsen_wlz.gm_weferlingen_summer\initPlayerLocal.sqf..., line 90
1:35:18 Error in expression <target && side _target == east && isMan _target) then {
missionNamespace setVari>
1:35:18 Error position: <_target) then {
missionNamespace setVari>
1:35:18 Error Missing )
1:35:18 File C:\Users\LiquidBlaze\Documents\Arma 3 - Other Profiles\Walzmine\mpmissions\widerstand_in_niedersachsen_wlz.gm_weferlingen_summer\initPlayerLocal.sqf..., line 90

Maybe I have a logical problem or how I use something. tried using () or {} doesn't helped

hallow mortar
#

isMan is not a command that exists

ruby turtle
#

like this?

player addEventHandler ["Fired", {
    params ["_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile"];

    if (!isNull _projectile && isPlayer _unit) then {
        _projectile addEventHandler ["Hit", {
            params ["_projectile","_target"];

            if (!isNull _target && {side _target == east} && {_target isKindOf "CAManBase"}) then {
                missionNamespace setVariable ["civForceAggro", true];
            };
        }];
    };
}];
hallow mortar
#

I don't think you can have {code} on both sides of &&, only on the right side

#

You could do it like this: (!isNull _target && {side _target == east}) && {_target isKindOf "CAManBase"}

warm hedge
#

You can, because in this context left argument is already a bool

#

If there is something I miss

hallow mortar
#

Depends how the order of operations shakes out, I guess

drowsy atlas
#

this addAction ["✈️ Reinsert via C-47 Paradrop", {
params ["_target", "_caller", "_actionId"];

private _spawnPos = [getPosATL _caller select 0, getPosATL _caller select 1, 1000]; 
private _dir = random 360; 

private _planeClass = "SPEX_C47_Skytrain"; 
private _pilotClass = "B_Fighter_Pilot_F"; 

private _plane = createVehicle [_planeClass, _spawnPos, [], 0, "FLY"]; 
_plane setDir _dir; 
_plane flyInHeight 1000; 
_plane setVelocityModelSpace [0, 150, 0]; 

private _pilotGroup = createGroup west; 
private _pilot = _pilotGroup createUnit [_pilotClass, _spawnPos, [], 0, "NONE"]; 
_pilot moveInDriver _plane; 
_pilot disableAI "TARGET"; 
_pilot disableAI "AUTOTARGET"; 
_pilot disableAI "WEAPONAIM"; 
_pilot allowDamage false; 

private _waypointPos = _spawnPos vectorAdd [0, 2000, 0]; 
private _wp = _pilotGroup addWaypoint [_waypointPos, 0]; 
_wp setWaypointType "MOVE"; 
_wp setWaypointSpeed "FULL"; 
_wp setWaypointBehaviour "CARELESS"; 

_caller moveInCargo _plane; 
removeBackpack _caller; 
_caller addBackpack "B_Parachute"; 

hint "You're aboard a fresh C-47! Jump when ready."; 

[_plane] spawn { 
    params ["_plane"]; 
    sleep 120; 
    {if (!isNull _x) then {deleteVehicle _x};} forEach crew _plane; 
    if (!isNull _plane) then {deleteVehicle _plane;}; 
}; 

}];

this works but i need to ai pilots to just fly straigt

granite sky
#

Well, you're giving them a target waypoint that isn't in the direction that they're facing.

#

If you want them to fly in the direction they're facing then something like this instead:

 private _waypointPos = _spawnPos getPos [2000, getDir _plane];
drifting badge
#

Been trying to use findIf to check several group arrays for one specifically named soldier in each group, that for example has the string "devil" in his variable name (so for example "Devil_01" or "Devil_02" or "Dan_the_Devil"). Want to prevent having to edit the code for each and every group so I thought that findIf might do the trick, but how can I search for a "partial" match in the variable name?

[thislist] findIF {_x == "devil" }
```The above, as I understand it would only get me a guy named devil, but using this is combination with ```typeOf``` would not work as it does not look for strings, right?
warm hedge
#

What kind of code would you write if you use it with typeOf and how it would work (at least on your brain's end)? Just because I can't think how these two ideas can combine into one

drifting badge
#

Oh brilliant thanks @tender fossil that is exactly what I have been looking for, thought I had to use findIF or typeOf but that is a LOT better!!! YEY! :)

tender fossil
sharp grotto
drifting badge
#

oh thanks for the headsup! but it does look for partial names and can compare and that is exactly what I wanted :)

#

@sharp grotto oh that is neat, thanks!

ruby spoke
#

Is there any way I can create a progress bar that's displayed by the Draw3D eventhandler?

pallid palm
#

Hello all: how can i send a hint to All on the server of the player name
that activated this addaction function

_object = _this select 0; // Replace with your object name
_object addAction ["", {
    params ["_target", "_caller", "_actionId"];

    ["functions\fnc_sabotage.sqf", [_caller, _target, _actionId]] remoteExec ["call", 0]; // Execute function globally
}];
hallow mortar
#
private _text = format ["This player just did an action: %1", name _caller];
_text remoteExec ["hint"];```
pallid palm
#

oh wow cool thx NikkoJT your Awsome

hallow mortar
#
["functions\fnc_sabotage.sqf", [_caller, _target, _actionId]] remoteExec ["call", 0];```
This is wrong, `call` cannot call a script file directly
stable dune
hallow mortar
pallid palm
#

oh no can you fix it for me

hallow mortar
#

No. It would be much better if you learned how to fix it yourself.
Your script file appears to already be intended to be used as a function rather than being called directly. You should see if the function exists in CfgFunctions, and if not, you can set it up using the information at Prisoner's link.
Fixing the order of arguments/function name is SUPER EASY, it's literally just switching left for right, you do not need help with this.

pallid palm
#

ok ill try thx you man

hallow mortar
#

Do you actually understand the purpose of any of the things you're writing?

pallid palm
#

i kinda do

#

but not totaly

hallow mortar
#

Do you know what a file path is?

pallid palm
#

oh yes

#

oh i see ok lol

hallow mortar
#

So when I said "you can't directly call a file", and "you need to switch the order of the function name and the arguments", why did you just change the file path to be even more wrong?

pallid palm
#

ok yeah i see lol dam

split ruin
#

@pallid palm you need to add the function path in description.ext as CfgFunctions subclass I think ....

#

then just call it by the name

#
SCO_fnc_theName; 
//SCO is from Scotty :slight_smile:
#

@pallid palm this is how is looking from the mission I am editing

class CfgFunctions
{
    class KIB
    {
        class buymenu
        {
            file = "path\to\category";
            class maxVeh
            {
            file = "func\maxveh.sqf";
            };
        };
    };
};
pallid palm
#

yeah i like the Functions Library

stable dune
pallid palm
#

oh wow awsome man thx alot @stable dune

split ruin
#

@stable dune nice din't know this, I will try it πŸ™‚

pallid palm
#

this all started from a small idea in my head πŸ™‚

#

or a small head in my idea lol

stable dune
pallid palm
#

yeah lol πŸ™‚

#

sorry i'm not so good, iv been playing more then scripting and i forget things all the time

#

i guess thats from my age of 64 maybe

#

but as long as i have you great guys around to help me i should be ok

#

oh and this great program Discord too

late drum
#

Hello! I am having some issues with remoteExec. I want to send a remoteExec to an array of players, but when I do, it does not send...

My code looks something like this:

copsArray = [];
copsArray pushBack player;

"test" remoteExec ["hint", copsArray];

copsArray has the following value: [civ_1]

granite sky
#

Where are you running this code?

split ruin
#

@stable dune mhh ... I made simple function just to test and nothing happens, no error

class cfgFunctions
{
    class KIB
    {
        file = "func" 
        class maxVeh {}; 
        class simpCheck {};
    };
};

to execute I use

call KIB_fnc_simpCheck;

this is the function itself

_message = "tralala";
hint _message;
granite sky
#

player has a different value on each machine so it doesn't make sense to use it to create an array of players.

pallid palm
#

@split ruin your missing 1 thing

granite sky
#

Well, the whole category level

split ruin
#

what I missed ? Maybe the path ?

late drum
granite sky
#

Dedicated server?

late drum
#

Yeah

granite sky
#

player is just objNull on a dedicated server usually.

#

If you wanted to send that hint to all players then this should work:

"test" remoteExec ["hint", allPlayers];
late drum
granite sky
#

Which is fine if you have an array with a specific group of people in it.

#

But the code you pasted is not making any attempt at that.

#

So I can't say what you're doing wrong.

granite sky
#
class CfgFunctions
{
    class TAG
    {
        class Category
        {
            class functionName {};
        };
    };
};
split ruin
#

oh I see

late drum
split ruin
#

@granite sky everything working now, thanks

class cfgFunctions
{
    class KIB
    {
        class SimpleFunc
        {
            file = "func" //PATH TO your script (missionROOT/func/)
            class maxVeh {}; //file "missionROOT/func/fn_maxVeh.sqf"
            class simpCheck {};
        };
    };
};
#

can I define functions in two different folders ?

pallid palm
#

i think you can, but im not sure, cuz im not that good

hallow mortar
#

The typical way to do it would be to make a category for each folder. For example:

class KIB
{
  class soundFunctions
  {
    file = "soundFunctions";
    class function1{}; // mission/soundFunctions/fn_function1.sqf
  };
  class guiFunctions
  {
    file = "guiFunctions";
    class function2{}; // mission/guiFunctions/fn_function2.sqf
  };
};```
pallid palm
#

totaly killer WooHoo Arma 3 hell yeah

tender fossil
split ruin
#

@tender fossil this way they will never learn πŸ˜†

pallid palm
#

i perfer to wright it my self, with the help of others ofcorse

hushed turtle
#

I don't recall using file = thingy at all in my CfgFunctions

hushed turtle
cosmic lichen
#

The file property is optional.

#

You can specific a specific path to a subfolder.

hallow mortar
hushed turtle
#

Ah, so you don't have it functions folder

#

I think I'll leave it at default

#

Only weird thing is file name has prefix fn, but function name is gonna have prefix fnc

cosmic lichen
#

Just Arma Things

split ruin
#

how to find out if the projectile is a hand grenade ?

still forum
#

CfgAmmo simulation/type entry?

#

There is some command to get projectile info, ammoInfo? Something ammo?

#

shot info?

hallow mortar
split ruin
#

I am using the "Fired" event handler, I have the projectile as object, but I need to exit the script if the prejectile is a hand grenade

hallow mortar
#

Try exiting if the weapon is Throw instead

still forum
#

configOf to get it's config.
And then either type or simulation entry

hallow mortar
#

Checking for Throw is probably cleaner because there are a few different simulation types for "hand grenades" (e.g. frags vs smokes)

granite sky
#

Bear in mind that if you want to support ACE then that might use a different weapon for their fancy throwing logic.

still forum
#

I don't think they do, because all mods register grenades with throw weapon. But they might be use any weapon at all and not trigger fired

split ruin
#

I resurrected a wind ballistics script form a2, its working in a3 πŸ₯³

params ["_bullet","_weapon"];
if (_weapon == "Throw") exitWith {};
_wind = wind;
sleep 0.01;
while {alive _bullet} do
{
    _windX = wind select 0;
    _windY = wind select 1;
    _windZ = (wind select 2) + random (2) - random (2);
    _velX = velocity _bullet select 0;
    _velY = velocity _bullet select 1;
    _velZ = velocity _bullet select 2;
    _bullet setVelocity [_velX+(random _windX)/10, _velY + (random _windY)/10, _velZ + (random _windZ)/10];
    sleep 0.01;
};

probably has things to polish but its working

#

I don't know how strong should be the effect in a stormy weather
are 5.56 rounds flying way along the crosswind at 700 m ?

#

I am thinking how to lower the wind deflection πŸ€”

hallow mortar
#

Well, if you read the script you can see there are numbers which act as divisors, controlling the magnitude of the velocity change. Increase those numbers to make the velocity change smaller.

#

You could also substantially simplify this script by using vectorAdd and vectorMultiply

split ruin
hallow mortar
#

Well, you can only set it with 2D vectors, so yeah, probably

tulip ridge
tulip summit
#

does anyone know why when some paa images i've converted from png, show up in game INCREDIBLY dark, to the point where they don't really show at all?

raw vapor
#

Maybe someone here knows the answer too.

sharp grotto
raw vapor
#

Thanks, I'll give that a try.

#

That worked!

hallow mortar
#

The reason it wasn't working before is because in most contexts, _this contains all the arguments that were passed to the current scope. For example, if you do "string" call { hint _this };, then _this contains "string" - and if you have an array of arguments, then _this contains that array. e.g. ["string", 2] call { hint _this } would fail because _this contains ["string", 2].
Event handlers always have an array of passed arguments. Their _this variable is what params parses to get all the things like _unit, _killer etc. So you were trying to use synchronizedObjects not on a single object, but on an array containing the EH unit, the killer, etc., and that doesn't work.

tribal crane
#

As in, black?

golden knot
#

Hey, this is fairly urgent, so if anyone can help, please do. My Unit is trying to run a scaling script that we used like.. 2 months ago. It's not working anymore and we are completely out of ideas

#

It's in a dedicated server as well

fair drum
#

and you don't post the script?

sharp grotto
#

and no rpt? pikachusurprised

tulip summit
#

so dark that it appears black, yes.

exotic flame
#

Is there a way to make the character break reload ? I'm working on a melee system and usually on modern weapons, you don't need to break reload because it only take 2 seconds to reload. But with muskets it takes 15 seconds to reload, that's a bit a lot without a way to break reload to switch on melee

pallid palm
#

when you say break reload do you mean Cancel reload

#

i wish there was away to Knife kill Enemy in Arma 3 with out using Mods

pallid palm
#

Hello all: is this the correct way

#
[_caller, _target, _actionId] remoteExec ["functions\fnc_sabotage.sqf", 0];
hallow mortar
pallid palm
#

ah ok now i understand

#

thx you

#

ok how about now is this correct

#
[_caller, _target, _actionId] remoteExec [[] spawn SFA_fnc_sabotage, 0];
exotic flame
exotic flame
pallid palm
#

well the only way iv found to Cancel reload is buy scripting my own reload script, and i exec it from a radio trigger

#

so i have 2 reloads like the default one and my radio trigger one

#

and the only reason i made the radio reload was so i could get rid of a the old mag that only had like 3 bullets in it when i reloaded: i could not seem to make that happend with the Reload EH

#

and i made that radio reload script into a funtion so i use [] call because theres no sleep in the script

#

im much more awake now i was half asleep earlyer

#

sorry about that

ivory lake
pallid palm
#

what's a gestures ?

ivory lake
#

type of animation

pallid palm
#

ah ok i see

ivory lake
#

reload animations, throwing grenades are gestures

#

hand signals

pallid palm
#

ah copy that

raw vapor
#

Is it possible to detect when specifically a missile-type projectile enters a trigger area, and then to destroy that missile either by prematurely detonating it or by just deleting it if I can't do that?

I have a use case where I want a trigger in a near-future scifi scenario to appear that it was intercepted missiles by a laser APS system on an aircraft. I plan to make the trigger attached to the plane and following it around.

#

I know games like Antistasi have a way of somehow preventing people from throwing grenades or shooting rockets at spawn but I don't know if this detects the projectile and deletes it or just somehow interrupts the weapon firing code.

granite sky
#

detect & delete.

#

It's about six different event handlers because it deals with ACE as well.

exotic flame
wheat jay
#

Hi all,

Anyone have a handy init to make a prop pickup-able?
Trying to make a flag able to be picked up for a CTF style mission.

Thank you!

stable dune
pallid palm
#

oh i see thx you @stable dune

#

i need # 2 then

split ruin
#

why only one patrol is spawning ?

params ["_uberPos"];

for "_i" from 0 to 2 do
{
    private _ptrlgrp = createGroup [west, true];
    _ptrlgrp setCombatMode "RED";
    _ptrlgrp setSpeedMode "FULL";
    _ptrlgrp setFormation "LINE";
    _ptrlgrp allowFleeing 0;
    private _spos = [_uberPos, 100, 200, 0] call BIS_fnc_findSafePos;
    for "_i" from 0 to 6 do
    {
        private _runit = selectRandom KIB_infUnits;
        private _unit = _ptrlgrp createUnit [_runit, _spos, [], 0, "NONE"];
    };
    {_x linkItem "NVGoggles_OPPFOR";} forEach units _ptrlgrp;
    {removeGoggles _x} forEach units _ptrlgrp;
    [_ptrlgrp, position (leader _ptrlgrp), 100] call BIS_fnc_taskPatrol;

    sleep KIB_tskTime;
    private _wp = _ptrlgrp addWaypoint [flg,0];
    _wp setWaypointType "SAD";
    [_ptrlgrp, 1] setWaypointSpeed "FULL";
    [_ptrlgrp, 1] setWaypointBehaviour "AWARE";
    [_ptrlgrp, 1] setWaypointCombatMode "RED";
};
stable dune
#

Try if you change "_i" in 2nd for loop like "_j"
I assume your _i is changing when you use the same var

#

@kiba ☝️

hallow mortar
#

Try adding some systemChat logging to see at what point the script stops

stable dune
# hallow mortar `for` is _supposed_ to be immune to that

Yeh, reading wiki. And
For loops can be safely nested. This means that there should not be any problems with recursion.

_array = [];
for "_i" from 0 to 3 do
{
    for "_i" from 0 to 3 do
    {
        _array pushBack _i;
    };
    _array pushBack _i;
};
hint str _array;```
stable dune
pallid palm
#

oh Man i got it to work correctly i added a groupChat message also: thx you so much @stable dune @hallow mortar

#

man that was the hardest thing i had to do in Arma 3 scripting

#

i think theres smoke coming out of my ears πŸ™‚

tough abyss
#

make sure they have a resultion that is 2^n x 2 ^ m, where |m - n| <= 2

#

512x512

#

64*256

#

etc.

winter rose
#

you have reached the average state of SQF users - congrats!

split ruin
#

@winter rose you really don't want to see the bottom πŸ˜‚

#

I had a friend who made one map a day πŸ™‚

#

quality out of the roof

winter rose
warped igloo
#

quick question, how would I create a string file in my mission folder that I can refer to using a script in a trigger

#

I currently have multiple triggers that perform a selectRandom function, and I want them all to refer to a file to pull the array of options so that I don't have to update the code in every trigger's init

#

this is the array that I want to use and update down the line inside a .sqf file

// Define the teleport points
["teleport_1", "teleport_2", "teleport_3", "teleport_4", "teleport_5"];

and this is the trrgger that I want to have pull from this array file

hallow mortar
#

execVM creates a new scheduled thread, which (currently) cannot return a useful value to the parent scope.
You need to turn the script file into a function, so you can call it.

split ruin
#
BAC_magicTeleports = ["teleport_1","teleport_2","teleport_3","teleport_4","teleport_5"];
publicVariable "BAC_magicTeleports";
\\then
{
  if (!isPlayer _x) then 
  {
    _x setPos (getMarkerPos (selectRandom BAC_magicTeleports)); 
  };
} forEach thisList;

I cannot imagine the context of this magical portals ? πŸ€”

warped igloo
split ruin
#

the function is this ? πŸ˜†

selectRandom ["some markers"];
warped igloo
#

I don't really know how to properly write up the function yet but that's got me looking in the right direction at least

split ruin
#

@warped igloo just use global variable name for the marker names

warped igloo
#

A lot of this fancy terminology is beyond me unfortunately

split ruin
#

@warped igloo you name the markers array to be something like BAC_rTeleport (whatever name u choose), then broadcast it ( with publicVariable command ) and use it when u need to select random teleport

#

this is a way not to have to define a function

warped igloo
#

and what exactly do you mean by "broadcasting it" ?

split ruin
#

just write

publicVariable "the_name"

and u can use it in all scripts in the mission
from all scopes

warped igloo
#

right, and that would be defined in an .sqf file

#

which can then be called by the script in a trigger?

split ruin
#

you don't need .sqf file

#

just define it initServer.sqf and that is

#
BAC_magicTeleports = ["teleport_1","teleport_2","teleport_3","teleport_4","teleport_5"];
publicVariable "BAC_magicTeleports";
#

then you can reach it from the trigger script

warped igloo
#

ahhh that's what I wasn't fully grasping, so you are indeed setting it up in an init file such that it can be reached by triggers

split ruin
#

you don need to use call or execVM , just the global variable name

#

its a "container" for your markers array

warped igloo
#

now I get you

split ruin
#

I think you can define it wherever you want (in a trigger for example) but after this you broadcast it and you will have it everywehere

warped igloo
#

yeah that does the job I was looking for, I was just looking the wrong direction.

#

global variables, gonna keep that one handy in the future 🧠

split ruin
warped igloo
#

appreciate the help

pallid palm
#

@stable dune and @hallow mortar oh man it works so Great woohoo, i love it, thx you so much again guys, i'm really happy you guys helped Me, thank you: thank you: thank you:

#

oh btw thx @winter rose for saying so

#

WooHoo i made it to average: πŸ™‚

#

lol i turned off the enemy and went around blowing up the stuff : to make sure it all worked: πŸ™‚

warped igloo
#

has anyone used the addMagazines function in a way that automatically picks the relevant magazine for the weapon? I'm trying to make it a universal rearm function that works for any weapon the player may have

granite sky
#

Based on what magazines they already have, or just the weapon?

hallow mortar
#

You can try compatibleMagazines.
This is difficult to reliably do fully automatically though, because some mod weapons can have a variety of fake/weird/etc magazines available to them

#

e.g. partial magazines for bolt-actions, magazines with blanks, spotting rifle mags for launchers

granite sky
#

The first element of compatibleMagazines is almost always reasonable.

#

but yeah, not guaranteed. Depends on the mod.

warped igloo
#

yeah, ideally it's to reload your weapon based on the magazine that you already have, if you're plain empty, then any compatible magazine would do

#

the important thing is that it's able to execute regardless of the weapon of the player

#

so the idea is

player addItem ([currentWeapon player] call BIS_fnc_compatibleMagazines);

where you call the function, which should return an array of options, and then select the first option in the array to use in addItem

#

I am unfortunately not sure how to properly write out the syntax to be correct

hallow mortar
#

Generally prefer to use the command version rather than the function, it's more efficient

warped igloo
#

how far off am I with this syntax? πŸ˜†

_compatMag = player compatibleMagazines select 0;

player addMagazines _compatMag, 3;
#

I'm trying to get it to select the first result in the array, and then use that to give it to the player

hallow mortar
#
private _compatMag = (compatibleMagazines currentWeapon player) select 0;
player addMagazines [_compatMag, 3];```
The command pages' description of the syntax is generally quite literal.
warped igloo
#

ahhhh that's how it's written

#

thanks a lot, it works now

hushed tendon
#

Anyone know why it suddenly doesn't like my addaction condition params? When I test it manually by adding it in the debug menu with the condition being hint str items _this it works just fine. I attached an image of the error

WAG_medicalSystem_fnc_addMedicalAction = {
    params ["_unit","_interactionText","_code","_priority","_condition","_range"];

    _unit addAction
    [
        _interactionText,
        _condition,
        nil,
        _priority,
        false,
        true,
        "",
        _condition,
        _range,
        false,
        "",
        ""
    ];
};

///===--- Heal Unit ---===\\\
//-- Self Interaction
_interactionText = "<img size='1.5' image='\Battery\Circle.paa'/><t color='#0CD61A' size='1.2' font = 'PuristaSemibold'> Heal</t>";
_code = { params ["_target", "_caller", "_actionId", "_arguments"]; [_caller,_caller,"Health_Syringe","BODY"] call WAG_medicalSystem_fnc_healPart };
_condition = "
    ('Health_Syringe' in items _this) &&
    (_target getVariable 'WAG_MS_health' < WAG_MS_SETTING_HEALTH) &&
    (_target == _this) &&
    !((vehicle cursorObject) isKindOf 'MAN')
";
[_unit,_interactionText,_code,10,_condition,-1] call WAG_medicalSystem_fnc_addMedicalAction;
hallow mortar
#

You're using _condition where you should be using _code

#
_unit addAction
    [
        _interactionText,
        _condition, // <<<
        nil,```
hushed tendon
warped igloo
#

any clue as to why I'm getting the undeclared variable error?

_mk20 = player addPrimaryWeaponItem "arifle_Mk20_F"; player addWeapon "arifle_Mk20_F";
_m79 = player addPrimaryWeaponItem "vn_weapon_arifle_m79"; player addWeapon "vn_weapon_arifle_m79";

selectRandom [_mk20, _m79];
sleep 0.2;
private _compatMag = (compatibleMagazines currentWeapon player) select 0;
player addMagazines [_compatMag, 3];
hallow mortar
#

addPrimaryWeaponItem doesn't return anything, unless the item failed to add.

#

Also, you're doing addPrimaryWeaponItem with the weapon classname, not an attachment classname, and I'm pretty sure that doesn't work

#

Your selectRandom isn't doing anything useful (it chooses one of the two items in the array, but does nothing with the result)

#

I really recommend reading the documentation for the commands you're using

#

Did you mean to do this?

private _weapon = selectRandom ["arifle_Mk20_F", "vn_weapon_arifle_m79"];
player addWeapon _weapon;```
warped igloo
#

that was the initial goal yes, but addWeapon and addWeaponGlobal weren't equipping, or adding anything to the inventory, so I stumbled upon a post that mentioned adding the magazine prior to the weapon in order for it to be equipped

#

I tried a few combinations, and this
player addPrimaryWeaponItem "arifle_Mk20_F"; player addWeapon "arifle_Mk20_F";
did the trick, likely by accident lol

hallow mortar
#

I think you should read those commands, and the classnames you're putting into them, and think a bit harder about what's happening here

split ruin
#

how to make it to check for every blufor unit instead of player?

while {true} do
        {
            {
                if (player distance (getMarkerPos _x) < 500) then
                {_x setMarkerColor "ColorYellow";
                } else {_x setMarkerColor "colorOPFOR";};
            } forEach KIB_redMrk;
            sleep 5;
        };

//KIB_redMrk is array of markers

hallow mortar
hallow mortar
warped igloo
#

I know for a fact that a weapon won't be equipped to the player without first adding the magazine, so it has to be a two-part execution, hence why I put it in a variable, so that they can be sorted in the selectRandom function

hallow mortar
#

addPrimaryWeaponItem works fine for adding a magazine directly to the weapon...after you've added the weapon. You can't use it when there's no weapon to add a thing to. It also works for adding a magazine when you give it the magazine classname, not the weapon classname.

hallow mortar
#

b) You're not saving anything useful to a variable. You're just saving the return from addPrimaryWeaponItem, which is either...nothing, or a not-very-helpful boolean value (false). Even if you were saving something useful to the variables, you've already done the weapon-adding. Doing selectRandom on the result doesn't change what's already happened.

split ruin
#

@warped igloo what are trying to do actually ?

warped igloo
#

equipping a random weapon with ammo to the player with a trigger πŸ˜„

#

so far I have the weapon equipping part working, but I'm getting a undefined variable error when running the script, so only the first option works

split ruin
#

@warped igloo do you have the classnames of the weapons you want to use ?

warped igloo
#

indeed I do,

_mk20 =  player addMagazine "30Rnd_556x45_STANAG"; player addWeapon "arifle_Mk20_F";
_m79 =  player addMagazine "vn_magazine_ugl_40mm_m381_he"; player addWeapon "vn_weapon_arifle_m79";

selectRandom [_mk20, _m79];
sleep 0.2;
private _compatMag = (compatibleMagazines currentWeapon player) select 0;
player addMagazines [_compatMag, 3];

just not sure what's throwing the undefined variable error

hallow mortar
#
private _weapon = selectRandom ["arifle_Mk20_F", "vn_weapon_arifle_m79"];
player addWeapon _weapon;
private _compatMag = (compatibleMagazines _weapon) select 0;
player addMagazines [_compatMag, 3];
player addPrimaryWeaponItem _compatMag;```
#

I promise you I have some idea what I'm talking about.

split ruin
#

@warped igloo first add the weapons, then the magazines for this weapos as @hallow mortar already showed in his script, end of the story πŸ™‚

hallow mortar
granite sky
#

In some detail :/

split ruin
#

the only thing you have to do is substitute player with (thisList select 0) if you want to use it in a trigger

manic kettle
#

I'm trying to find a way to make AI stay inside damaged vehicles, specifically tanks, when they are partially damaged. For example if the engine is damaged but the turret is fine, they just leave.
I found
"allowCrewInImmobile" function that stops them from leaving if the tracks are dead. So thats something, but not everything
Anyone know?

granite sky
#

allowCrewInImmobile works on engines too IME?

split ruin
#

if activation is any player

granite sky
#

Only time it doesn't is when the vehicle is about to explode.

#

I guess that might conflict with things like ACE advanced vehicle damage.

hallow mortar
#

You could try locking the vehicle as well, although that has an obvious secondary effect

manic kettle
#

Nah they definitely just get out

hallow mortar
# split ruin if activation is any player

It's a bit more complicated than that.
Using player will do fine for initial testing. Once the adding functionality is confirmed working, the rest can be sorted out.

granite sky
split ruin
#

can he check that its working, thats the question ... @warped igloo just use the debug console and paste the code, then execute it locally

manic kettle
granite sky
#

ACE advanced vehicle damage enabled or not?

manic kettle
#

its off

#

locking didnt work either, but i found this checkbox and it does work!
Now i just gotta figure out what variable/function this goes to.... (3den enhanced)

hallow mortar
#

or event handlers might actually be where the function is called from

granite sky
#

hmm. Which allowCrewInImmobile syntax did you use?

manic kettle
#

this allowCrewInImmobile true;

hallow mortar
#

Possibly the expression of that attribute is happening after the init field and overriding it

manic kettle
#

thats true..

granite sky
#

Works fine here? Did basic test with M136 vs M2A3 engine.

manic kettle
#

i'll try adding a delay after spawn then to see

granite sky
#

With this allowCrewInImmobile true they stay in the vehicle otherwise they jump out.

hallow mortar
granite sky
#

It's probably just running allowCrewInImmobile though. Different timing is possible.

manic kettle
#

Yeah i forgot it had that in too, didnt think it would matter

#

yep adding a delay fixed it. They arent getting out. Thanks fellas

granite sky
#

Well, there is also the question of how you're applying engine damage. I assumed you were shooting things :P

warped igloo
# split ruin can he check that its working, thats the question ... <@486252918744416272> jus...

~~It ended up working with this section from Nikko

private _weapon = selectRandom ["arifle_Mk20_F", "vn_weapon_arifle_m79"];
player addWeapon _weapon;

and my existing ammo script at the end to add magazines (in reserve only, not instantly loaded in the weapon)

private _compatMag = (compatibleMagazines currentWeapon player) select 0;
player addMagazines [_compatMag, 3]

I appreciate the patience and help to get it to work without errorsπŸ™~~
edit: the randomization still doesn't work, I'll sleep on this problem πŸ˜…

warped igloo
#

using that entire code by itself throws this error message πŸ€·β€β™‚οΈ

granite sky
#

should be private _compatMag = compatibleMagazines _weapon select 0;

hallow mortar
#

oh right

#

I forgot what the select 0 was doing in there when I changed it from currentWeapon 😢

warped igloo
#

πŸ˜… arma is still not happy

for reference:

private _weapon = selectRandom ["arifle_Mk20_F", "vn_weapon_arifle_m79"];
player addWeapon _weapon;
private _compatMag = compatibleMagazines _weapon select 0;
player addMagazines [_compatMag, 3];
player addPrimaryWeaponItem _compatMag;
granite sky
#

Are you sure "vn_weapon_arifle_m79" is the correct classname?

#

_compatMag will be nil if compatibleMagazines _weapon is an empty array.

warped igloo
#

looks like it

granite sky
#

nah that's the CfgVehicles one.

#

Equip one and run primaryWeapon player

#

Or go find it in CfgWeapons

#

CfgVehicles has weapon holders you can place that have weapons in them, but those are not weapon classnames.

warped igloo
#

d'oh what an oversight, good catch!

#

that's the ticket

raw vapor
hallow mortar
hushed turtle
#

You could use empty stings for not needed parameters in the middle

old owl
#

Someone just asked us if we could add something to allow them to change their FOV in-game for the server because he uses NVIDIA Cloud Gaming. I informed him it wasn't possible and he sent me an entire zip file saying "this is how it's possible". This being the most notable file:

params ["_top","_left"];
if (!hasInterface) exitWith {};
if (isNil "_top" || isNil "_left") exitWith {};

setCustomFOV [_top, _left];

// Persist for future sessions
profileNamespace setVariable ["JTF_fovTop",  _top];
profileNamespace setVariable ["JTF_fovLeft", _left];
saveProfileNamespace;
warm hedge
#

ChatGPT go brrr

old owl
#

I was really trying my best not to crash out

#

There was also an entire AI generated README.md which was pretty brutal too

meager granite
#

Where do you display these images? UI? Texture?

round hazel
#

Hey there folks, is it possible to use an animated (preferably looping) texture with CutRsc?

frigid spade
#

Is there anything for detecting if something is an airfield?

#

I know the auto land can find them so I’m assuming but idk if functionality like that is useable in SQF

granite sky
#
private _mainRunway = configFile >> "CfgWorlds" >> worldName;
private _otherRunways = "true" configClasses (_mainRunway >> "SecondaryAirports");

Then ilsDirection and ilsPosition under each of those.

thin fox
frigid spade
#

Wouldnt you like to know

thin fox
granite sky
#

There's one in secondaryAirports so that makes two?

#

_mainRunway there is just the root config for the world but that has the ilsXXX parameters too.

granite sky
#

It's the usual config horror, like where the base weapon class can also be a fire mode.

warm hare
fair drum
#

what build script?

warm hare
#

construction of fortifications for engineers from loaded materials in Trucks

still forum
# old owl Someone just asked us if we could add something to allow them to change their FO...

Also recently seen a Arma mission on workshop. AI generated description saying one of the features is it can change the game language mid game. Open the script, yeah its there, its using the setLanguage script command.

The amount of bullshit I'm seeing lately is just too much. And somehow, in all of it AI is involved.
I want to get back to the good old days when the top-level of bullshit was scripts by Quiksilver

old owl
#

Brutal how made up it all is

#

Also very right about AI always being involved. Before AI there was always bad written code but at least it didn't just entirely make up the names of random commands and functions so blatantly 🀧

lime rapids
old owl
#

Or loops on every frame with network commands like setMarkerColor- very performant catnod

#

So much sickening stuff PepeCRY

split ruin
#

people think they can make good mission or mod without their brain taking part of it

tulip ridge
split ruin
#

i need to change marker color if whatever bluefor unit goes too close (< 500 m )

{
    {
        if (_x distance (getMarkerPos _x) < 500) then
        {_x setMarkerColor "ColorWEST";
        } else {_x setMarkerColor "colorOPFOR";};
    } forEach KIB_redMrk;
} forEach units west;

gives error array instead of object

tough raven
#

im trying to set up a script for training where I can delete all units of opfor attached to a button, anyone able to help?

#

im trying to use deleteVehicle but I cant seem to get it to actually delete anything

hallow mortar
scenic shard
#

how can i override a function from a mod? I tried to make my own .sqf file at the correct path in the mission, and in the function viewer i see my code instead, but calling the function runs the old code.

also tried funcName = {mycode} in the init file, but same there

hallow mortar
tulip ridge
pallid palm
#

hello @tulip ridge i wanted to thank you again for helping me with my Chopper Command, i have now made all the Chopper Command into Functions Works Awsome

split ruin
#

@hallow mortar you deserve a drink 🍻

real tartan
#

I have 2 objectives, ~100m apart. I engage objective 1, and enemy from objective 2 is running towards objective 1 engaging. How to prevent, or keep units from objective 2 keep on place. Note, units are should remind patrolling assigned sector, usually by marker.

split ruin
#

@real tartan wanting the enemy not to engage from distance less then 100 m ? wtf

real tartan
#

I set group to defend sector, but they run out to engage enemy. want to prevent them to leave defending position, but still able to move in designated area

split ruin
#

@real tartan just make them unable to move but they will be able to shoot

this disableAI "PATH";

//place this in the unit init

scenic shard
# tulip ridge Depends on how the function is defined If it's in CfgFunctions, you can just mak...

thanks!

i tried using this in the init:
mod_fnc_name = compileScript ["myOverride.sqf", true];
but it did not work, perhaps the mod runs before the init.sqf? or do the path and name of "myOverride.sqf" need to match the original, not just the variable mod_fnc_name?

I also tried adding a matching path and "fn_functionName.sqf" file in my mission folder, it seems to override in the function viewer but not working when called. is there something else i need to add for it to override correctly?

this is a mission specific change i want to do, so I need a way to embed all the changes into the mission.

real tartan
tulip ridge
split ruin
#

@real tartan first you say there are 100 m between them (obj 1) and you (attackin obj 2 I guess). Then you say they somehow run across to the whole map the engage enemy they don't know about. I am confused. πŸ˜΅β€πŸ’«

scenic shard
split ruin
tulip ridge
#

No, just no

#

That doesn't even make any sense in an arma context

scenic shard
#

that does not sound like something i can do on all players machines πŸ˜› i'll find some workaround for my issues somehow, just wont be as efficient

granite sky
#

If you're giving them move waypoints then they'll roughly follow them. However unless you use disableAI "TARGET" they will send some members of the squad towards contacts.

real tartan
granite sky
#

Ok no idea then, haven't read that code.

split ruin
#

@real tartan AI forgets waypoints when in contact with the enemy, the FSM kicks in and you don't have control what they will do, but they will resume patroling after they kill you or they lost info about you for 2 minutes

#

with @CBA you have fnc_taskDefend you can use if you want them to defend an area

#

mind that part of the enemy will garrison buildings with this function

granite sky
#

They don't forget waypoints while in contact. If the group has a move waypoint they'll still be making an attempt to travel in that direction. It just slows down and can get a bit roundabout, depending on cover. However there's a mechanic where the squad leader sends one or more units in the direction of the contacts instead, which you can disable with TARGET.

austere tartan
#

Guys, I got a question and need urgent help. I'm making a south african border war server and want to split the map im using in two. Each halve of the map will have its own town which will have capture points. Now each team has to capture each other's points and whoever captures all points wins. I need the ai commanders to automatically take the points and garrison it. And if the ai gets killed it respawns in 10 minutes and continues to capture points. Will someone please tell me how i can do this or maybe help me to set it up? I would really appreciate! Maybe with scripts or modules? Thank you!

split ruin
#

@austere tartan basically you want someone else to script your mission thonk

austere tartan
#

No i just need help scripting it or using modules. Im recruiting devs for my server. Im a noobie and have no idea how to code at all. I hope im not angering people

#

I can be a fun project and anyone can join it

split ruin
#

normally people help in this channel after you have some script already and its not working for some reason

#

what is your arma 3 experience in hours ?

austere tartan
#

I understand. Thanks man

austere tartan
split ruin
#

@austere tartan you need to play the game a lot more and then you can start thinking about missions and servers

austere tartan
#

Yeah i agree. Anyways thanks for the help. I will check the link for info

frigid spade
#

how would you pull items from nested arrays?
i tried

(_array select 0) select 8;

(pull the 9th item from the 1st array of the array of arrays)

#

but that just gives me the first array

granite sky
#

Nah, that's correct.

frigid spade
#

thats what I thought

granite sky
#

Your arrays probably aren't what you think they are.

frigid spade
#

testing it with hint str and its returning the whole first array

granite sky
#

Well, hint str (_array select 0) select 8; would return the first array, because precedence. But you're not doing that, right :P

frigid spade
#

no i would never do that it would be silly of me to even think of it

#

gimme a sec to delete that exact line

granite sky
#

cackles

frigid spade
#

they were out of parentheses at the store

split ruin
#

how to open the rugged comms terminal open with a script ?
RuggedTerminal_01_communications_F

warm hedge
#

this

meager granite
#

@exotic flame Checked it out and indeed its impossible with simple objects, collision damage can randomly apply before EpeContact* events, even if you know which object you expect to hit you can't add EpeContact* to it as its a simple object

atomic niche
# warm hedge this

this only does the progress bar no?
i believe its something like Terminal_source

warm hedge
#

Does it?... Prolly yes, I might misremember it

atomic niche
#

Yes its Terminal_source just tested, no idea what the upper limit is tho, probably 100

meager granite
#

@exotic flame

vehicle player removeAllEventHandlers "EpeContactStart";
vehicle player addEventHandler ["EpeContactStart", {call epec}];

arr = createHashMap;
epec = {
    _obj = _this select 1;
    if(hashValue _obj in arr) exitWith {};
    arr set [hashValue _obj, createHashMapFromArray [
         ["obj", _obj]
        ,["damage", damage _obj]
    ]];
    systemChat format ["%1: Obj=%2 | EpeContact initial damage=%3"
        ,diag_frameno toFixed 0
        ,_obj
        ,damage _obj
    ];
};

onEachFrame {
    if(count arr > 0) then {
        {
            private _obj = _y get "obj";
            private _old = _y get "damage";
            private _dam = damage _obj;
            systemChat format ["%1: Obj=%2 | Old=%3, New=%4, Delta=%5"
                ,diag_frameno toFixed 0
                ,_obj
                ,_old
                ,_dam
                ,_dam - _old
            ];
        } forEach arr;
        arr = createHashMap;
    };
};
```My test script
#

Sometimes it works, Car->Obj triggers first and it works properly

#

But other times Obj->Car collision triggers first (which you can't add event for at all) and object is already damaged

#

I noticed that it all comes does to order in which objects are inserted into EPE scene

#

If you spawn a car and hit something, its always Obj->Car collision event first

#

If you drive car somewhere other objects are inserted into scene after the car and its always Car->Obj collision first

#

Basically you can use this approach but its not always reliable

#

Also its better to use EpeContact for this method, I just did EpeContactStart to see less chat spam

meager granite
exotic flame
meager granite
#

This collision order issue applies to all objects really

#

And for simple objects your only option is comparing damage (maybe hit points if you really want to complicate it)

exotic flame
#

I'll make a ticket for that too

next kraken
#

im just trying to use the respawn system with parameters and it seems to be bugged. using respawnTemplates[] = {"MenuPosition","Tickets","EndMission"}; but mission does not end when run out of tickets or all dead in mp hosted server environment. anybody an idea?

#

it just says 0 tickets in respawn system instead of failing the mission

split ruin
#

how to put agents in vehicle as driver, they don't care about moveInDriver command?

#

@next kraken in a trigger condition

[west] call BIS_fnc_respawnTickets <= 0

activation field

["win", true] remoteExec ["BIS_fnc_endMission", 0, true];

description.ext

class CfgDebriefing
{
        class win
    {
        title = "Mission Completed";
        subtitle = "RAF liberated group Brand";
        description = "RAF dorces liberated group Brand from enemy hands.";
        pictureBackground = "";
        picture = "b_inf";
        pictureColor[] = { 0.0, 0.3, 0.6, 1 };
    };
    class fail
    {
        title = "Mission Failed";
        subtitle = "RAF forces faled to liberate group Brand";
        description = "Without Brand's military expertise RAF will have heavy times wining in west Germany.";
        pictureBackground = "";
        picture = "b_inf";
        pictureColor[] = { 0.0, 0.3, 0.6, 1 };
    };
    class ZeroTickets
    {
        title = "Mission Failed";
        subtitle = "No More Reinforcements";
        description = "RAF has no more fighters to continue this operation.";
        pictureBackground = "";
        picture = "b_inf";
        pictureColor[] = { 0.0, 0.3, 0.6, 1 };
    };
};
granite moat
#

❓
What is the best way to have a script execute on each player every 5 seconds ?

Also the goal is to work on dedicated server.

Thx in advance for the answers πŸ™‚

split ruin
#

@granite moat run it from initPlayerLocal.sqf, also look for event handlers before writing** while** loop

granite moat
#

For now I had in mind init player with PFH.

pallid palm
#

@split ruin what color is that in the pictureColor[] = { 0.0, 0.3, 0.6, 1 }; ?

split ruin
#

how to move or spawn an agent as driver ? πŸ€”
this doesn't work, they spawn but stay around the vehicles

_agent = createAgent ["B_Soldier_F", [3040.13,7992.61,0], [], 20, "NONE"];
_agent setVariable ["BIS_fnc_animalBehaviour_disable", true];
_agent assignAsDriver veh;
_agent moveInDriver veh;
pallid palm
#

oh nice awsome m8 thx @atomic niche

#

@split ruin ```sqf
_agent assignAsDriver _veh;
_agent moveInDriver _veh;

granite moat
#

Is there a reason why I cannot set a PFH in the initServer.sqf ?

[
    {
        missionNamespace setVariable ["TEST", time, true];
    },
    5,
    []
] call CBA_fnc_addPerFrameHandler;
#

this does not make it run every 5 secs. But if later I run the cmd manuualy on the server it works

#

How can I execute this at server start if not in the serverInit ? :/

real tartan
#

is there a "paper flip page" / "document read" / "write on paper" sound in game that I can use ?

pallid palm
#

is this paper flip page only for CBA ?

#

or can we do it in Vanilla

thin fox
#

what are you trying to achieve?

granite moat
granite moat
#

and update them every 5 seconds according to some conditions

thin fox
granite moat
thin fox
granite moat
#

Omg I might be dumb... let me test something

real tartan
granite moat
hallow mortar
round hazel
#
[]spawn{
  _initialLoc = getPos floatyMan;
  while {true;}do{
    yPos = [((getPos floatyMan) select 2),((_initialLoc vectorAdd [0,0,2]) select 2),0.5] call BIS_fnc_lerp;
    newPos = [(getPos floatyMan) select 0, (getPos floatyMan) select 1, yPos];

    floatyMan setPos (newPos);
    sleep 0.01;
  };
};

Looking to move 'floatyman' up 2 metres gradually. With this script he just vibrates on the ground. Any ideas?

tender fossil
round hazel
#

Cannot believe I missed that

tender fossil
#

Np, it happens πŸ˜›

hallow mortar
#

(They're also slow and have compatibility issues because of using an inconsistent altitude format, but they are 3D)

tender fossil
gritty escarp
#

Is there a way to make an empty vehicle hostile towards a faction? For example, OPFOR will always shoot at BLUFOR vehicles even when empty?

errant iron
gritty escarp
pallid palm
#

Ai will attack empty vehicles, i found if you get in the vehicle and drive it, and then get out, enemy Ai will attack the empty vehicle, Enemy Ai always attack my (Mobile Respawn Truck), and then i always have to call the extraction chopper to get back to base to get the Truck again after it respawns

#

i think when you get in a vehicle it becomes your side:

#

even if its a enemy vehicle

#

exsample: steal the car mission

#

correct me if i'm incorrect

spiral canyon
#

Does anyone know when doing a ParticalArray, what does the size numbers represent? Like is it [X,Y,Z] or [base width, top width, height] kinda like a light cone?

#

Im trying to do a thick black oily smoke like out of Desert Storm

meager granite
#

Array of Numbers - particle size along its lifetime, in meter

#

Each number is particle size relative to its lifetime

#

So if lifetime is 9 seconds and size is [0,5,6,10] means it will be
size 0 at 0s
size 5 at 3s
size 6 at 6s
size 10 at 9s

#

For example if you want size to grow and then stay large you can do something like [0,3,10,10,10,10,10,10,10]

#

Growth from 0 to 10 in first 1/4 of lifetime and then staying 10 rest of 3/4 of lifetime

spiral canyon
#

oh, I thought size could only be 3 numbers. Didnt know I could do more

meager granite
#

Basically its a multi point linear graph

spiral canyon
#

thanks, thats been really helpful

meager granite
spiral canyon
#

oh, ok. Thats cool. I was reading over the wiki and I just couldn't comprehend what was being said. Thanks again for the help!

meager granite
#

Yeah its all hard to get until you start testing it

queen cargo
#

mhhh

#

is it possible that there is a limit on how many units can be created in a single group or in general?

#

accidently created 877 units with some script (btw. nice way to kill your SP FPS ^^ had like 0.01FPS)

#

and after that: "nil" variables everywhere

#

ahh

#

found the problem

#

i think at least i did ...

#

not for the 877 units spawned

#

but for the nil

#

((stupid random select ... forgot a floor :/ )

round hazel
#

Hey folks, I keep getting a 'GIF pre stack size violation error' with this chunk of script

while {(_object getPosATL select 2) < _targetZ} do {
    private _currentPos = getPosATL _object;
    private _currentZ = _currentPos select 2;
    private _newZ = _currentZ + _riseSpeed;

    
    if (_newZ > _targetZ) then {
        _newZ = _targetZ;
    };
    
    _object setPosATL [_initialX, _initialY, _newZ];
    sleep 0.03; 
};

It reckons I'm missing a (. I've read up and apparently this error is for very subtle syntax issues. I'm at a loss. Any ideas?

warm hedge
#

Usually missing or mismatched bracket can cause it

round hazel
#

Checking it out in notepad++, highlighting each of the brackets brings up the correct closing bracket

still forum
#

Are you sure its in that chunk? Not before/after it?

#

Ah there

#

_object getPosATL select 2
That code is nonsense

warm hedge
#

Ah

round hazel
#

Ahhh, the _object needs to go after the getPosATL, right?

warm hedge
#

getPosATL _object is the syntax

#

None of scripting command can go X command syntax, but command command X or X command Y

round hazel
#

Sweet, I'm such a doofus, much obliged!

drifting badge
#

I am currently using diableUserInput in combination with an EventHandler while playing a defined gesture in order to stop the players from moving around (have all that in the player's init field). While this works just fine (i.e. stopping players from doing anything), I kind of want the players to be at least able to look around (but not move forward/backwards, left/right). Is there a way to still allow that?

warm hedge
#

Use an animation that doesn't allow people to move is much more reliable and safe. disableUserInput is incredibly hrash way to do so

drifting badge
#

Hmmm but would that animation not interfere with the gesture?

warm hedge
#

Depends on what you want them to do

#

Acts_AidlPercMstpSloWWrflDnon_warmup_1_loop is one thing you can use

drifting badge
#

Well the gesture is a "reloading" gesture that still should play (which it does when using the disableUserInput way -> but I totally agree it is a harsh way to do things). Never tried mixing animation with gestures so I have no idea if they interfere with one another.

drifting badge
#

Oh while I am at it: Is there a way to have the "action menu" (i.e. where all the addactions etc. show up) display more than the ~5 or so entries before one needs to scroll? Or is that something hardcoded?

warm hedge
#

Likely hardcoded

drifting badge
#

Thanks, feared as much.

old owl
#

Has anyone reported issues of players randomly receiving BIS_fnc_endMission success with a fade?

#

I'm thinking more than likely a cheater instead of an Arma issue but figured I'd ask

pallid palm
#

i have not seen this,,, randomly receiving hmmmmm

#

i don't understand cheaters, they have such useless lives i guess

old owl
#

Yeah, cheat devs have zero issue ruining the game for everyone if it means making a little bit of coin. Pretty scummy stuff.

#

I did look through the guys RPT files and couldn't find any diagLog that would've typically trigged through BI's BIS_fnc_logFormat. Meaning probably the endMission command being ran. Shouldn't be possible though, so still not sure what's up.

pallid palm
#

yeah i do remember one guy cheated and put all of us players in a Halo jump: it was so stupid

#

i had to close the server pissed me off cuz we were having so much fun

old owl
#

At least from what I've seen- we got a cheater expert who knows more about this stuff than I do but seems all very bizarre to me

still forum
#

But a cheater running the endMission command directly, would not run BIS_fnc_endMission.
What do you mean "receiving" how do players receive a function

atomic niche
#

Is it not you guys doing an anti-cheat check and running endmission if those fail and a scripter finding a way to trigger those checks?

#

I've seen some servers do that

sharp grotto
#

Would be nice to be able to turn on logging for network script commands on dedicated servers.
Maybe with a filter array ["hideObjectGlobal"]

#

That would make it much easier to catch such cheaters (if they use network commands).

old owl
#

Apologies I am an SQF native so my code explaining literacy might be a little bad. I guess what I am trying to say is I suspect endMission is being ran not the BIS_fnc_endMission function.

Although I could be mistaken if it's obfuscated from standard text searching- I don't think we end with any success states anywhere in mission like what the guy was being kicked with.

still forum
old owl
#

Is there anything by default that would stop remoteExec of the endMission command if not added to cfgRemoteExec?

pallid palm
#

isnt endMission and BIS_fnc_endMission way diff ?

old owl
#

The BIS_fnc_endMission is the function created for ending missions with capabilities of logging and other stuff. It's a function that can be viewed and is SQF code like anything else you'd find in your mission. The endMission is a command which is something we can't see. Commands are engine solutions to stuff so they are always gonna be faster than functions.

pallid palm
#

hmm really

old owl
pallid palm
#

i remember using endMission back in the day but i changed to BIS_fnc_endMission cuz well i don't know why πŸ™‚ i guess cuz it BIS ---- and i only use vanilla

sharp grotto
#

In short BIS_fnc_endMission also uses endMission, so blocking it via CfgDisabledCommands should also block BIS_fnc_endMission

pallid palm
#

holw cow @old owl thats a big script

#

lol my missions only have 3 endings πŸ™‚

old owl
#

Sorry another dumb question- deleted. Speaking before I am thinking this morning.

pallid palm
#

join the club m8

pallid palm
#
//in most cases i have 2 triggers that end my missions
//win
["end1"] remoteExec ["BIS_fnc_endMission"];
//lose
["end2",false] remoteExec ["BIS_fnc_endMission"];

//in the Description.ext
//Debriefing
class CfgDebriefing
{  
    class End1
    {
        title = "Hostiles Eliminated";
        subtitle = "MISSION COMPLETE";
        description = "All Enemy K.I.A";
        backgroundPicture = "";
        picture = "b_inf";
        pictureColor[] = {0.0, 0.3, 0.6, 1.0};
    };
    class End2
    {
        title = "MISSION FAILURE";
        subtitle = "USMC KIA";
        description = "Failed To kill All Enemy";
        backgroundPicture = "";
        picture = "b_inf";
        pictureColor[] = {0.0, 0.3, 0.6, 1.0};
    };
};
#

i don't know but i feel: Simple is better then Complicated

atomic niche
pallid palm
#

i see holy shit 1000s of SQFs holy shit lol

#

i see what you mean my missions only have 109 sqf files

#

maybe i can use something simpler then BIS_fnc_endMission

atomic niche
#

BIS_fnc_endMission is perfectly fine to use, even preferred instead of endmission

sharp grotto
#

It all depends on your needs ☝️

pallid palm
#

i saw a part in that BIS_fnc_endMission script that i may use

sharp grotto
#

If you just wanna exit from the server fast

(finddisplay 46) closeDisplay 0

I used that to DC in a admin tool, because i didn't wanted to wait the 10 second escape menu timer all time.

pallid palm
#

oh cool thx @sharp grotto

#

yeah the alive check part in the BIS_fnc_endMission script looks cool

old owl
#

I do appreciate all your guys help and for bearing with me. If I figure out anything more on the issue I'll keep you guys posted. Thanks again meowheart

pallid palm
#

ill just do what Crumble said its all good πŸ™‚ BIS_fnc_endMission is perfectly fine to use

#

and that script is not really that big

hushed turtle
#

You run that at the end the mission, it ain't gonna hurt performace πŸ˜‚

pallid palm
#

ok thx @hushed turtle i always take your advise, cuz i know your good

royal quartz
#

Forwarding this here incase anyone has any insight?

little raptor
#

if there's no command for it, you can instead script a UI element to act like a button and do whatever you want with it

pallid palm
#

i'm so happy everything in all my missions is working so good, Thx to all you guys helping me, im really having lots and lots of fun in Arma 3

#

now that i learned about functions πŸ™‚

#

my missions are running so fast, i had to raise my view distance, so i didn't over control my guy πŸ™‚

little raptor
#

anything that accepts mouse clicks, like an RscPicture
or you can even group multiple ones in a controls group and script them to make them work together

rain vessel
#

Any scripts that allow a medic to drag either a injured or dead soldure and then revive the soldure ?

granite moat
#

If dead you would need to TP him

rain vessel
#

TP?

pallid palm
#

TP ?

thin fox
#

teleport

#

you can't revive a dead soldier

tropic nimbus
#

im having an odd issue that i hope someine can help me with

    diag_log str _bodyPartColor;
    diag_log str _selected;
    private _ctrlBodyPart = _ctrlGroup controlsGroupCtrl _bodyPartIDC;
    diag_log str _ctrlGroup;
    diag_log str _bodyPartIDC;
    _ctrlBodyPart ctrlSetTextColor _bodyPartColor;
    diag_log str _ctrlBodyPart;```
I have this snippet of code from ace, that updates a body parts color based off of damage and bleeding, 
However, for some strange reason, when i call it from one script it breaks and fails, but when i call it from another script, it works fine
https://github.com/Cplhardcore/KAM/blob/INDEV/addons/gui/functions/fnc_displayPatientInformation.sqf
https://github.com/Cplhardcore/KAM/blob/INDEV/addons/gui/functions/fnc_menuPFH.sqf
https://github.com/Cplhardcore/KAM/blob/INDEV/addons/gui/functions/fnc_updateBodyImage.sqf
Scripts for reference, along with the results of a diagLoag for both the menu
 ```0:08:39 "[0.52,0.73,1,1]"
 0:08:39 "true"
 0:08:39 "Control #6000"
 0:08:39 "6031"
 0:08:39 "Control #6031"```
and from the DPI
``` 0:08:04 "[0.52,0.73,1,1]"
 0:08:04 "true"
 0:08:04 "Control #6000"
 0:08:04 "6031"
 0:08:04 "No control"```
lofty lily
#

Hey all im looking for lights out script. Basically you drop the script into a breaker box and it cuts off lights around an area.

ornate whale
# lofty lily Hey all im looking for lights out script. Basically you drop the script into a b...

You will need two pieces of code:

  1. for turning off the lights in the area,
  2. for adding the use action to the breaker box.

This is a code you may use for the lights. Create a marker in the Eden that will cover the area (a circle preferably) and give it a name, then call this script:

private _markerPosition = getMarkerPos "YourMarkerName";
private _markerSize = getMarkerSize "YourMarkerName"; //[X,Y] size in meters
private _radius = sqrt(_markerSize#0^2 + _markerSize#1^2); //Turn it into a radius.

private _objects = nearestObjects [_markerPosition, ["House"], _radius]; //Get the nearest objects. House should also include lamps, I think.

{
    _x switchLight "OFF";
} forEach (_objects);
ornate whale
# lofty lily Hey all im looking for lights out script. Basically you drop the script into a b...

For the breaker box action, you can use this function:
https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd

and pass the code I wrote above (either as a function or a literal block of code) into the codeCompleted argument of the BIS_fnc_holdActionAdd.

This will allow the player to use the breaker box, which will then turn off the lights. But you will have to adjust it for multiplayer.

So the result could look like this:

[
    yourBreakerBoxObject,
    "Kill The Lights",
    "\a3\ui_f\data\igui\cfg\actions\beacons_off_ca.paa",
    "\a3\ui_f\data\igui\cfg\actions\beacons_off_ca.paa",
    "_this distance2D _target < 3 && alive _target && alive _this",
    "_caller distance2D _target < 3 && alive _target && alive _caller",
    { },
    { },
    { 
        private _markerPosition = getMarkerPos "YourMarkerName";
        private _markerSize = getMarkerSize "YourMarkerName";
        private _radius = sqrt(_markerSize#0^2 + _markerSize#1^2);

        private _objects = nearestObjects [_markerPosition, ["House"], _radius];

        {
            _x switchLight "OFF";
        } forEach (_objects);
    },
    { },
    [], 5, nil, true, false
] call BIS_fnc_holdActionAdd;
stable dune
valid abyss
#

Hi, im trying to get a sound to play on an object for a mission im making but im having issues. Im testing on a locally hosted listen server.

this works:

playSound3D ["\lxWS\sounds_f_lxWS\ambient\civilian\muezzin_long1_lxWS.ogg", Muezzin_Player_01, false, getPosASL Muezzin_Player_01, 5, 1, 1500];

but this doesnt work:

    "\lxWS\sounds_f_lxWS\ambient\civilian\muezzin_long1_lxWS.ogg", 
    Muezzin_Player_01, 
    false, 
    getPosASL Muezzin_Player_01, 
    5, 
    1, 
    1500 
] remoteExec ["playSound3D", 0, true];```

Any idea why remote execing it doesnt work?
hallow mortar
#

Well, playSound3D already has global effect, so you don't need to remoteExec it

#

If you were to remoteExec it (again, you don't need to), you probably wouldn't want JIP set to true, because that would cause any joining player to immediately play the sound again the moment they join

valid abyss
#

ah okay thank you

hallow mortar
#

The reason the remoteExec didn't work is this:
remoteExec expects its left argument, when it is an array, to be an array of the subject command's original arguments, like this:

[_left, _right] remoteExec [ ...```
Your left argument for remoteExec is an array, so remoteExec is trying to apply that logic to it. But it _isn't_ a `[_left, right]` array - it's just `_right`, which happens to be an array itself.
So you would need to show remoteExec that this array isn't a whole mess of left, right, ??? etc arguments for the command, it's just one argument. The way to do that is to put it in another array, so that you have an array of one argument which is itself an array.

tldr: you have `_right remoteExec ...`, you would need to make `[_right] remoteExec ...`
(But you don't need to remoteExec it)
jade abyss
#

@queen cargo Noob πŸ˜›

queen cargo
#

well ... developing XInsurgency 2.0 with OOS ... so

pallid palm
#

Exsample:

#
[_target, _caller] remoteExec ["SFA_fnc_sabotage", 2]; // Execute function on the server
exotic flame
#

Does arma 3 have a limit of objects per scenario ?

pallid palm
#

depends on your PC really

granite sky
#

It has a limit of groups but not objects as far as I know.

exotic flame
#

Hmmm good then

hallow mortar
#

Do note that having a lot of objects can affect performance, especially if many of them are close together, and if they're placed in the Editor it does affect the size of the mission file

granite sky
#

With the caveat that different types of objects have very different performance costs.

exotic flame
#

I'm just asking because i've already heard about someone working on a 100kmx100km map and who said he reached A3 object limit when he was at 50% of the map

fierce crow
#

Hello, I'm not sure if this is where I'm supposed to ask this, but how can I turn a server-side script into a workshop mod, so it can be just added to a mod pack rather be added as separate file in every mission file?

warm hedge
old owl
#

@exotic flame In any case using createSimpleObject or createVehicleLocal where possible will be more performant for network. If you are creating a bunch of objects you could also create a script to dynamically spawn / delete them based off player proximity too to reduce the amount active on the client at a given time. Although that may be a little overkill depending on how many you intend to have and what your mission looks like. If that helps though πŸ™‚

pallid palm
#

Hello All: can we disable the minimap: so no one can use it: or maybe only the host can use it

#

i wounder is that in the game settings

atomic niche
#

minimap?

pallid palm
#

yes i mean the miniMap

atomic niche
#

There is no minimap, do you mean the GPS panel you can open by pressing [ or ]?

exotic flame
#

i guess you mean the gps

pallid palm
#

no i mean the miniMap

thin fox
atomic niche
#

do you have a screenshot?

pallid palm
#

you know the littel map at the far bottom right

atomic niche
exotic flame
#

that's not game ui

pallid palm
#

umm i dont know how to do that

#

the gps and the minimap are diff things yes ?

thin fox
#

just send us a screenshot

pallid palm
#

i dont know how to do a screenshot

thin fox
#

press print screen and ctrl+v here

pallid palm
#

ok ill try

#

but you must know what i mean when i say the miniMap at the bottom right

thin fox
#

I think you mean the gps but let's see

pallid palm
#

ah ok

stable dune
#

Usually
C:\Users[YourUserName]\Pictures\Screenshots

pallid palm
#

copy that

#

so thats the gps your saying

thin fox
pallid palm
#

i see ok cool

#

thx man i was thinking that was the miniMap

#

So can i do this in the Description.ext ```sqf
ShowGPS = 0;

#

i guess that wont that stop the user

#

thxs guys i was thinking that was the miniMap all this time πŸ™‚

#

so its like the gps in your car lol πŸ™‚ or the Tom Tom

#

or like the gps on your Phone πŸ™‚

#

i see now thxs m8's

#

i kinda remember a gps that just showed numbers, way back in Arma 2 or was it OFP that was a small box like thing and the minimap was diff, i guess that shows my age πŸ™ or maybe that was a mod thing hmm no wounder i dont use mods any more

#

im going to make it so you must steal the gps from the dead enemy if you want the gps

#

but ofcorse i have a param that removes all from dead enemy so it may not be available woohoo Arma 3

#

im just crazy about Arma 3 πŸ™‚

#

thx again guys @stable dune @thin fox @atomic niche @exotic flame

#

sometimes the simple things are the hardest, and the hardest things are the simplest: like the Golf Swing πŸ™‚

sage pond
#

How do I make a trigger activate when all players enter a zone?

thin fox
hushed turtle
#

Use BIS_fnc_listPlayers or see Example 1 to only get human players.

cyan dust
#

Just a quick argument we have: Is it possible to extract your system specs via scripts?

hallow mortar
cyan dust
#

Got it, thanks

hallow mortar
#

The RPT log file contains more extensive information, but as far as I know scripts can't read that

cyan dust
#

Yeah, that's what I thought too. We just stumbled across a server that says they gather all the info about players to "prevent cheating" whatever that means.

hallow mortar
#

As a server, they may be able to record the IP address of connecting clients (not through scripting, through out-of-game network tools) and they can record the Steam UID of connecting players.
Also, if they're requiring BattlEye, then your BattlEye client is almost certainly collecting that information, but I don't believe their records are directly accessible to server owners.

manic kettle
#

Its also possible to record what mods players run. But i've never heard of collecting system specs

fierce crow
tulip summit
#

Sa-matra, in a hint with parsetext

drifting badge
#

Is there a way to select the same position within an array from two or three different arrays? For example the long way round would be to do

_array1 = [Man1, Man2, Man3, Man4];
_array2 = [Green, Blue, Yellow, Brown];
_array3 = [a, b, c, d]

_array1 select 1; // Man2
_array2 select 1; // Blue
_array3 select 1; // b

but is there a simpler function to achieve this?

fleet sand
drifting badge
#

oh neat - thanks @fleet sand did not even think about being able to form an array out of several arrays! That is pretty clever :)

tiny wadi
#

Quick question, how do I change the abort button text + its action

#

I need to call a function when someone hits the abort button.

#

I know which class it is under, would it affect anything if I overrode that class, changed the text and added an action= field?

drifting badge
#

Found something weird. I have set up the following two 'MissionEventHandlers' within a simple repeatable trigger to test their functionality for MP:

hint "Click movement location on map";

addMissionEventHandler ["MapSingleClick", {
  params ["_units","_pos","_alt","_shift"];
  if !(_shift or _alt) then {
    {
      _MoveMarker1 = createMarkerLocal ["MoveMarker1", _pos];
      _MoveMarker1 setMarkerTypeLocal "hd_dot";
      _MoveMarker1 setMarkerColorLocal "colorOPFOR";
      _MoveMarker1 setMarkerTextLocal "Move here";

      _x doMove _pos;

    } forEach units Teleportsquad;
  };

addMissionEventHandler ["Map", 
{ 
 params ["_mapIsOpened", "_mapIsForced"]; 
 if(!_mapIsOpened) then { 

removeMissionEventHandler [_thisEvent, _thisEventHandler];

deleteMarker "MoveMarker1";

removeMissionEventHandler ["MapSingleClick", _thisEventHandler];

 }; 
}];

}];

While the above does seem work fine, I get an odd behaviour on the first time it is used: The unit moving walks to the point clicked, but then returns to its original location. On the second try it works as it should, the unit walks to the indicated location and stays there. Can not really explain why that happens (i.e. why the unit does not stay on the indicated point on the first time the trigger and all is used).

#

A second question is that the above script gives me one "waypoint" that the unit uses, but can I tell him to use a 2nd waypoint too? To do so do I just need put another '"MapSingleClick"' EH within the first one? Or do I have to set things up differently?

stable dune
drifting badge
#

thanks @stable dune can you elaborate a bit how to utilize _thisargs correctly?

thin fox
#

for the behaviour problem we need more details on how your mission is set up and if there are mods been used, like AI mods that could change the entity's behaviour

stable dune
ornate whale
#

Hello, are there internally any differences between setPos and setPosATL except for that the first is for AGLS, when used on units? Thanks

hallow mortar
#

setPos has a snap-to-nearby-surface feature. It's also slower. The use of AGLS is a serious issue in itself because it's very difficult to get an AGLS position to feed to the command, and that format is difficult to be vertically precise with.
You should almost always use setPosATL or setPosASL instead, and the same goes for getPos and equivalents.

ornate whale
thin fox
hallow mortar
thin fox
pallid palm
#

what is AGLS ?

hallow mortar
pallid palm
#

ahh ok i see cool

#

thx KikkoJT πŸ™‚ thats really cool

thin fox
#

kikko

granite sky
craggy olive
#

small question:
is the code on the biki have a specific license?
i am making a mission for unit use and i want to be sure i credit people properly

craggy olive
#

thank you so much...

still forum
#

I didn't realize this before. But that also means any modder creating mods for pay, is not allowed to use the wiki 🀣

craggy olive
#

so crediting the specific user is not strictly necessary, but is polite to do?

still forum
#

It is also probably hard to find the specific user. As many scripts are edited by several users. Cleaned up/optimized over years

granite sky
#

It's none of them. The description after that is correct.

#

I guess it could be described as the terrain surface position in AGL coords.

#

Ah no, because it doesn't adjust with waves.

versed trail
#

I'm trying to add units / modules to zeus through script, after looking at a few examples am I correct in guessing that both modules and units need to be added through config, and that I cant attach a script to a placeable unit (e.g. executing a script instead of placing a unit down)

#

I guess I could do the latter by having my own init event handlers on a specific class, to be fair. Just exploring the options.

crude tendon
#

Hello. I have a strange problem. I'll mark with |#| where Arma says something's wrong.

(units alpha2) commandGetOut;
(units alpha1) commandMove (getPos wp1);
(units alpha2) commandMove (getPos wp1);
uavholder commandMove (getPos wpuav);```
It tells me that ; is missing.
hallow mortar
crude tendon
#

Fuck

radiant lark
#

what do Type_128 and Type_134 network messages mean?

sage heath
#

so doing unitCapture for an airstrike using Firewill’s F-18s and…sadly unitcapture doesnt capture laser designators πŸ™

anyone has any ideas how i could work around this? or should i just do a dive bombing run with dumb bombs?

warm hedge
#

What are you trying to do is the first question

sage heath
# warm hedge What are you trying to do is the first question

so basically, I’m trying to script an airstrike that will happen in the background of a mission using unitCapture, planes come in, drop bombs, and fly off, without having to rely on waypoints and stuff

however, unitCapture as far as I’ve tested, doesnt record when the plane turns out it laser designator, and when the LGBs are locked on to said laser, so when my plane actually drops the bomb when using unit play it drops them β€œdumb” (unguided)

#

I’m not sure if I did anything wrong but since unitCapture records β€œfiring data” I would assume the laser designators is not something that fires

#

so my current workaround is probably going to be dropping dumb bombs

tender fossil
#

Btw, just a headsup: Visual Studio Code's AI code completion tool has become really useful for the first time even in the case of SQF. I'm not sure whether it's due to the just released GPT-5 or not, but it can really guess your intentions based on my testing. Would be interesting to hear other's thoughts about it as well. (NOTE! I'm not talking pure code generation but rather autocompletion/suggestions when you're writing SQF in VS Code.) Edit. It can also write proper comments in code

warm hedge
#

Because unitCapture doesn't capture laser fire, turret movement, etc. What you need is a scripted designated laser point and fireAtTarget command to scripted bombing

sage heath
#

interesting, I’ll give that a shot, thank you!

sturdy sage
tender fossil
# sturdy sage Writing comments and log statements is the most consistently useful application ...

Agreed. Although I think that the code completion indeed has become much better with GPT-5 so that it can do other stuff too than pure boilerplate. Still not perfect, but it's quite/surprisingly good for LLM already in my honest opinion.

I consider myself as a somewhat sloppy coder, making small mistakes here and there. It's not as big issue as it was earlier, since GPT nags almost always instantly if I make a mistake (like missing comma or something), so it increases productivity noticeably in my case at least

sturdy sage
# tender fossil Agreed. Although I think that the code completion indeed has become much better ...

I have been using Claude which was ok. Considering GPT-5 has more context it is not much better imo. Its a bit more all over the place. Claude gives more precise results generally and is way faster. That being said i am using GPT-5 currently and honestly both are fine 🀷
Mostly using GPT-5 because its cheaper.

GPT-5 imo did not suddenly unlock AI for SQF. If you think Claude wasn't good enough for SQF then GPT-5 experience didn't either. Its not a big step up from that. Mostly just different.

tender fossil
sturdy sage
#

But yeah like i said. I usually just get distracted by the code generation suggestions.
Logs statements and comments is definetly best use case.

And documentation. I always have function headers that explain the function (similar to wiki) within the .sqf file for that function. Mine are 90% AI generated and then a bit adjusted. Results are good enough for me.

warped igloo
eternal ingot
#

can someone help me with a little weird problem? it includes a chat.sqf file

tulip ridge
#

tl;dr, just saying "can someone help" gets you less help because you don't give details

thin fox
#

he already asked the same question a time ago lol

#

and didn't give any details

tulip ridge
#

Shocking

warped igloo
#

does someone know how to concatenate a variable into the debrief text?

_lastRound = BAC_RoundCount;
_printLastRound = format ("you lasted %1 rounds"), _lastRound;

class CfgDebriefing
{
    class End1
    {
        title = "you won";
        subtitle = "";
        description = _printLastRound;
        pictureBackground = "images\endScreen.jpg";
        picture = "";
        pictureColor[] = { 0.0, 0.3, 0.6, 1 };
    };
};
#

no matter what I put in there, it reads it as literal text, not a variable to pull from

warped igloo
#

no, that was my own flawed reasoning

#

I was trying to get it to show in the title box/ main debrief window

thin fox
warped igloo
#

yarp, it's a shame it doesn't, would have made for a nice visual flair

#

I'll work around it by fading to black and having a custom cutText before the debrief window

split ruin
#

@warped igloo it very simple to make custom end screen

//use it from trigger or script 
["win", true] remoteExec ["BIS_fnc_endMission", 0, true];
//description.ext
class CfgDebriefing
{
        class win
    {
        title = "Mission Completed";
        subtitle = "RAF liberated group Brand";
        description = "RAF dorces liberated group Brand from enemy hands.";
        pictureBackground = "";
        picture = "b_inf";
        pictureColor[] = { 0.0, 0.3, 0.6, 1 };
    };
};

just put your class or change the class I pasted - title, subtitle, description, marker, etc.

warped igloo
#

oh that's not really my issue, I already had a custom debrief setup in description.ext, I was just looking to add a custom variable to display in the title when the mission ends.
I got around it by triggering a fade to black and displaying a custom title right before starting the debrief.
Thanks for the help and suggestions!

thin fox
#

yes

pallid palm
#

oh nice thx m8

#

that's cool: i can limit who calls the chopper cammands, you must be a officer to call the chopper commands in my missions WooHoo

sage heath
#

so, I'm trying to get firewill's F-18's afterburners to come on via a trigger, and if I'm guessing correctly, it's activated via a function, (FIR_fnc_aws_Afterburner)

so I put in the trigger Hornet1 call FIR_fnc_aws_Afterburner, and it gives me this error, thoughts?

#

I've tried remoteExec, also another error

#

I don't think it's a problem with the function, I probably am executing it wrong, if so, then what? I wonder

#

I've also tried spawn, same error

tulip ridge
sage heath
#

oh dang it, where do I find the array now 😭

tulip ridge
#

You'd just make one

#

[Hornet1] call FIR_fnc_aws_Afterburner

sage heath
#

ah, I see, well thank you!

hallow mortar
pallid palm
#

Hello all: Is it possible to tell witch _player activated a Radio trigger: and send a system message to the server: ofcorse
my _player(s) var names are ["p1","p2","p3", and so on ];

#

something like this maybe: this would be in the script that gets called by the radio trigger ofcorse

#

would this be correct

stable dune
#

player will be local on player client.
So you only need ->

private _allowedPlayers = [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10];
if (player in _allowedPlayers }) then 
{
    [format ["%1   Activated the Radio Trigger", name _player]] remoteExec ["systemChat", 0, false];
};
pallid palm
#

oh wow cool thx @stable dune

#

@stable dune did you mean this right ?

stable dune
#

Noup, because you dont need define

private _player = player

when player is player.

pallid palm
#

copy that

#

thx m8

pallid palm
#

awsome thx man your the best

#

@stable dune yes Sir, it works perfectly: thx again

#

i made it a call function its fast as heaven Woohoo Arma 3

drifting badge
#

If I got a relative position - for example [5, 3, 0] - is there a command to transform that into the current world position? I know there is getPosWorld but according to the wiki that only works with an object as reference, not just with a relative position.

pallid palm
#

@drifting badge getPosATL maybe

#

or getPosAGL or setPosATL or setPosASL instead

warm hedge
#

[5,3,0] is already a position

#

Or sorry I misread I guess

#

modelToWorld

drifting badge
#

but modelToWorld uses an object as reference, I am trying to find out if there is a likewise easy way to use a relative position as a reference, to transform that relative position as worldposition (hope that made sense and things a bit clearer)

so something like RelPosToWorld (which of course is not a real command)

warm hedge
#

So vectorAdd?

drifting badge
#

Why vectorAdd? Does that not just add vectors together?

What I am asking is if I know the relative position to an object, can I get the world position of that relative position somehow. Yes it would be easy if there was an object at that relative position (that way one could use modeltoWorld) but what I wonder is if there is no object but one only has that relative position as reference.

warm hedge
#

Then why not vectorAdd doesn't work in this context? Do I miss some context?

getPosWorld player vectorAdd [5,0,0]```means 5m away in the North of the player
drifting badge
#

ahhhhh ok I now get what you mean - it takes the world position of the player and then adds the relative position to it -> thus getting that position as worldposition! Totally did not think about doing it that way! (I thought there was a way to somehow transform the position itself without any object reference, which probably was dumb)

warm hedge
#

More trick

posY vectorDiff posX```returns the relative pos from `posX`
drifting badge
#

am still such a complete noob that knows squat apparently ;) thanks mate!

tender fossil
#

(NOTE! Arma 2: CO) Is there a large difference in performance between constant usage of setVariable with global flag set vs. constant usage / ping pong of targeted publicVariables (i.e. using publicVariableClient and publicVariableServer whenever possible)?

#

I'd like to replace global setVariable calls with more secure solution so that the variables in question get moved to server side completely

pallid palm
#

this channel is for Arma 3 scripting: don't know about, Arma 2 Combat Operations, i did have that game years and years ago,

muted crystal
#

Are there modes such as TWS, RWS, SRC, and PDV in arma 3??

pallid palm
#

@muted crystal hell yeah there's like 100,000,000 mods for Arma 3

hallow mortar
#

Where did you get the idea that they don't know the difference between private and global variables? That wasn't the question at all

pallid palm
#

sorry about that my misstake

hallow mortar
# muted crystal Are there modes such as TWS, RWS, SRC, and PDV in arma 3??

I'm assuming you mean radar since I know some of those abbreviations from that. If not then never mind.
There might be some insane mod that fully scripts simulation of advanced radars, but in the engine there is only active and passive radar. Passive radar can be set to act only as RWR.
https://community.bistudio.com/wiki/Arma_3:_Sensors_Config_Reference
https://community.bistudio.com/wiki/Arma_3:_Sensors
There are some config options for setting the radar's field of view and other limitations, but it's not super complex. Radar is always TWS for example, there is no separate tracking mode.

pallid palm
#

i like when you are hard on me KikkoJT: it makes me sharper: and faster: thx you

muted crystal
pallid palm
#

lol that's funny lol good one lol

cosmic lichen
#

Hint command

pallid palm
#

like if i only want it to be sent to the host

#

or the server i guess as it were

cosmic lichen
#

remoteExecCall

pallid palm
#

oh right roger that mate

pallid palm
#

oh yeah WooHoo

winter rose
#

sending to everyone?

pallid palm
#

yes sir

winter rose
#

(in English? :p)

pallid palm
#

ummm huh?

winter rose
#

just toying with you, translating over network can be a bit tricky

pallid palm
#

that way i can see who called for the chopper and i can send the chopper to them

#

from anywhere on the map ofcorse

#

so if i just wanted it to be on the server would i use #2 ?

hallow mortar
#

remoteExec target 2 (not #2) is always the server, yes. (https://community.bistudio.com/wiki/remoteExec)
Keep in mind that doing systemChat etc on the server is not very useful on a dedicated server, because there's no player to read it. This will only do anything worthwhile if the mission is hosted on a player machine.

pallid palm
#

oh cool thx NikkoJT

stable dune
#

Yyou can check false with !

if !(_player in _allowedPlayers) then {
//Do stuff if condition return false
};
pallid palm
#

oh cool roger that @stable dune

#

oh man you guys are making my missions Awsome WooHoo

#

thx so much

#

ok i think i have it all together now thx so much guys @stable dune @hallow mortar @winter rose

#

omg i just realized how Lame: my missions would be without you guys omg πŸ™‚

winter rose
#

I refuse to believe that! you're the fuel to your missions, we only nudge in the direction / smooth the corners πŸ˜‰

pallid palm
#

yeah but i had some ruff corners

#

πŸ™‚

winter rose
#

edgy!

pallid palm
#

man i really truly love you guys πŸ™‚

round hazel
#

Hey folks, any ideas why the overlay seems to flash, then work properly, when it's activated?

SQF

params ["_thisUnit"];

TAG_fnc_camON = {

    while {true} do {
        11 cutRsc ["cameraOverlay", "PLAIN DOWN", -1, false, false];
        "filmGrain" ppEffectEnable true;
        "filmGrain" ppEffectAdjust [0.05, 0.5];
        "filmGrain" ppEffectCommit 0;
        uiSleep 1;
        11 cutRsc ["cameraOverlay2", "PLAIN DOWN", -1, false, false];
        "filmGrain" ppEffectEnable true;
        "filmGrain" ppEffectAdjust [0.05, 0.5];
        "filmGrain" ppEffectCommit 0;
        uiSleep 1;
    };
};


TAG_fnc_camOFF = {
   
    11 cutRsc ["Default", "PLAIN", -1, false, false];
    "filmGrain" ppEffectEnable false;
};


_thisUnit addEventHandler ["OpticsSwitch", {
    params ["_unit", "_isADS"];
    if ((weaponState _unit) select 0 == "Bro_Camcorder") then {
        if (_isADS) then {
            terminate _handle;
            _handle = [] spawn TAG_fnc_camON;
            hint " Aiming down sight of Camera!";

        } else {
            terminate _handle;
            _handle = [] spawn TAG_fnc_camOFF;
            hint " Not aiming down sight of Camera!";
        };
    };
}];
#

P.s. I've been trying to fix this for the past hour. Every rewrite of the script I've done has had the same result. A real head scratcher for me
P.p.s. I know that terminating handle on turning off the effect is probably unecessary, but at this point, if it doesn't break it, it's not worth worrying about for me :(

fair drum
#

are you aware that _handle doesn't exist when you go to terminate it?

round hazel
#

It had crossed my mind, though it doesn't throw any errors so I hadn't taken a look. I'll define it and see if that fixes the issue

fair drum
#

save the handle to a variable, then pull that variable to terminate it. you have to save it out of scope as each time this event is called, its a new scope. and it won't throw an error currently, because terminate silently failed

round hazel
#
MyMission_scriptHandle = [] spawn TAG_fnc_camOFF;
_thisUnit setVariable ["MyMission_scriptHandle", MyMission_scriptHandle];

_thisUnit addEventHandler ["OpticsSwitch", {
    params ["_unit", "_isADS"];
    if ((weaponState _unit) select 0 == "Bro_Camcorder") then {
        if (_isADS) then {
            _handle = _unit getVariable ["MyMission_scriptHandle"];
            terminate _handle;
            _handle = [] spawn TAG_fnc_camON;
            _unit setVariable ["MyMission_scriptHandle", _handle];
            hint " Aiming down sight of Camera!";

        } else {
            _handle = _unit getVariable ["MyMission_scriptHandle"];
            terminate _handle;
            _handle = [] spawn TAG_fnc_camOFF;
            _unit setVariable ["MyMission_scriptHandle", _handle];
            hint " Not aiming down sight of Camera!";
        };
    };
}];

This is how I wrote it, is this roughly correct? (Pardon my poor scripting and slightly changed variable names. I plugged the code into an AI to see if it could spot the issue. It couldn't but changed some names)

granite sky
#

If you're declaring a global variable then you may as well use that instead.

#

Which is a perfectly fine solution as it looks like this is per-player not per-unit functionality?

round hazel
#

This is indeed per player, though it will be working on a dedicated server with numerous players having access to a camera, which I want to create overlays when they zoom in independantly of one another

granite sky
#

hmm, I guess it depends whether the EH is inherited on respawn.

round hazel
#

Previous testing makes me believe they are

granite sky
#

Some of them are, some of them aren't. Not all are documented.

round hazel
#

Ahhh

granite sky
#

but yeah, if it's respawn-inherited then just use a global variable.

#

MyMission_scripthandle is a terrible name though :P

round hazel
round hazel
granite sky
#

This is all player-local code, right.

#

You run it separately on each client.

#

From initPlayerLocal or whatever.

#

Server doesn't even need to run it.

#

hence everyone has their own global variable.

round hazel
#

If I make it global, will it not then update across all players? Also, we are talking about 'MyMission_scriptHandle' variable right?

granite sky
#

No, yes.

#

"global" is used in two different ways when talking about SQF.

round hazel
#

Ahh, well butter me up and call me randy, I did not know that!

granite sky
#

Each machine has their own variable namespaces. If you wanted to publish them to other machines then you'd use publicVariableXXX commands, or the third parameter of setVariable.

#

Simply using MyGlobalVar = X will only set the variable on the machine that the code is run.

round hazel
granite sky
#

Global vs local variable scope is a separate thing.

fair drum
#

also if using the array syntax of getVariable, you really should give it a default fallback. But in this case, nil is a fine fall back so you can use the non array syntax and do a nil check after.

round hazel
#

@granite sky

May have made a mistake making "handle" global. Testing shows it's creating a new occurance of the functions each time

params ["_playerUnit", "_didJIP"];

handle = nil;

_playerUnit addEventHandler ["OpticsSwitch", {
    params ["_unit", "_isADS"];
    if ((weaponState _unit) select 0 == "Bro_Camcorder") then {
        if (_isADS) then {
            terminate handle;
            handle = [] spawn TAG_fnc_camON;
            hint " Aiming down sight of Camera!";

        } else {
            terminate _handle;
            handle = [] spawn TAG_fnc_camOFF;
            hint " Not aiming down sight of Camera!";
        };
    };
}];
round hazel
granite sky
#

You missed one: terminate _handle;

#

give it a proper name though.

round hazel
granite sky
#

Also you need a proper starting value.

round hazel
round hazel
granite sky
#

should be fine.

#

actually I guess you can just do MyTag_handle = scriptNull here. Makes more sense.

#

As the off script just clears the effect.

#

scriptNull rather than nil though. Referencing a nil var doesn't work and may prevent execution of following statements.

round hazel
#
params ["_playerUnit", "_didJIP"];


TAG_fnc_camON = {

    while {true} do {
        11 cutRsc ["cameraOverlay", "PLAIN DOWN", -1, false, false];
        "filmGrain" ppEffectEnable true;
        "filmGrain" ppEffectAdjust [0.1, 1.25, 2.01, 0.75, 1.0, false];
        "filmGrain" ppEffectCommit 0;
        uiSleep 1;
        11 cutRsc ["cameraOverlay2", "PLAIN DOWN", -1, false, false];
        "filmGrain" ppEffectEnable true;
        "filmGrain" ppEffectAdjust [0.1, 1.25, 2.01, 0.75, 1.0, false];
        "filmGrain" ppEffectCommit 0;
        uiSleep 1;
    };
};


TAG_fnc_camOFF = {
   
    11 cutRsc ["Default", "PLAIN", -1, false, false];
    "filmGrain" ppEffectEnable false;
};

overlayFuncHandle = scriptNull;

_playerUnit addEventHandler ["OpticsSwitch", {
    params ["_unit", "_isADS"];
    if ((weaponState _unit) select 0 == "Bro_Camcorder") then {
        if (_isADS) then {
            terminate overlayFuncHandle;
            overlayFuncHandle = [] spawn TAG_fnc_camON;
            hint " Aiming down sight of Camera!";

        } else {
            terminate overlayFuncHandle;
            overlayFuncHandle = [] spawn TAG_fnc_camOFF;
            hint " Not aiming down sight of Camera!";
        };
    };
}];

I believe I've done everything yet still the 'Camera on' effect flashes when I ADS, disappears, then appears and plays out properly

#

And this occurs no matter what 'weapon' is equipped. It isn't a bug with the particular 'camera' weapon i'm using