#arma3_scripting

1 messages Β· Page 588 of 1

manic sigil
#

It is certainly a number.

warm hedge
#

If it isn't readable for you, it translates into 1021790

manic sigil
#

I am aware, but I'm not sure if it's readable for my code. I've had issues before with e+00x type of things, notably when I was premaking missions back when Zeus had admin console.

jade abyss
#

It is

warm hedge
#

Put 1.02179e+006 into your code, it just returns 1.02179e+006. You even can do something like 1.02179e+006 + 100

winter rose
#
private _result = 1.02179e+6 / 1000;
manic sigil
#

so

if (1.02179e+6 in (getDLCs 1))

would work?

warm hedge
#

Yes

manic sigil
#

Just weird, didn't have that happen with the Marksman DLC, it was just the flat number.

warm hedge
#

Because 1021790 is bigger

jade abyss
manic sigil
#

I get that; as I said, when I was doing admin-console-loading-shenanigans, I had issues where an object's Z position would get something like '5.2e+001', and trying to create an object with that would throw a huge fit. Had to go through my entire blocks of code to remove all e+ instances.

candid cape
#

Hi , for open an inventory player it's player action ["Gear", player];

#

And for close ?

warm hedge
#

It's not a question about EHs...

crude vigil
#

My bad. I had my attention on somewhere else.

inner pine
#

Hey Guys , iam here right for a Little ace 3 question?

#

just a question about an Item..

oblique arrow
#

Depends on the question @inner pine

wispy cave
#

Is there a way to get a list of all the slots in a multiplayer lobby? I'm specifically looking to make a listing ingame of which slots have which players in them and which ones are empty

winter rose
#

playableUnits does that iirc @wispy cave

wispy cave
#

playableunits only returns slots that are currently filled

winter rose
#

only if AI is disabled for them

wispy cave
#

AI is disabled on them unfortunatly

winter rose
#

then unfortunately IDK, unless getting the description.ext value of maxPlayers (number) is enough for you

wispy cave
#

No, it isn't. Guess I'm gonna be hardcoding it

faint oasis
#

hi, i have a question ? how to create a keybind and can custom the key if you go in "control" and "config addons" ?

cunning crown
#

With CBA iirc

faint oasis
#

yes i think but how ?

cunning crown
faint oasis
#

ok but i need to call the function ? or i need only to add in .cpp ?

cunning crown
#

Just call the function, everything is explained in the link I sent Β―_(ツ)_/Β―

faint oasis
#

ok i will check | i'm sorry

alpine ledge
#

could someone tell me what i'm doing wrong here:

trying to pack some functions into an addon
the functions themselves work just fine, however they keep getting called on the main menu for some reason
how does one prevent this from happening?

config.cpp:

class CfgFunctions
{
    class TestScripts
    {
        tag = "TEST";
        class Scripts
        {
            file = "function_test\functions";
            class civsInit {postInit = 1};
            class carsInit {postInit = 1};
            class trafficInit {postInit = 1};
            class combatInit {postInit = 1};
            class carsRadio {postInit = 1};
        };    
    };
};
robust hollow
#

its because the main menu is technically a mission too

alpine ledge
#

mhmm, but i only want it to be called when i call it via script or w/e

#

does arma really call all functions once the menu is loaded? AAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

robust hollow
#

remove postInit then?

alpine ledge
#

needs to be post init since i need to wait for the objects that will call them are loaded

robust hollow
#

im sure there is a better way, but this is what I have

private _isMainMenu = false;
private _mission = format["%1.%2",missionName,worldName];
{
    if ([_mission,getText(_x >> "directory")] call BIS_fnc_inString) exitWith {
        _isMainMenu = true;
    };
} count ("true" configClasses (configFile >> "CfgMissions" >> "CutScenes"));
if _isMainMenu exitWith {};
#

could probably rework it to something like this

private _mission = tolower format["%1.%2",missionName,worldName];
private _isMainMenu = (("true" configClasses (configFile >> "CfgMissions" >> "CutScenes")) findIf {
    _mission in tolower getText(_x >> "directory")
}) > -1;
if _isMainMenu exitWith {};
#

idk, its all the same in the end

alpine ledge
#

could do it that way i guess - surely there's a better way around it though PeepoThink

#

could do it as a module instead GWcmeisterPeepoShrug

#

meh, too lazy for that and this works so i'll go with that, thanks wave

exotic flax
#

I know that ZEN (Zeus Enhanced) has a module to export a mission to SQF. Not sure about the full extend of it, but one of the zeuses in my unit used it yesterday without many issues.

lucid junco
#

does someone has experience with laggin ogv vids? which export setting youre using .etc ...

inner pine
#

Okay - Problem is : we cant use Surgical Kit in ACE and we Dong know why ...we had all looked up and checkt the addon Options. Could be there anythin we missed? In Mission.sqm we had had edited the NPC Units of Medics and what else...maybe some of you know the magic πŸ•

exotic flax
#

for the Surgical Kit to be useful you need to enable 'Re-open Wounds' (or ace_medical_treatment_advancedBandages = 2;), otherwise the wounds will automatically close after being bandaged and the SK option won't show up.

inner pine
#

Dude - wtf....God Save your Soul . Best Regards

exotic flax
#

it's basically "Basic Medical" from the old ACE settings πŸ˜‰

inner pine
#

i have the newest Version and i work with it after 2 years again and many has changed so i feel like noobish

#

So...thanks i will sleep now in peace ✌🏻 Good Night

exotic flax
#

good night to you too and have fun stitching wounds in the future

inner pine
#

😘 everytime i will think at ya

spiral fractal
#

if I want to override ACE server variable in mission file, where should I do it?

#

I just want to set ace_explosives_requireSpecialist to true and make it ignore/override server setting

#

cant I just do missionNamespace setVariable ["ace_explosives_requireSpecialist", true]; ?

#

I will set it server init, hope it will work

spiral fractal
#

oh I forgot about the global parameter, Thank you!

#

not tested yet

brave jungle
#

You know in eden when you rotate via the red rotation, is that vector up or dir?

#

when using setVectorX

#

nvm

brave jungle
#
Stationary = [23.256, 0.310, 1.582];
    _currentUp = vectorUp slingMove;
    if (_currentUp select 0 != Stationary select 0) then {
      slingMove setVectorUp [_currentUp select 0 + 1, _currentUp select 1, _currentUp select 2];
    };
    if (_currentUp select 1 != Stationary select 1) then {
      slingMove setVectorUp [_currentUp select 0, _currentUp select 1 + 1, _currentUp select 2];
    };
    if (_currentUp select 2 != Stationary select 2) then {
      slingMove setVectorUp [_currentUp select 0, _currentUp select 1, _currentUp select 2 + 1];
    };

I'm getting error type any, expected number on my third if statement, slingMove |#|setVectorUp Not sure why though, the first two work and its just a copy paste

#

Making an object rotate basically

warm hedge
#

Maybe because _currentUp select X + Y considered as _currentUp select (X + Y)

still forum
#
Stationary = [23.256, 0.310, 1.582];
private _currentUp = vectorUp slingMove;
{
    if ((_currentUp select _forEachIndex) != (Stationary select _forEachIndex)) then {
        _currentUp set [_forEachIndex, (_currentUp select _forEachIndex) + 1];
    }
} forEach _currentUp;
slingMove setVectorUp _currentUp;
#

But, vectorUp should be normalized, just adding +1 doesn't seem right

tough abyss
#

Can someone explain what is this syntax ?
_x >> "directory"

robust hollow
#

(config class) >> (config class or property)

tough abyss
#

Thanks Connor!

#

@robust hollow I'm trying to use it, am I using it wrong?

CfgServerSettings >> General >> TestVar call BF_fnc_log;

class CfgServerSettings
{
    class General
    {
        TestVar = "BF Arma";
    };
};
robust hollow
#

configFile >> "CfgServerSettings" >> "General" >> "TestVar"

tough abyss
#

aww

robust hollow
#

or missionConfigFile if it is in the description ext

tough abyss
#

it's not, it's an addon

robust hollow
#

ok, so configFile is the one you want πŸ‘

tough abyss
#

Okay

#

I tried, it prints the variable name, not the value

#

(TestVar)

robust hollow
#

wrap it in parenthesis

tough abyss
#
configFile >> "CfgServerSettings" >> "General" >> "TestVar" call BF_fnc_log;
robust hollow
#

or, you meanit is only logging the config path?

tough abyss
#

output:
TestVar

robust hollow
#

To output the full pathsqf (configFile >> "CfgServerSettings" >> "General" >> "TestVar") call BF_fnc_log;

#

to output the property value (in this case)

getText(configFile >> "CfgServerSettings" >> "General" >> "TestVar") call BF_fnc_log;```
tough abyss
#

Oh

#

is this the most common way to access class variables?

robust hollow
#

one way or another accessing any config data is done with >> or / (slower)

#

read up on the commands in the additional information section of that wiki page i linked. it has most relevant config related commands.

tough abyss
#

Thanks

faint oasis
#

hit , i have a question ? how to use the ed-1d drone ? because i want to create a script when the ed-1d scan an object or units but the event handler hit part doesn't work so how to detect the laser ?

hazy trail
faint oasis
#

@hazy trail yes but it doesn't work for the laser only for the knife

sacred slate
#

is there a simple way to make the strider faster? would be great to get it as fast as the hatchback. is it possible to get the driving mechanics of the hatchback sport into the stabile chassis of the strider?

spiral fractal
#

how to exclude server and some player in remoteExec? remoteExec ["CBA_fnc_notify", [-2, ? ];
-1 * (owner _player) ?

slim verge
#

@sacred slate, only if you create a config addon that overides the originaL CONFIG VALUES

winter rose
#

@spiral fractal maybe [-2, -(owner _player)] yes

candid cape
#

Hi , anyone know how to make an sleep

#

on an specific code ?

winter rose
#

yes, use sleep

candid cape
#

what I have to do ?

#

If ((side player == WEST) then { hint "Hi";
sleep 1;
}

#

And it hint "Hi" avery 1 second?

winter rose
#

nope. tell me what you want to do

candid cape
#

I want to do an script

#

That if you are COP

#

You will recive 5 exp

winter rose
#

then check while and sleep yes

coarse sedge
#

Hello, I am reading about the Arma 3 equipping uniform restriction which prevents you to equip uniforms from the dead but you are still able to take items from it. I want to expend that restriction to vests and backpacks.

On the internet all I've found is how to remove the uniform restriction, nothing about expanding it. Any thoughts on this?

winter rose
#
while { sleep 1; playerSide == west } do {
  _playerXP = _playerXP + 5;
};
```@candid cape
#

