#arma3_scripting

1 messages · Page 700 of 1

amber lantern
#

but then I need to put that into a function, and declare it with CfgRemoteExec

#

Which need to be in main config.cpp or in campaign or mission Description.ext.

little raptor
amber lantern
#

oh?

little raptor
#
[{
  hint "hello";
}] remoteExec ["call", _owner];
amber lantern
#

functionName: String - Function or command name.
While any function or command can be used here, only those allowed by CfgRemoteExec will actually be executed.

little raptor
#

¯_(ツ)_/¯

amber lantern
#

so that should work?

#
addMissionEventHandler ["PlayerConnected",
{
    params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
    [{
        [] spawn
        {
            waitUntil {!isNull player};
            player spawn
            {
                _unit = _this
                _unif = "FDF_sf_fat_maasto_sin_1";
                _hgear = "FDF_hel_m05_1";
                while {alive _unit} do
                {
                    if !(uniform _unit isEqualTo _unif) then
                    {
                        _inv = uniformItems _unit;
                        _unit forceAddUniform _unif;
                        {_unit addItemToUniform _x} forEach _inv;
                    };
                    if !(headgear _unit isEqualTo _hgear) then
                    {
                        _unit addHeadgear "FDF_hel_m05_1";
                    };
                    sleep 1;
                };
            };

            player addEventHandler ["Put", {
                params ["_unit", "_container", "_item"];
                _unif = "FDF_sf_fat_maasto_sin_1";
                _hgear = "FDF_hel_m05_1";
                if (alive _unit) then
                {
                    if !(uniform _unit isEqualTo _unif) then
                    {
                        _inv = uniformItems _unit;
                        _unit forceAddUniform _unif;
                        {_unit addItemToUniform _x} forEach _inv;
                    };
                    if !(headgear _unit isEqualTo _hgear) then
                    {
                        _unit addHeadgear "FDF_hel_m05_1";
                    };
                };
            }];
        };
    }] remoteExec ["call", _owner];
}];
little raptor
#

maybe...

#

but I have a question: if you don't want to touch the mission files, how do you plan to execute that?!

amber lantern
#

Anycase, then I could place that stuff into a .sqf file and execVM it, right?

little raptor
#

it has to be executed on the server

amber lantern
#

remoteExec execVm 😄

little raptor
#

is the file even on the server?

amber lantern
#

oh wait, you can put commands as string into the function name straight for remoteExec

amber lantern
little raptor
#

well why not just make an addon for the server only?

amber lantern
#

is there a simple guide for that?

little raptor
#

I don't know

#

if you know how to make addons it's very easy

#

you just make an addon

#

with a function, set to postInit

#

then add the addon with -serverMod= command line parameter

amber lantern
#

no I mean I've never done addons before myself

little raptor
wet shadow
#

Unpack some mod you've downloaded and see whats inside. 😄 Aside from unpacking the PBO you might have to unbinarize the config if its in bin form but then again you need addon tools should you make your own anyway.

amber lantern
#

"@emil/test.sqf" remoteExec ["execVM", 2]

#

Would this work if executed from the debug console?

little raptor
#

afaict, no. but why don't you try it?

amber lantern
little raptor
amber lantern
#

hmm, it says that script not found

amber lantern
little raptor
#

you could probably provide the full path
but not sure if it even works with execVM

amber lantern
#

can I print the current path?

little raptor
#

what current path?

little raptor
amber lantern
little raptor
#

¯_(ツ)_/¯
afaik it should always be back slash
but I've never tried the Linux build so not sure

amber lantern
#

hmm lemme try then

#

no difference, though I would need to find it first

copper raven
amber lantern
copper raven
#

you need to load it as a mod

#

compile it via cfg functions, or use like prefixes properly

amber lantern
#

I don't care about it not being "proper", I'd just like it to work 😄

#

what's the working directory where the debug console executes from?

little raptor
distant oyster
copper raven
drifting sky
#

Arma2OA: When a player opens a weapon crate, is it possible to open one other than the crate that they interacted with?

drifting sky
#

I want the contents to be based on which team you are

winter rose
#

and always have the same content, or it can be "always the same loadout"?

drifting sky
#

I want 2 boxes. One for west and one for east. With their contents persistent. But I don't want those boxes to be accessed directly. I want them to be accessed indirectly through other boxes in the battlefield

winter rose
#

not sure it is really doable

#

(especially in A2OA must I add)

hybrid crescent
#

Всем привет

winter rose
hybrid crescent
#

