#arma3_scripting
1 messages · Page 700 of 1
you can just remoteExec call or spawn
oh?
[{
hint "hello";
}] remoteExec ["call", _owner];
functionName: String - Function or command name.
While any function or command can be used here, only those allowed by CfgRemoteExec will actually be executed.
¯_(ツ)_/¯
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];
}];
maybe...
but I have a question: if you don't want to touch the mission files, how do you plan to execute that?!
From the debug console : )
Anycase, then I could place that stuff into a .sqf file and execVM it, right?
it has to be executed on the server
remoteExec execVm 😄
is the file even on the server?
oh wait, you can put commands as string into the function name straight for remoteExec
Will be once I put it there
well why not just make an addon for the server only?
never done that, but yeah that's possible I suppose
is there a simple guide for that?
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
no I mean I've never done addons before myself
addons are easy
you just put a config.cpp file containing a cfgPatches class in the addon folder to let the game "identify" its contents
then add your other stuff (e.g. cfgFunctions) from the same file
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.
"@emil/test.sqf" remoteExec ["execVM", 2]
Would this work if executed from the debug console?
afaict, no. but why don't you try it?
yeah I will. How should I change it to make it work? Or is there no way to execute sqfs from the debug console?
is filePatching enabled on your server?
hmm, it says that script not found
iirc yes
you could probably provide the full path
but not sure if it even works with execVM
can I print the current path?
what current path?
also you're using forward slash
you should use back slash
not a Windows server
¯_(ツ)_/¯
afaik it should always be back slash
but I've never tried the Linux build so not sure
that's not the proper way to do it
The correct way being?
you need to load it as a mod
compile it via cfg functions, or use like prefixes properly
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?
https://community.bistudio.com/wiki/Script_Path seems like this has been hidden from the wiki?
well if you'd gone with the addon approach you'd have gotten it to work by now
there is no cwd in sqf. the path is dictated by the command you use, eg. execVM checks mission folder, campaign folder and global scripts folder
sure. but just so you know, you will waste more time doing that
Arma2OA: When a player opens a weapon crate, is it possible to open one other than the crate that they interacted with?
I want the contents to be based on which team you are
and always have the same content, or it can be "always the same loadout"?
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
Всем привет
Hello!
this Discord speaks in English only though, for moderation purpose 🙂
Welcome aboard!
Is there any way to trigger some code when a player accesses a weapon crate?
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
not in A2OA; there is such EH in A3 since 1.22