by script? @coarse sedge

coarse sedge
#

Any means necessery

#

Hopefully there is a simple way to do it πŸ˜…

winter rose
candid cape
#

And, where I have to put it @winter rose ?

#

On the init?

winter rose
#

@candid cape no, wherever you want technically
I guess you are coding for the L*fe framework, and I don't know their structure. You should ask in their Discord (which is linked in #channel_invites_list)

candid cape
#

Omg

#

Thanks

#

It's working

digital hollow
#

TIL you can press F1 in Debug Console for scripting help.

winter rose
#

and there is autocompletion, too

#

(in-game doc is still less up-to-date than our beloved #community_wiki!) πŸ˜‰

sacred slate
#

@slim verge thx. do you have any more syntax where to start, i am not a coder

#

this is harsh to google.

sacred slate
#

ok for some quick boost i have now this:

#
(findDisplay 46) displayAddEventHandler ["KeyDown", { 
    params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"]; 
    if (_key == 46 && {not (vehicle player == player)}) then { 
 _vehicle = car1; //your vehicle  
 _vel = velocity _vehicle; //current velocity of car1  
 _dir = direction _vehicle; //current direction of car1  
 _speed = 50; //how much you want to add speed for the vehicle  
 _vehicle limitSpeed 200; 
 _vehicle setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+ (cos _dir*_speed),(_vel select 2)]; 
    }; 
}];
#

but changing a vehicle statical would be great πŸ˜„

shut shadow
#

If something like BIS_fnc_stalk is used with group player like on the wiki example, and there's multiple seperate player groups, what will happen?

winter rose
#

if the function is called on a dedicated server, nothing at all

sacred slate
#

how do i get the dikCode of my joystick or pad?

#

this isn't working:

#

waituntil {!(IsNull (findDisplay 46))};
_keyName = (findDisplay 46) displayAddEventHandler ["keyName", "hint str _this"];

still forum
#

You don't.. basically

spiral fractal
#

is it possible to get [x,y,z] point on object that I aim at relative to object [0,0,0] point? I want to set positions for ACE menu items

steel fox
still forum
#

lineIntersect + worldToModel + math

steel fox
#

☝️

spiral fractal
#

bruteforce it is meowsweats

spiral fractal
#

hmm is it possible that groundWeaponHolders blocks ACE interaction menu from showing on object that I set it on if they are between player and ACE menu object?

still forum
#

Think so ye

spiral fractal
#

thonk wow everything fights against me in my scripting activities, is it possible to ignore this objects somehow?

steel fox
#

hmm is it possible that groundWeaponHolders blocks ACE interaction menu from showing on object that I set it on if they are between player and ACE menu object?
@spiral fractal I don't think that is what is happening, and object can't "block" the ace interaction menu

#

The distance between you and the object you set the menu on is however important

spiral fractal
#

I set it to 6m and I have to get to 1m to see the menu, but I can see menu items above the objects from 6m

#

when I set Y to -1 it seems to work

exotic tinsel
#