(((

#

Rassha

#

(

#

No anglish(

drifting sky
#

Is there any way to trigger some code when a player accesses a weapon crate?

winter rose
# hybrid crescent No anglish(

you could type your message in Russian with a google translate message below; otherwise, maybe a member here speaks Russian and you can ask for help

winter rose
hybrid crescent
winter rose
#

@hybrid crescent
Do you need scripting assistance?

вам нужна помощь в написании сценариев?

hybrid crescent
#

No no

#

Sori

winter rose
#

hey no problem! 👍

drowsy cipher
#

Something I'd like to do is have so I can command an AI unit in my squad to fire a m203 at any target of my choosing, target could be a wall or building, anyone have a sample or something to help get me started

#

Guessing to use addaction cmd and call a script that does that work?

candid umbra
#

Using ALiVE, is there a way to prevent AI from spawning in a particular area?
I've set the crowd faction to a civilian faction, but I don't want them spawning inside of my FOB

untold copper
candid umbra
wet copper
peak pond
#

Hi all. To avoid having to copy my collection of scripts to each mission I create, I'm making a mod to contain them. However, I haven't figured out yet how to call the functions I usually call from onPlayerRespawn.sqf. Is there some way my addon can mimic this and call some code each time the player respawns (including once at mission start)?

little raptor
peak pond
#

Ok, makes sense. Do you know if that includes start of mission?

#

I was also looking at the "EntityRespawned" mission event handler, as it doesn't need to be attached to an object (not sure if player object is the same before and after respawn).

#

Seems like player object is the same, before/after respawn, testing it out now...

candid umbra
peak pond
#

Both event handlers work, and I'll use the object based one so I don't need to do my own comparisons. However, they are only called after and actual respawn, not at mission start, so I still need to cover that base.

past gazelle
peak pond
past gazelle
#

I've been staring at the screen too long. Shouldn't that be "unless debriefing param is set to 0" ?

peak pond
#

@past gazelle I think you are right. Pretty sure debriefing IS shown by default.

past gazelle
#

Well, to turn off the debriefing you use sqf debriefing = 0;

peak pond
#

For my issue, I'm trying mission event handler "PreloadFinished" for mission start.

#

Sounds right

past gazelle
#

I'm actually trying to turn the debrief back on for some weird reason although I'll probably turn it off...

#

I like the bare...cold...empty feeling of returning to the main menu after getting shot 6 hours into a mission...

#

with no record of what I actually accomplished...

past wagon
#

I want to check who is inside a certain area. If only people from blufor are inside the area, then blufor wins. If only people from opfor are inside the area, opfor wins. If no one is inside the area, nobody wins. I already have a way of doing this, but I feel like there must be a better method, such as possibly using a switch. How would you do it?

past wagon
#

the area is a trigger

past gazelle
#

Oh you mean a switch-case loop?

past wagon
#

maybe ....

peak pond
#

You can get list of units in trigger area, then filter by side

past wagon
#

this is my current code:

waitUntil { units west inAreaArray _mapTrigger isEqualTo [] or units east inAreaArray _mapTrigger isEqualTo [] };
if ( units east inAreaArray _mapTrigger isEqualTo [] && units west inAreaArray _mapTrigger isNotEqualTo [] ) then {
    [parseText "BLUFOR WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
};
if ( units west inAreaArray _mapTrigger isEqualTo [] && units east inAreaArray _mapTrigger isNotEqualTo [] ) then {
    [parseText "OPFOR WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
};
if ( units west inAreaArray _mapTrigger isEqualTo [] && units east inAreaArray _mapTrigger isEqualTo [] ) then {
    ["NO TEAM WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
};
```It just feels inefficient, and I am pretty sure it doesnt even work
peak pond
#

One thing to consider is, you probably don't want this to activate once the first unit reaches the trigger area. You probably want to have a way to wait until both sides reach the area and have time to battle it out.

past wagon
#

ok

#

yeah, countSide sounds like it might be a solution

past wagon
#

it waits until one of the teams is dead, then it decides the winner

past gazelle
past wagon
#

yeah

peak pond
#

Yeah makes sense. Have you tried running it?

past wagon
#

I have, but I need to test it with more than one player and I havent had many opportunities to do that

peak pond
#

The countSide example online _num = west countSide list _triggerOne; may be more efficient, but I think still equivalent in behavior.

past wagon
#

it works perfectly in singleplayer, the side that the player is on always wins. however, in multiple its really weird

past wagon
peak pond
#

yes

past wagon
#

oh yeah obv

#

so in order for list to return all players in the area, I just need to set the activation for the trigger to be "any player"

#

right?

peak pond
#

I think so, but TBH i don't really remember.

past wagon
#

ok

peak pond
#

I do believe the activation type affects what units will be returned by list. Like if you set the trigger to activation by any BLUFOR present, then list would not return OPFOR units even if they are inside the area.

past wagon
#

yeah

peak pond
#

MP is a bit more complex than SP btw. You may want to configure a local dedicated server, and run two Arma clients at once (launch from .exe rather than Steam), to test those details.

past wagon
#

im not that lonely

peak pond
#

lol lucky you 😛

past wagon
#

lol

past gazelle
# past wagon lol

It's really fun putting all this stuff together until you try to get it working for someone else...then suddenly you panic and realize it's a lot of work for just ONE other person. 🙂

past wagon
winter rose
past wagon
#

this is definately for multiplayer

past gazelle
past wagon
#

wait...

winter rose
#

definitely plzzz

past gazelle
#

So suddenly I'm panicking and cleaning up tons of stuff...

past wagon
#

when I said "singleplayer" before, I meant on a server with only me.

#

i tested it in multiplayer with 1 person

past gazelle
past wagon
#

yeah my bad

past gazelle
#

Han Solo...the late rogue pilot...

past wagon
#

lol

#

I think I can figure it out, just looking for other people's ideas since I was kinda stuck

past wagon
#

yeah, but AI is disabled anyway so it wont matter

#

there only will be players

winter rose
#

well, on the principle "any units" then, as I assume it is a sector control

#

this way, if one day you want to re-add AI units, you don't need to toy with scripts 😉

past wagon
#

you mean as a gamemode? its more of a team deathmatch. I just need to know when one team is completely dead, and which team that is

winter rose
#

…why use a trigger then

#

are they respawning outside a game area?

#

@past wagon ↑

past wagon
winter rose
#

oh, ok then

past wagon
#

then they get teleported back in for the next round

winter rose
#

to begin with, instead of a loop, you could use a mission Event Handler```sqf
addMissionEventHandler ["EntityKilled", {
}];

past wagon
#

hmm

#

you mean the waitUntil?

winter rose
#

for example yeah

past wagon
#

I feel like the way im doing it would be a lot simpler.

winter rose
#

you could do a allUnits inAreaArray theTriggerArea for example

#

the EH will save CPU

past wagon
#

ok

peak pond
#

All, do event handlers and mission event handlers run in a scheduled environment? I.e. can I call waitUntil in them?

winter rose
past wagon
#

well this is my revised version of my script:

waitUntil { sleep 1; west countSide list _mapTrigger == 0 or east countSide list _mapTrigger == 0 };

if { east countSide list _mapTrigger == 0 && west countSide list _mapTrigger != 0 } then {
        ["BLUFOR WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
};

if { west countSide list _mapTrigger == 0 && east countSide list _mapTrigger != 0 } then {
        ["OPFOR WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
};

if { west countSide list _mapTrigger == 0 && east countSide list _mapTrigger == 0 } then {
        ["NO TEAM WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
};

and this is the old one: #arma3_scripting message

does the new one look a bit more functional?

winter rose
#

exitWith perhaps?

past wagon
#

yeah but this whole thing is inside a much larger while loop

#
  • while { true }
little raptor
#

so wrap it in a call

winter rose
#

and at least put a 1s sleep in your waitUntil

past wagon
winter rose
#

thanks

past wagon
#

thanks

winter rose
#

no I meant, thanks for saying it makes sense 🤣

past wagon
#

lmao

winter rose
#

not calling you out on your politeness 😛 😉 (others though…)

peak pond
#

waitUntil, and triggers, use polling which is not the most efficient, but will probably be good enough as long as your condition check isn't too expensive (sleep helps). EH is more efficient, but you would need to restructure your code.

#

As long as you don't get any frame drops, you're probably fine.

past wagon
#
call {
        waitUntil { sleep 1; west countSide list _mapTrigger == 0 or east countSide list _mapTrigger == 0 };
        if { east countSide list _mapTrigger == 0 && west countSide list _mapTrigger != 0 } exitWith {
                ["BLUFOR WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
        };
        if { west countSide list _mapTrigger == 0 && east countSide list _mapTrigger != 0 } exitWith {
                ["OPFOR WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
        };
        if { west countSide list _mapTrigger == 0 && east countSide list _mapTrigger == 0 } exitWith {
                ["NO TEAM WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
        };
};

does this look better? I suppose the exitWith does make it somewhat more efficient, but i feel like it could somehow fit into a switch....

winter rose
#

yeah but switch bad

#

and less perf

#

you wanted perf

past wagon
#

i guess

#

mainly I just wanted it to look like it wasnt scripted by an idiot lol

#

I felt like it looked that way

winter rose
#

…theeen 😄

past wagon
#

having 3 if statements when only one of them is meant to be true feels a little redundant

peak pond
#

All code written by people other than yourself looks like it was scripted by an idiot.

winter rose
#
private _aliveBlufor = blufor countSide list _mapTrigger > 0;
private _aliveOpfor = opfor countSide list _mapTrigger > 0;
private _data = "NO TEAM WINS!";
call {
  if (_aliveBlufor && !_aliveOpfor) exitWith { _data = "BLUFOR WINS"; };
  if (!_aliveBlufor && _aliveOpfor) exitWith { _data = "OPFOR WINS"; };
};
[_data, -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
past gazelle
#

It amazes me you can substitute a variable with an equation..

winter rose
#

"WHO IS THE STUPID THAT WRO— oh it's me, 6 months ago"

past wagon
winter rose
#

it makes sure the variable is local to that scope

past wagon
#

yeah

#

but wouldnt it already by local to that scope?

winter rose
#

not if it was defined somewhere else

past wagon
#

ohhh

#

so in this case, it wouldnt really matter unless I happened to use those same var names somewhere else?

winter rose
#
private _a = 0;
hint str _a; // 0
call {
  _a = 1;
  hint str _a; // 1
}
hint str _a; // 1
``````sqf
private _a = 0;
hint str _a; // 0
call {
  private _a = 1;
  hint str _a; // 1
}
hint str _a; // 0
past gazelle
winter rose
past wagon
#

ok

#

so are you saying its good to use it whenever you use variables with an underscore?

#

does private mean that as soon as the scope changes, the variable is deleted?

#

even if it enters a lower scope?

#
private _var = 0;
call {
  hint _var; //undefined?
};```
peak pond
#

I think it creates a new variable with that name. Not sure if it enters lower scope, good question. But when control returns to outer scope, the variable is deleted (but if the outer scope happened to contain a variable with the same name, that one would continue to exist).

past gazelle
#

I thought variables that started with _ were automatically private?

past wagon
past wagon
#

okokok

winter rose
#

a variable exists in lower scopes, not upper scopes
that's it

past wagon
#

k

#

I am getting Error if: type code, expected bool on this line. Do I need to add ()?

if { east countSide list _mapTrigger == 0 && west countSide list _mapTrigger != 0 } exitWith {
winter rose
#

if {}

#

if is ()

past wagon
#

oh sh*t lmao

#

im dumb

winter rose
#

SPANKIE

#

hi dumb, I'm dad!

past wagon
#

lmao

#

maybe you deserve the spankie for not noticing that earlier

winter rose
#

I provided my code, period 😛

past wagon
#

yeah but ur the master scripter

winter rose
#

not compiler, please notice :p
I thought you already ran this code, didn't check for mistakes but logic issues

#

anyway
write good code from the start
so it's easier to debug :p

past wagon
#

good idea

past wagon
#

if im adding a display event handler for "KeyDown", how do I check if the key "H" is being pressed?

winter rose
#

use its DIK!

past wagon
#

oh

#

you mean the params

#

?

#
params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"];
little raptor
#

its dik meowsweats

past wagon
#

that rings a bell

#

where do I find the DIK's?

little raptor
#

google

past wagon
#

ok got it

#

thanks

#

last time I used one of these EH's, I did this:

if ( ( ( inputAction "pushToTalk" > 0 or inputAction "voiceOverNet" > 0 ) && currentChannel == 5 ) or ( inputAction "PushToTalkDirect" > 0 ) ) then {
little raptor
#

not related

past wagon
#

i know but I did something different so i forgot about the DIK's

#

anyway, do I do this:

( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
    params ["", "_key"];
        if ( _key == 35 ) then {
                //code
        };
}];
#

is that what _key will return?

little raptor
#

DIK is a number

past wagon
#

oh

little raptor
#

like I said, just google it

#

arma dik codes

past wagon
#

so I use the integer, not the DIK_ID?

#

i found the DIK keycodes on the wiki

little raptor
#

you can only use the DIK Ids if you use:

#include "\a3\ui_f\hpp\definedikcodes.inc"
past wagon
#

so I just use the number instead?

winter rose
past wagon
little raptor
#

ye

past wagon
#

thanks

little raptor
#

if that code is gonna be preprocessed you could also write:

#include "\a3\ui_f\hpp\definedikcodes.inc"
( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
    params ["", "_key"];
        if ( _key == DIK_H ) then {
                //code
        };
}];
past wagon
#

okay

#

and if my mission had a bunch of different keys that did different things, I would only need to add the event handler once and then add in more if statements for the different keys

#

would that be the way to do it?

little raptor
#

yes

past wagon
#

great, thanks

little raptor
#

also add something to make sure you only add one event handler

#

as a safety measure

#
_EH = findDisplay 46 getVariable ["My_EH", -1];
if (_EH < 0) then {
  _EH = findDisplay 46 displayAddEventHandler ...;
  findDisplay 46 setVariable ["My_EH", _EH];
};
#

also just to be safe, terminate the event handler code with false

#

if one of your ifs return true, the key will be overridden

past wagon
#

okay

#

well I put this in initPlayerLocal to test it, and nothing is coming up.

( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
    params ["", "_key"];
    hint ( "YOU PRESSED THE KEY:" + str _key );
}];
#

do you know what the problem might be?

little raptor
#

hint "YOU PRESSED THE KEY:" + str _key;
is wrong

past wagon
#

hmm

#

i dont see why

little raptor
#

but still it should've given you a hint

little raptor
past wagon
#

ohh

#

better now?

little raptor
#

yes

past wagon
#

and i didnt get a hint at all

#

i will try remote exec

little raptor
#

the problem is probably display#46 is not initialized yet

little raptor
#

it's in initPlayerLocal

#

it's already local

#

add:

waitUntil {!isNull findDisplay 46};
past wagon
#

oh yeah

#

okay its working now

#

i should just leave this in the mission

#

it would be really helpful for players so they always know which keys they pressed

little raptor
past wagon
#

they can look up the number in the DIK key codes on the wiki

#

or i can add in a GUI that contains a guide

#

so they dont even have to tab out

#

convenient!

little raptor
#

what's the point? they do know what key they press!

past wagon
#

im being sarcastic

#

lol

#

i guess it wasn't that obvious lol

velvet dust
#

Hello. I wanted to ask this question. how to make sure that when the server starts, it is closed and opens only after the mission starts. Thanks

past wagon
#

what is closed?

velvet dust
#

server

#

It is necessary that while the server is running on it it was impossible to go. But after launching and starting the mission, it became available again

little raptor
#

you make no sense. are you using google translate?

velvet dust
#

I have so

past wagon
#

ok so I made this nice weapon holstering script that works flawlessly

#
waitUntil { !isNull findDisplay 46 };
( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
    params ["", "_key"];
    if ( _key == 35 ) then { //you can change "35" to any DIK integer for the key you want to use to holster
        if ( currentWeapon player != "" ) then {
            player action ["SwitchWeapon", player, player, -1];
        } else {
            player action ["SwitchWeapon", player, player, 1];
        };
    };
}];

Im very happy with it. press H to toggle your weapon in hands/on back

little raptor
#

what if they use H for something else?!

past wagon
#

here

#

better?

little raptor
#

wat?

past wagon
#

^^^

little raptor
#

how can they change the code?

past wagon
#

they just change the number

#

35

#

they can make it whatever key they want

little raptor
past wagon
#

lol

little raptor
#

you should never give scripting access to other people

past wagon
#

wym

little raptor
#

otherwise they can do whatever they want

past wagon
#

fine by me

#

lol

little raptor
#

if you use CBA of course

#

that way people can change the key

#

and you won't be giving scripting access to everyone (which is utterly stupid)

past wagon
little raptor
#

aren't you making a mission?

past wagon
#

oh

#

well yeah, but in MY mission it will always be H

little raptor
#

yes, but people have their own keybinding

past wagon
#

but if someone wants to borrow the holstering script for THEIR mission, they can change it

#

yeah, but most servers use H for holstering

little raptor
#

most servers don't know how to do something properly in the first place

#

¯_(ツ)_/¯

proven charm
#

what is the best way to get the vertical middle point of a man when the man can stand or crouch or prone?

little raptor
#

or aimPos (not exactly middle tho)

proven charm
past gazelle
little raptor
#

¯_(ツ)_/¯

past gazelle
#

See, this is where I get caught up in coding stuff. I wanna do the right thing and know why stuff works and it's like "No...just use display 46 and don't ask any questions..."

little raptor
#

46 is just a number

past gazelle
#

Oh thanks for double checking my issue I posted on BI btw, I think I am usually just estatic after firing an RPG and praying to god it hits...

little raptor
#

created by the devs

#

it's an IDD

#

every display in the game has an ID

#

that's how you "retrieve" them

past gazelle
past gazelle
#

oh nevermind, found it

#

Finally, dunno why I couldn't find that earlier..

#

Oh wow...I never realized there were so many...it's more like every window/box is treated as it's own display...

ripe sapphire
#

yo bros how would i make text from BIS_fnc_dynamicText function to show up at the same place on the screen on different resolutions?

little raptor
ripe sapphire
#

do i need to use safezones

little raptor
#

depends what GUI format the cinematic border uses

ripe sapphire
#

i use BIS_fnc_cinemaBorder

little raptor
#

if safeZone, then yeah. If GUI_GRID, then no.

#

idk

#

check what display it creates

#

then find it in the config and see what GUI format it uses

ripe sapphire
#

can you give an example of using safezones with dynamictext mate

little raptor
ripe sapphire
#
["my text",-1,safeZoneY + (1 - 0.2) * safeZoneH,4,1,0,789] spawn BIS_fnc_dynamicText;
#

like that?

little raptor
#

maybe

#

I've never used dynamicText

#

I'm not sure what x and y are

#

read that for GUI coordinates

ripe sapphire
#

ok i think i figured it out, this shows it a quarter of the screen from the bottom

["my text",-1,safeZoneY + (0.75) * safeZoneH,4,1,0,789] spawn BIS_fnc_dynamicText;
little raptor
#

@ripe sapphire yeah cinematic borders use safeZone format:

_height = 0.125 * safeZoneH;
#

that's the height of the border

ripe sapphire
little raptor
#

depends on font height

ripe sapphire
#

okok thanks

ripe sapphire
little raptor
#

that's out of your hands

#

it depends which layer the text and cinematic borders lie in

ripe sapphire
#

it says you can define the resource layer of the text

#

would it show in front if i set rsclayer to 9999?

little raptor
#

idk

#

but I'd recommend that you don't touch that

ripe sapphire
#

can it break the game

little raptor
#

no, but maybe other layers. idk

ripe sapphire
#

hmm ok thanks

#

btw, whats the default value of rsclayer when using this function? its not stated in the wiki

ripe sapphire
#

ok i see

little raptor
#

if you create the cinematic border first, the text will probably always be on top

#

you can try it

#

intentionally make it overlap

#

see what happens

ripe sapphire
#

thanks

ripe sapphire
#

tried creating text before cineborder, text still on top of it

little raptor
#

if you spawn both, there's no guarantee which one finishes first

ripe sapphire
#

oh leopard actually

#

calling it without defining a rsclayer will put it behind the cineborder

#

but using 789 like the wiki example it shows in front of cineborder

#

without regards to which one spawned first

little raptor
ripe sapphire
#

how do you find out

little raptor
#

it was a rhetorical question. I mean don't use numbers

ripe sapphire
#

well if you dont define the rsclayer, it will get covered by the cineborder

#

even though you spawn cine border first

little raptor
#

I said don't use (arbitrary) numbers

ripe sapphire
#

but the rsclayer params need numbers?

little raptor
#

yeah, but you're just providing an arbitrary number

#

what is 789?

ripe sapphire
#

its from the wiki example lol

winter rose
#

…or copypaste the function's code and add your text control and stop asking questions xD (j/k, no worries)

ripe sapphire
#

oh ok so:

["my text",-1,(safeZoneY + (0.750 * safeZoneH)),4,1,0,[] call BIS_fnc_rscLayer] spawn BIS_fnc_dynamicText;
little raptor
#

wat?

#

provide a layer name

#

e.g. :"my_dynamictext"

ripe sapphire
#

ok so:

["my text",-1,(safeZoneY + (0.750 * safeZoneH)),4,1,0,[myText] call BIS_fnc_rscLayer] spawn BIS_fnc_dynamicText;
#

seems to be working dope

ripe sapphire
#

uh, no but it worked for some reason lol

#

nvm it shows the text but layer failed to create i guess and text is behind cineborder

#

turning it to a string shows text in front of cine

#

thanks this is like the stack overflow of arma

winter rose
#

we try ^^ nice to hear it works! 👍

winter rose
ripe sapphire
hushed tendon
#

I'm having an issue here where I'm trying to spawn some backpacks with random amounts of loot in them but I'm getting no error and no loot is being put into them. I believe the error is around lines 91 - 112.

Sqf the code is located in
https://sqfbin.com/inukufavojafozoheduq

Config
https://www.sqfbin.com/goduvojibahokevakepo
I don't believe this is part of the error but just in case it's needed to find the error

winter rose
#

nooope, not reading that.

hushed tendon
#

:(

winter rose
#

plus, you have a throw and no try/catch.

#

make the smallest repro, then ask your issue plz

hushed tendon
#

I believe the issue is somewhere here. When I use the hintSilent those variables are correct.
Also got rid of the throw stuff. Probably shouldn't use code I don't know

_vestArray = getArray (_tableConfig >> "Loot" >> _itemSpawnType >> _itemSpawnRarity);
            _selectedVest = selectRandom _vestArray;
            
            _itemName = _selectedVest select 0;
            _itemClassname = _selectedVest select 1;
            _marker = createMarker [_itemName, _pos];
            _marker setMarkerShape "ICON";
            _marker setMarkerType "mil_triangle";
            _marker setMarkerText _itemName;
            
            _lootContainer addBackpackCargoGlobal [_itemClassname,1]; 
            
            if (_fillBackPacks isEqualTo 1) then 
            {
                _backpack = firstBackpack _lootContainer;

                _backpackSpawnRarity = _backpackLootRatios call BIS_fnc_selectRandomWeighted;

                for "_i" from 0 to round(random _maxLootPerSpot) do {
                    _itemArray = getArray (_tableConfig >> "Loot" >> "items" >> _backpackSpawnRarity);
                    _selectedItem = selectRandom _itemArray;
                    
                    _itemsClassname = _selectedItem select 1;

                    _itemAmounts = _selectedItem select 2;
                    _minItems = _itemAmounts select 0;
                    _maxItems = _itemAmounts select 1;
                    //hintSilent format ["%1\n%2\n%3\n{%4,%5}", _selectedItem,_itemsClassname,_itemAmounts,_minItems,_maxItems];
                    _numItem = [_minItems,_maxItems] call BIS_fnc_randomInt;
                    _backpack addItemCargoGlobal [_itemClassname,_numItem];
                };
            };
winter rose
#

so what is _fillBackPacks value?

#

where does the code breaks / stop running?
what "doesn't work"?

hushed tendon
#

It's fillBackPacks = 1; in the config. But I know it works cause the hintSilent is showing up

hushed tendon
#

Was mostly just wondering if you saw anything wrong here

winter rose
#

so far nothing
try _backpack addItemCargoGlobal ["FirstAidKit", 1] maybe

#

like, hardcode it

hushed tendon
#

Good idea

winter rose
#

issue with multiple parameters = reduce the variables to not overload the brainz 🧠

hushed tendon
#

Also figured out that some backpacks don't have markers being created for them

winter rose
#

¯_(ツ)_/¯

frosty cairn
#

Hey, I need some help.

this addEventHandler ["Engine", {
    params ["_vehicle", "_engineState"];
_driverItems = items driver _vehicle;
if (_engineState isEqualTo true) then {
if !("ACE_Clacker"  in _driverItems) then {
 _vehicle engineOn false;
"You don't have the keys to this vehicle!" remoteExec ["hint", driver _vehicle];
    };
  };
}];
``` I setup a small script to have the engine turn on if a player only has a particular item. My question is, is there a way to check if that player still has that item in his inventory, and if he doesn't, the engine turns off.
#

I tried using the "GetIn" EH like this, but it doesn't work:

this addEventHandler ["GetIn", {
    params ["_vehicle", "_role", "_unit", "_turret"];
    _unitItems = items driver _vehicle;
["keyondri", "onEachFrame", {if (_unit isEqualTo driver _vehicle) then {if !("ACE_Clacker" in _unitItems) then {_vehicle engineOn false;}} }] call BIS_fnc_addStackedEventHandler;
}]; 
little raptor
#

_unit, _vehicle and _unitItems are not defined

frosty cairn
#

Doesn't it see _unit and _vehicle in the params?

little raptor
#

no

#

it's in another code, which executes in another "place"

little raptor
#

also, convert _unitItems to a hashmap

#

altho, what if he drops it midway? thonk

#

better just put it in the EH code then

frosty cairn
#

That's the main point

#

If he puts it out his inventory , then it turns off.

frosty cairn
little raptor
#

let's just say it just executes in another scope

#

no it's not related to locality

frosty cairn
#

Ah, okay, I get it then.

frosty cairn
# little raptor pass those stuff as the event handler arguments
this addEventHandler ["GetIn", {
    [vehicle1, "" , unit, []] params ["_vehicle", "_role", "_unit", "_turret"];
    unitItems = items driver vehicle1;
["keyondri", "onEachFrame", {if (unit isEqualTo driver vehicle1) then {if !("ACE_Clacker" in unitItems) then {vehicle1 engineOn false}}}] call BIS_fnc_addStackedEventHandler;
}];

Something like this or....?

copper raven
#

why the params there?

#

and BIS_fnc_addStackedEventHandler allows you to pass parameters into the code, so why not use that?

frosty cairn
#

Fair

past gazelle
#

Hmm. I made an onPlayerKilled.sqf in the root directory of my mission but it's not being executed on death...

winter rose
#

maybe it's onPlayerKilled.sqf.txt

past gazelle
#

no it's sqf all right...

frosty cairn
#

What's the code.

past gazelle
#
"End4" call BIS_fnc_endMission;```
#

I tried it in the debug menu in the editor and it works fine...

little raptor
#

maybe the file name is incorrect

#

also did you just restart the mission?

frosty cairn
#

"end4" maybe?

little raptor
#

you should go back to editor afaik

winter rose
#

try systemChat "works"; enableEndDialog;

past gazelle
#

works works...

#

oh ok, will try exporting the mission next

#

hmm, "works" shows up but I'm getting the standard uh...what do you call that where the camera rolls slowly above the player death screen

#
class CfgDebriefing
{  
    class End1
    {
        title = "Mission Completed";
        subtitle = "";
        description = "You successfully rescued our forces and neutralized the spotters, despite being forced to retreat.";
        pictureBackground = "";
        picture = "b_inf";
        pictureColor[] = { 0.0, 0.3, 0.6, 1 };
    };
    
    class End4
    {
        title = "You didn't survive...";
        subtitle = "";
        description = "Ashes to ashes...dust to dust.";
        pictureBackground = "";
        picture = "KIA";
        pictureColor[] = {0.6,0.1,0.2,1};
    };
};
``` description.ext debriefing code...
#

(copied off BIS's site)

winter rose
past gazelle
#

Unless maybe BIS_fnc_endmission can't be called like that...

frosty cairn
#

"
endName (Optional, default "end1"):
String - End type from configfile >> "CfgDebriefing". Same as with endMission and failMission.

#

Might not be in the configfile.

#

Try failmission "End4" ?

past gazelle
#

Sorry say again?

winter rose
frosty cairn
past gazelle
#

["End4"] call BIS_fnc_endMission; ?

past gazelle
#

no ; ?

frosty cairn
#

Add it.

past gazelle
#

ok THAT worked...

#

wow...caught it right at the grenade explosion 🙂

#

ok now I'll try ["End4"]

winter rose
#

ah yep, doesn't work
the function checks if the player is alive

#

@past gazelle ↑

past gazelle
#

BIS_fnc_endMission does?

winter rose
#

yep

#

you could copy-paste the function and remove the check ofc

past gazelle
#

wtf it's right there on BIS's page...

#

Oh...but you never see it if you DIE...

#

gotcha...

winter rose
#

it's right there on BIS's page
what is? 😅

#

the "End4" and not ["End4"], yep

past gazelle
#

under Execution:
// Singleplayer / client-side
"end1" call BIS_fnc_endMission;

past gazelle
#

I guess...it's not that kind of execution?

winter rose
#

…yyyes.

past gazelle
#

Hold on..i'm trying to austin power up some more gags...

#

"I guess if you die first...you didn't actually FAIL the mission did you...because nobody could expect a dead man to be so succesful?"

winter rose
#

someone else failed the mission, by sending you 😄

past gazelle
#

Hmm...but an even weirder question: why does the ending dialog have "restart" and "continue" instead of "main menu..."

past gazelle
proven charm
#

I wanted to check if group is known to side but knowsAbout takes object as target

#

would using group leader as target be sufficient?

copper raven
#

what about taking the average for every unit in the group?

#

just a thought

proven charm
little raptor
#

it also takes side

#

oh target?

copper raven
#

yea, target

proven charm
#

im going to just check all the units even its slower

copper raven
proven charm
#

yeah average

#

the return number of knowsAbout is hard to understand. what is 1 what is 2? well 4 is max

tough abyss
#

how do we uh set up vehicle patrols and helicopter extractions im dum

little raptor
#

player1 and player2 is an example of units that you want to extract

tough abyss
#

ok!

#

what language is used

little raptor
#

sqf

little raptor
#

the landing script never even checks the condition

meager epoch
#

I'm placing the player inside a truck via the moveInCargo command, however, there's no eject/get out option once we reach our destination and the truck's engine is off.
What might be causing this?

little raptor
#

¯_(ツ)_/¯

meager epoch
#

Got no mods loaded

#

Except 3den enchanced

little raptor
#

what if you double press V?

meager epoch
#

Nope

little raptor
#

is the vehicle locked?

meager epoch
#

👀

#

yes

little raptor
#

then how do you expect to get out?!

meager epoch
#

🚪 🏃

proven charm
#

how do you stop zeus group dragging?

amber lantern
#

How do I correctly check if a piece of code has already been executed? Do I make a client local global variable and check its value?

still forum
#

ye

amber lantern
#

so that should be just, from anywhere, variable = value

#

where variable does not start with _

#

hmm

#

if (p == p) then { systemChat "exists"; } else { systemChat "no joy"; }; doesn't print anything

#

So I assume I would need to check for existence some other way

still forum
#

p == p ? what's that

amber lantern
#

testing global variables

still forum
#

uh

#

where did you get that from cuz that doesn't work like that

#

you can use

#

to check if variable is undefined

amber lantern
#

if (isNil p) then { systemChat "exists"; } else { systemChat "no joy"; };

#

doesn't print anything,e ither

#

ah needs to be string

fierce solar
#
if ( player inArea "SpawnMarker" _x && started = 1 ) then {
    remoteExec ["spectate.sqf", 3]
};    

Whats wrong with this? Says I'm missing a )

hollow thistle
#

= is an assigment,
== is a comparison.

fierce solar
#

fair enough, thanks

hollow thistle
#

inArea check is more expensive than simple comparison, you could use lazy eval here to optimize that condition.

willow hound
#

You can't use remoteExec with a filename.

#

Also player inArea "SpawnMarker" _x? That looks like an error to me.

brazen lagoon
#

is there an obvious way to delete hash values in a cba hashmap

#

i cant seem to find anything

still forum
#

set them to nil?

brazen lagoon
#

is it just cba_fnc_hashset with nil?

#

i guess that makes sense

brazen lagoon
#

ok ty

copper raven
#

that CBA component should have a deprecation warning imo

#

or atleast be updated to the new hashmaps, atleast better backwards compatibility

still forum
#

it does things that hashmaps don't support, like objects as key

steel trail
#

Hey guys I'm trying to put multiple sounds in my mission and it keeps saying i'm missing a "}" at the end but I cannot for the life of me figure out where to put it. here is the script

#

class CfgSounds
{
sounds[] = {};
class Sound1
{

name = "Sound1";

sound[] = {"sound\Sound1.ogg", 20 ,1};

titles[] = {};
};
class CfgSounds
{
sounds[] = {};
class Sound2
{

name = "Sound2";

sound[] = {"sound\Sound2.ogg", 20 ,1};

titles[] = {};
}
}

still forum
#

class CfgSounds
can't have multiple classes with the same name

#

and yeah you're missing a } just count them

steel trail
#

im very new im kinda lost. i just got the script from a youtube vid

still forum
#

its not a script, its a config

steel trail
#

It was for one but i tried to modify it for two

still forum
#

you have two sounds

#

Sound1 and Sound2

steel trail
#

yes

still forum
#

but you don't have two CfgSounds

#

you only have one CfgSounds, with two sounds inside it

steel trail
#

What would I put the other one as?

#

CfgSounds2?

winter rose
#

you have one CfgSounds
in which you set multiple sounds

steel trail
#

So remove the second one

winter rose
#
class CfgSounds
{
 sounds[] = {};
 class Sound1
 {
  name = "Sound1";
  sound[] = {"sound\Sound1.ogg", 20, 1};
  titles[] = {};
 };
 class Sound2
 {
  name = "Sound2";
  sound[] = {"sound\Sound2.ogg", 20, 1};
  titles[] = {};
 }; // ←
}; // ←
#

something like that @steel trail

steel trail
#

Thanks! Where was I missing the lasst "}" ?

winter rose
#

you have to close your } with ;

copper raven
#

but it only throws a warning right? if you don't put a ; after class }

winter rose
#

put ;. this is config, not fun

copper raven
#

yeah, of course, just making sure so i don't have to edit my config parser 😄

winter rose
past wagon
#

if I put exitWith inside a forEach loop, it will only exit the current iteration of the loop, not stop the loop from progressing, correct?

copper raven
#

the second

past wagon
spark sun
#

sharps already answer to you, just wanting to point this one as it could be what you want

amber lantern
#
[{
    if (hasInterface && isNil "alreadyCheckingForUniformAndHelmet") then
    {
        alreadyCheckingForUniformAndHelmet=true;
        [] spawn
        {
            waitUntil {sleep 1; !isNull player};
            player spawn
            {
                _unit = _this;
                _unif = "FDF_sf_fat_maasto_sin_1";
                _hgear = "FDF_hel_m05_1";
                while {alive _unit} do
                {
                    if !(uniform _unit isEqualTo _unif) then
                    {
                        _inv = uniformItems _unit;
                        _unit forceAddUniform _unif;
                        {_unit addItemToUniform _x} forEach _inv;
                    };
                    if !(headgear _unit isEqualTo _hgear) then
                    {
                        _unit addHeadgear "FDF_hel_m05_1";
                    };
                    sleep 1;
                };
            };

            player addEventHandler ["Put", {
                params ["_unit", "_container", "_item"];
                _unif = "FDF_sf_fat_maasto_sin_1";
                _hgear = "FDF_hel_m05_1";
                if (alive _unit) then
                {
                    if !(uniform _unit isEqualTo _unif) then
                    {
                        _inv = uniformItems _unit;
                        _unit forceAddUniform _unif;
                        {_unit addItemToUniform _x} forEach _inv;
                    };
                    if !(headgear _unit isEqualTo _hgear) then
                    {
                        _unit addHeadgear "FDF_hel_m05_1";
                    };
                };
            }];
        };
    };
}] remoteExec ["call", 0];

Any way to make this better? There's another handler for Take event, too, but I shortened the code here a bit

#

I suppose I don't actually need the spawn at all

errant jasper
#

Extract the identical body of the spawn and the event handler into a function.

plush sun
#

I am using the hide/show nodes and want units to appear upon a units death.

Example wave1group1 wave1group2 wave1group3 are the units that will die first and I want wave2 to unhide upon their death.

I am having trouble getting a script working

amber lantern
#

Ie can I define functions within the code for remoteExec

errant jasper
#

Yes, in CfgFunctions. Or as global variables.

#

Yes also inside the remoteExec, but you probably want them outside.

amber lantern
#

I'm shoehorning this, I'm executing the code from the debug console so no CfgFunctions

#

But lets see about those inline functions

plush sun
#

Should it be something like wave1group2 == o) but with proper brackets?

#

I have the script I am working on, on my PC and can't remember it exactly on the top of my head

errant jasper
#

A very rough edit, something like this if you want the function inline:

[{
    if (isNil "EMIL_fnc_EnforceUniformAndHeadGear") then
    {
        EMIL_fnc_EnforceUniformAndHeadGear = {
            params ["_unit"];
            private _unif = "FDF_sf_fat_maasto_sin_1";
            private _hgear = "FDF_hel_m05_1";
            if !(uniform _unit isEqualTo _unif) then
            {
                private _inv = uniformItems _unit;
                _unit forceAddUniform _unif;
                {_unit addItemToUniform _x} forEach _inv;
            };
            if !(headgear _unit isEqualTo _hgear) then
            {
                _unit addHeadgear _hgear;
            };
        };
    };

    if (hasInterface && isNil "alreadyCheckingForUniformAndHelmet") then
    {
        alreadyCheckingForUniformAndHelmet=true;
        [] spawn
        {
            waitUntil {sleep 1; !isNull player};
            player spawn
            {
                _unit = _this;
                while {alive _unit} do
                {
                    [_unit] call EMIL_fnc_EnforceUniformAndHeadGear;
                    sleep 1;
                };
            };

            player addEventHandler ["Put", {
                params ["_unit", "_container", "_item"];
                if (alive _unit) then
                {
                    [_unit] call EMIL_fnc_EnforceUniformAndHeadGear;
                };
            }];
        };
    };
}] remoteExec ["call", 0];```
amber lantern
#

thanks

fierce solar
#

Trying to play a sound to every player in the server and

["FD_FINISH_F"] remoteExec ["playSound"];

wont work?

winter rose
#

does it work locally

amber lantern
#

Is there no way to load a file on the file system?

winter rose
amber lantern
#

I have filePatching enabled (set to 2)

#

I have made a file called pathfinder.sqf in every single directory starting from the arma3 root directory

#

but if I try to execVM or loadFile it, I just get Warning Message: Script pathfinder.sqf not found

winter rose
#

yeah, try an absolute path or some ../.. path
I don't know much more 🙂

amber lantern
#

but it should work, right?

#

is there no way to print the current working directory for the arma script?

copper raven
#

can you just use an addon already? 😄

amber lantern
#

reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

#

😄

somber radish
#

So quick question

#

Anyone got any idea how to remove custom materials

#

from objects

#

lets say I do this:

car setObjectMaterial [0,"A3\Structures_F\Data\Windows\window_set.rvmat"];

How do I then remove it after?

copper raven
#

store the old ones before setting

smoky verge
#

is there a way to detect a laser pointer is on you?

#

the binocular not the rifle attachment

amber lantern
smoky verge
#

lines?

amber lantern
#

or was it points

#

anycase iirc yes you can get those

copper raven
#

that wouldn't be really precise, but close enough id imagine

smoky verge
amber lantern
#

@sanches see laserTarget

thorny gull
#

hello? I need some help with scripting, should be easy as I am just getting an error that I am missing some bracket and I need a little help finding out where

warm hedge
#

Post the details

thorny gull
#

this addAction["LMG Gunner", setUnitLoadout{[["ff_bb_Lewis_MG","","","",["ff_47rnd_lewis",47],[],""],[],["LIB_Webley_mk6","","","",["LIB_6Rnd_455",6],[],""],["fow_u_uk_bd40_commando_01_private",[["ACE_fieldDressing",1],["ACE_packingBandage",1],["ACE_morphine",1],["ACE_tourniquet",1],["LIB_No77",1,1],["LIB_MillsBomb",1,1],["ff_47rnd_lewis",1,47]]],["V_LIB_UK_P37_Heavy",[["ACE_EarPlugs",1],["ACE_EntrenchingTool",1],["LIB_6Rnd_455",4,6],["ff_47rnd_lewis",7,47],["ff_47rnd_lewis_tracer",2,47]]],["fow_b_uk_p37",[["ACE_fieldDressing",4],["ACE_packingBandage",4],["ACE_quikclot",2],["ACE_adenosine",2],["ACE_epinephrine",2],["ACE_morphine",2]]],["H_LIB_UK_Helmet_Mk2"],"",["LIB_Binocular_UK","","","",[],[],""],["ItemMap","","","ItemCompass","tf_microdagr",""]]}];

#

Its for a custom loadout box I am making in game that gives people loadouts for certain weapons

#

basically just pasting this into an ammo box with some decorative weapons placed on it

crude vigil
crude vigil
thorny gull
crude vigil
thorny gull
crude vigil
thorny gull
#

mhm

#

my player is set up with another loadout though i still got this one anyways

crude vigil
#

It should be another thing unrelated to this then, I dont know?

thorny gull
#

I dunno, the only other scripts I use are teleport scripts

#

hmm, and for the box its not showing the action

#

it works for items, like if i put the script in a gun it works, but the script doesnt work on the boxes

#

and selecting it doesnt give me the loadout, though that might be because I messed up the unit imput

thorny gull
#

this addAction["LMG Gunner", player setUnitLoadout[["ff_bb_Lewis_MG","","","",["ff_47rnd_lewis",47],[],""],[],["LIB_Webley_mk6","","","",["LIB_6Rnd_455",6],[],""],["fow_u_uk_bd40_commando_01_private",[["ACE_fieldDressing",1],["ACE_packingBandage",1],["ACE_morphine",1],["ACE_tourniquet",1],["LIB_No77",1,1],["LIB_MillsBomb",1,1],["ff_47rnd_lewis",1,47]]],["V_LIB_UK_P37_Heavy",[["ACE_EarPlugs",1],["ACE_EntrenchingTool",1],["LIB_6Rnd_455",4,6],["ff_47rnd_lewis",7,47],["ff_47rnd_lewis_tracer",2,47]]],["fow_b_uk_p37",[["ACE_fieldDressing",4],["ACE_packingBandage",4],["ACE_quikclot",2],["ACE_adenosine",2],["ACE_epinephrine",2],["ACE_morphine",2]]],"H_LIB_UK_Helmet_Mk2","",["LIB_Binocular_UK","","","",[],[],""],["ItemMap","","","ItemCompass","tf_microdagr",""]]];

crude vigil
#

Wrap it up with {}

thorny gull
#

got it

#

it works now

#

just not with the boxes, though I can try to fix it by replacing them with another box and see if that works

proven charm
#

I'm creating zeus editing area in the middle of nowhere to disable the unit/group dragging in zeus. but I wanted to ask if there's a better way?

sleek olive
#

How can I make the scenario save with a hold action

#

I want to add a prop that you can use to save the game

#

I know arma saving is really shit for long scenarios but I don't know any persistent saving system I can use

still forum
little raptor
proven charm
#

do I remember wrong or is it possible to have a script file in your user folder that is run every time mission starts?

winter rose
#

I think you remember wrong (otherwise I would learn something)

proven charm
#

hmmm

#

execVM wiki: The script is first searched for in the mission folder, then in the campaign scripts folder and finally in the global scripts folder

#

what's global folder?

little raptor
proven charm
little raptor
#

¯\_(ツ)_/¯

proven charm
#

ok

amber lantern
little raptor
#

¯\_(ツ)_/¯

#

I could be wrong

winter rose
#

how dare you

past gazelle
#

2 hours and 8 minutes of silence later...

winter rose
#

shhh! you're scaring them

#

oh no
what's coming next is curious

brave jungle
#

👀

#

With _x and forEach, if i'm say, 3 deep, does it require being assigned a variable first or should it work as expected?

{
    params ["_curpath", "_curFilesandFolders"];

    //Fix path string
    _curPathFixed = [_curpath, "\", "\\"] call PX_fnc_stringReplace;

    //Fix path sting to just mission folder and or sub dir
    _curPathReduced = [_curpath, "", _editedPath] call PX_fnc_stringReplace;

    //remove folders from array
    _FileAllowed = [];
    { 
        //Iterate each file and folder, removing the files/folders that do not have an extension
        _curFile = _x select _forEachIndex;
        {
            _fileAllowed = [_x, _curFile] call BIS_fnc_inString;
            if (_fileAllowed) then {
                _FileAllowed pushBack _curFile;
            };
        } forEach _allowedExt;
    } forEach _curFilesandFolders;

    _fileListAllowed pushBack _FileAllowed;
} forEach _fileList;

Because this is my code and I'm getting a generic error returned at the second forEach loop, first use of the _x (_curFile = _x select _forEachIndex;)

winter rose
#
_curpath = _x select 0;
_curFilesandFolders = _x select 1;

_have you heard of our lord and saviour params?

brave jungle
#

😄

#

We work on optimisation/better practise later down the line

winter rose
#

it's -not- optimisation, it's… common sense at that stage!!!1!

#

agrrrr

brave jungle
#

But I have just changed it anyhow 😛

winter rose
#

but yeah, if you want to use _x from different levels, you should (and can) assign them to differently-named variables

brave jungle
#

hmm

winter rose
#

other than that, if you don't need, _x is always the innermost

brave jungle
#

Then a generic error popping up is likely something else and not the _x then

winter rose
#

huh?

brave jungle
#

Well I got a generic error at that point, but seems to have gone now

winter rose
#

that's something else then

brave jungle
#

OKay yeha must have been something else because now i'm only returning [[],[]]

#

Greatttt

#

think its my use of BIS_fnc_inString

#

Will probs be back when I give up myself Cheers 👍

past gazelle
#

¯\_([[],[]])_/¯

winter rose
past gazelle
#

Hmm...why is the first slash disappearing... 😛

winter rose
past gazelle
#

There we go...

winter rose
#

also, think of escaping underscores 😄 \_

past gazelle
#

THERE we go...

winter rose
plush sun
#

What would I need to script to make a unit unhide when a unit dies would it be like example

{ Wave1group1 alive == 0) && {wave1group2 alive == 0)

I am having a little trouble figuring this out

winter rose
#

don't "figure" things, read the wiki? 🙂

plush sun
#

I just want units to unhide from my show/hide node once the previous units die (opfor)

#

So the wiki should help me out? Sorry I am really trying to learn lol

winter rose
#

sure thing! yes the wiki should provide assistance; we can help you to understand it if needed 👍

plush sun
#

Thank you, I'll check it out I actually want to understand what exactly I am doing and gain knowledge I appreciate the help

fair drum
hushed tendon
#

I'm having issues when trying to create a marker on a spawned objects position and was wondering if there were any known issues or things you had to do to fix it (aka like putting a small sleep to give it time to get a variable or something).
Too much code to read to understand what's going into it so I'll give a description of the path the code takes

At the start of the script I'm getting arrays and variables from the config for spawning the loot around the playing field
Then I run a forLoop for the amount of items I want spawned
In the forLoop
I chose a random loot spawn position and randomize the loot spawned by randomly selecting a loot type and then loot rarity
I then grab all the info I need from the loot array I have and create the loot afterwards
Example

//{itemName,classname,{minAmount,maxAmount}}
{"$","Money",{1,5}}

When the loot is created and needed info is taken I then call a compileFinal preprocessFileLineNumbers sqf where the markers are created
I then create a marker for the spawned loot with this little bit of code with some of the info from the spawned loot
https://www.sqfbin.com/odakegasiwemijunohak

No error shows up but only like 1/5 of the loot gets a marker created for it. Same thing happened when I created the marker in the same section of code as the spawned loot
Sorry for the huge chunk of shit I threw in here

winter rose
copper raven
#

issue is elsewhere, not in that function

#

im suspecting you might be using same marker name everywhere

hushed tendon
little raptor
#

no marker can be created if another marker with the same name exists

#

you can check as follows:

_marker = "marker_name";
if (_marker != createMarker [_marker, _pos]) then {//create and test if successful at the same time
  diag_log format ["Failed: %1", _marker];
}; 
hushed tendon
little raptor
#

where you create the markers

#

obviously

#

it creates the marker and checks at the same time

#

you can make it a while loop

#

and while it fails, try to create a new one

#
_marker = "marker_name";
while {_marker != createMarker [_marker, _pos]} do {//create and test if successful at the same time
  diag_log format ["Failed: %1", _marker];
  _marker = "marker_new_name";
}; 
#

a simple way to create a new name for the marker is to use a global variable for the IDs

#
_marker = "marker_name" + str global_marker_ids;
global_marker_ids = global_marker_ids + 1;
fair drum
#

can also do a for "_i" or a _forEachIndex as well depending on your use

hushed tendon
#

I got it working now. Thanks you guys!
Lou Montana, Sharp, Leopard, Hypoxic

#

Is it possible to display a markers name below the marker icon?

meager epoch
hushed tendon
#

Nvm

#

I forgot about structured text

hushed tendon
#

I'm failing. Looks like you can't use structured text in setMarkerText. I'm also trying to use a variable for the name. Anyone know what command allows me to change how the text looks in setMarkerText?

astral dawn
#

Marker text is quite poor in formatting

#

So I guess you can't do this

hushed tendon
#

Yeah I just tried every combo I could think of with the text commands and nothing was working

#

It'd be cool if we could change marker text

#

Well it wasn't necessary so I'll just scrap the idea. Was just for debug anyways

proven charm
#

I'm trying to render a icon on map that stays at the same size no matter the map scale/zoom, but there's something wrong with my math as the icon doesn't stay over the underlying marker...

#
private _defaultMainMapCtrl = (findDisplay 12) displayCtrl 51;
_scale = ctrlMapScale _defaultMainMapCtrl;
_renSize = (1 - _scale) * 256;

    _mapCtrl drawIcon [
        "a3\ui_f\data\map\groupicons\selector_selectable_ca.paa",
        [1,1,1,1],
        markerpos _pmrk,
        _renSize,
        _renSize,
        0,
        "",
        1,
        0.03,
        "TahomaB",
        "right"
    ];
#

that's the code, any ideas what's wrong with the scale math?

little raptor
#

gives it a constant size

proven charm
copper raven
#

_scale * 256 + (1 - _scale) * 256 umm, that?

proven charm
#

the problem isnt scaling the icon but scaling it to same sizes as markers on the map

random loom
#

Is there any script command to get playable/player occupied logic entities?

#

Such as Spectator and/or Zeus game logics

still forum
#

zeus has commands

#

I don't think spectator is necessarily a occupied unit? or some weirdness?

random loom
#

allCurators or whatever returns all curator logics

#

not the actual virtual entities, which don't need to be tied to a curator module

copper raven
random loom
#

Running player in debug console while in a spectator unit returns L Alpha 1-2:1 ()

#

so the player is certainly tied to it

proven charm
dusky wedge
copper raven
random loom
#

and then pass it coordinates as 2D, ignoring the Z axis

dusky wedge
#

Thx

copper raven
random loom
#

Tried that, returns []

#

though it does list the logics

#

playersNumber sideLogic also returns 0

#

even though side player returns LOGIC

copper raven
#

🤔

proven charm
#

can you post a screenshot in here?

copper raven
random loom
#

Tried with Zeus game logic and Spectator

winter rose
copper raven
#

typeOf(units sideLogic select {isPlayer _x} select 0) >"B_VirtualCurator_F"

#

and "VirtualSpectator_F" works for spectator aswell in my case

random loom
#

I'd like to avoid hard coding it that way

copper raven
#

im not talking about hardcoding

#

im saying it works here 😄

proven charm
random loom
#

I must've made a typo because now it works ¯_(ツ)_/¯

still forum
amber lantern
#

But as mentioned, I have pathfinder.sqf in every single directory

still forum
#

Ah I'm slow again

copper raven
#

there is probably a better way i feel like 😄

still forum
winter rose
#

@proven charm

proven charm
#

ty Lou. In the screenshot White circle should always be marker size, when zooming. but it isnt

amber lantern
#

@still forum yeah I have filepatching enabled, it's the allowedFilePatching = 2; setting in server.cfg, right?

#

or do I also need to set it as launch parameter?

still forum
#

Thats the setting to allow players with filePatching enabled to join the server

amber lantern
still forum
#

enabling it on client is seperate

amber lantern
#

how can I execute .sqf files with execVM on the server?

still forum
#

with filepatching you mean?

#

put file in server directory, enable filepatching on server, and.. execVM it

amber lantern
#

is it to add -filePatching to the arma3 launch line, with -mods etc?

still forum
#

yes

copper raven
amber lantern
still forum
#

yes

amber lantern
#

alrighty, let see

proven charm
winter rose
#

so pick one or another, but you can't resize and not resize at the same time 😅

proven charm
copper raven
#

like i said, you need to lookup marker config, and use it's size

amber lantern
#

IT FUUUKKEEN WOOOORKS

copper raven
# proven charm yes but it's render pixel size changes
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { 
    params ["_map"]; 
    private _cfgMarkers = configFile >> "cfgMarkers"; 
    { 
        private _markerPosition = getMarkerPos _x;
        private _markerSizeConfig = getNumber (_cfgMarkers >> markerType _x >> "size");
        markerSize _x apply {_x * _markerSizeConfig} params ["_sizeA", "_sizeB"]; 
        _map drawIcon [
            "a3\ui_f\data\map\groupicons\selector_selectable_ca.paa", 
            [1, 0, 0, 1], 
            _markerPosition, 
            _sizeA,
            _sizeB,
            0, 
            "", 
            1, 
            0.03, 
            "TahomaB",
            "right"
        ] 
    } forEach allMapMarkers;
}];
proven charm
copper raven
#

yes

proven charm
#

my markers are ellipse so it wont work

copper raven
#

oh, so you were talking about ellipses the entire time?

#

ellipses/rectangles DO scale with zoom, because they need to represent an area accurately

proven charm
#

well your code works, with icon markers

#

well back to the drawing board 🙂

#

g2g now, thx for the help!

amber lantern
#

booo yah

#

execution is with execVM "forceUniformAndHeadgear.sqf" as server or global from the debug console

#

of course, yes, I'll make an addon at some point

winter rose
#

ha

#

haha

amber lantern
#

It's just the same things as I've already pasted here, except I added the event listener for new players

copper raven
# proven charm my markers are ellipse so it wont work
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
    params ["_map"]; 
    private _meterInScreen = (_map ctrlMapWorldToScreen [1, 0]) # 0 - (_map ctrlMapWorldToScreen [0, 0]) # 0;
    { 
        private _markerPosition = getMarkerPos _x;
        markerSize _x apply {_x * _meterInScreen * 640 * 2} params ["_sizeA", "_sizeB"];
        _map drawIcon [ 
            "a3\ui_f\data\map\groupicons\selector_selectable_ca.paa", 
            [1,0,0,1], 
            _markerPosition, 
            _sizeA,
            _sizeB,
            0, 
            "", 
            1, 
            0.03, 
            "TahomaB", 
            "right" 
        ] 
    } forEach allMapMarkers;
}];

this works, but its really hacky meowsweats

winter rose
amber lantern
winter rose
#

yup

#

sorry if you already answered, not trolling (for once)

amber lantern
copper raven
#

you just need to create a config.cpp

#

and pack it with arma tools

#

easy as that

amber lantern
#

It's two of the same thing, one where we install the event handler for new players and then execute for existing players

#

Is there a better or more correct way to do this?

copper raven
#

why not have all of this clientside? 😄

amber lantern
#

whatcha mean?

copper raven
#

all of this code could be ran by client himself, without the need of server telling him to do it

amber lantern
#

that would required a client addon/mod

copper raven
#

wut?

amber lantern
#

I don't understand what you mean

fierce solar
#
waitUntil { !isNull findDisplay 46 };
( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
    params ["", "_key"];
    if ( _key == 207 ) then {
        fadeEnvironment 0.1;
    };
];

Anything wrong with this? Trying to make earplugs using the key [End]

amber lantern
copper raven
#

via some init script?

#

i.e initPlayerLocal?

amber lantern
#

so I would need a clientside addon/mod

fierce solar
#

I did

#

wont work

copper raven
#

ah yeah, unary fadeEnvironment doesn't exist

copper raven
amber lantern
#

I'm not

#

I'm shoehorning this into existing missions

#

so that if I want, I can force, for any mission, the player gear

fierce solar
#

what would I use?

copper raven
#

read the wiki page and the syntax

copper raven
amber lantern
#

and do it every time they update?

#

No thanks

#

I'm not going to be making a pull request for stuff like this to co10 for example

tough abyss
#

You only really have two choices, you either store code in the missions or you store it in a mod. If you want something applying to all your missions automatically then a mod is the way to do it.

amber lantern
amber lantern
#

hmm

#

How would I best replace all vectors with the ace version of them?

#

I suppose I could do it like I'm doing now, with using the put, take and 1 second interval checks but for the binoculars weapon

#

and if such is found that contains the word vector, replace it with the ace one

hushed tendon
#

You can also setVariable in a players init assigning them a role like “medic”. Then in the respawn sqf check the players variable and give them a certain loadout based on their variable.

past wagon
#

can I do units blufor instead of units west ?

still forum
#

wiki say yes

past wagon
#

thanks

meager epoch
#

So, I'm kinda lost over here... where exactly do I have to put the parent task ID in the following code?

files1 addAction ["Take Files", {player1 playAction "amovpercmstpsnonwnondnon_ainvpercmstpsnonwnondnon_putdown", [player1, "secretTask", ["Find any additional info about your Lieutenant.", "Find more intel", ""], [0,0,0], "CREATED", -1, false, "documents"] call BIS_fnc_taskCreate, ["secretTask", "SUCCEEDED"] call BIS_fnc_taskSetState}, nil, 1.5, true, true, "", "true", 3, false, "", ""];

Also, any idea why the player1 playAction "amovpercmstpsnonwnondnon_ainvpercmstpsnonwnondnon_putdown" isn't working? (it's the anim that plays out when you pick something up and stuff).

fair drum
#

playMove instead of playAction first of all: "amovpercmstpsnonwnondnon_ainvpercmstpsnonwnondnon_putdown" is an animation not in the playActions list

#

second, you used a , instead of a ; after the playAction

fair drum
# copper raven not an issue

if you reformat his coding better, the error is right after the playAction line with that ,. the , is in the code block

#

he also has one after the BIS_fnc_taskCreate

#
player1 playAction "amovpercmstpsnonwnondnon_ainvpercmstpsnonwnondnon_putdown", 

[player1, "secretTask", ["Find any additional info about your Lieutenant.", "Find more intel", ""], [0,0,0], "CREATED", -1, false, "documents"] call BIS_fnc_taskCreate,

["secretTask", "SUCCEEDED"] call BIS_fnc_taskSetState

his code block with better spacing

copper raven
#

yeah and the , is valid there

meager epoch
#

No error gets shown and the task gets created

#

The only problem is the animation not playing

cosmic lichen
#

did you try switchMove?

meager epoch
#

And me not knowing where to put the parent task ID

#

Ive checked the wiki, but I'm still lost honestly

copper raven
#

you already got an answer that you should use playMove over playAction

meager epoch
#

Will try

fair drum
#

am I missing something? When is , used as a valid end of line? even a direct copy paste in my environment is throwing an error at that

willow hound
copper raven
fair drum
#

its throwing a encountered "," was expecting one of: every single thing listed lol

willow hound
fair drum
#

i see ansin's post, which I never knew,
An SQF expression has to be terminated via either ; (preferred by convention!) or ,

But the sqf syntax environments certainly don't like it

copper raven
#

the code you sent compiles fine for me blobdoggoshruggoogly

still forum
#

I suggest not relying on undocumented unguaranteed behaviour that works "in most cases"

past wagon
#

why does drawIcon3D have a parameter for a color? what if the icon I am using already has a color?

still forum
#

textcolor?

#

oh icon

#

well color modifier

#

map markers are also single color image, with color on top

past wagon
#

okay

#

so if I had a black image, and then set the color to blue in that parameter, it would be completely blue?

#

so I dont need multiple icons for different colors then

still forum
#

ye

past wagon
#
{
    if ( _x == player ) then {
        continue;
    };
    addMissionEventHandler ["Draw3D" {
         _thisArgs params ["_x"];
        _color = if ( side player == blufor ) then {
            [0,0,1,1]
        } else {
            [1,0,0,1]
        };
        _pos = position _x;
        _name = if ( _tilde ) then {
            name _x
        } else {
            ""
        };
        drawIcon3D ["hex.paa", _color, _pos, 0, 0, 0, _name, 1.5, 0.05, "RobotoCondensed"];
    }, [_x]];
} forEach units ( side player );
```Why is `_x` returning `nil` inside the EH code?
still forum
#

because _this in Draw3D is nil

#

and params by default gets the parameters from _this

past wagon
#

okay

#

how can I pass the variable to the EH script then?

still forum
#

see here ^

past wagon
#

okay

#

so do I just change params ["_x"] to _thisArgs params ["_x"];?

still forum
#

ye

past wagon
#

okay thanks

still forum
#

it does

#

the first one is faster, if your code has higher scope (is called from somewhere else)

#

because without it, it has to check all variables in all parent scripts to see if a variable with same name exists, because it has to overwrite it if it does

#

with private it just creates a new variable in current scope, no need to check

past wagon
#
{
    if ( _x == player ) then {
        continue;
    };
    addMissionEventHandler ["Draw3D", {
        _thisArgs params ["_x"];
        _color = if ( side player == blufor ) then {
            [0,0,1,1]
        } else {
            [1,0,0,1]
        };
        _pos = position _x;
        _name = if ( _tilde ) then {
            name _x;
        } else {
            "";
        };
        drawIcon3D ["hex.paa", _color, _pos, 0, 0, 0, _name, 1.5, 0.05, "RobotoCondensed"];
    }, [_x]];
} forEach units ( side player );
```I am getting `Error: type any, expected string`. Anyone see why that might be happening?
#

I think it is something to do with _color. When I paste the code for color in the debug console, it still wont return anything.

_color = if ( side player == blufor ) then {
    [0,0,1,1]
} else {
    [1,0,0,1]
};

and then I do _color and it returns nothing

still forum
#

_tilde undefined

#

thus _name also undefined

past wagon