@hybrid crescent
Do you need scripting assistance?
вам нужна помощь в написании сценариев?
hey no problem! 👍
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?
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
I haven't used ALiVE in a long, long while.
Are there still "Blacklist Marker" fields in the modules?
If yes, then place an area marker over your base and name it something like BASE_KEEP_OUT and put BASE_KEEP_OUT under "Blacklist Marker" on each module; Civilian and Military.
I hope that helps you out.
I'll try that tonight, thanks a bunch!
@candid umbra
Yes, Maff has it right, find TAOR and Blacklist fields to setup your markers.
Here's a link to ALiVE's Wiki :
http://alivemod.com/wiki/index.php?title=Main_Page
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)?
You can use the "respawn" event handler
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...
Just tried it and it worked! 😄
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.
There is an ALiVE discord too if you are interested...
ALiVE discord (also in #channel_invites_list ): https://discord.gg/SjVe8E7x
From: https://community.bistudio.com/wiki/Arma_3:_Debriefing
Mission debriefing is displayed automatically upon mission end, unless debriefing params is not set to 0 in Description.ext.
I've been staring at the screen too long. Shouldn't that be "unless debriefing param is set to 0" ?
@past gazelle I think you are right. Pretty sure debriefing IS shown by default.
Well, to turn off the debriefing you use sqf debriefing = 0;
For my issue, I'm trying mission event handler "PreloadFinished" for mission start.
Sounds right
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...
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?
A trigger you mean?
the area is a trigger
Oh you mean a switch-case loop?
maybe ....
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
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.
I already have the following line of code immediately before this
waitUntil { units west inAreaArray _mapTrigger isEqualTo [] or units east inAreaArray _mapTrigger isEqualTo [] };
it waits until one of the teams is dead, then it decides the winner
Ahh I was wondering how you were doing that so the first team inside the trigger doesn't automatically win...
yeah
Yeah makes sense. Have you tried running it?
I have, but I need to test it with more than one player and I havent had many opportunities to do that
The countSide example online _num = west countSide list _triggerOne; may be more efficient, but I think still equivalent in behavior.
it works perfectly in singleplayer, the side that the player is on always wins. however, in multiple its really weird
that would return a number, right?
yes
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?
I think so, but TBH i don't really remember.
ok
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.
yeah
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.
im not that lonely
lol lucky you 😛
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. 🙂
or you can script it :p
differently to what I did before? #arma3_scripting message
design for SP or design for MP should be decided at first 😉
I personally always script as if it were for MP (remoteExec included), but for some SP-only effects of course
this is definately for multiplayer
yes o_o
Oh I'm doing a single player mission but after a month of working on it ONE person asked me to play it...
wait...
definitely plzzz
So suddenly I'm panicking and cleaning up tons of stuff...
when I said "singleplayer" before, I meant on a server with only me.
i tested it in multiplayer with 1 person
Oh you mean SOLO multiplayer...
yeah my bad
This seems to do the trick.
Han Solo...the late rogue pilot...
lol
I think I can figure it out, just looking for other people's ideas since I was kinda stuck
you only want players right?
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 😉
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
yeah
oh, ok then
then they get teleported back in for the next round
to begin with, instead of a loop, you could use a mission Event Handler```sqf
addMissionEventHandler ["EntityKilled", {
}];
for example yeah
I feel like the way im doing it would be a lot simpler.
ok
All, do event handlers and mission event handlers run in a scheduled environment? I.e. can I call waitUntil in them?
unscheduled, but you can always spawn from them
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?
exitWith perhaps?
so wrap it in a call
and at least put a 1s sleep in your waitUntil
yeah that makes sense
thanks
thanks
no I meant, thanks for saying it makes sense 🤣
lmao
not calling you out on your politeness 😛 😉 (others though…)
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.
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....
i guess
mainly I just wanted it to look like it wasnt scripted by an idiot lol
I felt like it looked that way
…theeen 😄
having 3 if statements when only one of them is meant to be true feels a little redundant
All code written by people other than yourself looks like it was scripted by an idiot.
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"];
and that, too 😄
It amazes me you can substitute a variable with an equation..
"WHO IS THE STUPID THAT WRO— oh it's me, 6 months ago"
see, this is what I mean. thats much better. however i still dont understand what private does
not if it was defined somewhere else
ohhh
so in this case, it wouldnt really matter unless I happened to use those same var names somewhere else?
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
Right. Or if someone ELSE used those variables in a mod...
just. use. private. it's not performance hungry, it's clean, it's safer, there is simply no reason not to use it.
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?
};```
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).
I thought variables that started with _ were automatically private?
rrread the page, dangit
all of you!
but doesnt it already get deleted when returning to outer scope if it has an underscore
a variable exists in lower scopes, not upper scopes
that's it
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 {
I provided my code, period 😛
yeah but ur the master scripter
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
good idea
if im adding a display event handler for "KeyDown", how do I check if the key "H" is being pressed?
use its DIK!
oh
you mean the params
?
params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"];
its dik 
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 {
not related
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?
DIK is a number
oh
you can only use the DIK Ids if you use:
#include "\a3\ui_f\hpp\definedikcodes.inc"
so I just use the number instead?
Grindr?
better now? #arma3_scripting message
ye
thanks
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
};
}];
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?
yes
great, thanks
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
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?
hint "YOU PRESSED THE KEY:" + str _key;
is wrong
but still it should've given you a hint
precedence
yes
the problem is probably display#46 is not initialized yet
wat
it's in initPlayerLocal
it's already local
add:
waitUntil {!isNull findDisplay 46};
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
how's some number gonna mean anything to them?!
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!
what's the point? they do know what key they press!
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
what is closed?
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
you make no sense. are you using google translate?
I have so
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
what if they use H for something else?!
wat?
^^^
how can they change the code?
what kind of mission is this anyway?! free for all?!
lol
you should never give scripting access to other people
wym
otherwise they can do whatever they want
well the proper way to do what you want would be to use something like CBA keybinding system
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)
wait what do you mean giving scripting access. if I share a script, people shouldnt be able to modify it?
aren't you making a mission?
yes, but people have their own keybinding
but if someone wants to borrow the holstering script for THEIR mission, they can change it
yeah, but most servers use H for holstering
what is the best way to get the vertical middle point of a man when the man can stand or crouch or prone?
selectionPosition
or aimPos (not exactly middle tho)
great thx! "pelvis" looks ok
Why IS that 46 anyway?
¯_(ツ)_/¯
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..."
46 is just a number
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...
created by the devs
it's an IDD
every display in the game has an ID
that's how you "retrieve" them
Is there a list somewhere?
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...
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?
same place?
as in same "ratio", or exactly the same place?
the idea is that there will be a cinematic border, i want to show up text exactly above that cinematic border for every screen resolutions
do i need to use safezones
depends what GUI format the cinematic border uses
i use BIS_fnc_cinemaBorder
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
can you give an example of using safezones with dynamictext mate
you just offset it. e.g.:
_y = safeZoneY + (1 - 0.2) * safeZoneH; //20% higher that total screen height
["my text",-1,safeZoneY + (1 - 0.2) * safeZoneH,4,1,0,789] spawn BIS_fnc_dynamicText;
like that?
maybe
I've never used dynamicText
I'm not sure what x and y are
read that for GUI coordinates
ok this seems to be working so far
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;
@ripe sapphire yeah cinematic borders use safeZone format:
_height = 0.125 * safeZoneH;
that's the height of the border
ok cool so this code should show the text just above the bottom border for every resolution right?
["my text",-1,(safeZoneY + (0.750 * safeZoneH)),4,1,0,789] spawn BIS_fnc_dynamicText;
it starts from above the border, yes. but I can't guarantee whether the text height causes overlap with the cinematic border
depends on font height
okok thanks
in case it does, how do i make sure the overlapping part shows in front of the border? (not covered behind the border)
that's out of your hands
it depends which layer the text and cinematic borders lie in
it says you can define the resource layer of the text
would it show in front if i set rsclayer to 9999?
can it break the game
no, but maybe other layers. idk
hmm ok thanks
btw, whats the default value of rsclayer when using this function? its not stated in the wiki
there's no default value
it creates a new one, using this:
https://community.bistudio.com/wiki/BIS_fnc_rscLayer
ok i see
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
yeah its on top, but i remembered some time ago there was a case where it was behind it, but i guess it works now
thanks
probably related to spawn
tried creating text before cineborder, text still on top of it
if you spawn both, there's no guarantee which one finishes first
makes sense
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
what if cinematic border was in 790?
how do you find out
it was a rhetorical question. I mean don't use numbers
well if you dont define the rsclayer, it will get covered by the cineborder
even though you spawn cine border first
I didn't say don't define rscLayer
I said don't use (arbitrary) numbers
but the rsclayer params need numbers?
yeah, but you're just providing an arbitrary number
what is 789?
just use:
#arma3_scripting message
its from the wiki example lol
…or copypaste the function's code and add your text control and stop asking questions xD (j/k, no worries)
oh ok so:
["my text",-1,(safeZoneY + (0.750 * safeZoneH)),4,1,0,[] call BIS_fnc_rscLayer] spawn BIS_fnc_dynamicText;
lol i considered that at one point xD
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
is myText even a string?
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
we try ^^ nice to hear it works! 👍
if users were rated by the usefulness of their answers, I would be in the negative
the biki is useful at least 😝
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
nooope, not reading that.
:(
plus, you have a throw and no try/catch.
make the smallest repro, then ask your issue plz
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];
};
};
so what is _fillBackPacks value?
where does the code breaks / stop running?
what "doesn't work"?
It's fillBackPacks = 1; in the config. But I know it works cause the hintSilent is showing up
That's the thing. Idk, no error and no loot in the backpacks
Was mostly just wondering if you saw anything wrong here
so far nothing
try _backpack addItemCargoGlobal ["FirstAidKit", 1] maybe
like, hardcode it
Good idea
issue with multiple parameters = reduce the variables to not overload the brainz 🧠
So it worked
Also figured out that some backpacks don't have markers being created for them
¯_(ツ)_/¯
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;
}];
_unit, _vehicle and _unitItems are not defined
Doesn't it see _unit and _vehicle in the params?
pass those stuff as the event handler arguments
also, convert _unitItems to a hashmap
altho, what if he drops it midway? 
better just put it in the EH code then
So is it a locality issue or....?
Ah, okay, I get it then.
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....?
why the params there?
and BIS_fnc_addStackedEventHandler allows you to pass parameters into the code, so why not use that?
Fair
Hmm. I made an onPlayerKilled.sqf in the root directory of my mission but it's not being executed on death...
maybe it's onPlayerKilled.sqf.txt
no it's sqf all right...
What's the code.
"End4" call BIS_fnc_endMission;```
I tried it in the debug menu in the editor and it works fine...
"end4" maybe?
you should go back to editor afaik
try systemChat "works"; enableEndDialog;
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)
yeah that's of what I wanted to make sure, that it triggered properly
Unless maybe BIS_fnc_endmission can't be called like that...
"
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" ?
Sorry say again?
it can, but it's better if you [] it
replace the code with failmission "End4"
["End4"] call BIS_fnc_endMission; ?
Add it.
ok THAT worked...
wow...caught it right at the grenade explosion 🙂
ok now I'll try ["End4"]
BIS_fnc_endMission does?
wtf it's right there on BIS's page...
Oh...but you never see it if you DIE...
gotcha...
under Execution:
// Singleplayer / client-side
"end1" call BIS_fnc_endMission;
I guess...it's not that kind of execution?
…yyyes.
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?"
someone else failed the mission, by sending you 😄
Hmm...but an even weirder question: why does the ending dialog have "restart" and "continue" instead of "main menu..."
continue is main menu
Yeah, I know that but...I'm not that smart...
I wanted to check if group is known to side but knowsAbout takes object as target
would using group leader as target be sufficient?
yea or check if any unit has knowsabout value higher than zero. but that would be slower
no
it also takes side
oh target?
yea, target
im going to just check all the units even its slower
private _units = units _targetGroup;
if (_units isEqualTo []) exitWith {0};
private _total = 0;
{
_total = _total + (_sideWho knowsAbout _x);
} forEach _units;
_total / count _units
i meant something like that
yeah average
the return number of knowsAbout is hard to understand. what is 1 what is 2? well 4 is max
how do we uh set up vehicle patrols and helicopter extractions im dum
vehicle patrols: add move waypoints, then close the loop with a cycle waypoint
helicopter extractions: add a land waypoint, then in the condition:
[player1, player2] findIf {
!(_x in vehicle this)
} < 0
and then add another waypoint for where you want to go
player1 and player2 is an example of units that you want to extract
sqf
actually nvm
the landing script never even checks the condition
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?
ACE/some other mod
¯_(ツ)_/¯
what if you double press V?
Nope
is the vehicle locked?
then how do you expect to get out?!
how do you stop zeus group dragging?
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?
ye
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
p == p ? what's that
testing global variables
uh
where did you get that from cuz that doesn't work like that
you can use
to check if variable is undefined
if (isNil p) then { systemChat "exists"; } else { systemChat "no joy"; };
doesn't print anything,e ither
ah needs to be string
if ( player inArea "SpawnMarker" _x && started = 1 ) then {
remoteExec ["spectate.sqf", 3]
};
Whats wrong with this? Says I'm missing a )
= is an assigment,
== is a comparison.
fair enough, thanks
inArea check is more expensive than simple comparison, you could use lazy eval here to optimize that condition.
if (started == 1 && {player inArea "SpawnMarker" _x}) then {};
see: https://community.bistudio.com/wiki/Code_Optimisation#Lazy_evaluation
You can't use remoteExec with a filename.
Also player inArea "SpawnMarker" _x? That looks like an error to me.
is there an obvious way to delete hash values in a cba hashmap
i cant seem to find anything
set them to nil?
ok ty
that CBA component should have a deprecation warning imo
or atleast be updated to the new hashmaps, atleast better backwards compatibility
it does things that hashmaps don't support, like objects as key
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[] = {};
}
}
class CfgSounds
can't have multiple classes with the same name
and yeah you're missing a } just count them
im very new im kinda lost. i just got the script from a youtube vid
its not a script, its a config
It was for one but i tried to modify it for two
yes
but you don't have two CfgSounds
you only have one CfgSounds, with two sounds inside it
no
you have one CfgSounds
in which you set multiple sounds
So remove the second one
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
Thanks! Where was I missing the lasst "}" ?
you have to close your } with ;
but it only throws a warning right? if you don't put a ; after class }
put ;. this is config, not fun
yeah, of course, just making sure so i don't have to edit my config parser 😄
oh shoot sorry, I thought it was the same person 😆
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?
the second
Skips current loop iteration and continues with the next one.
then is the answer to my question that no, it will cancel all future iterations of the loop?
sharps already answer to you, just wanting to point this one as it could be what you want
[{
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
Extract the identical body of the spawn and the event handler into a function.
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
Can I define functions anywhere for that remoteExec?
Ie can I define functions within the code for remoteExec
Yes, in CfgFunctions. Or as global variables.
Yes also inside the remoteExec, but you probably want them outside.
I'm shoehorning this, I'm executing the code from the debug console so no CfgFunctions
But lets see about those inline functions
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
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];```
thanks
Trying to play a sound to every player in the server and
["FD_FINISH_F"] remoteExec ["playSound"];
wont work?
does it work locally
Is there no way to load a file on the file system?
…plz explain
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
yeah, try an absolute path or some ../.. path
I don't know much more 🙂
but it should work, right?
is there no way to print the current working directory for the arma script?
can you just use an addon already? 😄
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?
is there a way to detect a laser pointer is on you?
the binocular not the rifle attachment
Iirc yes you can get those lines
lines?
maybe some near objects command?
that wouldn't be really precise, but close enough id imagine
I don't understand
I'm trying to have a way for a script to detect if a laser pointer is onto a specific opbject
@sanches see laserTarget
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
Post the details
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
Incorrect syntax for setUnitLoadout (missing unit input, ie. _unit setUnitLoadout...)
https://community.bistudio.com/wiki/setUnitLoadout
I assume rest is generated from getUnitLoadout so there should be no issue there.
Also... check data types:
(_unit) setUnitLoadout {} does not have a meaning.
it should either be string or code, this means nothing...
Judging from location of that {}, you just wrote setUnitLoadout later and just confused and put it outside of {} instead of inside.. as well as forgot to mention a unit
got it thank you
now i am having the issue that it sets the loadout to that loadout on start instead of leaving the base loadout
define "on start", before you activate the action?
havent used that, this is the only code in the init
So you didnt activate the action and still got the loadout?
It should be another thing unrelated to this then, I dont know?
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
Paste the new code here.
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",""]]];
That 2nd parameter (player setLoadout...) is still not a code or string..
Wrap it up with {}
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
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?
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
that doesn't exist, scripts have no working directory, what are you trying to do??
He wants to execute a script on the server (Linux) every time a player connects (without modifying the mission), and he's trying so hard not to do what we told him: make an addon! 😂
do I remember wrong or is it possible to have a script file in your user folder that is run every time mission starts?
I think you remember wrong (otherwise I would learn something)
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?
iirc you set it via command line
so its not ArmaInstallFolder ?
¯\_(ツ)_/¯
ok
How do you set it?
how dare you
2 hours and 8 minutes of silence later...
👀
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;)
_curpath = _x select 0;
_curFilesandFolders = _x select 1;
_have you heard of our lord and saviour params?
But I have just changed it anyhow 😛
but yeah, if you want to use _x from different levels, you should (and can) assign them to differently-named variables
hmm
other than that, if you don't need, _x is always the innermost
Then a generic error popping up is likely something else and not the _x then
huh?
Well I got a generic error at that point, but seems to have gone now
that's something else then
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 👍
¯\_([[],[]])_/¯
Hmm...why is the first slash disappearing... 😛
need double \\
There we go...
also, think of escaping underscores 😄 \_
THERE we go...

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
don't "figure" things, read the wiki? 🙂
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
sure thing! yes the wiki should provide assistance; we can help you to understand it if needed 👍
Thank you, I'll check it out I actually want to understand what exactly I am doing and gain knowledge I appreciate the help
units Wave1Group1 findIf {alive _x} == -1;
returns true if all units are dead
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
yyyeah. a lot of text to say "I have multiple steps, I don't know at which one(s) it fails"
issue is elsewhere, not in that function
im suspecting you might be using same marker name everywhere
Sounds about right
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];
};
Where should I put that? In the section where I create the loot or where I'm creating the markers?
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;
can also do a for "_i" or a _forEachIndex as well depending on your use
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?
markerName setMarkerText text
I’ve done that but it displays it on the right side of the marker
Nvm
I forgot about structured text
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?
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
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?
I personally do it this way:
_size = ctrlMapScale _map * worldSize / 8192 * 64;
gives it a constant size
hmm I tried your math but the icon still renders bigger/smaller than the underlying marker
_scale * 256 + (1 - _scale) * 256 umm, that?
nope...
the problem isnt scaling the icon but scaling it to same sizes as markers on the map
Is there any script command to get playable/player occupied logic entities?
Such as Spectator and/or Zeus game logics
zeus has commands
I don't think spectator is necessarily a occupied unit? or some weirdness?
allCurators or whatever returns all curator logics
not the actual virtual entities, which don't need to be tied to a curator module
i don't get what you want then, drawIcon behaves +- the same way as map markers
Running player in debug console while in a spectator unit returns L Alpha 1-2:1 ()
so the player is certainly tied to it
map marker rendering size should be same as icon rendering size. but I cant do that
Is it possible to adapt bezierInterpolation command to work with UI coordinates?
It is necessary that the control moves as in the first picture here - https://community.bohemia.net/wiki/bezierInterpolation
each marker has a size field in their class, if you use that size in the drawIcon parameters, it will be 1:1 marker size
Just work off the [0,0,0] coordinates as top left coordinates?
and then pass it coordinates as 2D, ignoring the Z axis
Thx
units sideLogic select {isPlayer _x}?
Tried that, returns []
though it does list the logics
playersNumber sideLogic also returns 0
even though side player returns LOGIC
🤔
can you post a screenshot in here?
what logic in particular?
Tried with Zeus game logic and Spectator
dm me
typeOf(units sideLogic select {isPlayer _x} select 0) >"B_VirtualCurator_F"
and "VirtualSpectator_F" works for spectator aswell in my case
I'd like to avoid hard coding it that way
umm ok
I must've made a typo because now it works ¯_(ツ)_/¯
objects in side logic, but that also contains triggers and other modules
But as mentioned, I have pathfinder.sqf in every single directory
Ah I'm slow again
there is probably a better way i feel like 😄
That info is old, read my comment there
@proven charm
ty Lou. In the screenshot White circle should always be marker size, when zooming. but it isnt
@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?
Thats the setting to allow players with filePatching enabled to join the server
And anyone know what used to be in this page: https://community.bistudio.com/wiki/Script_Path ?
enabling it on client is seperate
so
how can I execute .sqf files with execVM on the server?
with filepatching you mean?
put file in server directory, enable filepatching on server, and.. execVM it
is it to add -filePatching to the arma3 launch line, with -mods etc?
yes
don't scale it with map zoom then
Like this
./arma3server -config=server.cfg -filePatching -mod=
?
yes
alrighty, let see
but then it wont ever be the same size as the marker
the marker doesn't resize with the map, it stays at its 2D size
so pick one or another, but you can't resize and not resize at the same time 😅
yes but it's render pixel size changes
how come?
like i said, you need to lookup marker config, and use it's size
IT FUUUKKEEN WOOOORKS
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;
}];
if you scale/zoom everything is ok?
yes
ok trying to get your code working...
my markers are ellipse so it wont work
oh, so you were talking about ellipses the entire time?
ellipses/rectangles DO scale with zoom, because they need to represent an area accurately
yes :/
well your code works, with icon markers
well back to the drawing board 🙂
g2g now, thx for the help!
booo yah
https://emil.fi/d/arma3stuff/forceUniformAndHeadgear.sqf
Anything you'd change?
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
It's just the same things as I've already pasted here, except I added the event listener for new players
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 
just… why not make a mod again?
mod and addon are the same thing, right?
I'll make it one when I figure out how 😄
Anycase, feedback on this?
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?
why not have all of this clientside? 😄
whatcha mean?
all of this code could be ran by client himself, without the need of server telling him to do it
that would required a client addon/mod
wut?
I don't understand what you mean
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]
How would clients run this code?
so I would need a clientside addon/mod
test it? 😄
no, you just store the code in the mission
you are assuming there's a mission I'm making
I'm not
I'm shoehorning this into existing missions
so that if I want, I can force, for any mission, the player gear
read the wiki page and the syntax
so edit the missions instead, and do it properly? 😄
You mean edit tens or hundreds of pbos?
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
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.
No, I have the third choice of executing code from the debug console, which now, finally, works nicely 😄
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
I’d recommend running the code for the player in a onPlayerRespawn.sqf so that way you just copy paste the file into the mission before loading the mission up. That way it is done manually on every respawn so you don’t cause a lag spike because your changing everyone’s outfits at once.
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.
can I do units blufor instead of units west ?
thanks
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).
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
checked the doc (wiki)?
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
yeah and the , is valid there
see https://community.bistudio.com/wiki/BIS_fnc_taskCreate "taskID" argument
No error gets shown and the task gets created
The only problem is the animation not playing
did you try switchMove?
And me not knowing where to put the parent task ID
Ive checked the wiki, but I'm still lost honestly
you already got an answer that you should use playMove over playAction
Will try
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
what error are you getting? 😄
its throwing a encountered "," was expecting one of: every single thing listed lol
The taskID parameter can be a String or Array, have a look at what the wiki says about the array 🙂
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
the code you sent compiles fine for me 
I suggest not relying on undocumented unguaranteed behaviour that works "in most cases"
why does drawIcon3D have a parameter for a color? what if the icon I am using already has a color?
textcolor?
oh icon
well color modifier
map markers are also single color image, with color on top
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
ye
{
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?
ye
okay thanks
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
{
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
ohh yeah forgot about that