Arma is giving an error about using numbers in a string for an array and i dont know how to fix.
Here is the error message followed by the line of code.
16:13:27 Error in expression <b + [["name=Request Transport Vehicles",Β "priority=22", "permission=Squad Leade>
16:13:27 Error position: <Β "priority=22", "permission=Squad Leade>
16:13:27 Error Invalid number in expression

v_db = v_db + [["name=Request Transport Vehicles",Β "priority=22", "permission=Squad Leader", "parent=Main Menu", "parent=SquadLeader Options", "action=[] execVM 'hud_os\actions\action_request_transpo_vics.sqf';"]];
#

im banging my head on desk now

winter rose
#

you may have an unclosed quote somewhere else

still forum
#

did you copy from BI forum?

exotic tinsel
#

oh i know what you guys are on about. ill find it. thanks i never thought it could be one of those damn characters. ill track it down.

winter rose
#

use an IDE that supports SQF syntax already!

prime trout
#

Please can someone correct my silly ways. I am using below in SP to open a menu that i created. However in MP it doesn't give the player the dialog option. I know I have missed something but I am unsure what.

player addAction["UNITAF Menu",
{
    execVM "openDialog.sqf";
}]; ```
winter rose
#

Where do you place this?

prime trout
#

in the initPlayerLocal.sqf

#

@winter rose

winter rose
#

then it does
but if you have a respawnOnStart that "kills" your units, the action is on the corpse

prime trout
#

Gotcha

#

Yeah removing that worked. So how would I get it to be on the player after respawn @winter rose

winter rose
#

you can use a respawn event handler πŸ™‚

prime trout
#

Rgr will take a look! Ta

tough abyss
#

is there a way a script can detect if the player is holding a weapon and then change their faction back and forth according to that?

winter rose
#

yes, currentWeapon player != ""

marble basalt
#

how would you go about getting classnames of ammo classnames for vehicles

winter rose
#

do you want ammo or magazine config @marble basalt?

marble basalt
#

not sure the difference but im trying to remove the ammo from a vehicle

#

like disableing rockets on helis

prime trout
#

@winter rose I did it like this ```sqf
(_this select 0) addEventHandler ["Respawn",{_this execVM "scripts\UTFN\AddActionOnSpawn.sqf"}];

winter rose
#

Perfect, that's the spirit! Thanks for sharing πŸ™‚

#

@marble basalt removeAllWeapons, removeMagazines, removeMagazinesTurret…or edit the helicopter pylons in Eden

prime trout
prime trout
#

Trying to get a script to run only if a player is in a area from my GUI.

I have placed an area and set its name to 'getdata'

then I am trying to only allow the button to work if they are inside that area.

_data = getdata;
_playerIsInside = player inArea _data;

if (_playerIsInside){

_thisPlayer = _this select 0;
onMouseButtonClick = [player, "scripts\UTFN\fn_Server_getUnit.sqf"] remoteExec ["execVM", 2];
};

false
winter rose
#

@prime trout by area, you mean marker, or trigger?

prime trout
#

@winter rose I have a marker down

#

is it easer to do with a trigger?

winter rose
#

same with inArea

but if you named your marker "getData", you should use a string "getData", e.g ```sqf
player inArea "getData";

prime trout
#

Like this @winter rose ```sqf
_playerIsInside = player inArea "getData";

winter rose
#

yep

#

also, always private your local variables

prime trout
#

Wonderful! Will try now. Thank you. I haven't learnt 'private' yet.

winter rose
robust hollow
#

if (_playerIsInside){ also dont forget your thens

prime trout
#

It works! Woop. Thank you @robust hollow missed that. Must have deleted by accident.

@winter rose Thank you very much, will take a look in tooooo!

spiral fractal
#

how to useremoteExec function inside ACE interaction menu condition ace_interact_menu_fnc_createAction?

molten roost
#

What's a dedicated server friendly way of teleporting players? setPos does not work (when ran on server at least).

robust hollow
#

it should work... are you sure you are giving it the correct object argument?

molten roost
#

yeah, one moment i'll put the code snippet here

#
        _spawnPos = [CrashPos, 1, 25, 3, 0, 20, 0] call BIS_fnc_findSafePos;
        player setPos _spawnPos;
        {
            if (!isPlayer _x) then {
                deleteVehicle _x;
            };
        } forEach units grp;
    }
    else
    {
        {
            _spawnPos = [CrashPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
            _x setPos _spawnPos;
        } forEach units grp;
    };```
robust hollow
#

player wont work on a dedicated server

#

a ds has no player

molten roost
#

there is no "player"

robust hollow
#

player setPos _spawnPos;

#

is grp defined on the server?

molten roost
#

ah i skimmed right over that, thought i took that out

#

its a variable in the group attributes

#

let me fix the player thing then try again

#

Still will not teleport players. When _playercount > 1 it will teleport all the ai in the group, but not the players. I have it in initserver currently, do i need to do the player teleport in init?

#

Code looks like this now for reference if (_playercount == 1) then { // Deletes extra units if played in SP { if (isPlayer _x) then { _spawnPos = [CrashPos, 1, 25, 3, 0, 20, 0] call BIS_fnc_findSafePos; _x setPos _spawnPos; } else { deleteVehicle _x; }; } forEach units grp; } else // Keeps slots open for JIP if Multiplayer { { _spawnPos = [CrashPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos; _x setPos _spawnPos; } forEach units grp; };

crude needle
#

@molten roost Try delaying it with a sleep or waitUntil. Also, should use !multiplayer to check if singleplayer. Can also log the units grp to see if the players are inside or use a different flavor of setPos.

molten roost
#

oh didnt know i could use !multiplayer, i'll do that, thanks!

zinc sorrel
#

how would one get the ai to find a safe spot behind a object? trying to implement ai dragging wounded to cover

light shale
#

is there any way to edit code while in game, such as a recompile of a script. i found this command but im not how its used [] call BIS_fnc_recompile;

exotic tinsel
#

@winter rose it was a special character that got copied over in the section for priority. i use Visual Studio Code with all the sqf addons.

tough abyss
#

Hi, are there "structs" in SQF ? similar to struct in C ?

#

Or objects that I can initiate at runtime with properties?

#

Or are there hashes/dictionaries?

thorn saffron
#

How do you detect editor placed static objects like houses, trees and such around player? They are not picked up by the nearestObjects nor nearestTerrainObjects commands

#

wait, they are, but under "House" it seems

#

basically they are picked up when no filter is applied. With makes it kinda wonky as no filter search picks up stuff like bees, footprints and such

still forum
#

@tough abyss no, setVariable, no... well a namespace is a hash

finite sail
#

How do you detect editor placed static objects like houses, trees and such around player? They are not picked up by the nearestObjects nor nearestTerrainObjects commands
@thorn saffron editor placed things are entities, so try https://community.bistudio.com/wiki/nearEntities and

#

also, nearestbuilding and nearroads might be useful to you, depending on what you want to do

slim verge
#

needed for MP environment

#

overall aim to get an auto join teamspeak link eg ts3server://teamspeak.zeus-community.net

slim verge
#

F*** Me it works in sp environment autostarts ts if installed and joined me to my ts server, now foir an mp test

#

wow..... this works in mp

winter rose
#

no reason not to πŸ˜‰

slim verge
#

they didnt used to allow external links and there aint many server admins that know this works

winter rose
#

yep, you cannot do a <a href=""> the usual way

slim verge
#

so this works via a class in a button... is there a way to have this working in a briefing with executecode rather than via a button class ?

winter rose
#

you mean, automatically?

#

or a "normal" link

slim verge
#

well you know the execute expression code

#

something to be clicked on like the link button

#

so not auto no, via user interaction

winter rose
#

hmm while I think of if, maybe ctrlCreate a button out of sight, process a click on it (if doable?), delete the button πŸ€”

slim verge
#

i have an auto inject serverside addon that spiels out a load of stuff on the briefing, to add an auto join ts link would be a leap ahead in helpfulness

winter rose
#

offside question, does it make Arma lose focus?

slim verge
#

no well. i have multi monitors and am in fullscreen mode

#

so time to dabble a lot

#

am failing to find anything reasonable to explain <execute expression= **************</execute> is their a comref link anywhere that explains it ?

winter rose
wet shadow
#

Anyone here with experience of BIS_fnc_initVehicle in a dedicated environment? My testings seems to indicate that the animation sources are properly transmitted to all clients but the vehicle texture set by this function is local to the machine that created the vehicle (with the function in its init)

slim verge
#

thx for the link Lou but already have that was looking at a set of params for it eg something i could use to pass a URL,

winter rose
#

nope, that's just code

#

@wet shadow I am not sure about createVehicle'd object's locality, indeed
as this function takes a local vehicle as param…

#

if by testing you get to know if createVehicle makes the vehicle local to the machine that called it, I can update the wiki

wet shadow
#

@winter rose You are correct, createVehicle does result in the object being local to the machine that executed that code as far as I can determine.

#

But I am still baffeled why the BIS_fnc_initVehicle is able to propagate the animation changes but not the vehicle textures.

winter rose
#

I would guess because animation-related commands are global, therefore everything is sync'ed

sharp peak
#

Any way to disable group chat specificly?
enableChannel cant do it, and same for Description.ext's disableChannels[]

wet shadow
#

@sharp peak You can disable it in your servers server.cfg

#

I am currently running this:

disableChannels[]={{0,FALSE,FALSE},{1,FALSE,FALSE},{2,true,truE},{3,FALSE,FALSE},{4,FALSE,FALSE},{5,FALSE,FALSE}};
robust hollow
#

is that really a server.cfg thing? thought it was only description.ext

#

yep, there it is on the wiki 😲

sharp peak
#

I see, will try it, hope it works better than in Description.ext

winter rose
#

@sharp peak there is an issue that it doesn't apply to JIP players

#

a workaround is using the related scripting command

sharp peak
#

wahts a JIP player?

#

Somebody who joins after mission start?

robust hollow
#

yea

#

"join in progress"

sharp peak
#

makes sence, thx too all

robust hollow
winter rose
#

was about to post that πŸ˜„ stahp ninja'ing meh!!

tough abyss
#

Is there any way to not let players join until some variable is True ?

#

(using a servermod)

#

if I delay init.sqf on mission folder, it still loads the player in

robust hollow
#

usually you would cover their screen when they load in and let them see again once the mission is ready to go. i cant think of a way to temporarily prevent players in the lobby from loading in.

queen cargo
#

Just why @tough abyss

winter rose
#

you can alway remoteExec endMission to them

tough abyss
#

Okay, thanks @robust hollow

tough abyss
#

Is someone using ExtDB3 here?

rough heart
#

Yeh why

tough abyss
#

@rough heart I'm using SQL_CUSTOM, with my own INI, but I can't get the protocol to always return strings (using TEXT definition)

modern adder
#

Hi lads, do you reckon it's possible to execute playSound for one player?

#

If so, how?

#

As in, I'd like to have a sound playing for one player, but not the other

spiral fractal
#

second parameter will execute the command on specific machine, server is 2 etc, 0 - everyone

modern adder
#

Thanks

#

I suspected that remoteexec may be involved

spiral fractal
#

also there is remoteExecCall but I still dont understand when to use what πŸ˜„

vivid monolith
#

How do I put where a medic drags a wounded soldier and 2 riflemen are providing covering fire?

remote pendant
#

[_logic,_display,_sideBars] spawn {
disableserialization;
_logic = _this select 0;
_display = _this select 1;
_sideBars = _this select 2;

        waituntil {!isnull curatorcamera && !([] call bis_fnc_isLoading)};      

Does anyone know what this is for?⬆️

nocturne bluff
#

its some code

remote pendant
#

yeah, but I would like to know what it does, since I get an error from this.

modern adder
#

Also, is there any way to make the addon builder include subdirectories?

#

Or do I just have to use pbo manager?

#

As I have a scripts folder which I'm trying to include within my pbo

rough heart
#

@tough abyss what exactly are you coding? Show me what you are trying...

oblique arrow
#

No crossposting please @remote pendant

modern adder
#

@remote pendant Looks like you're missing a closing bracket

sacred slate
#

how to assign all tasks to the player after teamswitch?

spiral fractal
steel fox
#

You can use that to createSub action i believe

#

Just pass it an empty {}, if you don't need it

spiral fractal
#

there is not enough info in ACE wiki, right now I add sub actions when I call ace_interact_menu_fnc_addActionToObject and pass the _action, but I have to get array from server and find value in it, if I add this code to action it will get array from server for each one, I want to get the array once and use it in every child condition check

steel fox
#

You could do something like this:

Private _fnc_childrenActions = {
  private _customParams = _this select 2;
  private _theArray;//Provide code to retrieve server array
  _customParams apply {_x set [6, _theArray]};
};

This function would be put into the "Insert children code" spot.
And the parameters you pass your action would be an array of actions you want to display as children to this action.

The code simply sets the parameter array of every child action to the array you would want to get from the server.

#

@spiral fractal

spiral fractal
#

in 3.6 Advanced Example there is an example of something similar to what I need, but I decided to leave this option for the next update...
for now I have to check if my code works correctly
what is the fastest way to get some unique detail about player that will also allow to find the player by it and will remain after player respawn?

#

is there something other than getPlayerUID ?

#

if I use owner what happens when player disconnects? joining player can get the same owner id the player who left?

robust hollow
#

no

#

if ownerID 3 leaves. ownerID 3 isnt used again. at least that how it was when i last worked with it

spiral fractal
#

hmm, so I can use owner id, is it related to allPlayers position?

robust hollow
#

no. it is related to the next available increment when they connected.

#

yea just tested, first connection i was owner 4, second connection i was owner 5.

spiral fractal
#

you connected twice or reconnected?

#

you use owner player?

#

I have 0 both times, I think I should use clientOwner instead

robust hollow
#

reconnected. this is on a dedicated server environ tho

#

yea owner command only works on server. clientOwner is how the player can get their own owner id.

spiral fractal
#

is it possible to get the player by owner id? for example if server gets id 4, how can I find the player with that id?

robust hollow
#

you'd run that snippet on the server though.

#

to do it on a client you would need to somehow globally associate each client with their owner id so other clients can see which id belongs to which player.

spiral fractal
#

I will check this code now, Thank you!

short sparrow
#

Hi, Im doing a really heavy mission (size) and I want to play a intro (cinematic intro). I've some troubles playing the intro in the right time. When the player click "Continue" on briefing (playing on multiplayer) it get stuck on a loading screen for several seconds and when the loading screen ends the intro its already playing. I've tried using time > 0, getClientStateNumber >= 10. Some ideas? Thanks

unique sundial
round scroll
#

can I add my own event handlers for stuff like 'plane in catapult', 'plane cat shoots' and so forth for the Nimitz? Right now the number of if's and the whole launch and arrest(recovery) scripts are a bit messy

warm hedge
#

Maybe BIS_fnc_addScriptedEventHandler and such functions?

short sparrow
spiral fractal
#

surfaceType getPosASL player in building returns "#GdtDirt" how can I fix it?

#

I tried postition, getPos, getPosATL same results

young current
#

What are you expecting?

spiral fractal
#

maybe at least floor_inside?

winter rose
#

(I updated the wiki page)

#

it takes a 2D position, so floor is most likely the terrain surface

exotic flax
#

surfacetype will only return the terrain type, without taking in account buildings or decals (eg roads)

spiral fractal
#

ah I misunderstood the

or Position3D in which case Z will be ignored

#

that is nice 😐 so this function is pretty much useless right? I mean how would I ever get it to show surf_rooftiles for example?

winter rose
#

magic

#

@spiral fractal you can find out with```sqf
onEachFrame {
hintSilent format ["ASL: %1\nATL: %2", surfaceType getPosASL player, surfaceType getPosATL player];
};

finite sail
#

I'm pretty sure surfaceType is a 2d function

#

altitude is ignored

winter rose
#

yep

finite sail
#

I wouldn't rely on it too much either.. you'll find it returning things like dirt even when youre on a runway

spiral fractal
#

no, this code only show the ground surface

winter rose
#

how would I ever get it to show surf_rooftiles
that's ↑ to what I replied

finite sail
#

yep

#

also, don't expect comparable results when using the command on different maps

winter rose
#

who knows, maybe Arma 3 introduced a 2D/3D change Β―_(ツ)_/Β―

#

(I wouldn't count on it much)

finite sail
#

one map, can't remember which has loads of 'reddirt' while another had none

spiral fractal
#

I dont understand, your code show the same result 2 times because Z is ignored

winter rose
#

It is "to be sure there is no difference"

spiral fractal
#

oh I am sure...

#

I tried almost every position function even eyePos πŸ˜„

#

is it was that hard to make it check Z?

finite sail
spiral fractal
#

I am planning to add onEachFrame to player if he has ghillie suit, and is prone on the ground to set his CamouflageCoef to 0

finite sail
#

ah ok

#

getenvsoundcontroller might help, its something I use a lot

#

You're specifically looking for long grass though, presumably

#

*pulls up getenv ~ wiki page. sees own username in notes section

spiral fractal
#

this function may come in handy

neon snow
#

How could I get animation state for pylon weapon?

winter rose
#

@neon snow ↑

spiral fractal
#

how can caller get result from remoteExec / remoteExecCall? called function return boolean

short sparrow
#

Hi, I want to execute some code to prevent AI move when a player disconnects from server. If I put 'this disableAI "Move";' on the init of each playable unit it works. But I don't want to do it that way. I want to do it in some script file, so when I add some new playable unit it will add this feature automatically. I tried to execute the same line in init.sqf, initServer.sqf, initPlayerLocal.sqf, initPlayerServer.sqf and it didn't work on any of those, I also tried to use eventHanddles but I don't know which event its the right one and where it has to execute, thanks

still forum
#

Anyone here with a windows or linux (32bit) server who can run
diag_log ["ROAds", count ([worldSize/2,worldSize/2] nearRoads 2000)]; on stratis on their server and give me the result?
Should be either 1190 or 1203... I get 1203 on windows client, not sure if thats supposed to be same on server or if 1190 is the number for server as it has different data.

finite sail
#

@still forum , I've got a windows 64b server here, can I help?

still forum
#

yes

#

just run it and give me the number :3

finite sail
#

ok, wait 1

#

1203

unique sundial
#

@spiral fractal make function send back the result to sender same way you called remote function

spiral fractal
#

yes I found reddit post and Adanteh suggested to run remoteExec with caller id inside the remoteExec, so I am changing my code now

still forum
#

Aww... I hoped it to be 1190 😒

finite sail
#

its 1203 on both server and client

still forum
#

17:30:53 nearRoads 16384 98694 1634 57534
17:30:15 nearRoads 16384 98683 1621 57522
Yeah.. linux x64 is still missing 13 roads... Well atleast its not missing over 1000 anymore πŸ˜„ πŸ™ƒ

finite sail
#

how strange

#

may or may not be relevent...

still forum
#

now I need to test on 32bit linux server, I'll do that myself instead of waiting πŸ˜„

finite sail
#

nearroads returns some runway peices

#

but some runway pieces return false for isonroad

spiral fractal
#

is it possible to "fix" surfaceType function?

still forum
#

whats broken?

spiral fractal
#

its not checking Z

warm hedge
#

...Why?

finite sail
#

im not sure that counts as broken

still forum
#

no, there is only one terrain under your feet, no need to check z

finite sail
#

yep

still forum
#

17:48:13 ["ROAds",1203] on linux32 bit daaang... I thought I was done...

spiral fractal
#

idk when I read "surfaceType" I think about surface under something, so if I pass player pos I except to get surface that he is standing on

still forum
#

it grabs the terrain material, and thats intended

warm hedge
#

Better make it more clear on BIKI?

still forum
#

same for surfaceIsWater, surfaceGetNormal, surfaceTexture

spiral fractal
#

no, better add parameter to it to allow it

warm hedge
#

I don't think that's a good idea

#

Make another command is better to make it compatible with older functions

#

(If there's even chance)

still forum
#

The command implementation can only read terrain, making a line intersect on any nearby objects and trying to find that and getting the exact face and its material and parsing that.. noooo. Won't happen. That'd be a completely new implementation of that command

unique sundial
#

surfaceNormal*

still forum
#

Ah, read the wrong column

spiral fractal
#

when vehicle drowns, it becomes wreck but it seems that killed event not fire, is it true?

#

is it because the setDamage command executed with false as second parameter when it happens?

finite sail
#

I think that observed behaviour predates the introduction of that parameter

spiral fractal
#

is it possible to fix it somehow?

#

make event fire?

still forum
#

I don't think the engine executes script commands internally when killing a vehicle
Sounds like a bug that should have a feedback tracker ticket

fast harness
#

Hey guys, is there a way to determine the player covered distance in meters?

finite sail
#

There's another weird 'vehicle gets wet bug'. If a vec gets deep in water but is able to drive out, if the driver gets out and back in, the vehicle will behave as though the engine is killed, although the indicator doesnt show red

#

other players can get in the vec and drive it as normal, but the player who dunked it cant

spiral fractal
#

nice 😐
I am not skilled enough to test it to be 100% sure its a bug... maybe its something in the mission file that I edit, but that is what I saw

finite sail
#

to me, what you are describing sounds game related rather than mission related

spiral fractal
#

and it wasn't reported before?

finite sail
#

ive never searched for reports of it

#

*searches own mission folder

#

it seems I knew about it, as my mission has a workaround

spiral fractal
#

what is the workaround?

finite sail
#

periodically, i check the health and ASL of my two main mission vecs

#

if they are damaged and underwater, i execute a vehicle died script

#

tbh, i rarely use kiiled EH on vehicles anyway

winter rose
#

@fast harness you could add a loop that every second check the player's distance from the earlier second's save position

spiral fractal
#

I thought about it but I wanted to use event instead

fast harness
#

@winter rose Can you guess, how that affects the performance? πŸ˜„

spiral fractal
#

you want something like pedometer?

fast harness
#

Yep

finite sail
#

negligible, @fast harness unless you have a million players

fast harness
#

Sounds pretty good πŸ™‚

#

Thank you

finite sail
#

will this be MP?

fast harness
#

Yep

finite sail
#

you need to decide if you are going to do it client or server side

fast harness
#

server side, because the values are passed to a extension

finite sail
#

yep, good reasoning

spiral fractal
#

if it run on client it will affect server?

finite sail
#

no

fast harness
#

So I can initiate a SQF thread per user or maybe a single thread which foreaches all players?

finite sail
#

yes, should be OK unless theres other stuff you havent mentioned

fast harness
#

Not at the moment πŸ™‚

finite sail
#

don't blame me when server gets 3 fps, lol

#

blame @still forum , obvs

fast harness
#

πŸ˜„ Sure, I'll do it...

spiral fractal
#

I think its best to make client do as much work as possible

finite sail
#

it depends....

fast harness
#

Yeah, but then I must handle a lot of publicVariables

spiral fractal
#

depends what you want to do with that value

fast harness
#

store them in a redis database

spiral fractal
#

ah you want to do something like dayz stats has?

fast harness
#

yep

finite sail
#

as a general rule, if its today with mission assets or enemy AI, do it on server

spiral fractal
#

then send the total value to server on player disconnect once

fast harness
#

My Idea is a rvextension, which spawn a seperate thread which takes control over the data i/o.. in the mission i make simple value calls to this extension

finite sail
#

thats way above my paygrade, so I'll keep quiet πŸ™‚

fast harness
#

But I'm not so famillar with SQF handling at the moment πŸ˜„

finite sail
#

i first learnt COBOL and then SQF. I'm not sure which is the most fit for purpose yet

#

yes, i am old

spiral fractal
#

I think getting the total value when player disconnects will be the optimal way to do it

finite sail
#

oh wait, news just in... CP/M was the first code I actually wrote with any skill

fast harness
#

Oh.. cobol is hunting me...

#

A lot of our IT workloads are running with 16 bit COBOL tools... lot of migration fun

molten roost
#

Little lost here.

 { 
  doStop _x; 
 }forEach units this; 
 waitUntil { 
  behaviour leader this == "COMBAT"; 
 }; 
 { 
  _x doFollow leader this; 
 }forEach units this; 
};```
Getting generic error in expression `behaviour leader this |#|== "COMBAT";`
#

in composition init ^

spiral fractal
#

maybe you have to add ( ): behaviour (leader this) == "COMBAT";

still forum
#

no

#

unary commands always take precedence

#

I'd say the posted error message is not the complete message

molten roost
#

this is all i've got

crude needle
#

Is it for sure scheduled?

#

Not sure where "composition init" is at.

molten roost
#

im pretty sure it is, { doStop _x; }forEach units this; works fine in the init

crude needle
#

Oh wait, you're using this.

#

That's unscheduled.

#

Wrap it all in a [] spawn {}.

molten roost
#

Will do

still forum
#

this spawn {
{
doStop _x;
}forEach units _this;
}
replace with _this inside the spawn

molten roost
#

okay, that mostly worked. How do i get the leader of a group in this scenario?

#

tried a few different things, cant seem to get it

still forum
#

huh

#

send your whole code please

molten roost
#
[] spawn {
 { 
  doStop _x; 
 }forEach _this; 
 waitUntil { 
  behaviour (leader _this) == "COMBAT"; 
 }; 
 { 
  _x doFollow leader _this; 
 }forEach _this; 
};
};```
still forum
#

thats not what I sent

#

Me:

this spawn {
You:
[] spawn {

molten roost
#

OH

#

yeah that worked, thanks πŸ˜‚

#

sorry im new to this, learning πŸ˜„

winter rose
#

Hi new to this, I'm dad!

crisp cairn
#

Hello All, I am wondering what is the best way to measure a unit travelling 100m or more, I have been messing with a few snippets and been unable to find the solution

hoary saddle
#

hey guys, trying to find a script that allows people to respawn with their full load out, not what they died with, but the number of mags, nades, AT whatever their initial loadout has. any suggestions?

winter rose
#

@crisp cairn 100m from the starting point or 100m total walking distance?

spiral fractal
#

maybe you can use trigger

crisp cairn
#

Total walking

winter rose
#

you would have to loop, something like this:

private _distance = 0;
private _oldPos = getPosATL player;
while { sleep 1; _distance < 100 } do {
  private _newPos = getPosATL player;
  _distance = _distance + (_previousPos distance _newPos);
  _oldPos = _newPos;
};
hint "you walked 100m!";
crisp cairn
#

Thanks mate, appricate it

tough abyss
#

Hey, how can I create a GUI that just stays in the background (the player does see it) at the bottom right corner of the screen, yet the player will still be able to play?

#

sort of like to display players stats

astral dawn
#

πŸ€” or you can just ctrlCreate at mission display I think

fast harness
#

setTimemultiplier... which factor does it have ? Tick*Multiplier?

#

or seconds * multiplier ?

finite sail
#

does it matter?

#

unless I'm fundamentally misunderstanding the concept, settimemuliplier 2 will double speed regardless of whether its doubling ticks or seconds

winter rose
#

it's in-game time multiplier, period.

fast harness
#

ty

unborn ether
#
configSourceMod (configfile >> "CfgWeapons" >> "arifle_AK12_F") // "enoch"

Which is Contact DLC, however this is expansion asset (Apex)

getText (configfile >> "CfgWeapons" >> "arifle_AK12_F" >> "DLC") // "" 

What?

configSourceMod (configfile >> "CfgWeapons" >> "arifle_MXC_F"); // "enoch"

However belongs to "A3_Weapons_F_Rifles_MX" addon which is vanilla A3 content

BIS Consistency β„’
Have a nice day

winter rose
unborn ether
#

So I'm wondering for "arifle_AK12_F" in particular. This is Apex content (expansion mod). However it has no config value of DLC it belongs to. How do you properly define that? Create a damn simple object of weapon model and getObjectDLC it?

winter rose
round scroll
#

thanks to the pointer to the scripted Event Handlers, guess I will restructure the Nimitz catapult and recover functions to make use of it. This is my very basic sample code for it, if there's more to it let me know: https://sqfbin.com/eseroyerasidihetuyuy

sacred slate
#

how to assign all tasks again to the player after teamswitch to a different squad?

spiral fractal
#

if I run this code in CBA_fnc_addPerFrameHandler:
_pos = getPosATL player;
and I use _pos value 3 times, will it be faster than calling getPosATL 3 times?
_pos will be created and deleted on every tick?

robust hollow
#

not by much, but most likely yes

winter rose
#

@sacred slate you can just add the tasks to all the potential units

robust hollow
#

because it is just returning the variable value instead of doign all the work to return the position every time.

#

as a general rule if I use something more than once, i assign it to a variable.

spiral fractal
#

I thought so, and _pos itself, will be created and deleted on each iteration right? is it possible to keep it?

robust hollow
#

set it as a global variable

spiral fractal
#

pos?

robust hollow
#

as a global variable you would want some prefixes on it. alternatively you can set the variable to a namespace just for that perframe event.

#

you can do it however you like, just as long as it is saved somewhere that isnt wiped when the perframe event script ends

spiral fractal
#

if I pass it as argument to the handler, and change its value inside will it work?

sacred slate
#

@winter rose units get spawned mid game too

robust hollow
#

that would be the same as defining it locally on every execution wouldnt it?

winter rose
#

@sacred slate ouch
well, no easy way I'm afraid

robust hollow
#

the pos argument would be what it was when you added the event (unless cba perframe events allow updating the event args for next execution)

sacred slate
#

ok thx, i thought about a simple snipped.

spiral fractal
#

ah ok

sacred slate
#

but i can live without too

spiral fractal
#

is there wiki page or something where I can see list of function benchmarks, except the Code Optimisation page?

robust hollow
#

you can benchmark yourself with diag_codePerformance

winter rose
#

or the bottom-left button of the Debug Console, too

robust hollow
#

does that use the command now or is it still on the old function version?

#

it uses the command, very cool πŸ‘

spiral fractal
#

I saw that button but last time I clicked it my game crashed so I never used it after that πŸ˜”

robust hollow
#

just make sure the code your benchmarking is unscheduled and you'll be fine πŸ‘Œ

spiral fractal
#

right now it shows : 0.0178ms

winter rose
#

for 10k iterations

spiral fractal
#

oh oh, I think it was registering the handler every time

robust hollow
#

πŸ‘€

winter rose
#

if you do```sqf
player addEventHandler ["Hit", {}];

spiral fractal
#

i pressed it like 10 times πŸ˜„

sacred slate
#

is this correct? if yes, where should i place it. i had it in the init. onTeamSwitch {[_from, _to] execVM "test.sqf";};

winter rose
#

it would be better to add a mission EH @sacred slate

sacred slate
#

i am lucky to understand, that means mission event handle.

winter rose
sacred slate
#

cool! thx

#

and this goes anywhere into the init? πŸ˜„

#

or can it be some where else

#

any other exec'ed sqf's for example

spiral fractal
#

I will benchmark my code to make it as fast as possible,
if I use exitWith will it be faster than nested if ?
I have 3+ checks at the top of the file, each one will exitWith

robust hollow
#

3 if exitwith, 1 if lazy eval exit with. nested ifs. dont think it makes a noticeable difference if the checks are light.

spiral fractal
#

ok, Thank you!

winter rose
#

@sacred slate depends on what you want Β―_(ツ)_/Β―

robust hollow
#

when it comes to simpler stuff you may consider readability over optimisation.

winter rose
#

@sacred slate if it is a local-run script, init.sqf yes

sacred slate
#

is there a: selectPlayer next? you even have a hotkey for that but i can't find anything.

winter rose
#

in ArmA, it was Y/U/I iirc
there might be a key for that, just unassigned

sacred slate
#

yeah, but i need that as a script.

winter rose
#

a combination of selectPlayer, find and playableUnits should do

sacred slate
#

oke leme google a week. thx

#

its frustating when you even can't find the syntax

winter rose
#

the syntax of…?

sacred slate
#

anything πŸ˜„

robust hollow
#

there is an entire wiki πŸ€”

steel fox
#

its frustating when you even can't find the syntax
What

sacred slate
#

selectplayer next; there is even a hotkey for that action (switch next unit)

spiral fractal
#

what happens to the CBA_fnc_addPerFrameHandler when player respawn?

hollow thistle
#

Nothing. It's there.

spiral fractal
#

on dead unit?

#

I have to remove it?

hollow thistle
#

What, no. Pfh is not related to unit at all if you added it will be running until removed.

#

If you mean that you added it with reference to player unit it will hold that reference.

#

It will be the corpse or objNull if corpse was removed.

#

You have access to pfh ID inside it.

#

Do !alive _unit check and remove it if you need to stop it.

spiral fractal
#

can I do it inside the PFH?

hollow thistle
#

You have access to pfh ID inside it.
Yes

spiral fractal
#

_this call CBA_fnc_removePerFrameHandler; inside will work?

hollow thistle
#

No, read PFH documentation

exotic flax
sage flume
#

I've placed a smoke module, a few, and I'm wondering if it's possible to replace that data with the "billboard" code/

#

sorry to butt in

hollow thistle
#
_thisΒ ARRAY
Β 0: _args - Parameters passed by this function.Β  Same as β€˜_args’ above.Β  <ANY>
1: _handle - A number representing the handle of the function.Β  Same as β€˜_handle’ returned by this function.Β  <NUMBER>
spiral fractal
#

and in MP environment, I cant use player inside the PFH, I have to pass the player as argument?

robust hollow
#

you can use player if the event is running on a client.

spiral fractal
#

hmm, how is it possible? I do separate test for each line in editor debug console:

private _s = "concrete_hall"; 

if ( "Grass" in _s || "Soil" in _s || "Weed" in _s || "Beach" in _s ) then {true}; // 0.0029 ms
if ( "Grass" in _s || { "Soil" in _s } || { "Weed" in _s } || { "Beach" in _s } ) then {true};  // 0.0038 ms
if ( "Grass" in _s || { "Soil" in _s || { "Weed" in _s || { "Beach" in _s } } } ) then {true};  // 0.0039 ms
proper sail
#

because you are checking for concrete_hall so it will check all

#

check for grass, im guessing the bottom one will be the fastest then

still forum
#

bottom one is the slowest obviously. as neither of the conditions are true and it has to nest into each of them

winter rose
still forum
#

┬─┬ γƒŽ( γ‚œ-γ‚œγƒŽ)

spiral fractal
#

ah, I understand now, the { } only useful when condition is true asap
I set it to "concrete_hall" to check the "worst case"

#

if I do setUnitTrait every 0.5s it will cause server bandwidth to increase right, it will send data to the reset of the players?

still forum
#

afaik unit traits are shared, so yes

spiral fractal
#

I added flag that (if will work as intended) will change value only if previous value was different, probably the most I can do...

spiral fractal
#

is it possible to search for "EAST" for example in nearEntities? I want to find enemy that dont know about the player

fast harness
#

There is no way to access a function (*.sqf) from addon in mission files?

I defined
missionNamespace setVariable ['TestFunction', compileFinal preprocessFileLineNumbers "fnc_test.sqf"];

But I can't call it in the mission ( "Test" call TestFunction; )

winter rose
#
_nearEntities select { side _x == east };
#

@spiral fractal ↑

#

@fast harness there is
either function viewer if declared in CfgFunctions,
or you can execVM its addon path

fast harness
#

Just updated my post

#

Okay.. but in this way I have to double handle the declarions (in addon and mission file) ?

winter rose
#

in addon = globally declared, same as BIS fnc

fast harness
#

ty; I'll give it a try via CfgFunctions

#

😦

#

The Server has -serverMod=@testlib , the client doesnt know this mod

winter rose
#

yes

#

server-side addon = server-side function yes

fast harness
#

ah okay, so there is no way to push the function to the client ?

winter rose
#

add the CfgFunctions to the mission! otherwise, the functions could be overridden.

fast harness
#

Ah

#

But in this way, I have to load the addon on client too, right?

winter rose
#

CfgFunctions and file in the mission yes

fast harness
#

okay, thanks πŸ™‚

winter rose
#

you have to choose:

  • server-side only function: server-side addon
  • server-side & client-side: either both have the addon, or the mission defines the function in its own CfgFunctions
quartz pebble
#

CfgFunctions
As far as I understand, CfgFunctions is a member of description.ext.
Does that mean that if I use CfgFunctions I have to get back to editor and make a save each time I wish a CfgFunctions structure update?

winter rose
#

CfgFunctions can be a part of an addon

quartz pebble
#

That makes the situation even worse))

winter rose
quartz pebble
#

I mean, my experience says using CfgFunctions makes the local development extremely slow.

fast harness
#

Hmm I didnt use the eden editor, just only for unit placements...

winter rose
#

@quartz pebble every time you Ctrl+S or start the mission, description.ext changes are updated/loaded

quartz pebble
#

Yeah, thats exactly what I mean. You can do "Start mission" only if you work on a tiny one.

#

But if it is a medium-to large and requires you to do a number of steps after the mission start to prepare the environment for your script run..
Then exiting to editor, restarting, setting environment becomes a too much time eater.

fast harness
#

Yep. I agree.. to setup an dev environment (build scripts, copy, restart and more) takes a lot of time

winter rose
#

don't develop your functions and your mission at the same time πŸ˜›
(I know, sometimes you have to)

fast harness
#

Heheh didn't do that πŸ˜„

quartz pebble
#

don't develop your functions and your mission at the same time
If you work on a multiplayer mission then you don't have an other option.

fast harness
#

I prefer the way: Just setup both projects (mission and addon) in your IDE and make some magic in Powershell πŸ™‚

quartz pebble
#

And I work on a mission as on a mission and then when PBO builds, the build scripts separarate the SQF code onto mission and addon pbos.

fast harness
#

Thats nice πŸ™‚

winter rose
#

If you work on a multiplayer mission then you don't have an other option.
youuu do, if you know what you are doing πŸ‘€
I develop my MP missions in SP, then eventually debug them with friends if needed

steel fox
#

☝️

quartz pebble
#

I develop my MP missions in SP, t
I guess everyone does so.
By the way. I gues what BIS CfgFunctions framework does - is takes your files and runs compile preprocessFileLineNumbers or compileFinal preprocessFileLineNumbers.
Or it also does any other useful things?

winter rose
#

compileFinal* so it is protected
it also defines _fnc_scriptName variable(s) and meta data too

quartz pebble
#

which kind of meta data?

winter rose
#

freshly baked yesterday for your eyes only πŸ˜„

#

you can also make them execute before or after init, etc

#

it makes coffee, too

quartz pebble
#

I feel that framework was designed to separate BIS devs who write code from devs who make missions.

winter rose
#

well, it's a framework

quartz pebble
#

"just take a suitable func from a lib and don't think how it works"

winter rose
#

yep!
also, prevents a super-useful function to be lost in one single mission

#

also helps the community to work with a lot of stuff - I mean, tasks without the Task Framework? buh!

quartz pebble
#

Sure. I totally understand why BIS implemented the framework as it is. It solves their problems.
But what I can't understand though, is why a single mission maker would use the framework for his in-mission scripts? Which problems the framework would solve for him?

exotic flax
#

Arma 3 doesn't force you to use the (new) Task Framework, since it's still possible to use the "old" functions to do exactly the same. It just makes it easier for mission makers to create/read/update/delete tasks and keep track of them

quartz pebble
#

We're not about the tasks framework, we're about CfgFunctions framework.

exotic flax
#

again; not required, just extremely useful, especially to prevent people from overwriting your stuff

quartz pebble
#

just extremely useful
Which way (for an MP mission)?

steel fox
#

From a bloody programming principle perspective

exotic flax
#

especially to prevent people from overwriting your stuff

quartz pebble
#

especially to prevent people from overwriting your stuff
How would they override your stuff?

winter rose
#
My_Function = compileFinal { /* code */ };

is "fine" too… as long as you set it for all your clients and the server 😐

#
My_Function = compile { /* code */ }; // not compileFinal'd
```can be overridden by a malicious `publicVariable`
quartz pebble
#

The question is - how that malicious publicVariable happens on the server? Through a cheat?

steel fox
#

when an exploiters runs arbitrary sqf

exotic flax
#

I can think of multiple ways to execute sqf on MP servers...

#

but won't go there since it's against TOS and #rules

quartz pebble
#

I think if someone malicious can run an arbitrary sqf code on the server, overriding your funcs - is the last thing you must care aboutπŸ˜…

winter rose
exotic flax
#

so why not do it correct from the start, so that it doesn't break your mission/mod...

spiral fractal
#

is it possible to set whitelist in server.cfg that will only allow whitelisted UID to join?

quartz pebble
#

not do it correct from the start
Making a developer return to editor and Save each time he needs to update a structure of functions - is not what I'd call "correct"πŸ™‚

exotic flax
#

create CfgFunctions once, start game once, modify scripts on the fly...

spiral fractal
#

it would be good if it was possible to simulate dedicated server in editor

exotic flax
#

just because you don't know HOW to do it, doesn't mean it's bad by default...

#

and I usually write my scripts within a mission (easier to debug) and move them to a mod

#

trust me; restarting the game every time you make a change is worse!

quartz pebble
#

create CfgFunctions once, start game once, modify scripts on the fly...
And if need to add/remove a function? That's not what can be done without exit to editor

winter rose
#

then make a simple execVM, what can I say

#

1/ define your functions
2/ code your mission

ideally, not both intertwined

quartz pebble
#

Ok, some ahother thoughtsπŸ™‚
Assume arma can't protect against a malicious publicVariable (it is a legitimate command itself - how can arma know what's inside Β―_(ツ)_/Β―)
But what if there is some code you wish to run on clients but don't wont to include into a client pbo? (say, it is secret)

exotic flax
#

make a server mod which includes the functions (so it's only loaded on the server)

#

however this also means it can only be executed by the server

quartz pebble
#

But somehow you'll need to pass it on client to run there

exotic flax
#

if a client needs to run it; it needs to be available on the client

#

although you could make a function which triggers a function on the server πŸ€”

winter rose
#

why would you transmit code through network, as it is both
1/ unsafe
2/ network-hungry

this is why it is in the bad practice list!

quartz pebble
#

There are two opposite requirements: "the client needs it" and "you don't want anyone to see it"πŸ™‚

#

(and that is only for a couple of funcs - not for the tons of code)

winter rose
#

this is bad too:

[[], { player setDamage 1; }] remoteExecCall ["spawn"];
#

but doable

#

"less bad"

exotic flax
#

got a feeling it's another L*fe developer 🀭

winter rose
#

but people can see it if they do an allVariables missionNamespace…

exotic flax
#

There are two opposite requirements: "the client needs it" and "you don't want anyone to see it"πŸ™‚
if the client needs it, the clients needs to have access to it...
if the client shouldn't see it, either protect your pbo or find a way to have the client execute a function from the server (which in return executes it on the client / all clients)

#

but in the end it's Arma, a sandbox, where good programming solves 50% of security issues, and proper server configs the other 50%

quartz pebble
#

Or the other way: pass the code to clients through the publicVariable, and then compileFinal on clients?

exotic flax
#

that will still show the full function on the client...

quartz pebble
#

Only for those clients which know how to dump traffic or memory.

winter rose
#

or access SQF

quartz pebble
#

or access SQF
I bet they are less numerous then those who know how to dump

winter rose
#

are you kidding? how many Debug Consoles are active out there…

if you want super code safety, it's
client β†’ params β†’ server
client ← results ← server
period

quartz pebble
#

how many Debug Consoles are active out there
Define "debug console". I'm serious. I've never investigated.

exotic flax
#

which can be accessed even on MP, either when mission/server is broken or with hacks

#

and trust me, the amount of script kiddies out there have access to it...

quartz pebble
winter rose
#

and that's the issue here
CfgFunctions makes it readable, but read-only

slim verge
#

might be missing something here.. @quartz pebble is your aim to create code that is unreadable to others ?

quartz pebble
#

Let's say I'm just thinking aloud.

slim verge
#

well the answer would be to me anyway, yes no or i dont know

exotic flax
#

unreadable by clients, but executable by clients

slim verge
#

so taking this another step, you want to write code for your project but you dont want others to see, copy your code ?

quartz pebble
#

unreadable by clients, but executable by clients
Mikero's tools. But that's another question: use or not to use. Philosophic ratherπŸ™‚

winter rose
#

anyway, logic-wise, always consider your clients as troublesome
you can only manage the server, therefore lock it up and secure it at best
make the clients ask the server, and the server answer the clients

the server is the one and only referee of the game

#

and hiding code is… meh

quartz pebble
#

Nowdays everyone tries to hide

exotic flax
#

not me... everything is open source (or not released yet)

slim verge
#

so here is my take on this, and this goes back to 2002 when OFP started. Since then most but not all code is a copy of someone elses work, developed and taken further. There is very little today that is "unique" as in not developed from someone elses work. Prior to "Life" the openess of using others code was very acceptable and allowed speedier development for new ideas.
The coming of the Life servers in my opinion poisoned all that, as far as i am concerned life server attitude to development stinks especially as very little of it is really any life server admins work

exotic flax
#

only thing I can think of to hide from clients are passwords and hashes... and for those there are other methods (although still readable on clients when accessible)

slim verge
#

as you can see from the reaction to that post I am not the only one that thinks this

winter rose
#

which is why I wrote this
https://community.bistudio.com/wiki/Code_Best_Practices#Final_words


    It soils your reputation and devaluates your actions once it is found out β€” and it always get found out. DMCA's are filled on Steam every day.
    It makes people in the community get less helpful and more reluctant in giving advices. It can also prevent them to release an interesting feature!

Don't try to obfuscate your code: it is considered rude, especially since you learnt from others.

    Obfuscated code only makes it harder to get, but does not make it copy-protected. If the engine can read it, it can be obtained.
    Obfuscated code is also slower on compilation (and, depending on the quality of code and obfuscation, on execution too).```
oblique arrow
#

I wonder if there's obfuscation tools for SQF

quartz pebble
#

which is why I wrote this
This has to be added as a warning to all obfuscators

winter rose
#

I wonder if there's obfuscation tools for SQF
oh, there are. guess the community

oblique arrow
#

If the people making the obfuscators shared the opinion of that text they propably wouldnt be making obfuscators @quartz pebble

slim verge
#

and in addition everything I release is open source for good reason. For historical evidence, take a look at an addon from many years ago called Tx_Utils and then look at one of the better known frameworks and look for systems in there that are based on that (There is a lot)... Happy to see it being used and happy it has become popular and used by so many. My repayment for many many years of fun in OFP/ARMa and by christ i get annoyed by the arrogance of those thinking they are better than anyone else and their code is so bloody special

#

rant over my blood curdled there for a bit

wraith cloud
#

especially as very little of it is really any life server admins work
That's just false

winter rose
#

@wraith cloud most of L*fe servers are full of stolen content. Not all of them.

#

either that or most of the thieves are in the L*fe community, maybe

wraith cloud
#

Those that have stolen content are irrelevant modded servers that last for a month or two

exotic tinsel
#

can someone point me in the direction of a link to replace an action key? i dont want to do a waituntil for someone to hit a key. but i cant remember or find the url that told me how to for example execute my own script when someone opens the map.

winter rose
#

@wraith cloud like, ANZ*S?

wraith cloud
#

I've heard that, yeah

exotic tinsel
#

eh, there was something i found so that i wouldnt have to worry about the key they pressed on the key board, rather it would fire no matter what they had the action bound to.

exotic flax
quartz pebble
#

got a feeling it's another L*fe developer
@exotic flax Now I understand what did you mean🀣
Nope. Ours is another one. (Don't know if #rules) allow placing server links.

exotic tinsel
#

@exotic flax that still relys on knowing the key they pressed. Crap. This UI guy in the past showed me how to do it and i cant find the src. fml.

#

if it helps with figuring out what im talking about i would have to add the code the description file. What im trying to do is replace the action for when someone opens the map to instead run my script.

#

that way it doesnt matter what key they bound the map too.

winter rose
#

well, that too veteran πŸ˜„

hollow thistle
#

he said he does not want to poll for keyPresses

winter rose
#

can someone point me in the direction of a link to replace an action key?
weeell :p
EH it is then

exotic flax
#

although you can use that in combination with CBA settings (for custom keybinds) or the User Action keys (in combination with inputAction and/or actionKeys)

exotic tinsel
#

sorry @winter rose that was my bad, poor wording on my part.

winter rose
#

(okido!)

exotic tinsel
#

with out the waituntil loop

hollow thistle
#

you can't.

#

you can check on keyPress what inputAction is pressed.

#

so add keyPress EH to mission display.

exotic flax
#
moduleName_keyDownEHId = findDisplay 46 displayAddEventHandler ["KeyDown", {
   if (inputAction "User1" > 0) then {
      // execute code
   };
}];
exotic tinsel
#

ok so if i use that, what i can do to prevent the original action from firing, so to stop the map from opening. So that it doesnt flash on the screen when i use the code i know to close it.

winter rose
#

you would need to override it by returning true at the end of it

exotic flax
#

perhaps explain what you want to achieve, because now we give solutions to problems you don't seem to have(?)

exotic tinsel
#

@winter rose got it

exotic flax
#

eg. if you want someone to not being able to open the map, remove the map from the player 🀣

exotic tinsel
#

im gonna use the code @exotic flax thx for all the help, again.

#

I want to write good code. even though im new. i have a custom gui for the map that i have been working on and now its time to activate it when someone opens that map. I dont want it to be clunky and i want it to run well. I all all the validation for whether or not to open it but i needed this code you provided. thanks all.

quartz pebble
#

eg. if you want someone to not being able to open the map, remove the map from the player
@exotic flax Lets say.. There are some scripts in the mission I don't want public to avoid unnecessary questions.

exotic flax
#

how is that quote related to your comment? πŸ€”

quartz pebble
#

The quote does not show whom it is addressed to Β―_(ツ)_/Β―
If that wasn't me - ignore my answer

winter rose
#

the map question was LifeSnatcher's πŸ˜„

quartz pebble
#

Then my favorite smile: Β―_(ツ)_/Β―

exotic flax
jade abyss
winter rose
#

stahp itt

jade abyss
#

No, don't eat the frog!

exotic flax
#

nom nom nom nom

jade abyss
#

:imageofragingpepe:

#

Now back to scripting, peasants!

winter rose
#

Yes, my liege

jade abyss
#

(wow, you gave up qui... oh)

#

πŸƒ

winter rose
#

πŸƒπŸ”¨

spice vigil
#

Before I go on a wild goose chase, is it possible to have an item that when you hold it allows you to have an action in your scroll bar that you can use up?

#

For example, a button misc item that teleports an item in.

winter rose
#

you can script that if you have an object of type "x" in your inventory, an action appears yes

spice vigil
#

Awesome, just making sure before I research how to do it, that it's possible.

queen cargo
#

Addaction has a condition property @spice vigil
Just Check if the Player has that given item in any inventory 😜

spiral fractal
#

X39 when I see your avatar I read the message with that character voice πŸ˜„

calm bloom
#

Hello, comrades! Can anyone remind me of the command, that renders object beyond objectviewdistance?

exotic flax
#

setViewDistance ?

#

or setObjectViewDistance?

calm bloom
#

no, it was kinda specific for one object

winter rose
calm bloom
#

Thank you!

ivory jetty
#

I'm having some issues wrapping my head around triggers, inits and remote execution. I've got a briefing area set up in my mission, which is enclosed in a trigger area; I want to set it up to warn players if they are leaving the area before I've finished the briefing.
My trigger is set up as a simple this trigger, with the activation condition being that any player exiting the area should trigger it. I set the OnActivation and OnDeactivation to be as follows:

[parseText "<t size='2.0'>Please do not leave the area while the briefing is in progress</t>"] remoteExec ["hint", thisTrigger];```
``` OnDeactivation
 [""] remoteExec ["hint", thisTrigger];```

Testing it with a friend, though, it appears that once the server is hosted, the trigger doesn't appear to do anything? I'm pretty sure the `targets` parameter of `remoteExec` can target an object, so it should target the client of the player who leaves the trigger, correct?
winter rose
#

is the trigger server-side only?

ivory jetty
#

Not set as such, no.

winter rose
#

try thislist instead of thistrigger - this will hint only to units in the trigger

gloomy onyx
#

hey guys, anyone willing to help with an addaction within the init.sqf? It works when I test it locally but not on a dedi server. Can I send someone the init.sqf for someone to look at please?

exotic flax
#

_object addAction []; or player addAction []; should work without issues in init.sqf so I guess you have an issue elsewhere, which should pop up when you check your log files or have -showScriptErrors enabled in the command line parameters

ivory jetty
#

Tried again with thisList, still doesn't appear to be doing anything.

gloomy onyx
#

@exotic flax nothing in the rpt and no script errors. I am trying to get the mission to end at an "Officer" when you reach him, officer addAction ["End Mission", "endmissionstate.sqf"];

#

can I put it in the init box of the unit?

exotic flax
#
this addAction [
   "End Mission",
   { [] execVM "endmissionstate.sqf"; }
];

this would be better

#

and please check the documentation of addAction, because you can't just call a file directly

#

hmm... it is possible, although IMHO a bad idea

gloomy onyx
#

ok cheers mate

spiral fractal
#

is it possible to lock UAV so that only specific player will be able to control it?

spiral fractal
#

this is the code I have:

_u = [getPos spawnflag, 340, "B_UAV_02_dynamicLoadout_F", west] call BIS_fnc_spawnVehicle;
//(_u # 0) setVehicleLock "LOCKED";
player connectTerminalToUAV (_u # 0);
_wp = group (_u # 0) addWaypoint [position player, 0];
spice vigil
#

Okay, follow up question: What would I add into the Config.cpp class to get the item to give the player the action to activate the sqf script? (anyone have an example, I've been trying to research it but, again, I'm at a loss. Haha).

simple notch
#

Im looking to get into Arma scripting. just been roaming the wiki, it'd be nice to have someone I can go to for questions, please dm me. Thank you

astral dawn
#

You can post your questions here 🀷

simple notch
#

I guess, I just don't want to flood the chat

exotic flax
#

but 1000 people know more than 1 πŸ˜‰

simple notch
#

Fair enough πŸ€·β€β™‚οΈ

still forum
#

I just don't want to flood the chat
But thats exactly what this channel is for πŸ˜„

simple notch
#

Only experience I have with programming was when I took 2 years of learning computer science in high school(java) and very minimal c++. I've just been scrolling the wiki for probably 3 days straight trying to find guides or something to help me progress and it I haven't really gotten anywhere because I don't know where to start, I look at snippets of arma scripts and they look entirely different from what I understand, I just need a guide I guess to help me get started

#

Im like 3 hours deep into this 18 hour c++ course

still forum
#

knowing a language like c++ will probably help you understand the underlying concept of SQF. Mainly the syntax and generally how things work and why (all because of the syntax basically)

simple notch
#

Is it a good place to start? Where do I go to progress in the future?

still forum
simple notch
#

IInteresting

#

Got me kinda confused, so scripts are written in sqf?

still forum
#

Yeah

simple notch
#

Oh

#

Ight I think im good for now im gonna look into sqf

#

Thanks g

winter rose
spiral fractal
#

if you played some mission that you liked or want to build something similar, you can check if it has github repo and learn from it too

spice vigil
#

Okay, so I have changed my mind a little bit. I would like to make a custom grenade (which I can do) which triggers a sqf supply drop (which I can also do). But what I can never figure out is the config. Like what would I put in the config of the grenade class to activate the sqf script? XD (Quickly Favs all of those links, haha)

spiral fractal
short sparrow
winter rose
#

@short sparrow you can install it directly from visual studio code, no need to download it from github

#

go to the modules panel, look up sqf, it will be in the list

short sparrow
#

I search by 'sqf' and I can't find any sqf-formatter

misty salmon
#

Hello everyone, does anyone know the difference between playMove and swtichMove? Because Im trying to do an animation menu, en some animations plays with playMove and others with switchMove

young current
#

I recall those are explained on the wikipages for those commands?

exotic flax
#

The difference between playMove and playMoveNow is that playMove adds another move to the move queue, while playMoveNow replaces the whole move queue with new move

agile pumice
#

would have been nice for cargoindexes to be a param for getIn/getOut eventhandlers

exotic flax
#

you can already see if it's a "driver", "gunner" or "cargo" seat, so if "cargo" simply do a _cargoIndex = _vehicle getCargoIndex _unit;

agile pumice
#

last time I checked, that couldn't be used for the getout event. It would always return a null as if it was too late to retrieve the value

#

I'll test it again

exotic flax
#

not sure about GetOut, since technically it should be empty because the unit is not in the vehicle anymore

agile pumice
#

yeah thats what I mean. I believe in the past I set a user variable for the cargo index when they got in, and then got the variable when they got out

exotic flax
#

getCargoIndex probably also won't work on GetOut since it needs to be in the vehicle to get the current index.

#

probably the best way to handle it is to have a GetIn EH (on vehicles), and add a GetInMan and GetOutMan EH on the unit entering (including a variable with cargoIndex, which can get updated with GetInMan for position changes) and remove the EH's on GetOutMan.

ionic anchor
#
    _Functions_CT_TREE tvAdd [[], "Primary Weapons"];
    _Primarylist = "getnumber (_x >> 'type') isEqualTo 1 AND getnumber (_x >> 'scope') isEqualTo 2" configClasses (configfile >> 'CfgWeapons');
    {
        _text = getText(configFile >> "CfgWeapons" >> configName _x >> "displayName");
        _pic = getText(configFile >> "CfgWeapons" >> configName _x >> "picture");
        _Functions_CT_TREE tvAdd [[4],_text];
        _Functions_CT_TREE tvsetPicture [[4,_forEachIndex],_pic]; 

    } forEach _Primarylist;

    _Functions_CT_TREE tvSort [[4], false];
exotic flax
#

I believe the image size is tied to the text size

ionic anchor
#

if that's the case i might as well ditch the images lol

ivory jetty
#

How would I go about making all of my player's screens fade to black? I'm using the following, but it's throwing an error:

    [[0] BIS_fnc_fadeEffect] remoteExec ["BIS_fnc_spawn", player];
} forEach _allPlayers;```
spiral fractal
#

[1, "WHITE", 5, 1] remoteExec ["BIS_fnc_fadeEffect", -2];
maybe something close to this

ivory jetty
#

Can remoteExec be used to spawn a function?

ivory jetty
#

Tried that solution, using remoteExec to call BIS_fnc_fadeEffect has no effect, possibly because it requires a spawn command.

spiral fractal
#

if you call it in multiplayer (not dedicated server), using -2 will not show it to you because you are the server and client with owner id 2, you can set it to 0 and try again, but then it will be executed everywhere

ivory jetty
#

... This reminds me why I always loathed netcode.

spiral fractal
#

everything I code works fine in SP then I test it in MP its not working right, then I fix it and test on Dedicated server and its not working again, so I have to rewrite my code at least 3 times meowsweats

#

I should probably change my technique...

thorn saffron
#

I'm clueless when it comes to MP scripting, so here's my question:
if I use [] remoteExec ["muh_superfunction", 2]; to run a function on the server, then I call/spawn another function in that server side function, will the called/spawned function run only on the server, or will I have to keep using remoteExec with target of 2?
I don't want that nested function to polute clients

quartz pebble
#

Im looking to get into Arma scripting.
A minute of discussions.
How much it is worth investing into SQF learning, taking into account SQF will retire once the next ArmA is released?

astral dawn
#

A minute of discussions.
How much it is worth investing into SQF learning, taking into account SQF will retire once the next ArmA is released?
Equal to your amount of will to invest into coding side of this arma

#

I mean if you want to code for this arma, then that's the language

#

SQF is simple ||but extremely annoying||

unique sundial
#

@thorn saffron you remotely execute the function, so it starts and runs on remote machine, so any function it calls will be on remote machine too

warm hedge
#

How much it is worth investing into SQF learning, taking into account SQF will retire once the next ArmA is released?
It's always worth it until you're interested with SQFs in Arma 3, even after the release of the next Arma which uses another language

winter rose
#

there is also sqs if you want to avoid sqf

but joke aside, "how much is it worth", well: no SQF = no Arma scripting, that's it
you can wait years for a release that hasn't been announced, but that's your call

this channel is about Arma scripting though, and right now it is SQF

#

@spiral fractal, have you read the Multiplayer Scripting wiki article?

modern adder
#

Right, this is really confusing me

#

Whenever I call a function which is supposed to return a value and assign the returned value to a variable, for some reason the value ends up being the bloody code of the function itself

winter rose
#

if you are spawning it, then yes

modern adder
#

Oh

#

Is there a way to get around that?

winter rose
#

yes, use call

modern adder
#

I'm using call inside spawn

#

So it goes to the scheduler

winter rose
#

use the result inside the spawn then

modern adder
#

I'd send a screenshot, but I can't

#

What do you mean?

#

Is there somewhere I can send a screenshot to?

warm hedge
#

Use external service and put link

#

But why you want to send a shot?

modern adder
#

Oh, forgot about code tags lol

winter rose
#
if (_wantToShowCode) then
{
  call LM_fnc_useSqfTags;
};
modern adder
#

yeah kk

#
hEvaluateCombat = [] spawn // once fncEvaluateCombat has run, set bEvaluated to true
{
        bCombat = call fncEvaluateCombat; // call fncEvaluateCombat with within the scheduler
};
#

ah bugger

winter rose
#

see pinned message

#
[] spawn
{
  call SuperFunc;
  bEvaluated = true;
};
#

urgh Java β†’ SQF transition, brain has issues

modern adder
#

no, I want to get the returned value of the function

winter rose
#
[] spawn
{
  private _result = call SuperFunc;
  bEvaluated = true;
  // use _result here
};
modern adder
#

That's the thing

#

When I define a private variable instead of changing my local one, it gives me a generic error in expression

winter rose
#

why not show us the whole code? (if it's huge, use sqfbin.com)

modern adder
#

Which means it's still returning code

#

Alright, hang on

queen cargo
#

if you are returning code, you are literally returning code, not calling it somewhere

modern adder
#

I am calling it

#

This is what makes no sense

winter rose
#

you are returned a handle

#

spawn returns a handle

modern adder
#

I know

#

That is not what I'm talking about

#

I'm talking about the returned value of call

winter rose
#

if you hint the handle, you will see code, but that's not a Code type

if (!(isNil "_this select 0"))
```…ever heard of `params`, our Lord and Saviour?
modern adder
#

One problem at a time

#

It's line 52 I'm talking about

#

Not spawn, not anything else

#

That always throws a generic error in expression

warm hedge
#

And Lou just pointed the problem didn't he?

modern adder
#

No

#

My spawn handle is unrelated

winter rose
#

so in an eventHandler, you want to define _Combat, that is not used anywhere else

modern adder
#

OH wait

#

I copied the wrong code

#

Damnit

warm hedge
#

F

modern adder
#

πŸ˜…

winter rose
#

please just paste the faulty code, not the whole page too ^^"

modern adder
#

bCombat = call fncEvaluateCombat; // call fncEvaluateCombat with within the scheduler

#

Right, this is the line I'm talking about

#

bCombat is defined elsewhere as bool

queen cargo
#

at what point are you getting code returned

#

what line

modern adder
#

THAT line

#

bCombat = call fncEvaluateCombat; // call fncEvaluateCombat with within the scheduler

queen cargo
#

number in your paste

modern adder
#

I'm really confused

#

Do you want all the code, or do you just want to faulty line?

#

Right, all the code is here

#

Line 48 is the line I'm talking about

#

bCombat = call fncEvaluateCombat; // call fncEvaluateCombat with within the scheduler

queen cargo
#

bCombat = call fncEvaluateCombat returns a code type (typeName bCombat == "CODE") according to you
what line number is bCombat assigned at, where is fncEvaluateCombat starting

modern adder
#

bCombat is assigned right at the start

#

function starts at line 6

#

I believe it's returning code yes

#

That's the only way it could be a generic error correct?

still forum
#

fncEvaluateCombat never returns anything, thus you cannot store its result in a variable if there is no result

#

you are trying to store something thats not there in a variable -> error

modern adder
#

It should, I followed the guide on the biki to a tee

still forum
#

it doesn't

#

and no it shouldn't

modern adder
#

How do I return something then?

still forum
#

You return combat = false; but assignment doesn't return anything

modern adder
#

Ohhh

#

God this language hurts my head

#

How do I assign the return of the function then?

still forum
#

combat = false;
->
combat = false;
false;

#

return the false

modern adder
#

bruh

still forum
#

don't return the leftover empty space that the assignment left around

modern adder
#

Are you bloody serious

still forum
#

Or, even simpler

#
fncEvaluateCombat = {
if (...) then {...} else {...};
combat
}

just return the combat variable that you are setting anyway

#

btw, its VEEERY bad practice to set global variables without a unique prefix

modern adder
#

Yep, thanks for reminding me

#

Was going to do that

still forum
#

Its very likely that some other script might use the combat variable too and mess up your stuff

modern adder
#

Ok, cheers

still forum
#

isNil "_this select 0" thats not valid

modern adder
#

I'm trying to select the first argument, and if it exists return true

#

What would be?

still forum
#

And as Lou said, just use params with a default value

modern adder
#

Okay, I'll look into that

#

Thank you

#

Sorry for all the confusion

still forum
#
params ["_uEnemy", objNull];
if (!isNull _uEnemy) then {...} else {_uEnemy = uSelf findNearestEnemy uSelf; ...}
modern adder
#

By the way, is not the same as !?

#

Operator wise

winter rose
#

exactly the same

modern adder
#

Okay, cool

still forum
#

Or even better..

New:

fncEvaluateCombat = // defines fncEvaluateCombat, which evaluates if the player is in combat or not
{
    params ["_uEnemy", objNull];
    if (!isNull _uEnemy) then {
        _uEnemy = uSelf findNearestEnemy uSelf; // find the closest enemy to the player and store them in uEnemy
    };
    private _uEnemy = uSelf findNearestEnemy uSelf; // find the closest enemy to the player and store them in uEnemy
    private _iEnemyKnowledge = _uEnemy knowsAbout uSelf; // find out how much the enemy knows about the player from a scale of 0 to 4
    private _iSelfKnowledge = uSelf knowsAbout _uEnemy; // find out how much the player knows about the enemy from a scale of 0 to 4
    if ((_iEnemyKnowledge > 0) and (_iSelfKnowledge > 0))  then // if the closest enemy is alerted to the player's presence, and the player is alerted to theirs
    {
        hint "Warning! Entering combat!";
        true;
    } else {
        false;
    };
};

just get rid of the duplicate code.

winter rose
#

params ["_uEnemy", objNull]; DEDMEN πŸ‘€

still forum
#

huh

winter rose
#
params [["_uEnemy", objNull]];
still forum
queen cargo
#

no worries
every men has theese kind of problems sometimes πŸ˜‰

winter rose
#

he wants to be on my paddlin' list but he won't!

surreal peak
#

What does having objNull in params achieve?

still forum
winter rose
#

@surreal peak basically:```sqf
params [
["_identifier", defaultValue, [allowed, types], [ifArrayAllowedSizes]]
];
// e.g
params [
["_unitPosition", [0,0,0], [[]], [3]],
["_unitDamage", 0, [0]],
["_lock", 0, [0, true]] // accepts numbers and booleans
];

#

to old timers: was Operation Flashpoint's Desert Paintball always in the game (a.k.a in the v1.00)?
Got my answer: Real Paintball arrived in 1.40 patch

narrow pollen
#

is the volume value in 5 fadeMusic 0.5; based on the client's music volume slider?
Let's say a client has the slider at 30%. Does that mean '0.5' volume would be 15% for that client, e.g. that specific client's master music volume?

winter rose
#

yes, % of the client's setting. and no, you cannot force 1 to clients

narrow pollen
#

Thanks.
Does 1 not just mean it will be the max volume as defined with the client music volume slider?

winter rose
#

1 = max of the client's setting, yes

#

if it's 0, it's 0

narrow pollen
#

Yeah, since it's a percentage of it

#

Thanks, I didn't want to blast clients' ears

hollow thistle
#

you can also do 5 fadeMusic 2; to increase the volume tho.

winter rose
#

range is 0..1 @hollow thistle?

lone zenith
hollow thistle
#

@winter rose no? you can bump the volume

#

wiki is not right there.

#

At least in editor played mission.

#

Might be limited in MP like playSound.

winter rose
#

ah well, this page has not been visited in ages so maybe then - anyway, the game's experience is always right πŸ™‚

hollow thistle
#

I just tried 5000

#

dont do that.

warm hedge
#

Variable feedback! πŸ˜‚

winter rose
#

maaaybe we should ask for a limitation

lone zenith
#

Lou? You think you could help me out?