#arma3_scripting

1 messages · Page 556 of 1

dire hearth
#

But shouldn't the second parameter pass the argument to the succeed and fail condition?

still forum
#

"generic errors" no

#

it also tells you the real error

#

show us the error

#

I assume it says "got array, expected object" right?

dire hearth
#

I'll have a look again later

oblique lagoon
#

Will be there a way to use vanila spectrum device's screen as a custom ui screen?

#

Its interesting that the screen seems to need PIP system but it works without PIP setting. What do we call such technologies? Is it something related to IGUI?

still forum
#

could be same as how aircraft monitors work

#

didn't look into it that much

errant patio
#

Is there a function in ace medical to get the wound status of a unit? as in, something like an array with each body part and its wounds?

real tartan
#

@errant patio _damageArray = _unit getVariable ["ace_medical_bodyPartStatus", [0,0,0,0,0,0]];

errant patio
#

👍 i found that a little while after and it's not great but it is something at least

errant patio
winter rose
#

ask him an id scan?

errant patio
#

:p

winter rose
#

you could "ask him" his playerUID, make him send it to the server

#

or on connection, setVariable it so the server can read it

errant patio
#

🤔 i'll give it a shot. annoyingly hard to test bug sadly

winter rose
#

I guess so yes - unreliable "safety" command…

errant patio
#

according to what i've found and read it can cause issues when called on the same frame as a unit is created so. using waitUntil and asking the client to send it themselves is probably a pretty good idea

winter rose
#

waitUntil isPlayer unit and getPlayerUID unit ! = "" ?

errant patio
#

maybe. i just noticed that PlayerConnected lets you read their name and uid so i'm going to try using that information instead.

errant patio
#

in my rigorous testing of one attempt, it at least works as well as before so that's good lol. Hopefully it holds up, it's fairly important :/

mint kraken
#

I've seen a lot of people use compileFinal with large strings but why doesn't people use compileFinal preprocessFileLineNumbers file.sqf?
Is there a specific reason or just personal preference?

fleet bear
#

@mint kraken we use this on every mission)

mint kraken
#

?

fleet bear
#

With preprocessFileLine i mean

finite dirge
mint kraken
#

hmm, ok thanks!

still forum
#

personal un-preference I guess

#

people who just don't know are everywhere

#

and the people who know, will probably just use CfgFunctions

fleet bear
#

Still working on upgrading OCAP replays. Want to detect placed mines. The problem is, that in ocap every entity gets unique id via setVariable. but mines, as part of CfgAmmo cannot get that. Did anyone tried to overcome this? Thought about detecting a mine, while it's not armed, so it's a part of CfgMagazines

dire hearth
#

Hey @still forum , talking about my issue yesterday, I took a look at it and you're right. It did indeed say 16:58:05 Error additemcargoglobal: Type Array, expected Object

#

You happen to know how to fix that?

finite dirge
#

If it's an array of objects, a loop.

still forum
#

You were passing an array

#

not your target

#

you need to pass _target instead of [_target]

dire hearth
#

Hmm, so you mean just params "_target"; rather then params[ "_target"];?

still forum
#

no

#

I meant EXACTLY what I wrote

fleet bear
#

addItemCargoGlobal ["rhs_weap_rshg2",1];

this works fine

