#arma3_scripting

1 messages ยท Page 519 of 1

robust hollow
#

correct (assuming those are .sqf file type)

jolly tendon
#

yes they are!

robust hollow
#

๐Ÿ‘

jolly tendon
#

And then is that correct? or do i take off the fn_

robust hollow
#

take off fn_

jolly tendon
#

Ok, cool.

#

So then when i call those, I do [arguments] call HP_fn_createGroup

#

?

robust hollow
#

yes

#

no

#

HP_fnc_createGroup

jolly tendon
#

does the system just recompile it into that?

#

Just one last check!

robust hollow
#

looking good ๐Ÿ‘Œ

jolly tendon
#

awesome! Thanks so much. I've never used functions like this before, only scripts.

#

Could I get your help with one other function? This one is a little more in depth

robust hollow
#

depends what it is

jolly tendon
#

Its supposed to create groups of units that have dynamic variable names (so that every single group has a unique name)

#

(_this select 3) params ["_side","_groupSize","_spawnPosition"];

//determine side of units
if ("_side" isEqualTo "EAST") then {
    //create the group and name it 
    private _group = createGroup ["EAST",true]; // why is there a 1 in your script?
    private _id = time; //(or sth similar to identify it)
    private _groupVarName = format ["EastGroup:%1",_id];
    missionNamespace setVariable [_groupVarName,_group];
    // access it later again:
    _groupVarName = format ["EastGroup:%1",_id];
    _group = missionNamespace getVariable [_groupVarName,grpNull];

    if (!isNull _group) then {/*group exists*/};

    for [{private _i =0}, {_i = _groupSize}, {_i + 1}] do {
        //create random units and add them to the group
        private _unit = group player createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"];

                    


    };
}else{
    //same code, but for West
}; 
#

This is what I have so far, but I'm not sure it'll work

robust hollow
#

can confirm, it will not

jolly tendon
#

easy enough!

robust hollow
#

"_side" isEqualTo "EAST" will always be false because "_side" is not "EAST".

#

is _side a string or type side?

jolly tendon
#

_side is passed in as a parameter from the function caller...at least that's what I want it to do lol

#

passed in as a string

robust hollow
#

yea, but you write _side in quotes so its comparing string "_side" to string "EAST". you want _side isEqualTo "EAST"

jolly tendon
#

Oh i see, that makes sense!

#

no clue why I did that

robust hollow
#

that condition in the for loop is wrong as well

#

_i = _groupSize doesnt return true or false

#

not to mention _groupSize isnt defined, but i assume this just a snippet of a bigger script.

#

o rip

#

its in params, never mind ๐Ÿ™‚

jolly tendon
#

so that doesn't act as the "maximum" of the for loop? I was thinking of it as for i=0:_groupSize, do {}

#

My background is in C++ and MatLab so SQF has been a earning experience lol...and come on, give me SOME credit lol๐Ÿ˜œ

robust hollow
#

its the condition the loop will exit on when true.
_i == _groupSize or _i > _groupSize is probably what you're after.

jolly tendon
#

Ohhhh, I just missed an =, ok. cool

#

when I added that second =, it started throwing errors for undefined vars

robust hollow
#

paste error here

jolly tendon
#

my IDE just says possibly undefined variable _i

#

in line 18

robust hollow
#

nahh itl be fine

jolly tendon
#

ok!

#

Is the logic for the group naming sound?

robust hollow
#

if you want it to go away you could do for "_i" from 0 to _groupSize do {

wary vine
robust hollow
#

it makes sense, i feel like you may end up with some double up names using time but itl do. may want to consider using random as well, so ur var would be format["EastGroup:%1:%2",time,random 99999]

jolly tendon
#

Oh ok, yea I thought about that too! I just didn't know if it worked like that. Yea that's a good idea

wary vine
#
for "_i" from 0 to _groupSize do {

};
robust hollow
#

@wary vine do you scale ur ui sizes or just straight pixel grid coords?

wary vine
#

it should use the 3den macros

jolly tendon
#

Do units need to each have unique names?

wary vine
#
#define pixelScale    0.50
#define GRID_W (pixelW * pixelGrid * pixelScale)
#define GRID_H (pixelH * pixelGrid * pixelScale)
#define CENTER_X    ((getResolution select 2) * 0.5 * pixelW)
#define CENTER_Y    ((getResolution select 3) * 0.5 * pixelH)

jolly tendon
#

or can I just use _unit each time?

wary vine
#

if you use the units outside of the loop, you will need to give them unique names, but it looks in your case you don't need to

jolly tendon
#

Ok, so my end goal is to add each of these units to the group we just created, and then I'm going to pass that array as a return value. I'm going to then give them a way point. Is that done on the group level?

robust hollow
#

i recently had issues with 16:9 vs 4:3 and sorted out scaling like this:

    // Mission UIs were built using small UI scale.
    // These values are used to properly scale UIs for different sizes.
    #define GRID_W_SCALE (0.00126263 * 8 * 0.50)
    #define GRID_H_SCALE (0.0016835 * 8 * 0.50)

    #define PX_WA(n) n*GRID_W
    #define PX_HA(n) n*GRID_H
    #define PX_WS(n) n*(GRID_W*(GRID_W_SCALE/GRID_W))
    #define PX_HS(n) n*(GRID_H*(GRID_H_SCALE/GRID_H))

    #define CENTER_XA(n) (CENTER_X)-(0.5*(PX_WA(n)))
    #define CENTER_YA(n) (CENTER_Y)-(0.5*(PX_HA(n)))
    #define CENTER_XS(n) (CENTER_X)-(0.5*(PX_WS(n)))
    #define CENTER_YS(n) (CENTER_Y)-(0.5*(PX_HS(n)))

I feel like it may not quite do the job for you though, you may need to set max sizes based off the resolution so it cant go off the screen.

wary vine
#

I shall take a look.

jolly tendon
#

@robust hollow my functions are still throwing Takitest\functions\fn_countGarrison not found

robust hollow
#

is this a mission or mod?

jolly tendon
#

Mission!

robust hollow
#

so your folder structure is <missionRoot>\Takitest\functions\<*.sqf>?

jolly tendon
#

no, Takitest is the mission file name

robust hollow
#

remove it from the filepath

jolly tendon
#

is it just \functions

#

or just functions

robust hollow
#

functions

jolly tendon
#

this is in cfgfunctions.hpp correct?

robust hollow
#

yes

jolly tendon
#

cause just functions didn't work either

#

class HP {
    tag = "HP";
    class HPfunctions {
        file = "functions";
        class countGarrison {};
        class checkSectorOwners {};
        class createGroup {};
        class initGarrisons {};
        class isSectorCaptured {};
    };
};
#

missions\Takitest.takistan\functions and this is where the functions file is

#

folder* not file

robust hollow
#

r u testing this in editor?

jolly tendon
#

yes, in SP

#

as in, in editor with SP mode

robust hollow
#

are you reloading the mission in editor when you edit ur config?

jolly tendon
#

Nope, didn;t realize I needed to

#

Ok, I think that was the error!

#

Thanks for all your help, I really appreciate it!

#

...I actually have one more question....

#

So I know you can access classnames by doing _configs = "true" configClasses (configFile >> "CfgVehicles"); Is there a way that I can then access the specific unit classnames for like rhs_faction_msv? Or would I have to use some sort of loop for that? I want to set up dynamic troop creation with arrays of all of the faction infantry

#

Could I take that one step further and do _configs = "true" configClasses (configFile >> "CfgVehicles">>"rhs_faction_msv");?

robust hollow
#

configClasses seems like a weird way to go about it but yea, keep using >> as deep as you want to go

jolly tendon
#

Is there a better way to do it?

#

I just don't want to write out 500 class names by hand

robust hollow
#

then use it once to get the list of units and then define that list so you dont need to sort through all the vehicles every time.

jolly tendon
#

that's a good point. Thanks.

jolly tendon
#

How do I get a return value from a function? exitWith says it just returns a value from the current scope, so if I'm in an ifstatement or switch, statement how do I exit the whole script with that desired value?

#

This is my code, sorry for the length

robust hollow
#

exitwith is used instead of then. not how you have it

jolly tendon
#

oh ok. So how do I return then?

robust hollow
#

case 0:{[]}; will return the array

jolly tendon
#

I'm sorry, I don't understand what you mean

robust hollow
#

in other languages you have return <value> to return a value. in sqf it returns the result of the last operation in the scope. so if your last operation in a case is stating an array, it will return that array.

#

you set the array to variable _infantryArray. you dont need to if thats all the case does

jolly tendon
#

so do I need to include some sort of like...dummy or holder array? or can I literally just hang _infantryArray

#

?

robust hollow
#
case "rhs_faction_usarmy": {[ 
    "rhsusf_army_ocp_rifleman_1stcav",
    ...
    "rhsusf_army_ocp_helicrew"
]};

will work

jolly tendon
#

Oh ok, so I just need to remove the exitWith and i'm good to go?

robust hollow
#

no, because you set ur array to a variable

jolly tendon
#

Ah ok, I see now

#

its a little weird to me that the switch statement will just exit out of the script once its done

#

Although I guess it makes sense if none of the other conditions are met and its not a loop

#

Works great, thanks.

wary vine
#

@robust hollow Ended up fixing it by allowing the end user to modify the dialog size multiplier

#
#define DIALOG_MULTIPLIER (profileNamespace getVariable ["Lega_Dialog_Multiplier", 0.70])
#define DIALOG_W 175 * DIALOG_MULTIPLIER
#define DIALOG_H 175 * DIALOG_MULTIPLIER
#

It sort of makes my uis independent of interface size, as that was what was messing with it.

astral dawn
#

Maybe there's a faster way to add vectors longer than 3?
vectorAdd takes around 1us, and the solution from BIS_fnc_vectorAdd takes around 8us private _ret = []; {_ret pushBack (_x + (_b select _forEachIndex))} forEach _a;

#

Hmm this solution seems to take 4us :D
_a = [0, 1, 2, 3, 4, 5]; _b = [0, 1, 2, 3, 4, 5]; ((_a select [0, 3]) vectorAdd (_b select [0, 3])) + ((_a select [3, 3]) vectorAdd (_b select [3, 3]))

quartz coyote
#

Hello. I'm trying to make the player teleport out of sight of other players but am having trouble with detecting if the player's teleport position is in or not of the light of sight of other players

private _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
if (!(count(allPlayers - [player]) isEqualTo 0)) then
{
    private _inVisual = 1;
    while {_inVisual isEqualTo 1} do
    {
        {
            _inVisual = [objNull, "VIEW"] checkVisibility [eyePos _x, _Pos1];
        } forEach (allPlayers - [player]);
    _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
    };
};
player setDir (random 360);
player setPosATL [_Pos1 select 0, _Pos1 select 1, 0];```
tough abyss
#

You are doing it wrong

#

check the wiki page

#

you can pass code as condition

quartz coyote
#

I'm not really friendly with that kind of explainations ...

still forum
#

even if the player is not visible. You are still getting a new position

#
private _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
if (countallPlayers > 1) then {
    private _isVisual = true;
    while {_isVisual} do {
        _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
        _isVisual = (allPlayers - [player]) findIf {
            ([objNull, "VIEW"] checkVisibility [eyePos _x, _Pos1]) > 0.5
        } != -1;
    };
};
player setDir (random 360);
player setPosATL [_Pos1 select 0, _Pos1 select 1, 0];
#

Here is a slightly better version of that script. You didn't say whether there is anything wrong with your script.

jolly tendon
#

Hey guys, I'm getting this error: ``` 11:50:52 Error in expression <blicVariable "_garrisonsOPF";
} forEach _opFTerritories;