finite dirge
#
[3, [_target], {

Should be:

[3, _target, {

For example.

dire hearth
#

Alright, I think I understand, i'm just rather new to coding

still forum
#

this works fine
no it doesn't missing left parameter, thats a syntax error

fleet bear
#

oh, sure, forgot that, sorry

#
_veh addItemCargoGlobal ["rhs_rpg7_PG7VL_mag",3];
dire hearth
#

ok, its working, thanks for the help!

astral tendon
#
_NewVehicle addEventHandler ["ControlsShifted", {
    params ["_vehicle", "_activeCoPilot", "_oldController"];
    If (_vehicle isKindOf "air" and (roleDescription _activeCoPilot != "Pilot")) then {
    ["Apenas pilotos podem co-pilotar aeronaves"] remoteExec ["Systemchat",_activeCoPilot];
    [_activeCoPilot, ["SuspendVehicleControl", _vehicle]] remoteexec ["action",_activeCoPilot];
    };
}];

this script does not work in dedicated servers, the player can still get the control of the helicopter, whats wrong?

finite dirge
#

Where are you running that? On the server?

#

This event handler will always fire on the PC where action is triggered as well as where the vehicle is local at the time. When control of the vehicle is shifted, the locality of the vehicle changes to the locality of the new controller. For example, if helicopter is local to the server and co-pilot takes controls, the helicopter changes locality to co-pilot PC.

astral tendon
#

is on the server, the _NewVehicle was created by the server

finite dirge
#

Then that's your issue.

astral tendon
#

So, the event handle is useless simply because its depends on locality to fire?

finite dirge
#

You'd have to add it to them when then get in that specific heli afaik

oblique arrow
#

Hm is there a command to make the mine dispensers fire?

surreal peak
#

setDamage 1 should activate it

sturdy cape
#

hello.i am trying to fix something that worked in 1.94 and now it doesnt ;)

i am getting an array of certain buildings on the server to later spawn a script forEach of them ```sqf
global_object_array_var = [];

_houses = nearestTerrainObjects [   
 [worldSize/2, worldSize/2],    
    ["house"],    
    worldSize,    
    false   
];  

{
if ((str _x) find "shed" >= 0) then {
global_object_array_var pushback _x;
};
}foreach _houses;
publicvariable "global_object_array_var";```well i figured that i cant spawn stuff on them client side (but want to) because my array returns a list of "NULL-Object" entries on clients.what can i do to solve this?or is it because its terrainobjects?

winter rose
#

createVehicleLocal involved?

still forum
#

terrain objects might be local

#

and probably are

winter rose
#

terrain objects are local yes

jaunty ravine
#

Question: How do I execute a script depending on a units next waypoint name?
Intention: If unit spawn_heli_vehicle's current waypoint is spawnDespawnWP I want to execute a script, else I want to execute a different script.

#

Current code: sqf if (spawnDespawnWP == currentWaypoint spawn_heli_vehicle) then { [] execVM "onPlayerKilled.sqf"; } else { player moveInCargo spawn_heli_vehicle; player assignAsCargo spawn_heli_vehicle; };

jaunty ravine
#

Could you give an example, @winter rose? I'm simply too inept to figure it out on my own though I am trying.

winter rose
#

I suppose this would work:sqf private _currentWP = currentWaypoint spawn_heli_vehicle; if (waypointName _currentWP == "spawnDespawnWP") then { // bla } else { // bla };

jaunty ravine
#

Thank you kind sir.

wary vine
#
    drag_evh = (uiNamespace getVariable ["lega_vehicle_shop_paint_display", displayNull]) displayAddEventHandler ["MouseMoving", {
        params ["", "_dx", "_dy"];
        if (dragging) then {
            
            private _distance = (missionNamespace getVariable ["lega_vehicle_preview_cam_dis", 10]);
            private _object = (missionNamespace getVariable ["lega_vehicle_preview_object", objNull]);
            private _direction = ((missionNamespace getVariable ["lega_vehicle_preview_cam_dir", objNull]) + _dx);
            private _camera = (missionNamespace getVariable ["lega_vehicle_preview_cam", objNull]);
            private _cur_pos = (_object modelToWorld [0, _distance + _new_y, _distance * 0.3]);
            private _coords = [_object, _distance, _direction] call BIS_fnc_relPos;    

            _coords set [2, (_cur_pos # 2)]; 
            _camera camSetPos _coords;
               _camera camCommit 0;

            missionNamespace setVariable ["lega_vehicle_preview_cam_dir", _direction];
        };
    }];
``` have a clean x rotation around an object, was wondering how I would impement the y dragging around the object, tried a few things, not been able to get it working.
jaunty ravine
#

Unfortunately it didn't work, trying a few other things as of right now.

#

More specifically it spits out the following error message:
currentWaypoint: Type Object, expected Group

frozen knoll
#

therefore since you are trying to get the waypoint of a object rather than using the id of a waypoint you could get the pilot group

_pilotGroup = (group (driver spawn_heli_vehicle));
#

_currentWaypoint = currentWaypoint _pilotGroup;

jaunty ravine
#
_pilotGroup = (group (driver spawn_heli_vehicle));
private _currentWaypoint  = currentWaypoint _pilotGroup;
if (waypointName _currentWaypoint == "spawnDespawnWP") then
{
    [] execVM "onPlayerKilled.sqf";
}
else
{
    player moveInCargo spawn_heli_vehicle;
    player assignAsCargo spawn_heli_vehicle;
};``` Like this?
#

If yes, doesn't work.

#

But hey, at least it now complains about line 3 instead of line 1 😄

#

Progress!

frozen knoll
#

waypointName check is wrong

#

_wpName = waypointName [_pilotGroup ,_currentWaypoint];

#

if (_wpName == "spawnDespawnWP") then

jaunty ravine
#

No errors, testing again to make sure.

#

Hm, doesn't work 100% but that could due to tiredness. Gonna get some sleep and pick up where i left off tomorrow, see if it makes more sense to me then.

Thank you for your help though, @frozen knoll @winter rose

wary vine
frozen knoll
#

nice

velvet merlin
#

is there an easy way to sort an array and store the index shifting of the elements?

frozen knoll
#

easier than keeping a copy of the original array sorting then finding index on copy of the original with find?

opal turret
#

Hello folks,

I'm having an issue trying to get random weapons and their corresponding ammo into a loadout script for players. I've randomised backpacks, headgear and uniforms without any difficulty but the weapons have me stumped.

I've tried a dozen different iterations of selectRandom and weapon arrays but still can't wrap my mind around it. Any help would be appreciated...included is the latest iteration I've tried:



_wep_01 =     [
                "player addWeapon 'rhs_weap_ak74n';",
                "player addPrimaryWeaponItem 'rhs_acc_dtk1983';",
                "player addPrimaryWeaponItem 'rhs_30Rnd_545x39_7N6M_AK';",
                "for '_i' from 1 to 10 do {player addItemToVest 'rhs_30Rnd_545x39_7N6M_AK';};"                
            ];

_wep_02 =     [
                "player addWeapon 'rhs_weap_ak74n';",
                "player addPrimaryWeaponItem 'rhs_acc_dtk1983';",
                "player addPrimaryWeaponItem 'rhs_30Rnd_545x39_7N6M_AK';",
                "for '_i' from 1 to 10 do {player addItemToVest 'rhs_30Rnd_545x39_7N6M_AK';};"                                
            ];

//SELECT RANDOM WEAPONS


_weapon = selectRandom ["_wep_01", "_wep_02"];

dire hearth
#

Maybe try randomizing it with a number?

#

if (_random > 49) then { 

loadout1

};

if (_random <51) then {

loadout2

};

#

etc

#

Atleast thats how I would do it @opal turret , though i'm hardly a scipting progidy

wary vine
#
private _weapon = selectRandom [
    ["rhs_weap_ak74n", ["rhs_acc_dtk1983"], ["rhs_30Rnd_545x39_7N6M_AK", 10]], 
    ["rhs_weap_ak74n", ["rhs_acc_dtk1983"], ["rhs_30Rnd_545x39_7N6M_AK", 10]]
];

_weapon params ["_weapon", "_items", "_mags"];
player addWeapon _weapon;
_items apply {player addPrimaryWeaponItem _x};
for "_i" from 0 to (_mags # 1) do 
{
    player addItem (_mags # 0);
}
``` would have to do some error checking in that though.
dire hearth
#

See what Leigham just wrote is just confusing to me with my limited knowledge 😛

wary vine
#
private _weapon = selectRandom [
    ["rhs_weap_ak74n", ["rhs_acc_dtk1983"], [["rhs_30Rnd_545x39_7N6M_AK", 10]]], 
    ["rhs_weap_ak74n", ["rhs_acc_dtk1983"], [["rhs_30Rnd_545x39_7N6M_AK", 10]]]
];

_weapon params [
    ["_weapon", "", [""]],
    ["_items", [], [[]]],
    ["_mags", [], [[]]]
];

if !(_weapon isEqualTo "") then 
{
    player addWeapon _weapon;
    
    _items apply 
    {
        player addPrimaryWeaponItem _x;
    };

    _mags apply 
    {
        player addMagazine _x;
    };
};
``` would probably be a little better.
opal turret
#

@dire hearth your script would necessitate whole separate loadouts and would be perfect if you only wanted a couple, however the script I'm working with has a selection of 20 uniforms, 15 vests etc. Thank you for your help though!

#

@wary vine that looks pretty damn good mate. You're using the one format I haven't tried. I've been basing it on the code exported from the virtual arsenal...which might be my issue.

dire hearth
#

Fair enough, gl with it 🙂

opal turret
#

@wary vine you nailed it. There was a little alteration needed, it didn't like the mag number being included in the array but with a little adjusting it works perfectly. Cheers.

Here it is with the modification:

                                    ["rhs_weap_ak74n", ["rhs_acc_dtk1983"], "rhs_30Rnd_545x39_7N6M_AK"], 
                                    ["rhs_weap_ak74n", ["rhs_acc_dtk1983"], "rhs_30Rnd_545x39_7N6M_AK"]
                                ];

_weapon params ["_weapon", "_items", "_magazines"];

player addWeapon _weapon;
_items apply {player addPrimaryWeaponItem _x};
 
for "_i" from 1 to 10 do {player addItemToVest _magazines;};```
wary vine
#

@opal turret player addMagazine [_magazines, 10]

dire hearth
#

Anyone happens to know how I add ace actions to a AI in a car? I'm able to add the actions to themselves when they are outside of the car. But I also want a action to be available when they are inside the car, same way the actions like "get out" are available

still forum
#

@velvet merlin
turn your [a,b,c] array into [[a,0], [b,1], [c,2]] then sort, it will sort the inner arrays based on first element, and youll have the original index in second element of the subarray

velvet merlin
#

good thinking. ty

dire hearth
#
// Server Only Execute
if(!isServer) exitWith {};

//Parameter init
params ["_animation"];

//Checks animation played

if (_animation in ["ace_gestures_hold","ace_gestures_holdStandLowered","gestureFreeze"]) then

//Stops car

{

_car = nearestObjects [player, ["car","truck"], 12];
{if (side _x == civilian) then {_x disableAI "PATH";}} forEach _car;

};

//=====================================================

//Checks animation played

if (_animation in ["gestureGo","gestureGoB","ace_gestures_forward","ace_gestures_forwardStandLowered"]) then

//Gets car to go again

{

_car1 = cursorTarget;
if (side _car1 == civilian) then {_car1 enableAI "ALL";}

};

I got this script working with this event handler:

["ace_common_playActionNow", {(_this select 1) call fw_fnc_gesture;}] call CBA_fnc_addEventHandler;

Works in SP, doesnt work on the server, anyone happens to know how to fix that?

winter rose
#

do you add this EH on the server itself? isn't the EH local to the unit?

still forum
#

you are running a script only on server

#

but you use player inside the script which is invalid on a server 🤔

#

cursorTarget is also not valid on server

#

and playActionNow looks to me like it would run clientside

finite sail
#

guys, has anyone worked with inpolygon? can I provide the positions to the command in any order? Would it be better to provide them in a clockwise direction?

winter rose
#

clockwise or counter-clockwise I would say, just not random order 😄

finite sail
#

ok thanks. i need a 6 point shape.. a rectangle with a gentle bend in it halfway down

#

so 2 rectangles touching end to end, but not quite in the same dir

#

oo yes

#

it gets weird if you dont provide them in a sensible order

#

ugh, it's too complex, im making the polygon in code and getting its points in the right order is faff

#

easier to have 2 rectanlges and have

#

inarea rect1 OR inarea rect2

sturdy cape
#

@still forum sorry didnt come round to check for replies here.actually i thought so but wanted to make sure,thanks for the replies.

i tried a workaroud through remoteExecing this on clients uding something like thsi sqf { [] spawn { for "_i" from 1 to 5 do { playSound3D ["tzr\tzr_audio\nuclear_boom.ogg",_x,false,getpos _x,15,0.8,10000]; sleep 9.5; }; }; } forEach tzr_siren_sources;but this will throw undef var in exp "_x".can playsound3d not be executed foreach?

still forum
#

you are not passing _x to the new script instance that youre spawning

sturdy cape
#

so "[_x] spawn..."?

still forum
#

you don't have to pass an array to spawn

#

but yeah you could do that

sturdy cape
#

ah there we go,thanks.its always the "little" things^^

astral dawn
#

I haven't studied the arma config sciences properly, but why does "ACE_quikclot" call bis_fnc_itemType return ["Item","AccessoryBipod"] 😦 or how do I universally get item type in this game?

#

(reliably at least for base game stuff + ace)
NVM I will ask that at ACE slack probably, unless you really want to reply to me

still forum
#

because its a bipod

astral dawn
#

Oh ok thanks

#

😆

still forum
#

previously it was a mine detector.. but that caused medical items to accidentally act as... mine detectors..

#

so it was changed over to bipod

astral dawn
#

But wasn't there a way to configure it to... something else?

#

item type is an integer or what is it? 🤔

still forum
#

YES

odd pollen
#

Do you guys know how to go about targeting the pilot camera in a script

#

it doesn't appear to be a seat of its own

opal turret
#

Hello,

Hoping you folks will be able to help me again. I'm trying to get a variable passed in an eventHandler but can't get it to work properly. If I put the variable in the init.sqf and make it global it will work for the event handler but not rest of the script...heres the example:


UCShotsFired = 0;

//EVENT HANDLER FOR SHOTS

{

_nearEnemy = nearestObjects [_x,["Man"],250];

    _x addEventHandler      

        [
        "FIRED",
    
            {                            
                if ((east countSide _nearEnemy) > 0) then 
                {UCShotsFired = UCShotsFired + 1} 
            }
                                
        ] 

} forEach allPlayers;

waitUntil {UCShotsFired > 1};

{_x setCaptive false} foreach allPlayers;```
finite jackal
#

Do you want it to exit the waitUntil if any player fires?
Because a global variable is still local to a client, you might want to remoteExec it to server and public variable it from there @opal turret

opal turret
#

@finite jackal Hey mate, I don't mind how it get's exited, one player, all players, doesn't matter at this stage as I'll be modifying the rest after I get my head around this issue.

All I want is for the variable UCShotsFired to be recognised in both the EH and the waitUntil. I can get either, but not both. The script is executed only on server.

finite jackal
#

if that script is going to your servers init,


UCShotsFired = 0;``` is local to the server
and all code excecuted in that eventHandler is local to the client
`object-based Event Handler is always executed on the computer where it was added.`
so UCShotsFired is undefined on clientside
You will need to define it in something like initPlayerLocal (or define it in your forEach allPlayers), and RE the value to the server for it to update that waitUntil on the server
@opal turret
#

Also did not notice this, but the server init will excecute before any player joins(roughly as soon as you boot the server up), you must add that EVH client side or have some kind of waitUntil/sleep because no players will be connected when that excecutes @opal turret

frozen knoll
#

UCShotsFired = 0;
publicVariable "UCShotsFired";

opal turret
#

@finite jackal Firstly, thank you for your help.

Secondly, If i were to put the above script segment into the initPlayerLocal, made UCShotsFired private, and included a loop to check the status of UCShotsFired, would that be sufficient?

opal turret
#

@frozen knoll sorry mate, I'm having a hard time figuring out how to implement that into the script??

frozen knoll
#
//COUNTER FOR SHOTS

UCShotsFired = 0;
publicVariable "UCShotsFired";

//EVENT HANDLER FOR SHOTS

{

_nearEnemy = nearestObjects [_x,["Man"],250];

    _x addEventHandler      

        [
        "FIRED",
    
            {                            
                if ((east countSide _nearEnemy) > 0) then 
                {UCShotsFired = UCShotsFired + 1;
              publicVariable "UCShotsFired";
                };
            }
                                
        ] ;

} forEach allPlayers;

waitUntil {UCShotsFired > 1};

{_x setCaptive false} forEach allPlayers;
opal turret
#

@frozen knoll Thank you for that. Just wasn't sure where to rebroadcast the publicVariable. It's no longer throwing undef var errors at me.

Still not working though. I think there may be an issue with _nearEnemy.

frozen knoll
#

slight edit

#

if ((east countSide _nearEnemy) > 0) then
{UCShotsFired = UCShotsFired + 1;
publicVariable "UCShotsFired";
};

#

yeh have a look at nearEnemy

#

ill read over the rest shortly to see if i can notice anything for u

opal turret
#

@frozen knoll thanks again. Player starts as captive, EH is supposed to kick them out of captive if they fire in proximity to opfor, it's just not kicking the player out of setCaptive though.

frozen knoll
#

just the player fired near or all players ?

#

or is there just 1 player in this mission?

opal turret
#

In its current iteration, all players

frozen knoll
#

looking at it _nearEnemy is defined outside of the eventhandler

opal turret
#

Can you define a variable inside an EH?

frozen knoll
#

it can be a local global var

#

since its just ran local

#

nearEnemy instead of _nearEnemy

#

it will just update as forEach loops

opal turret
#

@frozen knoll still no good I'm afraid. I'll have to come back at it when I can concentrate. Cheers again for the help bud.

frozen knoll
#

{_x setCaptive false} forEach allPlayers; is that ran local?

#

or back on the server

opal turret
#

On the server

frozen knoll
#

is the whole thing on server?

#

another thing to note
with
_nearEnemy = nearestObjects [_x,["Man"],250];
outside of the event handler it will only register that first postion

#

bring it inside the event handler so it checks every time fired is triggered

opal turret
#

Yup. I brought it inside the EH but not sure how to call the players position. Can't use _x, or player.

frozen knoll
#

i really would add the eventhandler to the player client side

#

so each player has it added on connection

#
//server side 
UCShotsFired = 0;
publicVariable "UCShotsFired";
waitUntil {UCShotsFired > 1};

{_x setCaptive false} forEach allPlayers;
#
//initPlayerLocal
waituntil {!isnull (finddisplay 46)};
    player addEventHandler
        [
        "FIRED",
    
            {                            
                _nearEnemy = nearestObjects [player,["Man"],250];
                if ((east countSide _nearEnemy) > 0) then 
                {
                    UCShotsFired = UCShotsFired + 1;
                    publicVariable "UCShotsFired";
                };
            }
                                
        ];
#

you could even go with

#
//server side 
UCShotsFired = 0;
publicVariable "UCShotsFired";
opal turret
#

...it works! Awesome work mate. You're a legend

frozen knoll
#
//initPlayerLocal
waituntil {!isnull (finddisplay 46)};
player setCaptive true;
    player addEventHandler
        [
        "FIRED",
    
            {                            
                _nearEnemy = nearestObjects [player,["Man"],250];
                if ((east countSide _nearEnemy) > 0) then 
                {
                    UCShotsFired = UCShotsFired + 1;
                    publicVariable "UCShotsFired";
                };
            }
                                
        ];
waitUntil {UCShotsFired > 1};
player setCaptive false;
#

ha sweet was typing up that alternate options aswell but all good

#
  • maybe remove the eventhandler once its fired
opal turret
#

Yeah, I'll be adding that next.

frozen knoll
#

awesome man all the best

warm hedge
#

Can somebody confirm a suspicious bug?:
Do this disableCollisionWith veh; this disableCollisionWith player; in Init for 2+ units, where veh is a vehicle, and the commands aren't executed properly for units expect placed last guy.
In my case, I placed player, 3 units and a Marshall named veh and do the same commands and in the preview the player is “ghost” for these units but veh isn't “ghost” for 2 units who placed firstly

productVersion = ["Arma 3","Arma3",197,146060,"Development",true,"Windows","x64"]

plucky wave
#

Can you have multiple of the same event handler assigned to the same object?

#

E.g. if I want to catch Killed multiple times with different results

warm hedge
#

Yes @plucky wave

exotic tinsel
#

is there a way to get a players armor rating? or total allowed damage based on their gear? i cant find a function using basic searches.

plain current
#

You can read the armour value from the config

young current
#

probably would need a more complex calculation based on hitpoint health values and gear armor damage reductions. Question is, is it worth it?

#

do you need to know if you die from the next pistol body shot or not?

dire hearth
#

Hey, perhaps someone could explain this to me. I'm creating a ACE action to call upon a script. Using the call function. I want to attach two paramaters to that.

        _action1 = ["sr_checkDocuments", "Check documents", "",{[_target, _unit] call fw_fnc_checkDocuments;}, {_checkDocuments = _target getVariable "documentsCheck_done";isNil "_checkDocuments";}] call ace_interact_menu_fnc_createAction;
        [_veh, 0, ["ACE_MainActions","ACE_Passengers", str _unit], _action1] spawn ace_interact_menu_fnc_addActionToObject;

Now the issue is, the _unit variable here is a object, but when I go into the actual script and try to hint it.

// Server Only Execute
if(!isServer) exitWith {};

// Parameter init
params ["_target", "_unit"];

It complains _unit is a number rather then a object, anyone has any idea why this happens and how to fix it?

still forum
#
// Server Only Execute
if(!isServer) exitWith {};

can't work.

#

ACE actions are only executed on clients

#

so unless you are in singleplayer, or playing a self-hosted MP game by yourself that cannot work

#

[_target, _unit] call fw_fnc_checkDocuments;
_unit is undefined

dire hearth
#

Surely the script it calls upon can be server only? Won't it otherwise create stuff for server+every player?

still forum
#

don't understand why its telling you that its a number

#

Surely the script it calls upon can be server only? it only runs on the client executing the action.

#

Won't it otherwise create stuff for server+every player? no.. I don't see why it would?

#

only valid variables in fnc_createAction are _target and _player.. aand _actionParams

dire hearth
#

Imagine there is more stuff above that script, _unitis defined as a object

plain current
#

The formatting of that code is top notch

still forum
#

Imagine there is more stuff above that script, _unitis defined as a object
doesn't matter.

#

The code of the action is a new script

plain current
#

not in the context

still forum
#

local variables carry over into lower scopes, but not into entirely new scripts

dire hearth
#

Aah, I see

still forum
plain current
#
_action1 = ["sr_checkDocuments", "Check documents", "",
{
    // this will be in a new context and the local variables defined outside won't work
    [_target, _unit] call fw_fnc_checkDocuments;
}, 
{
    // same here
    _checkDocuments = _target getVariable "documentsCheck_done";
    isNil "_checkDocuments";
}] call ace_interact_menu_fnc_createAction;

[_veh, 0, ["ACE_MainActions","ACE_Passengers", str _unit], _action1] spawn ace_interact_menu_fnc_addActionToObject;
dire hearth
#

Ok, makes sense

plain current
#

Same thing as with eventhandlers

still forum
#

actions are actually eventhandlers

dire hearth
#

So the ACE action can only pass over the _target _player and _actionParams?

plain current
#
// this wont work either
private _friend = call some_fnc_getMyFriend;

player addEventHandler["DoStuff", {
    hint name _friend;
}];
still forum
#

So the ACE action can only pass over the _target _player and _actionParams?
no

#

As I said and linked above. Read that page

#

you'll find out how to pass parameters by yourself

dire hearth
#

I most likely won't since I don't understand, hence the question

#

Nope, I can honestly say I have no clue how to pass on any other variable but _target and _player

still forum
#

And inside the action code you get a variable named _actionParams

astral dawn
#

Sry but wiki is down
is disableSerialization only meant to work in spawned scripts? Or does it also enables saving non-serializable stuff into missionNamespace in event handlers?

still forum
#

non-serializable stuff cannot be saved

astral dawn
#

Yes I meant setting missionNamespace variables

still forum
#

disableSerialization just makes sure your whole script instance is not saved, instead of variables

#

unscheduled code is never saved

#

as you cannot save a game while they run

#

as they freeze the game while they run, so the game cannot freeze in that time

#

thus disableSerialization not a thing in unscheduled

astral dawn
#

yeah I get that, thanks!

#

I thought it meant like 'from now on don't warn me any more when I save dumb stuff into missionNamespace' but appears it's not like this then, thx

patent moat
#

Does anyone know how to make something like this? Is it hard to make something like this? I just wanna see if I can make it for free. If not I’ll pay for it. https://imgur.com/a/cXI8NNS

astral dawn
#

Do you mean UI? Yeah you can for sure, CBA has features to let you override standard displays

#

If you have never worked with UIs, then the proper word is not "hard", probably there is not even such word 🤔

#

You can have a look at #arma3_gui , I think we have discussed this topic some time ago in it

frozen knoll
#

@patent moat its rather easy but you still need to understand what you are doing... i recommend doing a mockup in photoshop to plan how you want it to look... create the basics of it via the gui editor and then style it via dialog file and code to function as intended
example of something ive made similar following that process
https://imgur.com/a/X6XvlRl

mortal wigeon
#

How can one increase (via mod or otherwise) the default right click view zoom level?

#

without altering the normal fov

winter rose
lucid junco
#

hey there! do someone knows how to turn off the fireplace effect (any fire) to give damage when unit is close? Im gettting damage by fire from absolutely stupid distance.....

winter rose
#

no can do from script, beside making yourself temporarily invulnerable with allowDamage or turning the fire off with inflame @lucid junco

lucid junco
spice axle
#

Is there a disconnected event handler? So if i'am pressing abort a script can be executed?

astral dawn
exotic flax
spice axle
#

I need it on both, SP and MP and on player side. I'm trying to use a recursive function with CBA_MissionTime atm, but it is not the preferred way

spice axle
#

I can explain it a bit. I have a radio that I can turn on inside a mission. But my problem is that you can't turn it off as soon you are out of the mission. You need to close the game to end the radio stream

#

But the disconnect event is kinda random for every client
I just a "trigger" that says me, hey I'm out of a mission

astral dawn
#

Yeah I understand, I will need to solve a similar problem soon.
So is "ended" event handler not doing the job for you?

spice axle
#

I don't think so. I mean if you disconnect before the mission is ended, there is still a problem

tough abyss
#

Is exist any article about level streaming realization in RV engine? GDC presentation, etc

young current
#

you mean like how the engine does it?

tough abyss
#

Yea

young current
#

its not really scripting/modding related tho

#

and its not probably public information

#

Since you know RV isnt open engine and the big terrains is one of its trump cards

tough abyss
#

I suggested that this thread is most closer to my question :D
Sometimes devs publish some information about their research in computer science, on GDC for example

spark turret
#

Hello fellow people im back from the dead

#

does anyone have a script or a good way of telling for the AI if they are under fire? (especially sniper fire)
i hate if players outrange the AI and they do nothing. so i want a script to detect them being fired upon

#

suggestions?

#

also i need that part for a more complex "entrenched ambush" and "hit n run" enhanced ai script

worn forge
#

The only thing I've found is to use a handledamage event handler to alert the group if a unit takes damage. The FiredNear event handler (@ wiki) has a hard-coded limit of 69m

#

That said, the AI seem to be pretty good at determining if they are under attack, the problem you may be seeing is that the shooters are far away enough that the AI can't effectively engage the target

exotic flax
#

I've got a question regarding getUnitLoadout;
at the moment I use it to create ACE Arsenal default loadouts in combination with CfgRespawnInventory (get loadouts and add them to the list).
This works like a charm, however the function seems to have issues with custom weapons and backpacks (due to attachments and inventory).

#

Is this normal behaviour, or is it simply because I set the scope to 1 (so it doesn't show up in Arsenal, but is available for my custom faction)

spark turret
#

that AI mod looks promising. will keep an eye on it

#

sadly not what im looking for

#

im trying to determine if they are being attacked BEFORE they take damage. a player who notices bullet impacts at his feet wont stay still, unlike the ai

winter rose
#

getSuppression? Also AI will react to flying bullets / impacts on the ground

#

@spark turret

spark turret
#

iirc getSuppression just spikes on bulletimpact and returns to zero a second after which makes checking it rather performance heavy

#

hmmm wait i got Brightcandle to include a custom suppresion value in his mod for me

#

there it is:
"Took a little longer than I hope as I hit a bunch of dumb issues and problems. Releasing now, [_unit] call CF_BAI_fnc_getSuppression; //gives you a value between 0 for no suppression and 1.0 for maximum suppression." - BrightCandle

#

mod is cf_bai

fleet hazel
#

Guys. I added to my dialog
url = "https://www.google.com/"
How to make the site open in Steam overlay.

winter rose
fleet hazel
#

@winter rose I for button added url. My site opens in the browser Google Chrome. I need it to open in steam overlay.

young current
#

you sure its even possible?

spark turret
#

opening random websites from the game seems like a big welcome to abusing it

fleet hazel
#

@young current I don't know. That's why I ask)))

finite dirge
#

That's not a thing afaik.

spark turret
#

spamming teamkillers with popup ads lol

finite dirge
#

^ That is a thing.

astral dawn
#

We can't attachTo to a house from the map, but can to a house placed in the editor. Is it a known bug or am I not reading the wiki properly again?

worn forge
#

You can, you just need to find the object, ie:

#

_house = nearestBuilding player
player attachTo [_house, [0,0,0]]

#

Huh, I say that, but in testing it doesn't seem to work.

still forum
#

terrain objects != objects

worn forge
#

I suppose you could get around it by getting the class name of the house, its coordinates and direction, delete the house and create your own

still forum
#

why would you even "attachTo" to something static?

#

it won't ever move anyway, just setPos it

worn forge
#

If it's an object that's affected by gravity, you'd need to use attachTo if it's ... precariously positioned

astral dawn
#

why would you even "attachTo" to something static?
unless when it's destroyed, it gets moved under the ground together with all my attachments 🙂

#

but yeah I have worked around that by using a bunch of modelToWorldWorld, vectorModelToWorld, etc

#

Might be worth placing a note on the wiki about it...

west pumice
#

New to all of this, but is there any scripts I can use in the editor to raise or lowered the sea level? AKA, flood terrian or just flat out lower the sea level?

#

I have heard that you can do it through mods, but I am trying to avoid using extra mods at all costs.

calm bloom
#

Hi there! Do you guys have an idea how to pass the string from this mission.sqm line into the script environment?
onActivation="call{call line1;" \n "call line2;}";

#

i am accidently passing that with

_statements = triggerStatements _x;
_statements params ['_cond','_activ','_deactiv'];
...
                    text format["onActivation= %1;",str _activ] call KK_fnc_makeFile;

but i cant do that on demand, i.e.


    (missionNamespace getVariable ["__temp", ""]) + "\n" + str _this
red wigeon
#

hi all, when does a compileFinal stop being final?

1 - Mission End
2 - Mission Restart
3 - Server Restart
4 - A.N.Other

finite dirge
#

compileFinal where? On the server or a client?

red wigeon
#

server - dedicated

random crescent
#

Server or client doesn't make a difference.

#

If it's saved in mission namespace, that gets cleared at the end of the mission. UI namespace remains until you shut down Arma.

queen cargo
#

The short story is: They stay as long valid as the namespace it is attached to lives

finite dirge
#

Server or client doesn't make a difference.
Sure does. If the client leaves the server, the mission on the server didn't end, but the namespace should have, no?

jovial nebula
#

If anyone is interested, there's a way using .net core to create cross platform extensions(C#).
The same code can be compiled without any 'adjustments' both on linux and on windows. It can be then called as an extension from arma engine.
Here's the repo for an extension template: https://github.com/DardoTheMaster/ArmaDotNetCore

Obviously you will need to have .net core sdk in order to compile it to a shared library.

Shortly, this is a good way of doing extensions if you do want to stick with C# , but this really has no sense if you already code in c/c++

astral dawn
#

That's cool but unfortunately will be lost in this chat after a few days, consider posting it on the forum @jovial nebula

jovial nebula
#

Yeah sure just wanted to check it was actually something useful 😂

astral dawn
queen cargo
#

@astral dawn kinda feel like this only ever is useful case by case

astral dawn
#

What do you mean?

queen cargo
#

Changing it for All will just lower the fps

#

A single spawn May needs a higher count

#

Aka

#

An array variant of spawn would be more useful

still forum
#

There is only a single VM though, and the whole VM controls the time available

astral dawn
#

Isn't my suggestion is more like changing the int const vmTimeFrame_ms = 3; to a variable which can be edited through the SQF command?

still forum
#

its not a const

#

and yes, thats your suggenstion

astral dawn
#

Ok, but max value is a const I assume? It must have some threshold after all beyond which it doesn't run more per frame>

still forum
#

no

astral dawn
#

How does it work then if it's not the no more than 3ms per frame as advertised literally everywhere? 🤷

still forum
#

its a global int

#

which gets changed by the loading screen up to 50

#

and down to 3 at end of loading screen

astral dawn
#

Well ok, IIRC there might be more 'contexts' in which this is changed, like the init sequence of a mission, etc

still forum
#

no

#

do you need that for anything but serverside AI scripts?

astral dawn
#

Doesn't seem likely right now, but maybe others might need it on client 🤷
Also I'll need that for HC to be fore precise

still forum
#

just use fps unlocked binary

#

server will pump as much as it can

astral dawn
#

It's the binary made by you, no?

still forum
#

originally yeah

astral dawn
#

But now do BI make it for all versions too?

still forum
#

no

astral dawn
#

So...

still forum
#

DB does it

#

usually when I don't have time

astral dawn
#

Anyway in my tests generally FPS is below 50 although still OK, I don't think this is a viable option really

still forum
#

lowering your fps further while youre already low isn't a good idea

astral dawn
#

I knew you'd say that but still!

still forum
#

well i wish you luck getting that command

astral dawn
#

So to sum it up, do you think that it can be done, is it hard to do, and how likely anyone at BI will bother to do it?

still forum
#

sure it can be done. its easy to do.
likelyhood: 0%, its a stupid idea and gives so many people to ability to break even more crap

#

if you want I can give you a server binary with 50ms limit ¯_(ツ)_/¯

#

But I won't have the time to update it so whatever

winter rose
#

spawn without arguments would be nice (the same as call)

astral dawn
#

I would not call this stupid due to it giving ability to break crap. There are so many ways to bring FPS down already by scripting.

still forum
#

like.. ever seen a while true loop without a sleep?

#

most newbs write scheduled scripts, meaning most bad scripts, are scheduled.
But thats not a problem because thanks to the 3ms limit they can't break that much

#

now you want to give the idiots the ability to disable the 3ms limit and let everything go ham

astral dawn
#

I'd assume it to have some reasonable limits actually

still forum
#

Okey I could agree to give you a max of 15ms

#

and a min of 2

astral dawn
#

Seems to make sense 🤷

dreamy kestrel
#

is it a bug that if ... exitWith within an apply block seems to be too aggressive, IMO. in other words, exits the entire calling scope, not just the apply. In this case, however, I think we can apply the conditional transform something like this, if ... then ... else as the closing statement.

astral dawn
#

As I have observed, scheduler won't run my stupid crap for some time if FPS has been brought down by scheduled scripts low enough, but I don't have a solid evidence of that

still forum
#

correct

astral dawn
#

So it must be a bit more advanced internally

still forum
#

I wrote a blogpost about the depths of the scheduler

astral dawn
#

Never saw it, could you share?

still forum
#

@dreamy kestrel I guess so. But also exiting a "apply" is what I would consider undefined behaviour. apply applies a function to an array, and returns an array of the same size. It cannot return same size if you abort in the middle.

#

Also I don't see what the reason for an exitWith is

#

if you want to check whether array contains some element, use findIf

astral dawn
#

I've read your article, interesting. I thought that scripts suspended with waitUntil take the priority in the queue (at least on wiki it says that arma will try to evaluate my condition mostly every frame)?

still forum
#

well if there are no other scripts

#

it will check every frame

jovial nebula
#

I didn't get the point of your mention(?) @queen cargo

queen cargo
#

you may want to edit the biki page if you got something new

still forum
#

he prolly cant

jovial nebula
#

yep I don't think I can

#

and there's already C# actually

waxen tendon
#

is it possible to sync locally executed variables with global?

still forum
#

yes

#

?

waxen tendon
#

how

still forum
#

publicVariable?

waxen tendon
#

thanks

#

didnt see that, sorry

#

had a go with remoteexec, didnt work

mint kraken
#

Should I use getArray or BIS_fnc_getCfgDataArray for configs?

finite dirge
#

I would say to stick to getArray, unless you expect it to maybe be a string or something else.

mint kraken
#

Alright, thanks!

balmy birch
#

Anyone have experience with the select random script? I created a script thats meant to move an object to your or somewhere around your general area depending on a random event. I just want to know if it will work. Anyone able to take a look at it?

young current
#

sure such thing is possible

balmy birch
#

Can I send you the script then?

young current
#

no, put it into pastebin and link here.

balmy birch
young current
#

I assume you have not written this yourself?

#

@balmy birch

balmy birch
#

I wrote most of it myself based off of BI's website

#

The setPos however I did not write

#

Just edited

young current
#

so what seems to be the problem then?

balmy birch
#

I was wondering if it would work, I havn't had too much success with the randomSelect. I understand it calls for a random variable from an array but I havn't had it actually do something.

young current
#

soo you have not tested it?

balmy birch
#

Not yet. I don't want to get people together to test something just so it wouldn't work.

young current
#

xP

#

well I suppose it could work then

#

someone else might actually run that in their mind and figure out if it works

#

you should be able to run that by yourself though

#

put in some debug hints in different phases to see if they go through etc

#

you could use switch instead of the ifs though

balmy birch
#

hrmmmmm I didn't know about that command. That would make it nicer looking wouldn't it.

worn flame
#

Hello. I'm trying to run a script on a dedicated server, from a client. The script runs, but doesn;t seem to be passed any parameters. Form is:

#

{ [_veh, _calledby] execVM "hH_moveRespawn.sqf" } remoteExec ["call", 2];

balmy birch
#

Undefined variable in expression able

#

Do I need "

calm bloom
#

Hi! Any idea why this doesent work?

vehicle player addMagazineturret ['Redd_Mg3_Mag_120',[0],10];
vehicle player loadMagazine [[0],'Redd_MG3','Redd_Mg3_Mag_120']```
spice axle
#

@worn flame I'm not sure but I don't think _veh and _calledby are not defined in the called statement. You need to pass the parameter with the remoteexec too, first try to replace [_veh, _calledby] with _this. If this doesnt work try [[_veh, _calledby], "hH_moveRespawn.sqf"] remoteExec ["execVM", 2];

#

@calm bloom I'm not sure which MG3 you wanna use but i used the AI version to test and got a magazine classname of Redd_Mg3_Belt_100_ai and a weapon classname of Redd_MG3_Static_ai.

And tested

vehicle player addMagazineturret ["Redd_Mg3_Belt_100_ai", [0], 10];
vehicle player loadMagazine [[0], "Redd_MG3_Static_ai", "Redd_Mg3_Belt_100_ai"]

and this worked

calm bloom
#

Hm, interesting

#

Have your turret weapon got other magazines?

#

I was trying to make fake reload animation on turret with empty magazine

spice axle
#

For all turret magazines use magazinesAllTurrets vehicle player;
For all turret weapon names use weapons vehicle player;
For reload use reload player;

worn flame
#

@spice axle That did it, thank you.

balmy birch
#

For some reason my selectRandom script is not able to determine "Able"

#

Thats the script

ruby breach
#

"Able" != Able

balmy birch
#

So take the " " away?

ruby breach
#

If you want to select from an array of presumably undefined global variables, sure

balmy birch
#

I want them to be more local variables so that way the same variables can be used on other clients at the same time

ruby breach
#

A few things: ```1. You're missing a semicolon in the first line of your code.
2. You should read up on the difference between Local, Global, and Public Variables.
3. A switch statment would probably be a cleaner way of doing this.

dreamy kestrel
#

@still forum to be clear, I am not just exitWith {...} with no result.

#

which in an apply {} I would take to mean, one of the transformed results.

#

even if that is nil

#

that being said, was able to work around it with the verbose if .. then .. else ternary statement.

still forum
#

you could do
appply {call {if () exitWith...; other stuff}}

vernal venture
winter rose
#

what is the returned error @vernal venture ?

vernal venture
#

It said "missing ;" at the "if side" line. which is why I thought it was literally missing a semicolon.

still forum
#

Yes

spice axle
#

Inside the If statement is a code block and a code block does not return a Boolean then it is not called

still forum
#

you are literally missing a semicolon

#

line 15, missing semicolon

#

and yeahalso that wrong code block in line 4, that you will get warned about when your script first executes

#

Also you have a typo in "Initialized"

vernal venture
#

Problem solved. Thanks for the proofread.

plucky wave
#

Is it possible to remove one of an item inside a players inventory? E.g. player has 3 smokes and I want to decrease this to two?

red meadow
#

at the start of the mission or as a trigger further down the line? @plucky wave

plucky wave
#

Further down the line @red meadow

plucky wave
#

Was hoping so, just couldn't find any docco on it.

#

I'll give it a test, cheers fellas

red meadow
#

unitname removeItem "classnameofsmokes";

#

copy and paste 3 times

still forum
#

Why 3 times if he only wants to remove one?

red meadow
#

oh i misread

#

only once

errant patio
#

Is it possible to check if a building has a ladder on it?

still forum
#

check selectionNames for "ladder" maybe

errant patio
#

no dice :(

#

apparently selectionNames doesn't look at all LODs according to the wiki comment? that sucks :(

still forum
#

tru

#

but it should look at the mods that matter?

#

maybe you can try finding the buildings config class? is that a thing?

errant patio
#

first building i tried it on that has a ladder only returned doors and doorhandles

still forum
#

maybe selectionPosition with some commonly used names for ladders

errant patio
#

i'll try checking the config yeah

#

yup, looks good. Buildings have a Ladders[] property so i can just check if it's empty or not

hot kernel
#

@still forum , on the forum you mentioned binary params should be bool and not just 1/0 or some arbitrary name. Is that correct? And if so do we,

If (_binaryPARAM==true) then {//stuff};

like that or is there a different syntax?

still forum
#

if (_booleanVariable) then

#

if needs a bool, if you already have a bool, then ==true makes no sense

hot kernel
#

okay so just the boolean Variable, thanks I'll play around with that

half inlet
#

potentially stupid question - but why does:

if (true == true) then {systemChat "success!"}```
throw an error?

Error position: <== true) then {systemChat "success!"}>
Error ==: Type Bool, expected Number,String,Not a Number,Object,Side,Group,Text,Config entry,Display (dialog),Control,Network Object,Team member,Task,Location
Error in expression <if (true == true) then {systemChat "success!"}>```

#

this only just occured to me, but it looks like it's not possible to compare booleans with one another, which seems... odd?

#

disregard - apparently it's just the == and != operators that don't work; isEqualTo works fine

still forum
#

it throws an error because its nonsense

#

== true and == false are both bullsh

worn forge
#

What Dedmen is trying to say is that you can't == true, you just use this method to detect true/false
if ( myTrueVariable ) then {systemChat "success!"}

#

Or if you're looking for false,
if ( !myTrueVariable ) then {systemChat "success!"}

half inlet
#

my line of code was just an example, the actual use case was to check if two boolean variables had the same value (similar to how a XOR gate works):

if (_oldState != _curState) then {
    systemChat "Status changed";
    _oldState = _curState;
};```
#

something that wouldn't be a problem in other languages

#

but it's a moot point - I'm now using isEqualTo instead

gleaming cedar
#

How to open tailhook_door_l ?

spice axle
#

@gleaming cedar you need to explain that question to me. which door is that, a vehicle one? then you should start with animateDoor

gleaming cedar
#

@spice axle I want to open de door on the aircraft carrier

#

The thingy that opens when an airplane takes off

#

It comes off from the ground

heavy pendant
#

hello, i was hoping someone could answer a few questions about the implementation of scripts by explaining to me the process of applying a particular script. it would highlight the parts of the process that i find difficult to get started
http://www.armaholic.com/page.php?id=23967
i understand it requires three units, named something particular, but how do i link them in the code?
i know exec vm calls the script but... wheres the REST OF THE OWL
i have all the scripts in the mission directory already
like... it mentions "FO"= but where do i put that?

#

people forget what its like to not know something they became an expert in lol

fervent kettle
#

FO seems to be a guy with a laser designator: FO"=
Forward Observer: The "FO" will report all targets to the "FDC".
For best efficiency use units with Rangefinders or Laser Designators as they tend to spot more reliable.
"FO"s won't call for a fire mission if the spotted unit is closer than 250m.
If all "FO" units get killed the "FDC" won't receive anymore targets.
Since I'm on my phone I can't open the script rn but I'll have a look later

heavy pendant
#

... @fervent kettle please tell me that was sarcasm

fervent kettle
#

@heavy pendant What?

still forum
#

Copy pastingstuff from the armaholic page isn't useful at all?

heavy pendant
#

not really... i have already read that so iti snt TOO useful

fervent kettle
#

Welp then i got the question wrong

heavy pendant
#

im just trying to figure out how to go from point A to point J without skipping the letters inbetween

#

SO

#

I have THREE units

#

and some kinds of scripting that LINKS them

#

i have the knowlede of how to CALL the script but not how to IMPLEMENT it

fervent kettle
#

you put FO or whatever name you used in the script into the units variable name, do you mean that?

heavy pendant
#

no offense @fervent kettle but i have little faith you are going to be able to understand what im asking after that

fervent kettle
#

you`ve asked before where you should put FO

heavy pendant
#

ok.... lets try this another way! HOW would YOU put this in a mission?!? STEP BY STEP

#

DONT

#

SKIP

#

ANYTHING

still forum
#

I recommend you stop the allcaps and read our #rules

fervent kettle
#
  1. I copy the files from armaholic into my Arma 3-Missions folder
  2. I check how the variables are defined in the SQF files
  3. I place the units IG and give them the names I`ve defined in the SQF file (for example FO. the observer is defined as FO so i put that in the variable name in a recon)
  4. Testing and fixing
#

in the Init.sqf the first line says "null = [[Monitor1],["FO1","FO2"]] execVM "LFC\feedInit.sqf";null = [[Monitor2],["Artycam","Artycam2"]] execVM "LFC\feedInit.sqf";"
FO1 and FO2 are the observers so you put FO1 in one recon and if you want FO2 into another one

heavy pendant
#

and I make the init.sqf myself?

fervent kettle
#

no it is in the ZIP file you downloaded from armaholic

#

you can find it in the Altis demo mission folder

heavy pendant
#

naw dude thats what is causing the confusion i think

#

it doesnt come with that, i have to make my own

fervent kettle
#

welp for me it came with it so i wonder why you dont have it

heavy pendant
#

i just downloaded it again... no init.sqf

fervent kettle
#

you go into the GOM_FSS_DemoV103.Altis folder

heavy pendant
#

lots of "GOM_FSS_xxxx" stuff

#

oh....

#

hold on let me sdee how stupid i am give me a second

fervent kettle
#

if you unzip you get 2 folder and 1 .pbo

heavy pendant
#

yeah i didnt see that ... sorry for being an ass

#

so how do i use thias?

fervent kettle
#

as mentioned above: copy the Init.sqf from the demo mission into your own one and the contents from GOM_FSS also

#

you can then delete the lines 2-9 from the init .sqf since its just text from the author you probaply dont want in your mission

heavy pendant
#

and all i have to do to use it is name units the right thing, have files in the imssion directory, and have that line in the init.sqf?

fervent kettle
#

very simplified, but yes

heavy pendant
#

yeah i was losing my mind because i couldnt see tht file lol

#

i made an empty init.sqf and forgot and thought the one in the archive was empty

#

thank you

fervent kettle
#

np

heavy pendant
#

i am going to find this dude and have them add at least that because this script is somerthing new people are going to see quickly lol

#

id like the ability to stop the arty by shooting ONE GUY

still forum
#

You can find him on BI Forums, hes active every day

heavy pendant
#

holy crap the spotter was near the spawn

#

it works!

smoky verge
#

does player hasWeapon work in multiplayer?

still forum
#

yes

smoky verge
#

thanks

winter rose
smoky verge
#

yeah I'm on that page but honestly does it say it anywhere?

#

wanted to check there before asking but in the Multiplayer part it just says " - "

still forum
#

I constantly forget that there is a "Multiplayer" part under additional info

#

I have never seen anything written there

smoky verge
#

I guess its just used for stuff that work differently in mp

still forum
#

which is usually written in the notes or description

smoky verge
#

indeed
well, thanks for the rapid answer anyway

winter rose
#

@smoky verge Argument Global, so yes

#

I have never seen anything written there
I have; I was there, Gandalf! 3000 years ago

heavy pendant
#

private ["_whatever"] is how you get objects from a higher scope into your script as a local variable right? so its like the command line argument variable?

winter rose
#

params*

heavy pendant
#

so when you call null = [[varA],["var1"]] execVM "xxxxxx.sqf"; it feeds varA and var1 to xxxxx.sqf as private ["_asdf", "_qwer"] ?

ruby breach
#

^ Private array is bad, and anyone who uses it should feel bad

heavy pendant
#

context and circumstance defines tyhe usage of all code

ruby breach
#

Nah, private array is just bad

winter rose
#

@heavy pendant params , not private

ruby breach
#

But you want Params

heavy pendant
#

so is my c++

#

yes i do

#

i dont wanna rewritye this whole script mod lol

ruby breach
#
["one","two"] call fn_someFunc

//fn_someFunc
params ["_one","_two"];
heavy pendant
#

sigh the higher complexity is nice but I miss modding homeworld 2 with lua lol

ruby breach
#

I mean, you could always go full Arma 2 and just use = _this select # for however many lines. 😅

spice axle
#

No don't do this please, use params

heavy pendant
#

BUT... private accomplishes that same thing as params? because I need to know that before I go changing this and forgetting I changed it and confuse myself again lol

ruby breach
#

No

#

Private just says "this is a private local variable", it assigns no value

#

Params makes a variable private and assigns it a value from _this (or whatever you want if you use a left argument)

heavy pendant
#

this working script does not have "params" and is receiving params... how is this?

#

oh _tjhis is array?

#

_this

ruby breach
#

It's a magic variable, which is an array of all things passed to the function, yes

#

Well, not necessarily an array

heavy pendant
#

so when calling with execvm it magically passes the params as an array named _this ?

spice axle
#

yes

heavy pendant
#

or "not-an-array" array

#

neato

spice axle
#

all parameters are passed to the function with the magic variable _this

ruby breach
#

If you pass multiple parameters, _this is an array. If you pass a single parameter, _this is just whatever that was

heavy pendant
#

so when is params needed? to reassign as local? why not use private only then?

ruby breach
#
[1,2] call {_this}; //[1,2]
1 call {_this}; //1
spice axle
#

because you can define default values then the parameter is not passed, define allowed data types or filter the array or single value problem

heavy pendant
#

ohhh for better context

ruby breach
#

Also because it's significantly faster from a performance standpoint

spice axle
#

Like

1 call abc_fnc_abc;

// inside abc_fnc_abc
_this // 1
[1] call abc_fnc_abc;

// inside abc_fnc_abc
_this // [1]

but

1 call abc_fnc_abc;

// inside abc_fnc_abc
params ["_number"];
_number // 1
[1] call abc_fnc_abc;

// inside abc_fnc_abc
params ["_number"];
_number // 1
#

you see the difference?

ruby breach
#
[1,2,3,4,5] call someFunc;

//This is good
params ["_one","_two","_three","_four","_five"];

//This is bad for the same result
private _one = _this select 0;
private _two = _this select 1;
private _three = _this select 2;
private _four = _this select 3;
private _five = _this select 4;
heavy pendant
#

so im seeing this script can be really streamlined right from that alone

ruby breach
#

As for private array being bad, use private as a keyword instead, it's faster even if it doesn't look like it

#

But params makes variables private by default, which is another reason it's good

spice axle
#

You see the difference here?

[1,2,3] call abc_fnc_abc;

// inside abc_fnc_abc
params ["_one","_two","_three"];
_one; // 1
_two; // 2
_three; // 3
call abc_fnc_abc;

// inside abc_fnc_abc
params [
    ["_one", 1],
    ["_two", 2],
    ["_three", 3]
];
_one; // 1
_two; // 2
_three; // 3
heavy pendant
#

i hate how even though i can read it all its stil gonna take a month to learn it

ruby breach
#

And chances are that if your script is old enough that it's not using params, it's going to be running much slower than it probably should be because of other reasons

heavy pendant
#

like... thats not how language is supposed to work right?

#

yeah 2014

ruby breach
#

I wouldn't know; I'm an accountant not a programmer. I only know sqf 😅

spice axle
#

to achieve the same result as params you have to do

private "_one";
if (_this isEqualType []) then {
    if (isNil {_this select 0}) then {
        _one = myDefaultValue;
    } else {
        _one = _this select 0;
    };    
} else {
    if (isNil "_this") then {
        _one = myDefaultValue;
    } else {
        _one = _this;
    }; 
};
heavy pendant
#

usually, competant programmers can read other languages pretty well when they get familiar with several languages

winter rose
#

brainfuck would be exception 😄

#

(LOLCAT is EZ)

heavy pendant
#

oh no, he mentioned it...

#

hahaha yeah lolcat is old now

#

well i guess this is the first .sqf batch going to my github rofl

#

to be never finished

#

how do i do code tags?

spice axle
#

on github?

heavy pendant
#

no in discord

#

i wanna show how this dude starts his ascripts

ruby breach
#

you can type sqf after them for syntax highlighting, but encase your code in three tilde's top and bottom ```sqf

spice axle
#

```sqf
your code
```

heavy pendant
#

private ["_getrndreloadtime","_FDC","_grouptype","_radiochatter","_debug", "AND_SO_ON"];

_getrndreloadtime = 6;
_FDC                 = _this select 0;
_grouptype             = _this select 1;
_radiochatter         = _this select 2;
_artyready                 = _this select 3;
_debug                 = _this select 4;
_rnds         = 4;
spice axle
#

yes right format but false code

ruby breach
#

Looks about like most things that exist for Arma

heavy pendant
#

why no best practices ;_;

#

at least line up the text for readability

#

"=" at the same column position

ruby breach
#

Combination of poorly informed "coders", and an ever changing codebase.

#

The fact that findIf wasn't a thing years ago still baffles me

heavy pendant
#

well to be fair you need newbies for innovation

#

and bad language is "challenging"

#

that last one was sarcasm lol

ruby breach
#

Any errors or ambiguously worded explanations are solely Lou's fault and responsibility. :p

heavy pendant
#

when calling a script with execvm, does the compiler allow you to specify which variable you are assigning? EG.

#
null = [ _asdf = [Monitor1], _qwer = ["FO1"]] execVM "GOM_FSS_FO.sqf";
worn forge
#

I don't think this will work:
private "_one";
I think it would need to be
private ["_one"];

exotic flax
#

either use
private _one;

ruby breach
exotic flax
#

or
private ["_one"];

ruby breach
#

private string works

#

It's just not the way you should ideally be using it

exotic flax
#

wait... the wiki ways that private "_varname"; also works...

worn forge
#

Personally I don't understand the hate on the private [] command, as it's useful to declare at the beginning so you can keep track of what you'll use. Also if I'm going to assign a value to a local variable later on with an if statement or the like, I'm not going to waste time assigning it some nonsense variable

ruby breach
#

It's the fact that between params and private keyword, there's much better ways of doing that same thing

worn forge
#

You don't strictly need private to assign a value, you can just do
_value = "1";
which is the same as
private _value = "1";

ruby breach
#

Second is faster

worn forge
#

Well I do have to type in six whole characters, which isn't faster for me 😛

#

Seven, if you count the space

heavy pendant
#
_arti = vehicle _leader;
#

vehicle is a keyword there right? its a group name?

exotic flax
#

defining privates beforehand is slower than setting each variable private on its own, but when a lot of variables need to be set private it will be slightly faster

worn forge
#

That code optimization for private looks like if you're assigning many variables ... yeah that

heavy pendant
#

yall are like, super awesome helpful. I like this place.

worn forge
#

But for just a single variable I doubt there's a significant difference

heavy pendant
#

It's like old school IRC

worn forge
#

ICQ 😛

winter rose
#

@worn forge use private, unless you want to take the risk of overriding a previously defined variable of the same name

worn forge
#

I do use private, mostly for personal sanity

winter rose
#

I don't think this will work:
private "_one";
I think it would need to be
private ["_one"];

it is not a matter of belief, it is a matter of wiki 😛

worn forge
#

The fact that it has a code optimization benefit was previously unknown to me, so win x2 😛

heavy pendant
#

lol it depends onwhat you are doing, you should always go for performance and readability unless the context calls for deviation

worn forge
#

Well, when I say "think" it's because I haven't personally tested it, but I seem to recall getting an error when I did that by accident once.

#

I'd be curious what the private command is actually doing, because it's clearly populating a value of some kind into the variable, enough so it's not nil

winter rose
#

readability > performance

worn forge
#

@winter rose I tend to agree

heavy pendant
#

better to overbuild than over engineer, you dont have to be afraid of lots of text if its formatted well

winter rose
#

I would know, I wrote the page

ruby breach
#

Like I said, any Biki issues are your fault lol

heavy pendant
#

well i meant dont use things obviously unperformant because its easier to implement

winter rose
#

(re wrote it hehe 😄)

#

@ruby breach …can I put a retirement notice? 😛

still forum
#

@exotic flax private _one; thats bullsh. you are calling private command, on a undefined variable.
@worn forge

But for just a single variable I doubt there's a significant difference
for a single variable the difference in % is the same as for a hundred variables.

ruby breach
#

Just fully expect that when you post questions here asking how to make it work, you'll get advice on all 3 steps at once

worn forge
#

The only thing I would say is that understanding good patterns in advance will save you a lot of time reworking for optimization later

exotic flax
#

@still forum I know, it only works when setting the variable. Although reading wiki can help

still forum
#

What you mean is private keyword

worn forge
#

@still forum I think the point I was trying to make is that yes, there is a quantifiable performance benefit, but if you are shaving 0.0004ms off the execution time because you defined a single variable with the private function, you won't be throwing a party for yourself

still forum
#

its a "modifier" for = operator.
without = that makes no sense

exotic flax
#

but shaving of 1000000 x 0.0004ms because it's in a loop does help, especially when you have a lot of variables

worn forge
#

.... yeeeeeeeesss, that's what I previously agreed to, I am talking about a single variable

still forum
#

in a loop it might be more efficient to just move the variable into the scope outside the loop

#

Problem is private array, private array ALWAYS makes stuff slower, instead of faster

#

even with a single variable

ruby breach
#

That kind of performance gain may also be more useful in something that's executing rapidly (onEachFrame, for example)

still forum
#

thats why its bad practice and everyone doing that deserves to be called stupid or unwilling to improve on their coding ability

worn forge
#

Well, we're lively in here today.

#

A couple of obvious observations.

  1. If you're defining 100,000 variables, you have bigger problems than use of the private function.
  2. If you're defining private variables in a scope that's repeated often (onEachFrame) there's probably a better way to do it like a global variable.
#

I for one will be happy to say that I learned something today.

heavy pendant
#

well , im going to make this my personal project because its really neat to have a fire support system that uses observers and relays insterad of spawning shells

#

theres ALiVE for the player side but nothing for the OPFOR

still forum
#

there's probably a better way to do it like a global variable.
global variables are WAY slower than local variables

#

A simple
private _myVar = MyVar
and then using _myVar will make your code faster

#

Sorry that some of us work on mods (ACE,CBA,TFAR,ZEN,ACRE) where such performance does really matter.

jaunty ravine
#

Quick question, how do I run a script only if a variable name does not exist?

spice axle
#

isNil "_myVariable" // returns either true or false

jaunty ravine
#

Thank you, @spice axle.

#

Forgot the quotes.

heavy pendant
#

lol vcomAI mod does what i want and more

dim owl
#

Hi guys, so I'm trying to create a fire extinguisher with some particles. However the particles won't change their angle.
Here is my code:

extinguisher = "Land_FireExtinguisher_F" createVehicle [0, 0, 0];
extinguisher attachTo [player, [0, 0, -0.2], "RightHand"];
extinguisher setDir 90;

extinguisherSource = '#particlesource' createVehicle (getPos extinguisher);
extinguisherSource setParticleParams [["\A3\data_f\Cl_water", 1, 0, 1], "", "Billboard", 0.1, 1, [0, 0, 0], [0, 5, 2], 0, 10, 1, 0.075, [0.3, 2, 4], [[1, 1, 1, 1], [1, 1, 1, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", extinguisher];
extinguisherSource setDropInterval 0.05;
#

Any ideas on that problem? I can't seem to fix it.

spice axle
#

You should check to set the angle of the particle not the source

#

but no 100% sure

dim owl
#

I've checked the directions and both, the player and the particlesource directions, are the same

spice axle
#

but you need to set the direction of the particle not the source

dim owl
#

oh okay now I get it

worn forge
#

@heavy pendant vcom AI is great, but it's resource intensive. On our 60-player server running I&A it took the client's FPS down to a crawl. On a smaller op with about 20-30 clients and far fewer enemy units it wasn't as strong a performance hit. So it really depends on your use

gleaming cedar
#

How to open tailhook_door_l

dim owl
#

Can someone explain why the angle parameter on setParticleParams does not work? At least in my code above. I don't understand how I should set the dir of the particle in any other way.

ruby breach
#

probably, anyway

exotic tinsel
#

anyone know a way to make ai not target a player other than setcaptive true. when i use setcaptive true then players side changes to civilian.

digital hollow
#

disableAI

exotic tinsel
#

i wrote a custom incapacitated script and the last piece is to get ai to stop shooting the player when incapacitated but i dont want to set the player to captive.

worn forge
#

Why don't you want to set the player to captive? Ie., why do you need them to retain their side

hallow mortar
#

Does setCuratorCameraAreaCeiling use a height ASL/AGL, or relative to the position of the camera area?

winter rose
#

I would say AGL, but I don't know for sure (the wiki is blank about it)

hallow mortar
#

time for science I guess

winter rose
#

tell me the result of your experiment so I can enrich the wiki 😉

hallow mortar
#

it's AGL

#

irritating for my purposes but makes sense

winter rose
#

so ATL above ground and ASL above water?

worn forge
winter rose
#

wut?

hallow mortar
#

interestingly it still seems to be AGL over water

winter rose
#

hm, so ATL then

#

wiki updated, thank you @hallow mortar

heavy pendant
#

@worn forge i plan to make missions for small 1-6 person teams with a zeus

#

the zeus can play alongside lol

worn forge
#

Then Vcom's gonna be great for you 🙂

heavy pendant
#

haha yeah, I hate PvP. PvE is more relaxing considering my mental issues rofl

#

i like to think i can add a TON if resource hogging stuff if I keep the player base small also

errant patio
#

What's the best way to make a simple variable final? Obviously you can use compileFinal but then you have to use call every time you want the value - is that the only way?

still forum
#

@errant patio yes thats the only way currently

errant patio
#

ah well, it could be worse. ¯_(ツ)_/¯

void delta
#

Is there a script to turn off auto contrast on thermal imagers? Real IR sensors can perform a Non Uniform Correction to adjust for changes in ambient temperature. It’s frustrating to see individuals as bright spots and having a completely washed out terrain/buildings.

winter rose
#

@errant patio see Code Optimisation for "constants" through Description.ext

#

Not ideal, but another way too

#

@void delta nope

#

Try maybe setApertureNew

void delta
#

I'll give that a shot. Thank you.

void delta
#

@winter rose Where do I need to put that script to get it to change anything?

plucky wave
#

Anyone got an example of a working addAction using BIS_fnc_MP?

winter rose
#

@void delta you would have to detect when your camera is in thermal mode, then use this

void delta
#

I'm pretty new to scripting. Do you know how to detect when in thermal mode?

#

I appreciate all the help

winter rose
#

check camera mode, on wiki (I am on mobile rn)

fervent kettle
winter rose
#

Yep, there is no "camUseTI", only camUseNVG

fervent kettle
#

But you can use a number to set the state of the nvg

void delta
#

I appreciate the help

plucky wave
#

Quick one, may be the wrong place to ask but does anyone know the locality of ace actions? If you add an ace action to an object does this need to be run once server side or per client on client side?

astral dawn
#

Can't tell you but if in doubt, it's useful to check their source code

worn forge
#

Trap been a while since I used ace but I think ace actions are client side

vernal venture
#

Is there a trick to using removeAction that I'm missing?

this removeAction 0;},0,0,true,false,"","_this == IDAPMedic"];```
winter rose
#

every action added increases action id

plucky wave
#

change:

this removeAction 0;

To:

(_this select 0) removeAction (_this select 2);
vernal venture
#

Aha

worn forge
#

Trap:Anyone got an example of a working addAction using BIS_fnc_MP?
That's an old implementation for multiplayer, use remoteExec or remoteExecCall instead. For what you're asking:
[player, ["<t color='#FF0000'>This Useless Action Is RED</t>", {hint "RED"}]] remoteExecCall ["addAction", 2]
adds the action to all players and not the server.

spice axle
#

@plucky wave ace actions are local

plucky wave
#

@worn forge & @spice axle Thanks for confirming. Did some further testing and can confirm, they're local. Which is unfortunate

worn forge
#

Just use remoteExecCall to push them to clients as you need

spice axle
#

It’s really simple to add them locally forEach one, but remove it for everyone expect one

worn forge
#

Or if it's on a mission-placed object, you put the code in the init segment

spice axle
#

No don’t do that pls

worn forge
#

😛

spice axle
#

Use the initPlayerLocal.sqf

worn forge
#

Obviously depends on your level of scripting and intended use, using init is an acceptable solution

plucky wave
#

Implemented with CBA event handlers

spice axle
#

But a really bad for, especially for actions like ace actions or bi actions.
What? I didn’t expect that, what have you done?
You will run into problems very soon when you use the init of objects, creating a txt file and rename it is quiet simple

worn forge
#

But a really bad for, especially for actions like ace actions or bi actions.
Why?

plucky wave
#

What? I didn’t expect that, what have you done?
Was this aimed at me?

spice axle
#

Because you need to filter the join in progress. All inits are global and will get executed for everyone, everytime.

#

Yes

plucky wave
#

Got an extended init EH for vehicles that spawns a function, function checks if vehicle is west, applies ACE interaction to it

spice axle
#

You can add ace interaction to vehicle classes, so you don’t need to manually add them every time

worn forge
#

Fair enough, and I do recall dealing with that in the past. Personally I set everything up using onPlayerRespawn.sqf (following a removeAllActions call so the player's a blank slate)

spice axle
#

Yes of course there are several ways to do this kinda simple thing, but there are bad, good and better ways, you need to choose

worn forge
#

I suppose you could do:
if ( local this ) then { this addAction ... };
in the init field

spice axle
#

Yes of course, but you need to check the skill of the asking one if he is able to add this and understand or not

plucky wave
#

@spice axle Eh, don't have specific classes though

spice axle
#

Ah ok

gleaming cedar
#

How to make ai plane go full throtle and stay full throtle

fervent kettle
#

I think way points do a good job

dreamy kestrel
#

Q: when you setup a MP mission, how do you set the group names and have them stick? Setting the call signs in editor does not seem to stick.

still forum
#

CBA can do that

#

it has a feature where you set the description to something specific, and itll stick into slot selection

dreamy kestrel
#

@still forum thanks, brilliant that works. although I'm not sure why the Callsign is not honored in the first place without a kludge like this being necessary. thanks, though.

#

follow on question, how to ensure the order of the groups? is that mission file order? so we need to delete, copy/paste, etc?

still forum
#

its order of how they were placed in 3DEN

#

cba has a UI editor coming up to change that order. But its still WIP

quasi gyro
#

what does the # in _lootholder = _this # 1; mean

#

never seen it before

still forum
#

Its a semi-alias for

exotic flax
#

it's the same as
_lootholder = _this select 1;

quasi gyro
#

thanks

still forum
#

it doesn't support all of selects abilities. It only does select element at index from array

mild pumice
#
hint ((50000000 - 10) toFixed 0)

prints 49999992 , wtf

still forum
#

Welcome to floating point precision

mild pumice
#

so there is no way to have an exact result ?

finite dirge
#

Use a smaller number. ABlobHaha

plain current
#

how to callExtension callback in c#?

still forum
#

same way as you call any unmanaged c++ function by pointer

#

I don't know how, but I know google knows

tough abyss
plain current
#

@tough abyss i already use the dllexport package and decorator to do my extensions, but i wasn't sure the function pointers work

tough abyss
#

i think they do, i dont have the source of my discord bot on hand but i didn't have implmentation issues with it while making it

plain current
#

i was thinking of using the unsafe keyword and just yoinking the shit out of the wiki? i might just as well write it in cpp

tough abyss
#

i think i used unsafe

plain current
#

it'd be nice to have a cs reference just in case, tho even if i got a cs version working i couldn't post it on the wiki pepe

tough abyss
#

although yes, C++ is a better solution to this

wispy cave
#

Is it possible to disable the sirene on ambulances?

worn forge
#

deleteVehicle ambulance

#

😛

dusk sage
#

@plain current Marshal the (function) ptr into a delegate

heavy pendant
#

does the arma 3 interpreter/compiler support multi-line statments? e.g. an array with many many variables having each variable on its own newline for improved readability?

astral dawn
#

yes

heavy pendant
#

so i just add a newline and nothing special? no delimiter?

#

thank you for answering btw

exotic flax
#

with the exception of macro's, but that's another story 😉

finite dirge
#

so i just add a newline and nothing special? no delimiter?
Correct.

#
private _myArray = [
    "one",
    "twelve"
];
unborn ether
#
diag_log ("blahblah" serverCommand '#exec users');
3:10:59 true
3:10:59 Failed attempt to execute serverCommand '#exec users' by server.

Huh? Password wrong but serverCommand goes true?

finite dirge
#

Return Value: Boolean - always true for some reason (since A3 v1.39 also false if a non valid command is used ("#blah"))

#

Maybe that extends to the password now too bcaWhat4Hmm

heavy pendant
#

i should have asked tyhis yesterday lol, does that multi line statment also work for if statments? i dont wanna refactor all my script, reload the game, and find out i have to undo it lol

#

cause I have an if conditional with like, 20 required booleans

#

and the rest are getting up there with thwe more small ideas i add

still forum
#

SQF doesn't care about line breaks

#

you can write all your code in one line, same as you can write it in 2000 lines

astral dawn
#

You can use SQF-VM for simple compilation-level checks like that for your code

#

If it doesn't complain, then arma won't complain either

heavy pendant
#

ohhhh thank you for the heads up @astral dawn and @still forum

queen cargo
#

@mild pumice what you need that precision for?

spark turret
#

hey can someone point me in the right direction for creating reusable global functions in sqf?

still forum
#

MyFunction = {< code here>}
done?

spark turret
#

you can write all your code in one line, same as you can write it in 2000 lines
if i see anyone doing a one line script, ill whoop their ass

wispy cave
#

I got a small issue with CfgRespawnInventory, I'm getting the following error: 17:29:26 [weapon hgun_P07_F]: item[optic_Hamr] does not match to this weapon!. This is what I have in weapons and linkeditems:

            "Throw","Put",
            "arifle_MX_GL_Black_F",
            "Binocular",
            "hgun_P07_F"
        };
linkeditems[] = { "H_HelmetB_light", 
"V_PlateCarrier1_rgr", 
"optic_Hamr", 
"ItemMap", 
"ItemCompass", 
"ItemWatch", 
"TFAR_anprc152", 
"ItemGPS", 
"NVGoggles" };

Anyone know how to fix it?

spark turret
#

well dedmen i thought more about a website with documentation or sth

wispy cave
still forum
#

not sure what you mean

spark turret
#

ALright, read up on fucntions.
Now, if i do

_value= [_x,_y] execVM "folderetc\myScript.sqf"

//myscript.sqf:
_x = _this select 0;
_y = _this select 1;
_returnVal = _x + _y;
_returnVal

will _value == _returnVal?
i saw it like that on the wiki, is the last line value always passed in return after exectuing the script?

still forum
#

@wispy cave well is that item compatible with the weapon? or is it supposed to go on main weap?

#

@spark turret yes

#

the last value that was left over, will be returned

wispy cave
#

it's the RCO, it's supposed to go on the main weapon, not the handgun

spark turret
#

now thats milestone knowledge. good bye extensive global values

#

thanks dedmen

still forum
#

you could also do _x + _y;
then the result of the call to the + script command, will be the last value left over, and be returned

#

@wispy cave random idea, try to swap the order of the weapons in the weapons array

#

such that main weapon comes below handgun

wispy cave
#

I'll give it a shot

queen cargo
#

@spark turret you May want to download sqf-vm for Quick testing or head over to the discord for testing it https://discord.gg/eP4QgTr

spark turret
#

oh nice

queen cargo
#

Alt, run arma and test it there in the debug console

spark turret
#

is that an alternative to ingame testing?

#

bc ingame testing is awful and takes ages.

queen cargo
#

Yup
Though, no full Support of every command

spark turret
#

got a list of supported or unsupported comands?

#

also, is it able to mimic multiplayer dedicated server?

#

bc thats the biggest cancer. having to upload testmissions to a ded. server and get multiple people to test out

queen cargo
#

It is only Supporting a basic Set of commands currently
More on the sqfvm discord (as that does not belong here)

wispy cave
#

yea, that fixed it @still forum , no idea why

astral dawn
#

@spark turret Launch two arma clients with different profiles (can easily organize it through launcher), one can host a server, another can join the server. And you have good test environment.

#

With access to variables through the console, plus fast restarts

spark turret
#

good idea, stealing taht

potent depot
#

Hello everyone, got a interesting dilemma that falls under multiple channels so ima put it here. Im trying to create a spawner that is able to be placed by both editor and zeus as a object. This being said, I want to have it be a set of objects that are placed together and tied together. Essentially, i need a podium + the spawner location(a grass cutter) to be placed whenever the zeus spawns the podium(new one added via config) and then for the two to connect to each other(probably via a setvariable on the podium used by the action added via config). Anyways, in short is there any way to make it so that spawning a object via zeus of editor will spawn two objects and also if its possible to have both objects show as a preview while spawning?

still forum
#

If you have CBA you can add a "init" XEH, on your podium, such that when a podium is spawned, that script runs, and then you spawn the other part via script

velvet merlin
#

is there a marker creation limit?

spark turret
#

hey is there a way to truely attach a marker to an object?
with something similar as attachTo, without having a setpos getpos loop

#

kju, i have created up to 10000 markers on a map in the past, no problems

#

@velvet merlin

velvet merlin
#

copy

digital hollow
#

Isn't attach to also essentially just omeachframe setpos? That's why if you chain then a few object they'll delay

spark turret
#

likely, i just dont wanna write the loop myself

still forum
#

Isn't attach to also essentially just omeachframe setpos?
not really.

#

Same as moving a pencil is essentially the same as disassembling it into molecules, and then rebuilding it elsewhere

astral dawn
#

@spark turret no way to attach it AFAIK

spark turret
#

shame.

astral dawn
#

Just make a loop for all markers you have created

#

And it would iterate them all once in <what interval you need>

#

Could have an array like [object, markerName]

spark turret
#

yeah did that. any way to check if a marker still exists, so the loop stops when the marker is deleted without error?

#

i have

//mom script
        [_tpMarker,_object] execVM "IRON\teleporter\markerPos.sqf";
//child script
    params ["_marker","_object"];
while {true} do {
    sleep 1;
    _marker setMarkerPos getpos _object;
}
#

does "isNull" work for markers?

#

apparently not, throws an error bc it doesnt want a string

winter rose
#

@spark turret markerPos , check if [0,0,0]

still forum
#

don't spawn a new script for every marker

#

have a single spawned script, that takes care of all markers

spark turret
#

that makes sense.

spark turret
#

alright, working fine so far. a bit worried that i might clog up the server but since its a teleportation script i dont expect to have mroe than 10 markers

astral dawn
#

Markers are for players. Therefore you could run your script on each client instead.

#

You can create local markers @spark turret

spark turret
#

yeah i know but i dont see a point why i should run it on each client. very prone to mistakes made by me

#

interesting fact: if you do "_marker setmarkerpos getpos _object" on an object that is deleted, the marker goes away. not sure if to 000 or deleted too

#

it does not throw an error.

astral dawn
#

because getPos of objNull most likely returns [0, 0, 0]

#

So marker most likely goes there

#

Did you look at the map edge?

spark turret
#

no, i made an extra condition, deleting the marker if object isnull or posmarker isequalto 000

#

is there a way to add code to the "onrespawn init" of a player via script?
i have educator players with a marker and i delete the marker if they respawn (or die) and if they respawn i want them to get a new marker.

finite jackal
#

There is a respawn Event Handler @spark turret

spark turret
#

ah completly forgot about that. that works too thanks

#

will use that too for assigning custom gear on respawn as well. since arma likes to sometimes ignore my onplayerrespawn.sqf.

#

i had players respawn in vanilla gear in a soviet-afghan 1980 mission. really annyoing.

#

how do i select the player that controles the unit? for the EH i also need to get the players new unit after respawn

potent depot
#

@still forum wanted to see if there was an alternative. Will this work in eden though?

still forum
#

XEH should work in 3den too

potent depot
#

k, wasnt sure if it did. really havent used xeh on objects yet.

grizzled spindle
#

Not sure if this is more related to server setup or scripting but.... Is there a way to disable explosions?

spark turret
#

like, all explosions?

grizzled spindle
#

Yeah

young current
#

not without tampering with the game files and making a config patch addon.

#

would also make you unable to join most of the servers

grizzled spindle
#

Well its serverside I want to put it @young current

young current
#

thats not possible

#

the effects are local

#

read from your local files

#

like Blastcore for example

#

at least thats my impression on the matter

spark turret
#

i guess if you disable vehicles cookoff and ammo explosion as well as not giving otu grenades or anything explosve, its hard to trigger one

#

@wraith cloud notManhattan?

grizzled spindle
#

@wraith cloud No lol, whos that? Was just something that came up in a conversation with a friend

spark turret
#

that guy? notmanhattan
#5691

#

lol it would be hilarious if its the manhattan i posted here. bc hes known for cheesing and cheating in a completly different game i also tend to play

grizzled spindle
#

Oh lol, didnt even realise. I dont really deal much with the players anymore, I more just code because I enjoy it. So people joining and leaving I dont really see haha

young current
#

whats the purpose of removing the effects?

#

It is quite a lot of work so I wonder is it worth it

spark turret
#

also quite wierd trying to disable explosions on a mil sim game

grizzled spindle
#

Your probably right, it wont be worth it. It was more to help with FPS But didnt realise it was clientsided. So it wont affect performance anyways

young current
#

It migth but it will make the game look a lot worse

spark turret
#

you can force graphic settings with ACE to affect performance. also theres better ways to do that

grizzled spindle
#

Well thanks for the input 🙂

spark turret
#

i remeber there was a way to force players to respawn first after joining, but i cant find it in the editor settings?

spark turret
spark turret
#

just so i get that right: variables stored in missionnamespace are updated on the client they are changed on but not broadcasting their changes automatically?

still forum
#

yes

plucky wave
#

Question about addAction and remoteExec. On init, I'm adding an action to an object without remoteExec. When the action is selected, I remote exec (-2) to removeAction from all clients. However, when I try to add the action back using remoteExec I get issues.

When I try an addAction with remoteExec of -2 I get duplicates of the action (one per player in the game). When I try using 2, I don't get an action at all.

heavy pendant
#

how do i do that map reload type thing where pretty much the whole scene changes to advance the story. like, AI placment and modules and props all change. Is it simply a completley new map or is there a script creating and destroying these things on the fly?

astral dawn
#

createVehicle/createUnit/deleteVehicle ?

#

That's how you create vehicles and AIs and destroy them 🤷

#

Or you probably want to change them from some preset?

smoky verge
#

do variable names that go with X_1 X_2 X_3
get the same results when called?

heavy pendant
#

@astral dawn im looking for advice on how they built the missions i guess. I was wondering if they had a seperate map creation for each major stage of a mission or were whole missions built in one mololithic scripted patchwork

#

or does it even matter?

astral dawn
#

Hmm... when depends on how huge your scenario is!

#

For more open world scenario, it would be wise to divide the map into areas and for instance disable simulations of objects when player is not in this area, or do similar things

heavy pendant
#

yes that would be the limiting factor i supopose. im all for pve with small groups so it could get HUGE if we want to command armies against each other

astral dawn
#

Well then you would even need to spawn/despawn units I suppose, this is a very hard task (I'm on it now and it IS very hard for armies). ALIVE mod should be solving this problem.

heavy pendant
#

yes, im using alive

#

its a very good mod lol

astral dawn
#

Ah, ok, doesn't it solve it then?

#

I thought it does dynamic despawning and stuff

heavy pendant
#

i was typing out what im trying to do and solved it in my head, create and destroy keywords should do just what i need thank you for mentioning them

#

im doing a SF map on livonia so ALiVE doesnt work too well there

astral dawn
#

Why?

#

Also what is SF?

heavy pendant
#

it hasnt been indexed properly yet

#

special forces

astral dawn
#

oh ok, interesting, don't they have tools for automated indexing (also what does their indexing do?)

heavy pendant
#

platyers are special forces in a small heli avoiding AA and doing nasty stuff in the dark

#

indexing i assume generates a "map" of sorts in a data form that can be used as a generic programmatic map of an in game area

#

something for AI to use, optherwise they think stuff isnt there

#

i tried to use the indexing tool on livonia and my game hung up

autumn nexus
#

Hey, would anyone be able to help me figure out how to add an addAction to all objects of the same type?

#

I want to make all bunk beds call ACE Advanced medical self heal

wispy cave
autumn nexus
#

Thanks @wispy cave

spark turret
#

@autumn nexus i advise using the ace add action instead of vanilla one. prettier to use and also comes with a "addactionto classe" function so no foreach loop needed

#

first you create the action and then add that action to the class of objects.

autumn nexus
#

Ok thank you

spark turret
#

ugh multiplayer scripting is the bane of my sanity

still forum
#

@smoky verge don't understand question

smoky verge
#

if I place 3 units
and write in their variables
"man_1"
"man_2"
"man_3"
and on a trigger I start an animation for "man"
will the animation play for all 3?
normally I'd say no
but a similar thing happened to me last night and I got curious

young current
#

no it should not

still forum
#

no

#

how would it know what "man" you mean

spark turret
#

you can use a script to select all units containing the word "man" but it doenst do that automatically.

#

iirc something along the lines of ```sqf
{
if ("man" in (str _x) then {_x execVM "specialscriptforManunits.sqf";}
}foreach allunits;

very performance heavy tho bc it checks all units.
gets even worse with allmissionobjects
smoky verge
#

yeah
weird,
last night one of the units in my mission was supposed to have an animation, but all of its copies had the animation aswell
but now that I tried it again it doesnt replicate
thanks for the answers anyway

spark turret
#

hey, how do i attach a variable to an object and have it local to a specific client?

spice axle
#

You wanna have a local saved variable or a variable on a object local to the player?

spark turret
#

i want to have a variable that is different for each object and each player. its used for actions added to the objects and since actions are local, the variable containing a list of these actions needs to be local too

#

the object is serverside, but sometimes also a player.

#

i use _object setVariable ["name",[array],clientowner]

#

run locally from all clients.

still forum
#

if you run it locally

#

you don't need to set clientowner

#

that is only for sending the variable tot he server and other players

spark turret
#

okay. any chance that:

 _object setVariable ["name",[array]]
``` is public by default?
#

bc that would explain my problem

still forum
#

no

spark turret
#

alright, ill try again with _object setVariable ["name",[array],false] and see if that fixes it. not quite sure whats wrong in my script

still forum
#

,false
that does absolutely nothing

worn forge
#

[_object, ["name", [array]] remoteExecCall ["setVariable", client] ?

still forum
#

the script is running locally on the client anyway. so you don't have to do anything special

#

maybe explain what you are really doing and what your problem is.

tough abyss
#

How does this make any sense??

#

the boxes just decide to start going in their own direction

#

after 4 in seemingly no pattern

tiny wadi
#

@tough abyss Create them with CAN_COLLIDE

#

_veh = createVehicle ["VR_Area_01_square_2x2_yellow_F", _1, [], 0, "CAN_COLLIDE"];