{
private _pos = getMa>
11:50:52 Error position: <_opFTerritories;

{
private _pos = getMa>
11:50:52 Error foreach: Undefined variable in expression: _opfterritoriesProfiles\Harbor\missions\Takitest.takistan\functions\fn_initGarrisons.sqf, line 19 ```

#

from this script, can anyone help me?

#

(_this select 3) params ["_bluFTerritories","_opFTerritories","_opfForces","_blufForces"];

private _garrisonsOPF = [];
private _garrisonsBluf = [];

{
    private _pos = getMarkerPos _x;    

    private _spawnPosition =  [_pos, 400] call CBA_fnc_randPos;

    private _group = ["EAST",8,_spawnPosition] call HP_fnc_CreateGroup;

    _garrisonsOPF pushBack _group;
    sleep 0.5;

    publicVariable "_garrisonsOPF";
} forEach _opFTerritories;

{
    private _pos = getMarkerPos _x;    

    private _spawnPosition =  [_pos, 400] call CBA_fnc_randPos;

    private _group = ["WEST",8,_spawnPosition] call HP_fnc_CreateGroup;

    _garrisonsBluf pushBack _group;
    sleep 0.5;

    publicVariable "_garrisonsBluf";
} forEach _bluFTerritories; ```
#

Not sure why the coloring doesn't work for me, sorry

radiant egret
#

can you do publicVariable "_xxx" local vars?, thought works only for global vars

jolly tendon
#

Yea i think you're right. I just need that array to be public and when i tried passing in a global variable it gave me the global var in local space error

#

I'm just gonna take that line out since i don't REALLY need it anyway

#

Its still giving me the undefined variable error though, even thugh I'm passing it in as a param

still forum
#

publicVariable "_garrisonsOPF";
wtf are you doing? why are you publicVariabl'ing a LOCAL variable?

#

I'm a little slow

jolly tendon
#

lol it was a dumb mistake that has been removed

still forum
#

did you copy the error correctly?
Error foreach: Undefined variable in expression: is it trying to say that "foreach" is the undefined variable?

#

It usually states the name of the undefined variable

#

Did you check whether that var is defined?

jolly tendon
#

its just pushed to the next line of the error

#

te variable is _opforTerritories which is passed in as a param

still forum
#

Apparently it is not passed in as param then

jolly tendon
#

I would agree with that statement

#

this is the function call ["BLUFTERRITORIES","OPFORTERRITORIES","OPFFORCES","BLUFFORCES"] execVM "functions\fn_initGarrisons.sqf";

still forum
#

add diag_log to log _this and crosscheck everything

#

yeah.. undefined then

#

(_this select 3) is "OPFFORCES"

jolly tendon
#

I suck at using the params command I fuck it up every time

still forum
#

And you are trying to pull 4 parameters out of a single string

jolly tendon
#

I thought _this select 3 on params said you're selecting what is passed into it

still forum
#

Correct

#

you are selecting the array where params will select it's arguments out of

#

that thing is a single string value though. Not gonna get 4 arguments out of that

#

Looks like you want to pull the arguments out of _this. Not out of a single value in _this

jolly tendon
#

this function...it kills me

#

I don't understand what I'm doing with it rn. Just woke up, sorry

quartz coyote
#

@still forum indeed I wasn't precise enough.
The position selected by my script is sometimes in the field of view of other players altho it's exactly what I'm trying not to get

high marsh
#

is it possible to make a sort of "scrolling" credits effect for text?

#

(like you would with credits)

robust hollow
#

start its ctrl pos y at the bottom of the screen and set it again to above the top and ctrlcommit the time it should take.

#

to clarify a bit, you may start on safezoneY + safezoneH and end on safezoneY - _ctrlPos#3

high marsh
#

Ok, thanks.

crystal schooner
#

Hi im hosting a mission and currently on blufor all civillians in the area gets spotted on map vise versa

#

how would u disable spotting other people on the map?

robust hollow
#

could disable those icons in the difficulty but itl hide ur blufor friends too

crystal schooner
#

Ye, that doesnt matter. How would you do that ?

#

i tried autoSpot = 0;

robust hollow
#

using a custom difficulty, set mapContentFriendly = 0;

high marsh
#

^

crystal schooner
#

Wont that remove player position aswell ?

high marsh
#

No

#

You can still center yourself on the map

#

you just won't be able to see any friendly icons

crystal schooner
#

So mapContent should stay 1 or?

high marsh
#

Friendly is a modifier of mapContent, mapContent can stay as 1 as long as you want to keep enemy map content active

crystal schooner
#

Well in the mission its currently only civ and blufor so

#

Enemies wont be apart anyways right?

high marsh
#

civ & blufor are considered friendly as a blufor unit as long as your rating is not below a certain threshold

#

friendlies are relative to the unit, if you're opfor. The blufor will be marked as enemies, if you're blufor the opposite applies

crystal schooner
#
class DifficultyPresets
{
    class CustomDifficulty
    {
        class Options
        {
            reducedDamage=0;
            groupIndicators=2;
            friendlyTags=1;
            enemyTags=0;
            detectedMines=0;
            commands=0;
            waypoints=2;
            tacticalPing=0;
            weaponInfo=2;
            stanceIndicator=2;
            staminaBar=0;
            weaponCrosshair=1;
            visionAid=0;
            thirdPersonView=1;
            cameraShake=0;
            scoreTable=1;
            deathMessages=1;
            vonID=1;
            mapContent=1;
            mapContentFriendly = 0;
            autoReport=0;
            multipleSaves=0;
        };
        aiLevelPreset=1;
    };
    class CustomAILevel
    {
        skillAI=0.5;
        precisionAI=0.5;
    };
};
#

Still spots civs

high marsh
#

Yes, if you look at what I wrote above civs are friendly.

crystal schooner
#

But they shouldnt be spotted when mapContentFriendly = 0;

#

Right?

robust hollow
#

they wont show on the map

crystal schooner
#

They do atm

high marsh
#

Oh you mean radio protocol communications ?

crystal schooner
high marsh
#

did you restart to affect changes?

crystal schooner
#

Yes

#

Ye if i tp close to them it spots them

#

if i do hint str (difficultyOption "mapContentFriendly");

#

it returns 1

robust hollow
#

is ur custom difficulty selected?

crystal schooner
#
class Missions 
{ 
 class Mission_1 
 { 
     template = "Altis_LifeDev.Altis"; 
     difficulty = "Custom"; 
 }; 
}; 
robust hollow
#

and i assume ur custom difficulty is in the server profile?

crystal schooner
#

Yes

robust hollow
#

try putting this in ur server cfg forcedDifficulty="custom";

crystal schooner
#

Ok

high marsh
#

are your profiles getting loaded?

crystal schooner
#

Ye

#

Still does it connor

robust hollow
#

๐Ÿค” idk then. i dont do difficulties in the profile

crystal schooner
#
class DifficultyPresets
{
    class CustomDifficulty
    {
        class Options
        {
#

is that correct ?

high marsh
#

looks to be correct?

robust hollow
#

does the profile expect DifficultyPresets instead of CfgDifficultyPresets?

crystal schooner
#

Might do ill try now

high marsh
#

@robust hollow CfgDifficultyPresets is used for ingame config value, I mistakenly posted the wrong link

#

DifficultyPresets is for profiles

crystal schooner
#

ffs :/

robust hollow
#

weird

crystal schooner
#

just changed

robust hollow
#

can always just put ur difficulty in ur server mod

crystal schooner
#

How would you do that ?

high marsh
#

load a mod with -serverMod, client doesn't required it

robust hollow
#

you would put ur difficulty in ur servermod config instead of the server profile

high marsh
#
class CfgPatches
{
    class DanielDifficulties
    {
        name = "Daniel-Difficulties";
        author="Daniel";
        weapons[] = { };
        units[] = { };
        requiredAddons[] = { };
        requiredVersion = 1.80;
    };
};
class CfgDifficultyPresets
{
    /*
        Your preset here
    */
};
robust hollow
#

*class CfgDifficultyPresets

high marsh
crystal schooner
#

๐Ÿคฆ god damn it midnight

high marsh
#

ยฏ_(ใƒ„)_/ยฏ

crystal schooner
#

๐Ÿ˜ƒ

#

if i disable mapcontent then it returns mapcontentfriendly at 0

#

but also disables player marker

robust hollow
#

well yea... it removes all friendly markers?

crystal schooner
#

So how would you make it so it would only show player makers ๐Ÿ˜ฆ or isnt that possible with cfgDifficulty?

robust hollow
#

not possible. you could disable it in difficulty then script ur own in to replace what you wanted to keep

crystal schooner
#

i tried doing that with draw3d but didnt like that

robust hollow
#

because you need to use draw on a map?

crystal schooner
#

No just wanted seperate colors for different factions on map marker but the first faction you joined sticked with u until you restarted your game

robust hollow
#

well... i feel like that is an issue with the way it was written ๐Ÿค”

crystal schooner
#

hmmmmยจ

#

most likely ๐Ÿ˜‰

#
switch (playerSide) do
{
    case west:
    {
        findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", 
        {
                player drawIcon 
                [
                "iconman",
                [0,0.3,0.6,1],
                getPos player,
                24,
                24,
                getDir player,
                "",
                1,
                0.03,
                "TahomaB",
                "right"
            ]
        }];
    };
    
    case civilian:
    {
        findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", 
        {
                player drawIcon 
                [
                "iconman",
                [0.4,0,0.5,1],
                getPos player,
                24,
                24,
                getDir player,
                "",
                1,
                0.03,
                "TahomaB",
                "right"
            ]
        }];
    };
};

in initPlayerLocal.sqf

robust hollow
#

well wut teh fuk. player drawIcon

crystal schooner
#

ohh dw that was just me being retarded, it originally had
_this select 0

robust hollow
#

i would hope so ๐Ÿ˜›

crystal schooner
#

๐Ÿ˜› Trying to learn by breaking it i guess (;

high marsh
#
/*
    Author: Midnight

    Description: Event handler that executes code when given unit is able to see an enemy

    Parameters:
    0 - OBJET: Unit to add event handler on
    1 - CODE: Code to execute when unit sees enemy (passed paramms: added unit, unit the unit can see)
    2 - CODE: (Alternative code), called when unit cannot see any other units
*/
_this spawn
{
    params
    [
        ["_unit",objNull,[objNull]],
        ["_code",{},[{}]],
        ["_altCode",{},[{}]]
    ];
    while{alive _unit} do 
    {
        {
            _cansee = [objNull, "VIEW"] checkVisibility [eyePos _x,eyePos _unit];
            if(_cansee == 1) then
            {
                [_unit,_x] call _code;
            } else {
                [_unit] call _altCode;
            };
        } forEach (allUnits - [player]);
        sleep 0.3;
    };
};    

Why exactly is there a constant activation for vision on the units?

#

_canSee is always 1

#

Tried GEO Lod (just for shits and giggles), VIEW lod obviously doesn't work for whatever reason.

#

Oh I am so dumb
facepalm
(allUnits - [player]) whilst testing with local player

#

Ok. nevermind. It still does it

#
_this spawn
{
    params
    [
        ["_unit",objNull,[objNull]],
        ["_code",{},[{}]],
        ["_altCode",{},[{}]],
        ["_randomExecution",false,[false]],
        ["_chance",100,[0]]
    ];
    while{alive _unit} do
    {
        {
            _cansee = [objNull, "VIEW"] checkVisibility [eyePos _x,eyePos _unit];
            if(_canSee == 1) then
            {
                if(_randomExecution) then
                {
                    if((random 100) <= _chance) then
                    {
                        [_unit,_x] call _code;
                    };
                } else {
                    [_unit,_x] call _code;                    
                };
            } else {
                [_unit,_x] call _altCode;
            };
        } forEach allUnits;
    }
vital sand
#

can someone help me with this j trying to make a esimple map esp for myself

#

private _markers = [];
private _units = [];
forEach(allUnits); {
_marker = createMarkerLocal[format["%1_marker", _x], visiblePositionASL _x];
_marker setMarkerColorLocal "ColorWhite";
_marker setMarkerTypeLocal "Mil_dot";
_marker setMarkerTextLocal format["%1", name _x];
_markers set[count _markers, [_marker, _x]];
}
foreach _units;
while {
visibleMap
}
do {
{
private["_marker", "_unit"];
_marker = _x select 0;
_unit = _x select 1;
if (!isNil "_unit") then {
if (!isNull _unit) then {
_marker setMarkerPosLocal(visiblePositionASL _unit);
};
};
}
foreach _markers;
if (!visibleMap) exitWith {};
uiSleep 0.02;
}; {
deleteMarkerLocal(_x select 0);
}
foreach _markers;
_markers = [];
_units = [];
};

#

brand new to this stuff j trying to fuck around and see wat i can do:)

robust hollow
#

better off using draw event. no hassle creating and deleting markers when players join or leave

high marsh
#

literally look a couple posts above you

#

draw example and everything

sinful flame
#

Hi, How do you call function with argument in SQF? I'm a python/Java programmer but I can't see to under stand how they are called. Some funtions are called wiuth the arguments pre fuction call and some post. Whats the difference?

robust hollow
#

what do you mean by pre and post?

#

its just <args> call {code}

#

<args> being anything or nothing in some cases.

sinful flame
#

could it also be <args> call function_name?

robust hollow
#

its the same thing. function_name refers to a code variable

sinful flame
#

like an anonymous function?

robust hollow
#

what?

tough abyss
#

@sinful flame yes

velvet merlin
#

what sqf code can be run as part of config definitions?

#

color[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"};

#

x = "(profilenamespace getvariable [""IGUI_GRID_CUSTOMINFOLEFT_X"", (safezoneX + 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])";

robust hollow
#

any.

#

its basically call compiled in the end anyway.

velvet merlin
#

@robust hollow did you do tests yourself yet?

still forum
#

an be run as part of config definitions That cannot be said definitely for all config entries

#

some are evaluated by the config evaluator (which is limited). Some are just passed as strings to SQF scripts, which then evaluate them on their own. These can ofc execute any code they want, even access local variables.

robust hollow
#

i cant say ive tested everything, but back in my earlier days i did some real stupid shit in those ui properties calling functions and commands.

velvet merlin
#

would diag_log work everywhere or only in specific game/simulation "phases"?

#

like one thing i would love to do is the make the default difficulty based on SP or MP env

#

(cfgDifficulties)

still forum
#

I looked into what commands work in configs recently. Don't think I wrote it down tho

#

Ah no, that was serverside script. Not config

velvet merlin
#

can you use a semi colon as part of the code?

still forum
#

sure

velvet merlin
#

wouldnt this allow to inject new config parameters?

still forum
#

huh?

#

no

#

the script is called from a parameter. So don't see how you could inject new ones

velvet merlin
#

x = "(profilenamespace getvariable [""IGUI_GRID_CUSTOMINFOLEFT_X"", (safezoneX + 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])";
IGUI_GRID_CUSTOMINFOLEFT_X = "'10;'; x2 = ";

#

sth along these lines

still forum
#

no

#

It obviously expects that script to return a number

#

you'd just make it return a string instead and kill the script that's executing that

velvet merlin
#

syntax errors aside ofc

#

the config parser is not as script with string vs number

#

and it may not even apply for such script injected values?

still forum
#

huh? yes it is. string and number are different things in the config parser

velvet merlin
#

text = 5; and text = "5";

still forum
#

Correct. This is a piece of string that's evaluated in a SQF script somewhere. The config parser doesn't care what it returns, for it it's just a string with whatever content

velvet merlin
#

or x = 5; and x = "5 * 4711";

still forum
#

that is not the config parser

#

that is getNumber script command and engine side command having special implementations for when they are given a string

velvet merlin
#

well you can/will break various stuff. yet would it even accept such code via pNS return?

#

like it would be a cool way to implement some features/configuration for config based stuff

#

but needs to be secure against abuse

still forum
#

I don't know whether the config evaluator does. But afaik the stuff you posted above is executed from a script

#

Best way would be to just try it out.

velvet merlin
#
class CfgWeapons
{
    class Default
    {
//        opticsZoomMin = 0.25;
        opticsZoomInit = "(profileNamespace getVariable ['TEST_OPTICSZOOMINIT',0.75])";```
#

like this works

#

even without game start

#

dont quite remember as i tested it some weeks ago, but not even mission restart needed

#

but only read again when used

#

ie weapon change back and forth

still forum
#

Some entries will be cached, and you'd have to somehow get them out of the cache.
Which ones are cached, the engine doesn't tell you

velvet merlin
#

the caching is not random though, is it? aka based on preloading defined in configs and some engine internal defined behavior, isnt it?

still forum
#

some engine internal behaviour

spark turret
#

if i have an array with classnames but im to lazy to add the "" brackets around each one, can i do something like the {doStuff "_x"} foreach _array?

#

basically add the brackets around the variable?

still forum
#

no

#

stop being lazy

spark turret
#

is there no workaround?

queen cargo
#

chances are: nobody has any clue what you are talking about

#

if you got an array with classnames, then you already have an array full of classname strings thus adding another paranthesis makes no sense

still forum
#

no there isn't

#

You can't just grossly violate the syntax of a language and say "I'll just put a piece of cake into these gears and hope it will still turn"

queen cargo
#

you sound salty today @still forum
are you okay?

spark turret
#

^

#

x39 i want to automatically add bracktes around array positions bc im to lazy to do it by hand.

queen cargo
#

that makes no real sense

#

at least to me

#

your input array? ["foobar", "barfoo", "anotherfoo"] and you now wnat to get a set of brackets around it or what?

spark turret
#

the thing is if you use rightclick get classnames in the editor you get the names but in the script they need to have brackets around them

#

_stuff =
[BWA3_optic_EOTech,
bwa3_optic_compm2, //Aimpoint normal
bwa3_optic_microt2, //Aimpoint Micro
bwa3_optic_eotech552, //EoTech lang
bwa3_optic_eotech_mag_off, //EoTech vergrรถรŸerung
bwa3_optic_rsas , //Reddot
bwa3_optic_zo4x30,
bwa3_optic_zo4x30_microt2,
bwa3_optic_zo4x30_rsas,
bwa3_optic_zo4x30i,
bwa3_optic_zo4x30i_microt2,
bwa3_optic_zo4x30i_rsas];
{_crate addItemCargo ["_x",5];} foreach _stuff;

#

that is the basic thing.

#

doesnt work tho

queen cargo
#

then dedmen is right

still forum
#

As I said. No.

queen cargo
#

though ... use eg. regex or another text editor thing to fix that

#

takes 2 seconds

still forum
#

The layout is already perfect to just ALT+Drag select and then add a quote

spark turret
#

now thats a nice feature i diidnt know about

#

thanks a lot

#

Still gonna try to get automatic bracktes

#

_stuff = [a,b,c];
_stuffBracket = [];
for "_i" from 0 to count _stuff do
{
_tempstring = str _stuff select _i;
_stuffBracket pushback _tempstring;

};
that should do it

still forum
#

Still gonna try to get automatic bracktes no.

spark turret
#

why not? the "str" command does exactly that

still forum
#

No. It doesn't

spark turret
#

what does it do then

still forum
#

It turns the content of a variable into a string

spark turret
#

Converts any value into a string by placing " and " around the argument - quote BI website

still forum
#

you are trying to get the name of a non-existent variable. Out of it's content

#

You have a bag of air, and are trying to turn it into a cake

spark turret
#

i take the value of the array at each position, turn it into a string and add it to a new array.

#

i turn air into "air"

still forum
#

no you don't

#

I don't know how else to explain

#

You simply don't understand how strings work

#

i take the value of the array at each position Yes. And the value you get will be any

#

how do you turn any which means (this value does not exist)
back into the string "a" that it came from? Right. You can't

spark turret
#

not sure what you are talking about. i select the position "_i" from the string.

still forum
#

I might aswell just give up now.
It's simply not possible.

spark turret
#

_stuff = [1,1,1];
hint str _stuff;
_stuffBracket = [];
for "_i" from 0 to ((count _stuff) - 1) do
{
hint str _i;
_tempstring = _stuff select _i;
_tempstring = str _tempstring;
_stuffBracket pushback _tempstring;
};
hint str _stuffBracket;

#

it works.

queen cargo
#

there is a major difference between a variable and a value dude

#
_a = 1;
diag_log str _a; // <-- "1", not "_a"```
spark turret
#

ah wait you re righ tlol

#

cant just throw in classnames in the array since it will try to read them as variables

#

Well it does work for numbers so theres that

#

Sorry for bringing up your blood pressure @still forum

#

im still learning so dont get mad ๐Ÿ˜ฌ

astral dawn
#

There is a preprocessor command # that adds " " around whatever you pass to it, is it what you were looking for?
#define STRINGIFY(s) #s

#

STRINGIFY(makeItAstringForMe) -> "makeItAstringForMe"

spark turret
#

that sounds good

astral dawn
#

Then you still need to add preprocessor command everywhere ๐Ÿ˜„ to every line of yours and add () brackets around items, so it's pointless

tough abyss
#

cant just throw in classnames in the array since it will try to read them as variables NO SHIT

spark turret
#

hey be nice i dont have a programming background and forgot about that ๐Ÿ˜ฌ

tough abyss
#

Nothing to do with programming background

queen cargo
#

actually, it has
or more: with the memory model you have in your brain

sudden yacht
#

Hello all. I was looking at the support modules. Transport virtual. Is there anyway to delete the vehicle as it spawns unless a variable is true?

silver linden
#

Hello everyone.
I'm running into a issue (very new to scripting)
Trying to get a radio object to play audio after a interaction is done with it.

h1 addAction ["Put in casette tape", {h1 say3D "music1", 30, 1}];

h1 is the name of my radio and music1 is the name of the audio I want to play.

#

Using a .ogg as sound btw

still forum
#

"music1", 30, 1 that looks wrong

#

what's that supposed to be?

#

comma's outside of arrays == you are doing something wrong

#

Did you put it into CfgSounds?

silver linden
#

30 is supposed to be the range you can hear it in
1 is supposed to be the deformation (default) of audio

still forum
#

^ That's not how that works

silver linden
#

class CfgSounds
{
sounds[] = {};
class music1
{
name = "music1";
sound[] = {"\sounds\Srpska.ogg", 300, 1};
titles[] = {0,""};
};
};

#

That's my description.ext

still forum
#

"300" is volume, 300 seems wrong there.

#

Distance is the 4th parameter, not the second

silver linden
#

I followed a shitty guide with a Stephen Hawking google translate voice explaining it.

still forum
#

What us your issue? you said you are having a issue but you didn't say which

silver linden
#

Can't get the radio to play sound.
The addaction for Put in casette tape works but it has no result, doesn't play the audio after

#

i've been struggling with this for over 3 hours for no reason

#

Other than I'm very shit and have no clue

#

Holy shit it works

vagrant mango
#

Hey guys. So I was wondering if I could get someone to tell me where I am going wrong here. Basically I have an intro.sqf being called by init.sqf along with some other scripts (unitPlay for the intro) where the intro is essentially a black screen showing some credits and then it fades into the players view as they do a helo insert into the AO. Anyways. I THOUGHT I properly handled when it gets to the "STARRING" part and listing off each players name in each role, but after testing while hosting an MP instance last night, I seem to be very mistaken. So for that specific piece in Intro.sqf I have

justPlayers = allPlayers - entities "HeadlessClient_F";
...code between doing title screens...
{
_name = name _x; 
_role = roleDescription _x;
_nameRole = _name +" as "+ _role;
titleText [_nameRole, "plain", 2]; sleep 2; titleFadeOut 1; sleep 2;
} forEach justPlayers;
#

And it only is showing whoever the player is that joins and I am not sure why, because according to the documentation allPlayers should get an array of ALL players connected. Im thinking this is maybe because allPlayers needs to be run on the Server only and then grabbed by each script on the client that is joined? But I am not for sure.

still forum
#

is maybe because allPlayers needs to be run on the Server only and then grabbed by each script on the client that is joined no

#

should work

vagrant mango
#

Wondering if anyone could properly steer me in the direction of not being a moron.

still forum
#

have you tried logging what's inside justPlayers?

vagrant mango
#

Actually no. I should have. I was really tired last night when I was looking at it and didn't even thing to look at it. You're talking checking it via the debug menu? Or another way?

still forum
#

doesn't matter what way

vagrant mango
#

Kk ill try that. I'll have to get a small group together to test it with me otherwise Im going to see what I expect which would be just myself lol. I'll try and do that and see what I turn up.

silver linden
#

Is there a way to remove my addAction after its been activated once?

tough abyss
#

Yeah you have action Id passed to the code as _this select 2

silver linden
#

So removeAction and itโ€™ll be gone for every player?

#

Donโ€™t want 7 players activating the action at once so it plays 7 times

tough abyss
#

No for the player who activated action

silver linden
#

Any way possible I could the action for everyone after one activation?

tough abyss
#

Yes but will be difficult

#

Would be easier to just put a variable in condition and publicVariable it false

silver linden
#

This is my 2nd time trying something like this.
What would the line be for doing something like that?

#

Or a cooldown on activation?
So you can use the addAction again after x amount of time to replay the audio

tough abyss
#

If you want cool down you just broadcast future time you want action to be available again

#

And condition will be something like this "serverTime > actionAvailableTime"

#

And after anyone executed action you do this actionAvailableTime = serverTime + 60; publicVariable "actionAvailableTime";

#

And in init.sqf you put actionAvailableTime = 0;

#

So this will set condition false and action disappear for everyone and after 60 seconds appear again

vagrant mango
#

Wow I am a moron. Thanks for the help @still forum its because I hosted it as a player. I skipped right over the part saying in player hosted game it may not get properly filled out and to use a specific function instead.

silver linden
#

@tough abyss so it'd be like this?

actionAvailableTime = serverTime + 60; publicVariable "actionAvailableTime";```
still forum
#

No

#

the commas are still wrong

silver linden
#

, 1, 1, 25

#

you mean that part?

still forum
#

ywes

silver linden
#

Radio works for some reason though

still forum
#

it's ignored probably.

#

still wrong

silver linden
#

and it fades when you walk away from more than 25m

#

So I could just delete it and it'll remain the same?

still forum
#

yes

#

it makes no sense anyway

silver linden
#

Alright I removed it

spark turret
#

i cant seem to find what to use to determine the free "inventory" or cargo of a crate/car/etc. i dont want to overload it via script. what command do i use?

#

when adding stuff via addItemCargo

ruby breach
spark turret
#

exactly what i was looking for thanks @ruby breach

tough abyss
#

@silver linden no. You are executing public variable in the wrong scope. I think you donโ€™t really understand what {} means or just donโ€™t bother reading wiki, which is it?

silver linden
#

Literally no clue what I'm doing
Read wiki tho

tough abyss
#

Wiki tells you where to put condition, you donโ€™t have it at all. Stop copying crap you find on the internet and read wiki

#

Wiki has explanation of every single param in addAction and what it does

#

Trust me, you want to know how addAction works and not guess

#

Read wiki

#

Dedmen made it to moderator? Everybody RUUUUN!

still forum
#

loads the machinegun

tough abyss
#

๐Ÿ˜‚

young current
#

๐Ÿ‘€

winter rose
#

ho-lee-scheisse!

still forum
#

Ze germans be invading

spark turret
#

@silver linden what did you want to do with the AddAction?

long pewter
#

Evening everyone. Is there a way to activate some code once multiple waypoints are complete?

#

EG - Once four units have moved to designated positions making all four waypoints complete, "this disableAI "MOVE";"

spark turret
#

double click on code, you can either run code from there or activate a condition

#

double click on Waypoint*

long pewter
#

There are four different waypoints is what I'm saying - sorry if I was unclear

spark turret
#

so only if all are complete, the code should run?

long pewter
#

Yes, exactly

#

Apologies if this is a dumb question

spark turret
#

there are no dumb questions

#

im no expert, if all waqypoints are from one unit, you can use the last one

#

if they are for different units, i would active a different condition with each waypoint and if all are true, execute the code

#

in the waypoint init on activation for eaxmple: waypoint1Active = true; etc for the other waypoints, in the code: if (waypoint1Active && waypoint2active && waypoint3active && waypoint5active) then {yourcodehere};

long pewter
#

Would the code just be in a trigger?

spark turret
#

well it doesnt really matter where you run the code from

#

and yes you can put the code in a trigger and put waypoint1active && waypoint2active ... in the condition

long pewter
#

Where would I put the code though? Like, where would I physically type it

spark turret
#

what kind of code is it, what is it supposed to do

#

either in an init of any object in eden editor, or in a texteditor program like notepad ++ or poseidon and save it as .sqf

long pewter
#

So basically, once four waypoints are complete, the code I was to activate is:

car1 forceSpeed 50;

spark turret
#

ah put it in the car preferably

#

but if your car has the variablename "car1" you can run it from anywhere.

#

an idea would be to give the car a waypoint and in the waypoint parameter conditions you put waypoint1active etc, in the waypoint init you put car1 forcespeed 50;

#

so the cars waypoint gets actived when the other waypoints are complete

radiant egret
#

https://community.bistudio.com/wiki/BIS_fnc_lerpVector
https://imgur.com/a/tdZPcr9
"Given two different vectors A and B, think of a straight line drawn between them"
But the line is following the terrain hill, i need a stright line if possible, is this intended ?

for [{_i=0}, {_i < 1.01}, {_i=_i+0.01}] do 
{ 
  _v = [getpos a,getpos b,_i] call BIS_fnc_lerpVector; 
  _a = "Sign_Arrow_Pink_F" createVehicle _v;
  _a setposAsl _v;
}; 
still forum
#

you are using nonASL for the lerp, and ASL for the vehicle

#

use ASL for the getPos too

radiant egret
spark turret
#

got another problem, how do i spawn cetrain crates without having vanilla stuff automatically added to them? clearItemCargo and clearItemCargoGlobal has no effect.

#

especially this one B_CargoNet_01_ammo_F

still forum
#

clearItem, clearWeapon, clearMagazine cargo

#

clearing items doesn't clear magazines

radiant egret
spark turret
#

@still forum it does clear the cargo now, although the canAdd still returns false. wierd, gonna use a different crate

radiant egret
#

you check the crate for canAdd ?

spark turret
#

i made a mistake, had a faulty array
yes @radiant egret i put ammo from an array into the crate, if its full it spawns the next crate, fills that etc

#

until its done

spark turret
#

Right now its like that, but it only returns caller and target, not the params tho

#

_params = _x;
_statement = {params ["_target", "_player", "_params"];
titleText ["Ausrรผstung ausgegeben","PLAIN"]; titleFadeOut 1;
[_this] execVM "L917\Ausruestung\Loadouts\Zinnsoldaten\BW_AFGHANISTAN\DynLoadout.sqf";
};
////////////////////AKTIONSSCRIPT DEFINIEREN, benennen
_aktion = ["EL_Trop_TL_416_IDZ",_Weaponname,"",_statement
,{true}] call ace_interact_menu_fnc_createAction;

#

_x is from a foreach command. I need to get _x into the script im executing but i cant seem to get it to work

sinful flame
#

Is sqf object orientated? what languges are similar?

edgy dune
#

imo javascript

sinful flame
#

Hmmm okay thanks. As in does it use JSON type objects? or just in the way you access methods? or both?

dusk sage
#

Neither

edgy dune
#

I said javascript mainly cause 1) js was my first scripting language and 2) scripting langs are kind of similar

tough abyss
#

Not object oriented, not like JavaScript.

zenith edge
#

more like a non-strictly typed bastardization of C with custom operators

tough abyss
#

It is pretty strong typed

forest ore
#

Am creating a vehicle with
_vehicle = _classname createVehicle (_unit modelToWorld [0,20,0]), [], 0, "NONE";
Would like that the vehicle faces the same direction as the player does when the vehicle creation happens.

Tried
_classname setDir (getDir _unit);
but getting Error Generic in expression

young current
#

Would need to be _vehicle setDir......

orchid nebula
#

how to change a vehicles main weapon to something else? Ex. I am trying to change the vanilla bearcat from the 12.7 that its currently at to a modded weapon

young current
#

RemoveWeaponTurret and addWeaponTurret commands

orchid nebula
#

and LoadMagazine commands?

young current
#

Possibly yes

orchid nebula
#

thanks

#

alright well I am still having trouble with this

#

This is what I got:

#

this setObjectTexture [0, "apc2.jpg"];
this setObjectTexture [2, "turr.jpg"];
this setObjectTexture [1, "notturr.jpg"];
this removeWeaponTurret [m2, [0]];
this addWeaponTurret [Z6_Rotary_Blaster, [0]];
this loadMagazine [[0],"z6_laser","600Rnd_Z6_RotaryBlaster_Magazine"];

young current
#

And what would be the problem?

orchid nebula
#

It not changing let alone making the gun unable to fire. Shoulda mentioned that

#

My b

#

but ace and star wars mods are loaded. Ive been working on this for a while before I found this discord online

young current
#

Does it give any errors or do any part of it work?

#

Have you tried each command in the ingame debug console separately?

orchid nebula
#

The textures work but outside of that nothin

young current
#

Like give the vehicle a name and use that instead of this

orchid nebula
#

Ive been placing all of them directly into the init in the vechicle

young current
#

Well go test them in live and see which ones work. If they don't read the commands wiki entry to see if you have made a typo

orchid nebula
#

Aight

forest ore
#

@young current Indeed it was _vehicle instead of _classname. Silly me. Thank You for the help and also for the quick reply!

young current
#

๐Ÿ‘Œ

orchid nebula
#

It says: Error type Any, expected string

young current
#

Did you try just single command and if you did which one?

orchid nebula
#

The remove weapon one

#

And just that one

young current
#

Paste it pls

orchid nebula
#

apc removeWeaponTurret [m2, [0]];

young current
#

The m2 has to be "m2"

orchid nebula
#

ahh

young current
#

Usually all names have to be string

#

I recommend y you check the scripting commands wiki again for the rest too

orchid nebula
#

Thanks

tough abyss
#

@forest ore your createVehicle syntax is wrong, the last 3 params are just ignored

forest ore
#

Why is that so?

#

you mean the [], 0, "NONE" ?

tough abyss
#

Yes

forest ore
#

True since I'm not using them any way. The special parameter "NONE" is probably that by default(?)

tough abyss
#

No your syntax is wrong, these params are not even read

forest ore
#

What is the correct way?

tough abyss
#

Check the wiki

#

You are mixing it from 2 different formats

forest ore
#

My guess is that I'm using this one _veh = createVehicle ["ah1w", position player, [], 0, "FLY"];

#

aaand I personally can't tell the difference between that and the version I'm using

tough abyss
#

I feel sorry for you

forest ore
#

Thanks, I guess

#

So far the script has worked well enough so haven't really noticed anything being wrong

#

_vehicle = createVehicle [_classname, (_unit modelToWorld [0,20,0]), [], 0, "NONE"];

#

Any better?

tough abyss
#

You missed comma

forest ore
#

True. And messed too ๐Ÿ˜„

tough abyss
#

That is correct syntax

forest ore
#

Still both the versions work so, I don't know what to ask.. Is there some drawbacks in the version I have?

tough abyss
#

For once, the drawback is that what you think is happening is not actually what is happening

#

If you are ok with that then who am I to tell you otherwise

#

_a = 10, 20, "123", true;

#

All valid

#

But what is the value of _a?

forest ore
#

Nothing?

tough abyss
#

It is 10

#

And the rest is ignored

#

Just like in your usage of createVehicle

#

And no errors

#

Because it is valid sqf

forest ore
#

Will change the script to use correct syntax. Thanks for notifying me

tough abyss
#

NP

vague hull
#
[1,2,3] apply { if (_x == 3) exitWith {"Test"}; _x  };  // Returns "Test" instead of any array

๐Ÿค” not what I expected ... (kinda did tho)

spark turret
#

I know item size is kinda abstract, but is there a better way to check how much items i can put in a crate then the canAdd way? check in advance to determine if i need a bigger crate.

still forum
#

read from config how much space the crate has. And then check the size for all the items you want to add

#

how much space item needs is in it's ItemInfo class the "mass" entry. For crates I dunno

spark turret
#

a lot of weapons dont have real mass entrys afaik but ill check it out thanks

still forum
#

all of them have to have them

cold linden
#

Hi, please help. I'm dumb ๐Ÿ˜‰ .
Thats the error.

15:14:57 Error in expression <
temp_medical = []; 
temp_player = []; 
onEachFrame {
{
_playeruid = getPlayerUI>
15:14:57   Error position: <onEachFrame {
{
_playeruid = getPlayerUI>
15:14:57   Error Generic error in expression
15:14:57 File mpmissions\sk3yn3t_db_dev_ace.VR\initServer.sqf, line 21

Thats the code. It begins with Line 19

temp_medical = []; //[[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]]]
temp_player = []; //[playeruid,playeruid,,playeruid,]
onEachFrame {
    {
        _playeruid = getPlayerUID _x;
        _medical_status = _x getVariable "ace_medical_bodypartstatus";
        if !(playeruid in temp_medical) then { //Wenn spieler in temp_medical nicht zu finden ist
            temp_medical append [_playeruid, _medical_status];
            temp_player append [_playeruid];
        } else { //Wenn spieler in temp_medical zu finden ist
            array_id = temp_medical find _playeruid;
            old_medical_status = temp_medical select array_id select 1;
                if !(old_medical_status isEqualTo _medical_status) then {
                    //Update die Datenbank und das Temp
                    //array neu einspeisen
                    _del = deleteAt temp_medical array_id; //_del gibt das gelรถschte Array wieder
                    _del2 = deleteAt temp_player array_id; //_del2 gibt das gelรถschte Array wieder
                    temp_medical append [_playeruid, _medical_status];
                    temp_player append [_playeruid];
                    //Datenbankupdate durchfรผhren
                    
                    ["sk3yn3t_log_medical_status", [_x, _playeruid, _medical_status]] call CBA_fnc_localEvent;
                };

        };
    } forEach allPlayers - entities "HeadlessClient_F";
};

I cant see my mistake ๐Ÿ˜ฆ .

#

i've already change playeruid and medical_status to private with underscore

still forum
#

to private with underscore That's not private, that's local

#

why are you using the bad onEachFrame of which only one can exist at a certain time

#

temp_player append [_playeruid];
pushBack

tough abyss
#

getPlayerUI

#

not a command?

still forum
#

It says the error is before the onEachFrame. But I don't see it.

#

The command is UID

#

it's not displayed in the error message because it's not erroring on that

#

//[[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]]]
Your comment says one thing. What you are doing says a different thing.
Comment says [[player,stuff],[player,stuff],[player,stuff]]
But you are doing
[player,stuff,player,stuff,player,stuff]

#

you probably wanted to use pushBack in there too

#

Also using CBA hashes could make this alot easier

#

And don't use onEachFrame. Use the eachFrame mission eventhandler, and call a function from CfgFunctions. You are recompiling your code every frame

cold linden
#

in short: Stop doing shit with arma?! ๐Ÿ˜‰

still forum
#

yep

cold linden
#

yeah ok and thx

tough abyss
#

It says the error is before the onEachFrame or in it. if !(playeruid in... playeruid undefined most likely

cold linden
#

wow thx oO

cold linden
#

okey i changed to eachFrame mission eventhandler. CBA Hashes, not at this moment. Later maybe. Changed from append to pusback.

Thats on of that Moments i could delete Arma.

lean estuary
#

Does anyone know why i suddenly can't see scripted map markers on the gps? It used to work fine but somehow it broke in the last 5 months?

robust mountain
#

Hello, i have make this and that's work:

#

if !(isServer) exitwith {};

_spawn_pos = ["markerb_1","markerb_2","markerb_3","markerb_4"] call BIS_fnc_selectRandom;
"blue_flag" setMarkerPos getMarkerPos _spawn_pos;

if (side player == blufor) then {
player setPos (getMarkerPos "blue_flag" )};

#

But if y want IA bluefor at this spawn?

#

this work only for player

still forum
#

"IA blufor" ?

robust mountain
#

bot bluefor

#

AI

spark turret
#

What do i do to check if a variable has been defined yet? i used that, but it doesnt work

#

waitUntil !(IRON_Equip_WeaponArray == nil);

#

workaround is: waitUntil {time > 30}; so the init has time to finish but its a dirty workaround.

still forum
#

if a variable has been defined yet?
isNil

cold linden
#

@still forum
63/5000
Do I have to do something special for the EventHandler to start?

#

i put it in initServer.sqf but nothing happens -.-

still forum
#

no

cold linden
#

okey, forEach needs time ....

crystal schooner
#

Hi currently i am pulling alot of prices from a config, but the rank check comes in a string, how would i make it so it would be formatted to be used in a if statement?

tough abyss
#

getText

crystal schooner
#

How would i use that on a string like "rank < 5"

#

because it gets pulled like this

_rankCheckString = (_unfilteredUniformCop select _itemLocation) select 3;

and _rankCheckString returns "Coplevel >=5", but i cant use that in a if (_rankCheckString)

radiant egret
cold linden
#

I've learned Local Variables are (_variable). But what means arma with: Error Local variable in global space WITHOUT ANY FUCKING LOCAL VAR in my script ...

still forum
#

where does it print that? editor script box?

cold linden
#

nope, rpt

still forum
#

where is the script it prints that for

#

it's either local variable where only globals are allowed, or other way around

cold linden
#
private ["temp_medical","temp_player","a>
18:36:35   Error position: <private ["temp_medical","temp_player","a>
18:36:35   Error Local variable in global space
18:36:35 File mpmissions\sk3yn3t_db_dev_ace.VR\initServer.sqf, line 2


private ["temp_medical","temp_player","array_id","oldmedical_status","medical_status","playeruid"];

....
                if !(oldmedical_status isEqualTo medical_status) then {


                    //Update die Datenbank und das Temp
                    //array neu einspeisen
                    //_del = deleteAt temp_medical array_id; //del gibt das gelรถschte Array wieder
                    //del2 = deleteAt temp_player array_id; //del2 gibt das gelรถschte Array wieder
                    temp_medical pushBack [playeruid, medical_status];
                    //temp_player pushBackUnique playeruid;
                    //Datenbankupdate durchfรผhren
                    diag_log format ["oldmedical_status verรคndert"];
                    //["sk3yn3t_logmedical_status", [_x, playeruid, medical_status]] call CBA_fnc_localEvent;
                } else { diag_log format ["oldmedical_status unverรคndert"]; };
        };
    } forEach allPlayers - entities "HeadlessClient_F";

}];
still forum
#

Wtf

#

yeah..

#

You can only private local variables

#

private'ing global variables is nonsense

cold linden
#

okey, give me a sec

still forum
#

also don't use private array unless you really have to

ruby osprey
#

Nerds

cold linden
#

okey, private only on _var

still forum
#

yes

cold linden
#

i deleted my private line

#

yeah Arma ... be more retarded ... thats was my first idea .... thanks dedmen โค

#

2 hours for nothing ...

#

i hate this game

#
18:50:12 Error in expression <cal_status = [];
addMissionEventHandler ["EachFrame", {
{
playeruid = getPl>
18:50:12   Error position: <["EachFrame", {
{
playeruid = getPl>
18:50:12   Error Generic error in expression
18:50:12 File mpmissions\sk3yn3t_db_dev_ace.VR\initServer.sqf, line 5

temp_medical = []; //[[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]]]
temp_player = []; //[playeruid,playeruid,,playeruid,]
oldmedical_status = [];
addMissionEventHandler ["EachFrame", {
    // no params
    //diag_log "EachFrame";
still forum
#

generic error? The code looks to be correct though. You are having some really weird problems ๐Ÿ˜„

#

playeruid should probably not be a global variable

cold linden
#

is it playeruid = getPlayerUID _x;

still forum
#

It says the error is before the ["EachFrame but I don't see anything wrong there

cold linden
#

i've deleted the // from this only

        //del = deleteAt temp_medical array_id; //del gibt das gelรถschte Array wieder
                    //del2 = deleteAt temp_player array_id; //del2 gibt das gelรถschte Array wieder
                    temp_medical pushBack [playeruid, medical_status];
                    //temp_player pushBackUnique playeruid;

trasformed tooooooooo

        del = deleteAt temp_medical array_id; //del gibt das gelรถschte Array wieder
                  del2 = deleteAt temp_player array_id; //del2 gibt das gelรถschte Array wieder
                  temp_medical pushBack [playeruid, medical_status];
                  temp_player pushBackUnique playeruid;


#

del isnt _del

still forum
#

you should learn the difference between local and global variables. And where to use which

#

deleteAt temp_medical array_id That is invalid.

#

That's not how deleteAt works

cold linden
#

oh

tough abyss
#

Wtf?

#

Retarded Arma indeed

still forum
#

Rawrma

tough abyss
#

Awrma, y u no wanna ๐Ÿƒโ€โ™‚๏ธ ?!??

cold linden
#

i work on it since 11 hour. sry

spark turret
#

any suggestion on how i can put in an OR condition?

#

waitUntil {(((getposATL _Cargo select 2) <= 2) or ((velocity _cargo select 2) =< -3))};

still forum
#

didn't you already put that into a or condition?

spark turret
#

yes but it doesnt work

#

BI website says the code inside waituntil {} must return true

still forum
#

jup

spark turret
#

ah it was the =<. must be <=

#

i think at least

still forum
#

yes "smaller or equal" not "equal or smaller"

cursive whale
#

This memory leak associated with compiling scripts, is an inline definition of code to spawn going to add to it?

#

_str Spawn {Sleep 1; Hint _this ;};

astral dawn
#

IIRC compiling random code adds to it

#

So static code shouldn't ๐Ÿคท but Dedmen knows better ๐Ÿ˜„

cursive whale
#

so i guess that would mean lazy condition evaluation also if (something and {something_else}) then ...

still forum
#

@cursive whale yes

#

The script file that contains your spawn statement will be cached forever

#

So yes. That spawn is also part of cached/leaked code

#

every piece of compiled code is cached, no exceptions

#

so if you can run it, and it's not SQS, then it's cached

astral dawn
#

But calling this code repeatedly won't cause RAM to increase, I think Defunkt means that?

still forum
#

no it won't

#

there is always only one instance

#

The bug is fixed in next arma update anyway, so doesn't really matter anymore

cursive whale
#

right but (in my example) the caching cost is based on the number of times the whole script is compiled not each time that fragment is called?

still forum
#

is based on the number of times the whole script is compiled no

#

compiled once, or compiled a million times, there is only one copy of the script in the cache.

#

not each time that fragment is called There is nothing being compiled when you just call a pre-compiled function

cursive whale
#

hmm... then that doesn't sound like a huge problem for scripts that have an ongoing use, it's more of an issue for use of compile to parse string data, yes?

still forum
#

yes

#

the issue is things that are compiled once and not reused. Anything that is "parsed" by using call compile

#

Though that also applies to anything CfgFunctions, as they are usually only compiled once. No reason to keep them in cache

#

The only things that benefit from the cache is code that is continously re-compiled. But if you are doing that, you are probably doing something wrong.

cursive whale
#

thanks. out of interest, presumably those CfgFunctions have to be stored in compiled form somewhere, so what is wrong with the engine caching them (assuming that's where they're retrieved/executed from when needed)?

still forum
#

assuming that's where they're retrieved/executed from when needed They aren't

#

While the functions exist and are used it's not a problem. But what if they are from a Mission's CfgFunctions, once you exit the mission and start a different mission they should be gone from memory, but they won't be.

cursive whale
#

right, you'd have thought it would be fairly simple (and fundamental to good memory management) to tag cache entries such that they can be purged based on origin (game, mod, mission).

still forum
#

That is actually TOTALLY not the case and would be very hard to implement

#

My idea was a timed cache, aka scripts that weren't accessed for 20 minutes will be removed from the cache

#

that would fix the leak problem basically. Not short term, but long term.

astral dawn
#

Or maybe some cache with fixed amount of entries? So the more often accessed stuff gets to the front of the array (sort of)? And the one which gets out of the array gets away to be replaced by something else

cursive whale
#

when you say it's fixed in the next update, is that the forceDisableCache option or something newer/better?

still forum
#

cache has been removed

astral dawn
#

So every time I start my mission in editor it will be recompiling everything instead of grabbing it from cache? ๐Ÿ˜ฎ

still forum
#

jup.

#

Just like previously before the cache was added

winter rose
#

no.

#

also, define your array first, it will be more readable

_myArray = (โ€ฆ);
{ code } forEach _myArray;

obtuse cosmos
#

Here's the thread.

#

@winter rose The array is defined in another file. _x is from select expression, not forEach.

#

I'm so confused. My brain needs rest ๐Ÿ˜„

winter rose
#

forEach (if ( nope, nope and nope

obtuse cosmos
#

why? ๐Ÿ˜„

#

Brain overloaded ๐Ÿ˜›

winter rose
#

readability

obtuse cosmos
#

Readability is the last of my concerns.

winter rose
#

don't complicate it: understand what you work with, don't oneline too much

obtuse cosmos
#

Getting it working is first priority.

winter rose
#

Aaand here is why your brain is overloaded

obtuse cosmos
#

๐Ÿ˜„

wind tapir
#

sorry not sure where to post this but how do you set a serpa holster point on a chestrig so holstered pistols stay in the holster

obtuse cosmos
#

Maybe you can't read it but I can. The question isn't about readability anyway.

#

I actually think the issue is with the select expression and the actual keyword, the messagesArr contains "Log", "Warning", etc where as the listbox contains other values ```SQF
} forEach
[
"Show All",
"Show Only Information",
"Show Only Logs",
"Show Only Warnings"
];

#

Fixed it, Just as I thought ^^ - Guess my brain wasn't overloaded after all. So much for your readability concern so early on. Now that it works, I will make it more readable though tbh. It is only for my eyes really and I can read it. Thanks anyway! ๐Ÿ˜ƒ

winter rose
#

Whatever floats your code! Good luck though

obtuse cosmos
#

Already fixed it.

ebon ridge
#
private _pos = getPosATL _obj;
_obj enableSimulation false;
.. stuff happens here
_obj setPosATL _pos;
_obj enableSimulation true;

My _obj doesn't get restored to the same place, why is this? Kind of looks like being on a slope affects it a lot, can I do something about this?

orchid nebula
#

Is it possible to change the amount of armor a vehicle has in a script?

astral dawn
#

@ebon ridge It's worth to getVectorDIrAndUp and setVectorDirAndUp probably

#

And maybe getPosWorld and setPosWorld... other set/getPos... are confusing in terms of measuring position above ground, but ...world is quite straight ๐Ÿคท

young current
#

@orchid nebula no

#

how it handles damage perhaps

orchid nebula
#

@young current What do you mean by handels damage?

astral dawn
#

@orchid nebula HandleDamage event handler

#

You can do custom damage processing there and return a custom number of how much damange your vehicle will receive instead of the standard amount of damage

open vigil
#

๐Ÿ”จ

orchid nebula
#

example? @astral dawn

#

Like if it does 50 damage, the actual output will be 10

astral dawn
#

well... look for addEventHandler command on wiki, then check the HandleDamage event handler

orchid nebula
#

aight

ebon ridge
#
private _light = "#lightpoint" createVehicle [0,0,0]; 
_light setLightBrightness 1; 
_light setLightUseFlare true; 
_light setLightFlareSize 2; 
_light setLightFlareMaxDistance 60;
_light setLightAmbient [1.0, 0.0, 1.0]; 
_light setLightColor [1.0, 0.0, 1.0]; 
_light lightAttachObject [cursorObject, [1,1,1]];

Any ideas why this appears to have no effect at all?

#

I see no lighting change

neon snow
#
js_jc_fa18_wingtipAoA_right setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal",16,12,16, 0],
       "", "Billboard", 1, 0.4,
       [0, 0, 0],
       [0, 0, 0], 1, 2, 1.5, 0.18,
       [0.28],
       [[0.8,0.8,0.8,0.7]],
       [2,1], 0.1, 0.5, "", "",
       _object];

Why my particles have this color in middle?
https://imgur.com/pGCSjTC

robust hollow
#

@ebon ridge are you actually looking at an object for it to attach to? also is it day or night? works for me a night.

ebon ridge
#

Yeah I'm looking at object, it is bright day time though. Was hoping a 1 intensity light that is weird color would be obvious regardless...

#

I will try at night instead thanks

robust hollow
#

you can use setLightDayLight to help it show during the day. it isnt as strong as it is at night, but that is to be expected.

unreal leaf
#

Is there any use of '#'in variable names? _module setVariable ["#active",_activated];

robust hollow
#

yes, BI does it in a fair few modules, most likely elsewhere too.

unreal leaf
#

But its nothing special then?

robust hollow
#

afaik its no different any other variable.

mortal wigeon
#

Is there something similar to sourceAddress = "loop"; for Class MFD? I'm trying to draw MFD altimeter lines.

#

One should follow the hundreds value only, another thousands, etc.

weary pivot
#

I need a script that auto magically Kills the player is trying to do a photo shoot and I need dead people.

robust hollow
#

_unit setdamage 1

wanton swallow
#

Some way to create simpleObject and handle damage on it?

robust hollow
#

i dont think you can.
Unsupported features include PhysX, damage, AI pathfinding (causes walking through walls), and built in lights.

#

simpleObjects are usually meant to be static props.

wanton swallow
#

Sad

#

But maybe exist the way to register hits on simpleobject?

#

some hacks...

robust hollow
#

doesnt matter if you cant deal damage to it. just use createvehicle?

wanton swallow
#

createVehicle doesnt fit

#

I need object that cant be locked (with R or T) and targeted (with 2).

#

Maybe you know how to avoid targeting on vehicle?

robust hollow
#

no i dont, however if you use the alt syntax of createSimpleObject you may be able to set the damaged .rvmat to the object to make it appear damaged.

wanton swallow
#

Didnt find a way to appear damaged in alt syntax.
Do you mean BIS_fnc_createSimpleObject?

robust hollow
#

no. the command

#

because the alt syntax (using className) is a normal simple object instead of super-simple, so you can set textures to it. I dont know for sure, but i'd assume you can set materials to it too.

wanton swallow
#

Need a sample...

robust hollow
#
_pos = player getRelPos [10, 0]; 
_tank = createSimpleObject ["B_APC_Tracked_01_CRV_F", AGLtoASL _pos]; 
_tank setObjectMaterial[0, "path\to\damaged.rvmat"]; 
wanton swallow
#

Dont understand why rvmat..

robust hollow
#

because its a material

wanton swallow
#

for visualization, not for a functionality...

robust hollow
#

what?

wanton swallow
#

Material determine how to looks a surface and interacts with a light.

robust hollow
#

yes. and arma uses them to display damage over texture layers. Its how you get things like bullet holes without making ur own bullet hole texture.

wanton swallow
#

I need to register damage on simple object.

#

Register damage and do actions after it.

robust hollow
#

I see. Well, I dont know any clean way to do what you need, simple objects dont support damage or eventhandlers (from a quick test).

wanton swallow
#

It is sad, anyway thanks for your time.

floral spade
#

if i set one side hostile to itself ( ex east setFriend[east,0] ) is there a way to stop units from attacking squad members?

tough abyss
#

if i set a variable in a building, and then the building get damaged (not killed) and its model change to a damaged one, the var set on it at the begining continue valid?

#

Thanks in advance.

winter rose
#

@tough abyss yes I think so
@floral spade no, find another way

eager edge
#

hello there

winter rose
#

so ; can you show us your script and how it fails?

eager edge
#

no thats the thing ive not put it in anywhere coz i dont know where it goes

#

i want to make a radio play a loop of radio chatter that doesnt play to everyone it fades and gets louder deppending on your position on the unsung mod but cannot figure it out

winter rose
#

so why not "say"?

#

myRadioObject say "mySound" should do the trick

#

like for a person speaking, someone getting closer will hear it better, etc

eager edge
#

where do i put that and how do i put the sound i want in the "mysound" bit

#

yeah that sort of thing

winter rose
#

(but if you want a repeating forever, createSoundSource would indeed be better)

eager edge
#

yeah that link means nothing to me where am i looking at what am i looking for haha sorry im very very very new to this

winter rose
#

ok ๐Ÿ™‚ I but I will have access to a computer in an hour or so

#

Either pm me, have someone else here help or wait a bit, I am on my way!

eager edge
#

haha ok ill be here

tough abyss
#

@winter rose thanks Lou. I added a Killed event handler to a building but when the building get destroyed it not run. This is normal?

winter rose
#

I shall check, I am not sure here

winter rose
#

it seems the original building gets destroyed

robust hollow
#

im like 90% sure it still exists, just a couple hundred meters underground. the variables do not transfer to the new building but are still accessible on the old one.

tough abyss
#

Thanks a lot.

long pewter
#

Hey guys. How would I broadcast a message to all players on a server?

#

I tried allPlayers sideChat "Hello";

#

Didn't work though

astral dawn
#

RemoteExec

austere granite
#

I tried allPlayers sideChat "Hello";
Why did you try this?

dim terrace
#

allPlayers is an array

#

{_x sideChat "hello"}foreach allPlayers

copper raven
#

That would only display hello on one machine. Use remoteExec as Sparker pointed out.

dim terrace
#

unless it's executed in i.e. init but yeah, question is about broadcasting so remoteExec indeed seems to be more valid answer

long pewter
#

What does _x do?

digital jacinth
#

it is a magic variable used in forEach loops

#

it can be what ever the current object from the array is that is being process by forEach

#
{
    systemChat _x;
} forEach ["1","asd","test"];

this will output:
1
asd
test

in the chat box

long pewter
#

Gotcha, thanks mate

eager edge
#

so guys ive got all the bits in place i need to get sound clip working on my mission but it doesnt seem to be working any suggestions on why
class CfgSFX
{
class SfxRadioLoop
{
sound0[] = {"\radio_chatter.ogg", db-10, 1.0, 1000, 0.2, 0, 15, 30};
sounds[] = { sound0 };
empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
};
};

class CfgVehicles
{
class RadioLoop
{
sound = "sfxradioloop";
};
};
sleep 1;
createSoundSource ["RadioLoop", getPos player, [], 0];
and then my sound clip

#

im very new to this so keep you answers simple haha

still forum
#

What did you use to template?

#

Are you sure you want a sfx loop?

robust hollow
#

it wouldnt work like that if the configs are in the mission? cfgvehicles doesnt work like that.

still forum
#

What is that CfgVehicles stuff? that looks very wrong

#

Ah you copied that from createSoundSource wiki page.
If you need the CfgVehicles class then you need to add that in a mod, you cannot add to CfgVehicles from description.ext

#

Although wiki says it works like that.. That's new to me

#

Why do you name the sound sfxradioloop in the CfgVehicles part, but SfxRadioLoop in CfgSFX?
Why did you change the casing?

#

You split that stuff up between description.ext and some SQF script right? You pasted everything as one block so I don't know what you did

halcyon crypt
#

would you look at that, he got promoted ^^

still forum
#

You are late to the party

halcyon crypt
#

the server has become a bit of a "mark as read" server ๐Ÿ˜›

sweet ridge
#

Is it possiable to use a script that deletes wrekcage if it enters a certain area?

#

Ik that there are ones that clean up on a time basis but wasnt sure if it could be confined to a certain area using triggers or code

astral dawn
#

that deletes wrekcage if it enters a certain area
What? Does it delete wrecks that enter certain area?

#

Anyway, you can delete any object based on any criteria which is computable, so I think answer is yes

#

Like delete an object if no players are close to it

calm bloom
#

Hello there, comrades! Does anyone know if there is Killzonekid's makefile_x64 without write permission feature? I need autonomous serverside writing

still forum
#

Sparker has a Intercept based mod for writing to files

calm bloom
vague hull
#

is there any better way to detect that an AI unit spots someone than polling on close units?

#

i.e. eventhandler?

tough abyss
#

Sparker has a Intercept based mod for writing to files so when do I want to use it?

astral dawn
#

@vague hull AFAIK no, but you poll whole group instead of polling a unit, because target knowledge is group based

#

Also it's worth to poll behavior before doing target query, if you want to wait until your group has spotted enemies it considers as threats, it's much cheaper

#

@calm bloom It's this addon, yes, however it will also log time like the standard diag_log and insert a newline character at each output as I intended to use it for debug purposes

calm bloom
#

so it writes line by line?

astral dawn
#

yes it will write something like 12:35:03 text\n when you ask it to write text

#

\n is newline character

calm bloom
#

timestamp is hardcoded?

astral dawn
#

Yeah but... if you have any C++ knowledge you can disable it... or I can do it. What do you need to write?

#

maybe I can just make extra commands to configure output formatting per each open file

calm bloom
#

basicaly i have the dll which does this (line by line wrighting), i was searching for another one to compare the performance

astral dawn
#

well I flush the output buffer per each line

calm bloom
#

ive tried the killzonekids makefile, it uses whole file aproach, but its hard to use because it has checkbox with permission

astral dawn
#

it's standard C++ ofstream class with standard buffer size inside

vague hull
#

@astral dawn thanks for the hint

#

also been diggin a bit deeper.. does anyone know if fsmDanger is still a thing?

astral dawn
vague hull
#

duh! yeah right! forgot that one existed ^^

calm bloom
#

Thanks for the answer and your dll Sparker! Hope it will fit good

astral dawn
#

Nice!
Make sure you disable battleye by the way

eager edge
#

@still forum haha I just copied it as I was given it and all that stuff you just said to me makes no sense haha I havenโ€™t a clue about scripting

thin pond
#

hey their Arma Community, I'm looking for someone who I could talk to regarding some ideas me and my unit have. We want to estimate the workload and practicability of our idead, these ideas are scripts along the lines of spyder addons. I hope this is the right channel for this.

vague hull
thin pond
#

@vague hull thanks alot

sinful flame
#

When arma 3 launches a mission made by the player in the editor does it seach for a default SQF file name? or does it execute all .sqf file in the directory?

robust hollow
#

executes init.sqf, initPlayerLocal.sqf, initPlayerServer.sqf, initServer.sqf

#

though to be clear, it doesnt execute any when you load a mission into editor itself, only if you play the mission.

sinful flame
#

Thanks ๐Ÿ˜ƒ

noble zenith
#

Do you guys think that public variables will cause lag. Say you have 100 vehicles, 40 players. If you set a public variable on 100 vehicles will that cause lag because it needs to stay propogated on all clients?

robust hollow
#

itl have an impact sure, but it all depends on how much data each variable holds.

#

100 variables of 10000 character strings will make a bigger dent than 100 variables with a number value. you know?

winter rose
#

the network impact being if you update them

noble zenith
#

Yeah so basically it would be better to have a remote script that checks against the server copy as needed

robust hollow
#

depends on what ur doing exactly. it can work out that publicvariables are less back and forth over the network (vs a remoteexec ping pong).

winter rose
#

Again, it depends. There is no "perfect solution whatever the situation is"

noble zenith
#

Not if its updated semi regularly. Im not trying for perfect lol

#

Just better

tough abyss
#

If I've got a licenseplate, with 5 hiddenselections (being the plate number), is there a good way for me to insert text without having to manually setobjecttexture one at a time?

#

I want to not have to go in and write up 5 lines for each plate of "_this setobjecttexture" but rather be able to just write it in like a text "UTE35" for instance.

robust hollow
tough abyss
#

So you're telling me that arma with its amazing abilities of .sqf cannot do this? I merely used a plate as an example.

#

I just want to be able to write a text somewhere and have it come out seperated into several hiddenselections without me having to do more

robust hollow
#

ur setting a texture... that texture file needs to exist somewhere and then u need to write the script (which wouldnt be hard) to pick the texture and the layer it will set to.

tough abyss
#

Yeah it's the scripting part that I'm curious about

#

I know I can just do a _this setobjecttexture but in the event that I want it to be more dynamic, can that be done?

robust hollow
#

yes

#

arma with its amazing abilities of .sqf will allow you to accomplish this with ease.

tough abyss
#

..ok

#

thank you

robust hollow
#

as a quick example:

{
    _object setObjectTexture [_forEachIndex,format["\path\to\my\image\%1.paa",_x]];
} foreach (_string splitstring "");

takes the input string and uses the image for that character on the layer index it was written in.

long pewter
#

Anyone know why this script isnt working:

this disableAI "MOVE"; this addAction ["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers];

#

Doin my nut in

robust hollow
#

because ur code isnt in a code block

long pewter
#

Bruuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

#

How do i do a cool ass code block

west venture
#

three `s on each side

robust hollow
#

{ }

long pewter
#

Teach me daddy

#

{this disableAI "MOVE"; this addAction ["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers];}

robust hollow
#

i meant the actual code tho ๐Ÿ˜ฆ

#

no. in the action

#

addAction ["",{}]

long pewter
#

''' this addAction ["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers]; '''

west venture
#

tildes ` / ~

long pewter
#

this addAction ["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers];

#

Nice, cheers mate

robust hollow
#

["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers];
should be
["Secure J. Maxwell-Clark",{{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers}];

long pewter
#

Oh I need some double bracket action?

#

Lemme try that, thank you Connor

robust hollow
#

though ur action will just make all players say that on the person who did the action i think

long pewter
#

Oh - I want it to seem like some omnipotent being named "HQ" is saying that - got any hints?

#

Its cool if not, I can Google

#

Your correction worked btw, thank you mate

still forum
#

@noble zenith because it needs to stay propogated on all clients? That's not how they work. They don't re-propagate automatically on intervals. They just get sent once.

noble zenith
#

Yeah I know but I am talking about regular updates

#

Like it's a vehicle ownership variable so it's changed frequently

robust hollow
#

@long pewter you want something like

[playerSide,{[_this,"HQ"] commandChat "message"}] remoteExec ["call"]
still forum
#

Vehicle ownership, aka ownerID? That is very small.
Yes you are creating a network packet, but if the vehicle ownership is changed the game itself already sends a network packet anyway. Your additional one won't do much there

noble zenith
#

No as in a variable that stores uid's of the owner, but still small.

#

I just figure one more thing to lose.

novel trellis
#

hi guys i need your help on something. i want to create a Training mission in which you fight a friendly force. however them being friendly i just want to be able to shoot them and they go into a perm-unconscious state, is this possible using ace3 advanced medical ?

#

thanks

quartz coyote
#

@still forum You updated my script like this last week. everything is working correctly except one thing : Player sometimes is teleported to a location in field of view of other players... Can't manage to find what's wrong...

private _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
if (count allPlayers > 1) then
{
    private _isVisual = true;
    while {_isVisual} do
    {
        _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
        _isVisual = (allPlayers - [player]) findIf
        {
            ([objNull, "VIEW"] checkVisibility [eyePos _x, _Pos1]) > 0.5
        } != -1;
    };
};
player setDir (random 360);
player setPosATL [_Pos1 select 0, _Pos1 select 1, 0];```
still forum
#

Are you sure he is in field of view?
Maybe the players had just a small tree or a street sign or some small object that blocked the view

quartz coyote
#

yeah sure, I once TP 20m in front of another Player

#

I had asked him not to move

#

would it be because of the format the coordinates _Pos1 is returning ?

still forum
#

different format would mean different height

#

not vastly different position

robust hollow
quartz coyote
#

I'll try to combine both ...

#

thanks Connor

#

Mmmmh it's slightly too complicated for me sadly. I'm not skilled enough to understand and use your script. i'll try to find what's missing up my one

robust hollow
#

i can explain it if you want

long pewter
#

Is there a way to make an AI unit join your squad in a MP mission? For example, if I'm saving a brother and want him to follow me and my dudes into out ride

robust hollow
quartz coyote
#

is it a problem if my while loop doesn't have a sleep in it ?

#

will it loop on each frame ?

still forum
#

It will loop each frame (if it can) and it will run multiple times per frame

quartz coyote
#

the code I displayed above doesn't have a sleep. but since it isn't doing anything really heavy it wont have much impact right ?

still forum
#

checkVisibility is quite heavy

#

and randomPos too

quartz coyote
#

okay

#

thanks

quartz coyote
#

okay so I kindoff mixed Connor's script with mine. it's a mess and it's not working but I can't figure where the problem is...

private _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
if (count allPlayers > 1) then
{
    {
        private _eyeIntersect = lineIntersects [(eyePos _x), _Pos1 vectorAdd [0,0,1.8], _x, player];
        private _bodyIntersect = lineIntersects [(eyePos _x), _Pos1 vectorAdd [0,0,0.9], _x, player];
        private _footIntersect = lineIntersects [(eyePos _x), _Pos1, _x, player];
    } forEach (allPlayers - [player]);
    private _isVisual = true;
    if (false in [_eyeIntersect,_bodyIntersect,_footIntersect]) then
    {
        _isVisual = false;
    }
    else
    {
        while {_isVisual} do
        {
            if (false in [_eyeIntersect,_bodyIntersect,_footIntersect]) exitwith
            {
                _isVisual = false;
            };
            _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
            {
                private _eyeIntersect = lineIntersects [(eyePos _x), _Pos1 vectorAdd [0,0,1.8], _x, player];
                private _bodyIntersect = lineIntersects [(eyePos _x), _Pos1 vectorAdd [0,0,0.9], _x, player];
                private _footIntersect = lineIntersects [(eyePos _x), _Pos1, _x, player];
            } forEach (allPlayers - [player]);
        };
    };
};
player setDir (random 360);
player setPosATL [_Pos1 select 0, _Pos1 select 1, 0];```
queen cargo
#

wait a second, gonna pull out my magic cristal to check your code

#

please hold the line

quartz coyote
#

Thank you for your time

queen cargo
quartz coyote
#

Since this is the next message of a conversation, I actually didn't expect YOU to look at my script ;)
But is you so well want to educate me, I we create a decent sentence for you particularly : Would you please @queen cargo, look into my code. I am having problems with it and cannot find what is going wrong.

tulip hare
#

for "_i" select [{this setFace "miller";} || {this setFace "IG_Leader";}];

this obviously doesn't work. can anyone point out why tho?

queen cargo
#

you then may want to annotate @robust hollow @quartz coyote as it is his script ๐Ÿค”

#

@tulip hare what would you expect it to do?
for "_i" is required in a for step loop
select expects an array lefthand, an index righthand
and CODE || CODE is not existing

tulip hare
#

@queen cargo was hoping that this line woud randomly pick which ever of the two functions but can't since I'm not well versed with coding.

queen cargo
#

ye ... no
selectRandom [{...}, {...}]

#

at best though, you start actually learning to code
otherwise you end up with such mess more then needed ๐Ÿ˜‰ + the biki is your friend

tulip hare
#

so this doesn't need any conditions? I only know about conditional statesments but would take u so much time and space to make. sorry and thank you.

queen cargo
#

no (aka: check the biki ๐Ÿ˜‰ )

tulip hare
#

wait it says missing ;

still forum
#

call selectRandom [{one function}, {other function}];

tulip hare
#

I'm sorry what's call?

ruby breach
#

If you can't understand what you're reading, you're far better off making an effort to learn before you continue trying to write things yourself. Far less headache that way

tulip hare
#

ok. wilco. still taking classes for programming. currently learning C and these mentioned functions I have not encountered yet. sorry for the trouble. thanks for the help.

ruby breach
#

If it's any consolation; between the biki and this Discord I managed to learn a bit and I'm just an accountant. Just gotta be more stubborn than Arma is all.

thin pond
#

maybe some here can help me.... I'm trying to make a vehicle spawner which allows the players on my server to spawn vehicles and customize them beforehand. I was able to make it via the virutal garage but the vehicle is only visible to the spawning player and also I dont know how to whitelist certain vehicles. Maybe there already is already a script doing this or you might be able to help me.

#

Intended functionality: The players can access the spawner on certain points on the map, each point has his own pool of vehicles which can be customized, the player can preview the vehicle and customizations he selected before spawning them in.

astral dawn
#

Yes @unreal leaf has such a script

long pewter
#

Hey guys, how do i make an ammobox into an arsenal?

#

I tried ["Ammoboxinit",[this,true]] call BIS_fnc_arsenal;

#

But doesnt work?

thin pond
#

@astral dawn @unreal leaf where can i find that, if i can use it

astral dawn
#

Hmm the Antistasi code has the garage where you customize a car and then spawn it

#

If you can use it, IDK, it's Jeroen's creation

tough abyss
#

@long pewter should be AmmoboxInit

harsh sphinx
#

When using setTriggerArea the triggerArea returns a different value for the angle even after hinting right after making it. Is there something I'm missing here? Am I having a stroke?

tough abyss
#

What do you set and what is returned?

restive leaf
#

You mean the optionals?

#

?

queen cargo
#

No dude
I do not Fall for this sceme

#

The macro mess already made enough Popcorn

restive leaf
#

Extended Event Handlers are a good thing if you need them. Works well for ACE for sure

queen cargo
#

And in regards of files, ๐Ÿคทโ€โ™‚๏ธ
Do as you think it is best
But putting especially Events into their own files is actually kinda a good idea as it gets simpler to fine

restive leaf
#

Macros can be a pain to read but been through ACE code enough to know what they do. Is a pain when you start out though

sinful flame
#

Whats the quickest way to test code? Going into a init.sqf file then loading up arma going into the mission editor and then running a mission takes ages. Is there any benifit to using a SQF file over just writing the code in the init of that object you have selected??

round scroll
#

Using the debugger is quite nice to do a fast test of some code

#

init boxes become a bit unwieldy if you have dozens if not hundreds of line, also it's a matter of organization and structure. E.g. why put some arbitrary code in an object init box that is not related to the object at all?

sudden yacht
#

while {alive player} do {nul = [getPos player,240,"Banshee",2] execVM "MIL_CAS.sqf"; sleep 60;};

#

params [
"_position","_direction",["_vehicle","B_Plane_Fighter_01_F"],["_type",0],
"_logic"
];

_logic = "Logic" createVehicleLocal _position;
_logic setDir _direction;
_logic setVariable ["vehicle",_vehicle];
_logic setVariable ["type",_type];

[_logic,nil,true] call BIS_fnc_moduleCAS;

deleteVehicle _logic;

#

Above is the code being called upon attempting to run in a loop. However the game seems to freeze right before the mission begins. It works fine as an addaction. However i cannot seem to get it to load as an loop. Help...

knotty arrow
#

Hi i exec a function an arma 3 crash haha

#

do u know what can be the problem?

#

Exception code: C0000005 ACCESS_VIOLATION at 7CC70B80

sudden yacht
#

Whats the function?

knotty arrow
#
private "_item";
private "_magazineSize";
private "_magazineSizeMax";
private "_magazinesAmmoFull";

_item = param [0,"",[""]];
if (_item isEqualto "") exitwith {};

_magazineSizeMax = getNumber (configfile >> "CfgMagazines" >> _item >> "count");
if (_magazineSizeMax isEqualto 0) exitwith {};

// allow repack for all magazines with greater than 1 bullet
if (_magazineSizeMax > 1) then {
    _magazineSize = 0;

    _magazinesAmmoFull = magazinesAmmoFull player;
    if (_magazinesAmmoFull isEqualto []) exitwith {};

    {
        if (_item == (_x select 0)) then {
            if (!(_x select 2)) then {
                _magazineSize = _magazineSize + (_x select 1);
            };
        };
    } forEach _magazinesAmmoFull;

    // remove all
    player removeMagazines _item;

    // Add full magazines back to player
    for "_i" from 1 to floor (_magazineSize / _magazineSizeMax) do
    {
        player addMagazine [_item, _magazineSizeMax];
    };

    // Add last non full magazine
    if ((_magazineSize % _magazineSizeMax) > 0) then {
        player addMagazine [_item, floor (_magazineSize % _magazineSizeMax)];
    };
};

#

i call it ["classnameofmagazine"]

#

if i call in on the console, its works

#

If i call in a function game closed crashed

sudden yacht
#

0xC0000005 - ACCESS_VIOLATION
This error is very generic. It may be caused by many issues, such as a hardware malfunction, a virus in the computer, but also an error in the game itself. Possible solutions:

Try joining another server, then rejoin the previous one.
Update the graphics card drivers to a newer version.
Rollback the graphics card drivers to an older version.
Check the temperature of your GPUs and CPUs.
Verify the integrity of the game cache using Steam.
Re-install DirectX.
Uninstall the Visual C++ 2013 Redistributable package (both x86 and x64 version), restart your computer and install the package again (do not use the Repair function).
Run a Windows System File Check tool to repair corrupted system files.

knotty arrow
#

xd

#

no sense

#

if i exec on console works perfectly

sudden yacht
#

I would at least validate your files.

knotty arrow
#

i will try xD

sudden yacht
#

Executing a on a console is different then through a function.