#arma3_scripting
1 messages · Page 649 of 1
backpacks are part of cfgVehicles
items are part of cfgMagazines
their configs are different
use an if condition with:
https://community.bistudio.com/wiki/isClass
isClass (configFile >> "cfgVehicles" >> _item)
if it's a class in cfgVehicles, use the backpack version
otherwise use the item one
ok
https://community.bistudio.com/wiki/addItemCargoGlobal
you could've used this with weapons and mags too
ok
Works with items, weapons and magazines.
but I want the backpacks to be integrated into the crates in the exact same way as the rest of the items. will using addBackPackCargo interfere with this?
wont I have to create a separate array like with the weapons and magazines?
as I said, use if
ok
private _itemArray = ["Binocular", "FirstAidKit", "Medikit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
_crates = allMissionObjects "Box_EAF_Equip_F";
{
_item = selectRandom _itemArray
_x addItemCargoGlobal [_item, 4]
} forEach _crates
ima just move this up here
no need to keep spamming it for no reason.
https://community.bistudio.com/wiki/if
ok
if _item isClass (configFile >> "cfgVehicles" >> _item);
@little raptor
is that a start?
you don't have to ask me with every change that you make
you should now know how to use the wiki
just read the description
https://community.bistudio.com/wiki/isClass
I read the whole thing
i am pretty sure that an if statement is a type of Boolean
and i put a boolean in the isClass statement
so everything should be good
if _item = isClass (configFile >> "cfgVehicles" >> _item);
what about the syntax?
is there a =?
here's how EVERYTHING in SQF works:
operand1 operator operand2
(operator and command are almost synonymous)
some commands don't have the left hand operand (like selectRandom). these are called unary commands/operators.
some have neither (like time) these are called nullar commands/operators.
commands that have both operands are called binary operators.
each operand can either be a variable, or the return value from another operand.
if a command returns something, it can also be saved into a new variable using =:
variable = operand1 operator operand2
Syntax:
if condition
condition: Boolean expression.
if is a unary command
you provide a bool to its right
it can be the result from another command
for example:Syntax:
Boolean = isClass config
Parameters:
config: Config
Return Value:
Boolean
isClass is also a unary command
it takes arguments to its right
it returns a boolean
so we pass its return value to our if:
if isClass (configFile >> "cfgVehicles" >> _item) then
ok
if isClass (configFile >> "cfgVehicles" >> _item) then
so that is just saying, if _item is in the cfgVehicles class, then....
what next?
@little raptor
private _itemArray = ["Binocular", "FirstAidKit", "Medikit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
_crates = allMissionObjects "Box_EAF_Equip_F";
{
_item = selectRandom _itemArray
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
}
} forEach _crates;
@little raptor is this what you were trying to get me to do?
I think I figured it out, ima try it
your if statement is missing the { and } 😬
plus else
@little raptor how does that look?
still not right. the line with foreach should be last
@robust hollow better now?
yea
how can I make that whole section repeat 4 times?
This has been an interesting read on how to teach Arma scripting. Maybe rewrite it as an article in BI forums introducing others to arrays and control structures?
try, fail, try again, see progress, continue trying till it finally works 🤣
so i have two triggers with a group of comanches inside them
the first one hides the comanches:
{_x hideObjectGlobal true} forEach thisList;
and the second one shows them:
{_x hideObjectGlobal false} forEach thisList;
however, in #screenshots_arma you can see that it spawns weirdly
wtf happened?
You meaning some parts of em still showing? That is just an issue that haven't solved for ages
huh thats weird
Can default functions be overwritten?
Since I want to force the "bis_fnc_arsenal" function to use Ace Arsenal instead of Virtual Arsenal.
https://gyazo.com/b7df0c081baa3290666147067b4026d8 can someone help me make it so the tabs on the back of this helmet emit light just like a chemlight would?
I have no starting script and Im totally lost on where to start and what to do with it
im trying to make a version of this helmet with no light and another with the light on
how can I make it so these light tabs glow red
how would i script a rush like mission ojectives, attackers vs defenders, attackers have to destroy two ojectives once they do that they have thier spawn point move up and the defenders spawn points move back, and enables the next set of objectives, attackers win if they take out all sets of of objectives and defenders win if they managed to drain attackers spawn tickets?
Do you guys know if the Vanilla Scoreboard is scripted somewhere and accessible to us or is it on Engine side ?
I mean the UI. That is just to interact with the scroes.
I need to check out how it's displayed in the code.
I don't think you have a way to access something related to it
yea looks to be engine side. the function for that display is empty
Okay thanks
And then get Leopard20 to do it for you
@quartz coyote I've been thinking about a custom scoreboard - my UI designer tells me it can be done, but keeps disappearing
I have one, that's not the issue. I'm just facing scripting issues I can't work around and would have liked to check how the engine is doing it
what kind of issues?
I should clarify... my UI designer chap keeps disappearing, not the scoreboard lol
LOL at Dedmen's GIF
are you meaning that it's dragging/beating a dead horse or that you are rushing whatever the cost to fill the task? 😁
thats what will happen when I do that
hmm yes, flogging a dead horse is a great saying in english, but there are better GIFs for that
so I assumed that wasnt what ded meant
or is it that one team member gets dragged along by another ignoring injury?
either way, it made me chuckle... my kids liked it too
meanwhle... back at the ranch....
BIS_fnc_showRespawnMenuDisableItem
should I run this on client or server?
as it uses uiNamespace, I presume it has to be client side?
How does the eden editor allow for vehicles being spawned as destroyed, without injuring anyone around, and not spawning flames? (while still being simulated)
Is there any way to achieve the same behavior through scripting?
Hello i have question with fire, I create fire with createvehicle but the problem its cursortboject return nil if i point the fire and if i want delete this i can' t
object setDamage [damage, useEffects] Since Arma 3 v1.67Parameters:
object: Object
[damage, useEffects]: Array
damage: Number
useEffects: Boolean - false to skip destruction effects. Default: true
Both are referring the same 
ah yes
I had the useEffects flipped
any lads or ladettes got a script that uses the ingame music stuff (accessible with jukebox from 3den enhanced etc) to play modded music through a radio, preferably with options?
tried say3d but cannot make it work for the life of me
music is already ingame with classnames, doesnt need adding to the mission or whatnot
if you could tag in reply that'd be grand as I have this server muted
playMusic may be what you are after 😉
that could be it, i'll try that after this lesson
will that play it originating from the object?
no
then say or say3D (same thing) but also a CfgSounds in description.ext
or playSound3D + and file nameattachTo
if the object is static, use playSound3D with the Music path
playSound3D+attachTo
works?
afaik it doesn't follow the object
ah yep nope, I mixed it with say3D returning an object
oh so regardless i cant path it to whats in the mods it has to be in the description.ext?
the musics are defined in CfgMusic, and this can only be played with playMusic
if you create a CfgSounds pointing to the files, it works
so no choice but to go fiddling with mission files
which i dont like doing
eeeeh ill just play music through my phone that way it sounds like a radio too 😂😂
Does anyone know a script where it can disable radio communication between players? (TFAR radios)
just take away the radios from the players? what exactly you wanna do?
play something from my wife's collection of shouty, angry, growled German heavy rock. That'll make them stop listening
@still forum i want to know a script where if avplayer on the other team destroys a communication tower then how do i disable the other teams tfar radios
didn't tfar have a jamming feature?
Not sure how would i use that
TFAR doc may have the info?
Is he/she in this discord?
@acoustic trellis
you can look at this script:
https://forums.bohemia.net/forums/topic/203810-release-radio-jamming-script-for-task-force-radio/
see how they jam the radio
About This is a multiplayer compatible script that jams the radios of players that are in range of the jamming device(s). The script supports multiple jammers and terminates once all of the jammers have been destroyed. This script affects each player individually, so a person standing inside the ...
Thank you!!
No
configFile >> "CfgVehicles" >> "B_Captain_Dwarden_F"
Had anyone seen this before?!
yes.

Ok cool!
How do base game landmines proximity "fuse" detection work? Is it repeatedly checking nearestObjects?
Same way as object collision checking works
So no
Quadtree
Well nearestObjects is also quadtree but not like that
In short: Magic
I see. Is it better for a placeable vehicle-detector-object compared to alternatives like nearestObjects, and/or more reliable than EpeContact EH?
Yes, epe is physics only
I kinda want to make some trigger area thing that works like mines do.
And replace where people use triggers, for teleporters or bargates
How can I make a mission end with the death of my character?
do you already have something executed on mission end, something to execute mission end, and/or do you just want it to coincide with the mission ending in general
I already have something done but now I don't know how to make that ending be laced when I die
oh i read it wrong I thought you wanted character to die when the mission ends, not make mission end when character dies
is it a SP or MP mission, if MP do you want to mission to end for everyone or just "end" for the player who died?
It is in sp, what I want it to do is when my character dies I skip a failed ending that I see
something like this will prolly work
"end1" call BIS_fnc_endMission;
}];
but it's ridiculous
Imagine as soon as you die, you don't even see your character drop to the ground and
bam
Mission Failed
i have to put an Pelter (Demining Robot) into my Hunter as cargo from mission start and later check if the robot is alive in the mission, is there any way to set a Variable for the backpack/mining roboter to check conditions for it?
@next kraken Inventory items are no objects, so you can only try using the WeaponAssembled EH to detect when the player deploys the robot and then work from there.
UserActions statement works for that 😄
Is there a built in way to make a dictionary, (i.e., key, value pair) data structure? Look up key, to get value for that key.
only on the dev branch at the moment
Whispering in the shadows
Some folk say HashMaps are coming

Small question about the UnitCapture/Play
I'm guessing it's still not supported in MP ^^ ? And if it doesn't, is there anything that's could do pretty much the same thing in MP ?
Thanks !
it… is MP compatible? no?
oh is it ?
Tbf last time i tried it was a while ago XD so it may work
I didn't tried recently c:
I used him in a video, Leo
my mum asked my 2 sons what they wanted to be when they grow up.. at the time, they were 8 and 9m and they said "We want to be youtubers!"
so I decided how hard it is to make content
*idecided to show them how hard it is to make content
and that was the result
not in A2.
but you can create two arrays
one containing the key
one containing the value:
_keys = ["a", "b", "c"];
_values = [1,2,3];
_index = _keys find "c";
_value = if (_index != -1) then {_values select _index} else {-1};
yeah, i guess that is a good enough solution
https://youtu.be/bPceKHYaIb4?t=28
But that's Kerry isn't it?
Dwarden is the left one standing in the back:
#arma3_scripting message
at 25 seconds, the runing man is dwarden and in the close up credits shot
nope, it's not!
im sure we used dwarden for this because hes gendarme in the game
and the tanoa 50 video needed a policeman
let me see if i still have the mission file
that's "Default Face", but the Editor unit might be a Dwarden
ah
yeah, the default face is Kerry isn't it?
i dont know
…no? at least, I don't think so
i dont have the mission file any more 😦
If you spawned the unit as player, his face has been replaced
That's just how the game works!
yes, it was a player, my son played dwarden, i was the camera
thats why he blanked me when I showed him
"Thats not me, you arse!"
lol
it took a few days of annotating the original hawaii 5 0 theme, then shooting it, timing it, editing... all ine all, took about 40 hours
80 man hours becuase there was two of us
well.. 40 man and 40 8 year old child hours... but they've never said since, I'm going to make a career out of posting shit on youtube
so, job done
A2OA: Is it possible to get the position an AI unit thinks another unit is located?
guys quick question , i am trying to create marker using createMarker https://community.bistudio.com/wiki/createMarker function , i need to pass channel and creator as third and forth parameter but still getting error that it only accept two parameters , any one can help me with that ?
_marker = createMarker ["player marker ", player,1,player];
You are probably not using A3 v2.01 yet.
(since Arma 3 v2.01.146752)
i got it , is this version on the main branch or it is on the development branch as steam telling me i have the latest version
ok got it thanks i will pull the dev to continue scripting 🙂
Hi all. new to the scripting thing.
So I've reffed a old script ( before 2.0) which I've figured out does not make use of "nil" which this old script does.
How can I correct this? ( since Im a proper noob. )
this addAction ["Download Files",{ [] execVM "download.sqf"}, nil, 2, true,true,"", "!_target getVariable ['inUse',false]"];
why do you need to correct it, there's nothing wrong with it
better question is: where did you get the information from that something needs to be altered
https://community.bistudio.com/wiki/addAction
see example 4 (or 5), it also uses nil for the arguments, which is 100% valid
ok well my googling turned that up. as said clueless. was getting a Boolean error. I could share here quick.
uploading mission
Thanks to anyone who is willing to help.
Well apparently i fucked somthing up in init.sqf but I don't know what. It is not initializing, there is no debug error code, nothing. I check with notepad++ with sqf coloring, nothing strange.
Could someone please take a peak what I did wrong. It worked but when I tried to make it more organized everything went dark
https://pastebin.com/c2y0W2R1
"!_target getVariable ['inUse',false]"
precedence issue.
it should be ```sqf
!(_target getVariable ['inUse',false])
you're wrapping lines 10 to 30 in { }
want to check if any civilian is killed by blufor on an MP server. what i tried, added EH in the initServer {if ((side _x) == civilian) then {this addeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]} forEach AllUnits}; and checked ingame via trigger civ_casaulties>0 but no reaction. any idea ?
is civ_casaulties even defined?
yea, publicVariable "civ_casaulties" in the serverinit
this is not defined
use _x
also you might wanna use MPKilled instead of Killed in MP
Yeah i just noticed. It was a rookie mistake. Damn 😅 Thank you
{if ((side _x) == civilian) then {this addMPeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]} forEach AllUnits};
mhh thx no luck with that one
Why the extra { }?
There is also one missing.
{
if ((side _x) == civilian) then
{
this addMPeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]
} forEach AllUnits
};```
Now find the mistake
the mistake was this
I already told you @next kraken
im using poseidon, but i cant find the mistake, sorry Leopard20, used _x allready
if ((side _x) == civilian) then
{
_x addMPeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]
} forEach AllUnits;
killed is not an MP eventhandler
used killed no luck^^
MPkilled
if ((side _x) == civilian) then
{
_x addMPeventhandler ["MPkilled",{civ_casaulties = civ_casaulties + 1}]
} forEach AllUnits;
where are you calling that?
debug console, tried serverside local and global + initserver.sqf
and where are you getting civ_casaulties?
is your trigger server side? (which should be)
also, why publicVariable?
you only need it on the server
trigger is serverside
Thank you so much !! only issue now is it dosent step to the progress 😦
well for one thing, you don't need execVM for addAction
this addAction ["Download Files","download.sqf", nil, 2, true,true,"", "!(_target getVariable ['inUse',false])"];
as for why it doesn't work, check download.sqf
Are you sure the trigger is not fired? Since trigger is server-side, the onAct will only execute on the server and you’ll have to remoteexec them to clients
You can also do this to check the actual value of it ```sqf
Hint str civ_casaulties
(btw: casualties)
no it's causalties 🙃
No, casaulties because the civvies got casaulted! 😆
Guys please explain?? Is this correct
Variable = 1 /// global variable
_variable= 1 /// local variable
private _variable = 1 /// private local variable
What is considered a local variable
yes
So local variables are variables whose identifier has an underscore in front yeah?
yes
Need help with importing a custom sound into a scenario. Arma seems like it can't find the custom sound file. I've added CfgSounds into description.ext, and my custom sounds are in a "sound" folder in the mission directory. Tried to play sound, getting a "Sound not found" error. Sound is also not present in Trigger:Effects sound list.
This is especially annoying since I literally copy pasted the examples from the Arma wiki to use as a template. It may be the pathing that's wrong, but I have no idea. Any help?
Description.ext file:
class CfgSounds
{
sounds[] = {};
class c4_beep
{
name = "c4_beep";
sound[] = {"sound\c4_beep1.ogg", 1, 1};
titles[] = {0.5, "*beep*"};
};
};
Thanks guys 👍
Try ”\sound\c4_beep1.ogg” edit: this is incorrect! Dont use
No change. "Sound not found" and still nothing in Trigger:Effects
Have you reloaded the mission?
Yep
not just reload.
Did you go back to 3den and start the mission again?
Just did, still nothing
what command do you use?
wait so this is your issue?
Sound is also not present in Trigger:Effects sound list.
It's a symptom of the issue, since I read that any sounds defined in CfgSounds should also appear in the Trigger:Effects list
but not Description.ext
it means the ones defined in ConfigFile
not missionConfigFile
Understandable, but I'm using a playSound in an .sqf to play the sound in question
That's my main issue, since it outputs the "Sound not found" error
Well, post the code
Literally just a
{playSound "c4_beep"} forEach allPlayers;
It's just for debug, since I can't even import the sounds properly 
Where do u put the c4_beep.ogg in the mssion folder?
I believe this code is correct already but the ogg file needs to be in a folder named sound in the mission folder
missionnamehere.Altis -> sound -> c4_beep1.ogg
Also according to the CfgSounds examples on the wiki, it doesn't even have to be named "sound" specifically
Yea but thats what u put in your description.ext
Trying moving the file to the main directory, change the description.ext, go back to 3den then reload mission?
I guess it's worth a try
Nope
class CfgSounds
{
sounds[] = {};
class c4_beep
{
name = "c4_beep";
sound[] = {"c4_beep1.ogg", 1, 1};
titles[] = {0.5, "*beep*"};
};
};
Strange, i have pretty much the same thing just with different file name and it works
Very strange indeed, it's driving me nuts since nothing seems amiss
Have you make sure to exit the mission to 3den and reload instead of just restarting
Aye
This might seem funny but is the mission folder the correct one with the one you’re editing right now?
Can go file > show mission folder from 3den
Cause i once edited the scripts of a diff mission than the one im loading in game and wondered why nothing changed 🙃
Try changing the classname to c4beep (remove underscore)
Does everything else (e.g. CfgFunctions) from your Description.ext work?
description.ext.txt 😬
The only other thing in Description.ext is respawnOnStart = -1, which I'm fairly certain is doing its job
But then again the respawn types are hella confusing, so I could very well be wrong
If this is actually it I'm eating a GBU tonight
That was it

Thanks for all the help, but goddamn that just feels bitter
Straight to jail
You can easily avoid stupid stuff like that by using something proper such as Visual Studio Code for your scripting 
Hello, does anyone know how it is possible for each unit to have its own reference points, being already in a group?
Reference points?
Bon appétit ! 😁
Woah, I was looking everywhere to see if anyone complained about processDiaryLink not working on briefing screen, thought Im imagining things, this seems to confirm it
Crazy that you found a message from me that old o.O
search function
Good thing discord stores messages that old 😄
yeah, going to fix it
Nice!
If you mean custom formation, not really.
You can make them move where you want, but then they're not moving in a "group"
Q: is there a limit to how many class functions you can include? I am running into some odd issues that seem to indicate there is a hard limit to how much text can be included in a file. Maybe I can separate that out across several files. i.e.
class MYLIB {
#include "path\to\functions.hpp"
// ... rinse and repeat ad nauseum (?)
};
Which might define something like:
class init {
class init_preInit {
preInit = 1;
};
class init_myInitFunc {};
};
And so on.
how big is that file? sounds chunky. I have never had that issue, but perhaps have never reached your level
I don't know, the parent file is only 60 lines, 26 includes. Each include defines its own member class, and can have anywhere from several, half a dozen, to dozen or so class/functions defined.
So it piles up, fast.
Wonder if I am hitting a barrier there.
If that's an accurate assumption on my part, then what are my contingencies. Introduce other parent classes. Could I even define a separate file, same parent class. I don't know, exactly.
what are the issues you are experiencing?
The log is indicating no ;, stuff like that, but I know there is a semi colon there. It's as though the parser hit a barrier.
or you have an issue elsewhere
Well, I thought that, but as I did what I thought were appropriate adjustments, the same issue would arise, in a different place.
so fix it in the new place?
mod configs are huge so a bunch of function classes is relatively small. highly unlikely it is an include issue.
is it common for compiled code to run behind that? i.e. I have something like class init_preInit {...}, right, which exposes a fn_init_preInit compiled function. A variable, compiled function like MYLIB_fnc_init_preInit lands in the namespace.
well... if you define a function in the function config then yes it will be compiled when you load in game. and if you set preinit=1 like you show above, then yes it will execute during preinit.
Hmm... can I define multiple files adding various functionality to the same parent class MYLIB {...}? does that work?
yes
Hmm, at the 'top' description.ext level, that ends up with,
class CfgFunctions {
#include "MYLIB_functions.hpp"
};
ok?
confused over it at the moment, head scratcher.
and in the problem area, I see the function in question, it did compile. but when I try to invoke it, nothing. not even an obvious log entry upon execution into the function.
how are you confirming it compiled?
I drop the variable name in the debugger.
and I have content there, versus nothing or nil when it does not.
What does the code look like?
Can you include side types in parameters? This is the only exotic thing I am doing there to my knowledge. i.e.
params [
["_varName", "", [""]]
, ["_proxy", objNull, [objNull]]
, ["_side", MYLIB_preset_sideF, [west]]
];
yea. it takes any type
Put something like systemChat "Function called"; above params and try if that shows when you call the function.
is it possible to get output of a script which can return nothing, and output predefined thing if it does such ?
I don't understand...
I get nothing, no systemChat even, like the execution never got there
[]spawn{
_v1 = [] call {_r = 1};
systemchat "t2";
_v = [[1]];
_v set [0,if isNil "_v1" then{[]}else{_v1}];
systemchat str _v;
};
in debug console it breaks before systemchat "t2";
It also breaks my mind
I am not fully aware of what you are trying to Archive
its for execution frame, so user wouldn't have to return something from the code he sends
What execution frame?
if (_condition) exitWith { nil };
_otherResult
```Are you aiming for something like this?
It looks more like the Black magic that is the out or ref Parameter stuff apllied in sqf
The Script Btw errors because in sqf, Var = val is not leaving anything on the value stack, making the code return literally nothing
But the function exists? 
verified the inputs to the function are there and correct. but the execution never lands in the function body. i.e.
["MYLIB_eden_startbase",MYLIB_eden_startbase]
@willow hound yes, see ^^, verified in the debug console
heaven forbid could it even be a call stack being blown.
So you can see the function in the functions viewer?
I'll check that... @willow hound
yep 👍 it's there
also as the debugger shows, enter the variable name, tells you the diagnostics
And call MYLIB_fnc_eden_startbase; does not show anything in system chat when systemChat is in the first line?
Where did _fnc_ go?
troubleshooting both sides of the execution path. those are inputs to the function, so it ain't that being the issue.
Functions from CfgFunctions are always TAG**_fnc_**functionName.
is it possible to get output of a script which can return nothing, and output predefined thing if it does such ?
func = {/*..*/ _this select 0 call (_this select 1); /*..*/};
_sc = {v = _this};
systemChat str ([1,_sc] call func);
if doesn't work, but works with _sc = {v = _this; 0}; . how to solve that ?
What on earth are you doing
(to make it work in the both cases)
@west portal not sure what you're accomplishing. I have a couple of functions, however, that return different shapes of results, depending on the input args. so, yes... entirely feasible.
X39 stated here #arma3_scripting message that _var = val; doesn't return anything.
if the function is specified by user, it may not return anything . i just need a handling for this .
right. would need to include _var = val; _var ... SQF is just particular like that.
if the function is specified by user
What do you mean by that?
@willow hound right, re: your assertion, yes. the function is there as we've established now, in a couple of ways. i.e. MYLIB_fnc_myFunc
the "_sc" is defined by user of the "func"
the inputs are healthy. verified those. the execution never lands in the function, however.
So if the user does ["Some argument"] call ILIAS_fnc_func; then ILIAS_fnc_func has to return nil?
the ILIAS_fnc_func processes script that he arguments . and return output of that script, which can be nil
Does ILIAS_fnc_func do anything else?
y
obviously
but i can't find how to get the output of script, if that output can be nil
First two lines in the script are literally,
systemChat "'MYLIB_fnc_eden_create' entered";
diag_log text "'MYLIB_fnc_eden_create' entered";
I see nothing appearing in the log.
@west portal
private _x = call {};
isNil "_x"
_result = (_this # 0) call (_this # 1);
if (isNil "_result") exitWith { nil };
_result
```Looks like it could work.
I'm tempted to just introduce a second function and start building it out slowly, see if/when it breaks.
with _var = [] call { a = b; }, the output is not nil but simply not existing
Doesn't that make _var nil?
no
the assignment does not return any value to the value stack, leaving nothing (literally)
not nil
nil would be an empty value
not no value
it's the same thing. nil is implied.
_x = call {};
isNil "_x"
same as:
_x = call {nil};
isNil "_x"
Well, but _var = nil; destroys the variable _var
So if _var = NOT EVEN NIL; then I would expect _var to not exist thereafter.
var = [] call { a = b; } is wrong
@dreamy kestrel @west portal to return something from any code, do this:
_Var = ([ni] apply {_params call _code}) select 0
this works with any code
yes, but not with _var = [] call { a = b; }
yep it works.
that is simply an exception
I already made a debug console with that!
An exception in SQF?
yikes!
_a = 0;
_b = 1;
_x = call {_a = _b;};
isNil "_x"
not even nil ...
mhh?
wat?
more like: a runtime issue you caused because it leaves nothing on the stack
tried it in the debugger. versus previous examples ^^ @little raptor
try this:
_a = 0;
_b = 1;
_x = ([nil] apply {call {_a=_b;}) select 0;
isNil "_x"
and behold the magic
So does it cause an error or what am I looking at here?
@little raptor simplify it. we're troubleshooting a "no return", not even nil question.
and I did
it's a peculiar gremlin
it's called an apply workaround
oh oh I see 👀
@little raptor thanks, this is exactly what i was looking for .
_sc = {_r = 1};
_v1 = ([nil] apply {[] call _sc}) select 0;
systemchat "t3";
_v = [[1]];
_v set [0,_v1];
systemchat str isNil {_v select 0};
"true"
_sc = {_r = 1; 0};
_v1 = ([nil] apply {[] call _sc}) select 0;
systemchat "t3";
_v = [[1]];
_v set [0,_v1];
systemchat str isNil {_v select 0};
"false"
yep that returns
np. it's nil tho (I misspelled)
no worries
tbh ... just ignore it
if someone is actually doing that, it is a user-error
period
Yes but I still want to understand what _var = NOT EVEN NIL; does to _var.
then give a 'correct way'
With or without error message?
@queen cargo
appreciate the 🔉 board, folks. I have a couple of avenues I want to explore before throwing it all away for the day.
you "just ignore it"
if a user decides to assign as last instruction in code, he just did wrong
not sure what error message it is ... probably generic something
Gotcha
that btw. is a classic case where sqf-vm can help you understand things better
https://github.com/SQFvm/runtime/suites/1889754040/artifacts/36957888
simple script, and much more diagnostic info (especially if you run the full diagnose build)
@queen cargo he need to write SQF, SQF allow to return nothing . inability to handle such (allowed) return is SQF's issue. not user's
given that it is mandatory for parts in arma, this won't change
and given that the issue literally only appears if one assigns a value as last instruction, it can be safely ignored (as people then just could add a nil or 0 after that and SQF would no longer complain)
general rule of SQF: never end with an assignment
"append" return nothing, while "push" -- something, and among other, such rule would sound like "always return something" . and it appears all the time, if you don't remember and follow that 'workaround' rule .
if that so, it anyway makes even worse, as the rule becomes less general and so even less meaningful and harder to remember
it is simple ...
just never do: variable = value anytime you end a codeblock
it does not matter for literally anything else
setVariable, fine
assign, too
using = last, nono
its not simple, because its junk . all you need to remember in programming language is basic syntax and some often commands .
found the issue 🤯 getPosAGL ... should be getPos or maybe getPosATL
complain at BI, not me
all i am telling you is that it returns nothing and that you do not end scopes with assignments if the value might be used afterwards in SQF
How can that prevent a systemChat in the first line?
@willow hound I do not know, it is bizarre. I just started paring off lines to see what worked... process of elimination.
i am not, i am trying to tell you what you have to do and that the situation is deal with it ... and you cannot change that
i would love to be able to do _var = _foo = 123
but SQF is SQF, custom script language for a game and BI decided that the assignment pushes nothing to the value stack
@queen cargo @west portal SQF is just not that sophisticated. it's pretty powerful though once you wrap your brain around the data flow, etc.
i realized when you said it the 1st time, but you kept adding things like "its easy" :)
it is simple ... and it is what it is
compared to visual data flow, like Prograph, but the principles are very similar.
not simple to remember though
it actually is kinda
and if you do not enjoy SQF, you may use SQC 🤪
@west portal it's a never ending struggle. logs are your friend. I continually get smacked by dumb stuff. SQF being what it is.
use vscode with some sqf language server (plugin)
helps to eliminate 99% of the issues 😉
@queen cargo so so... in its own way, I will give it that.
The SQF LS reports too many problems 
will continue working on SQF-VM language server once the pressure of university stuff settles
will get especially funny once #pragma support lands in arma and i can actually spend the time to rework the whole language server (type checked SQF ftw)
SQF-VM LS reports too many problems and Armitxes' language support has not received an update in forever despite GitHub repo activity, this makes me very sad 
ye... sqf-vm LS has issues
mostly because, as said, could not spend as much time as i would have anticipated with it yet
I have faith in you 😋
i have hopes for some people in the community still to pick it up
like ... my time schedule is so filled to the rim
could not even do any work 2020 (since corona started) on arma.studio really
and that even already uses sqf-vm for debugging
I considered it when you advertised for it, but I too have studies to complete, a happy little pet project to take care of and wiki articles to beautify, so I decided against figuring out VSC addon creation and looking into an already existing complex code base.
the codebase for the LS is trash 😄
somewhere there is a memory leak, the whole way i do it is also borked ... so many issues i would need to change
hm. i have made a new module with a variable size class AttributeValues { size3[] = {400,400,75}; }; can anyone tell me how i access these values in my script?
nevermind, i got it :>
_module getVariable "objectArea"
excuse my english, i only by now have correctly related/arranged all the messages X)
Wiki says of "getHideFrome" this: "Return Value:
Array - ASLToATL representation of the believed aimPos of the enemy object ". Does this mean the value returned is ASL or ATL?
if (typeOf rhsusf_m1132_m2 in _vehicle) then { CODE } else { CODE };
I'm trying to get this to work to run a different script depending on the specific type of vehicle
Getting: Error Undefined variable in expression: rhsusf_m1132_m2
Is there are a way to do this where I simply have the classname and check if it is in the vaariable _vehicle?
rhsusf_m1132_m2 is just a class name, not an object variable name
This is what _vehicle is passing 15ee5314080# 1170912: rhsusf_m1126_m2.p3d
isKindOf is probably what you're looking for
file names still have nothing to do with the classname
and that is an object...
so I guess you want ```sqf
if (_vehicle isKindOf "rhsusf_m1126_m2") then {
Lemme give that a try. Thank you!
Do i need a script to make a crate spawn with a parachute?
place this in the init field of the crate, and it will drop down (with parachute) from 200m
para1 = "steerable_parachute_f" createVehicle [0,0,0];
para1 setPos [getPos this select 0, getPos this select 1, 200];
this attachto [para1,[0,0,-1]];
3sec on Google
How would I change the name of a backpack drone after it's been assembled?
this addEventHandler ["WeaponAssembled", {
params ["_unit", "_staticWeapon"];
(group weapon) setgroupID ["Raven 1-1"];
}];
I've got the EH activating after being assembled but the group name's not changing.
can you use setvariable on a marker?
@exotic flax if I want to change it from 200m to 500m would it look like this:
para1 = "steerable_parachute_f" createVehicle [0,0,0];
para1 setPos [getPos this select 0, getPos this select 1, 500];
this attachto [para1,[0,0,-1]];
that seems to work
however there is one issue
the crate has random spawn location in the initServer.sqf file
and when I use this in the init on the crate, it no longer spawns at one of the given options in the initServer.sqf file
also why does it have to be a steerable parachute? what about those round ones that supply drops come with?
Is this the right forum to ask for scripting help? If not, could you point me in the right direction?
@buoyant hare If you read the last messages I think it looks like the right place, doesn't it?
Morning all. Trying to find a list off roll classes for scripting. ‘If “sniper”, ‘if “engineer”.
That kind of thing. Could someone point me in the right direction?
@topaz fiber A full list of the unit classnames can be found here: https://community.bistudio.com/wiki/Arma_3:_CfgVehicles_WEST
You could check for those classes using typeOf, which return the classname of a given object (more info here: https://community.bistudio.com/wiki/typeOf). If you just want to know the difference between Medics and Engineers and stuff like this use getUnitTrait: https://community.bistudio.com/wiki/getUnitTrait
Perfect, thank you.
"getNumber (_x >> 'scope') == 2 and getText (_x >> 'role') == 'marksman'" configClasses (configFile >> "CfgVehicles") apply {configName _x}```->```["B_soldier_M_F","B_recon_M_F","B_spotter_F","B_sniper_F","I_G_Soldier_M_F","B_G_Soldier_M_F","O_G_Soldier_M_F","I_Soldier_M_F","I_Spotter_F","I_Sniper_F","O_soldier_M_F","O_spotter_F","O_sniper_F","O_recon_M_F","O_soldierU_M_F","B_ghillie_lsh_F","B_ghillie_sard_F","B_ghillie_ard_F","O_ghillie_lsh_F","O_ghillie_sard_F","O_ghillie_ard_F","I_ghillie_lsh_F","I_ghillie_sard_F","I_ghillie_ard_F","B_Sharpshooter_F","B_Recon_Sharpshooter_F","B_CTRG_Sharphooter_F","O_Sharpshooter_F","O_Urban_Sharpshooter_F","O_Pathfinder_F","I_G_Sharpshooter_F","B_G_Sharpshooter_F","O_G_Sharpshooter_F","B_T_soldier_M_F","B_T_Recon_M_F","B_T_Sniper_F","B_T_Spotter_F","B_T_ghillie_tna_F","O_T_Soldier_M_F","O_T_Recon_M_F","O_T_Sniper_F","O_T_Spotter_F","O_T_ghillie_tna_F","B_CTRG_Soldier_M_tna_F","O_V_Soldier_M_hex_F","O_V_Soldier_M_ghex_F","B_Patrol_Soldier_M_F","B_W_soldier_M_F","O_R_soldier_M_F","O_R_recon_M_F","I_E_soldier_M_F","O_R_Patrol_Soldier_M_F","O_R_Patrol_Soldier_M2_F"]```
It's not nicely formatted, but it does have everything from vanilla game
Does anyone know the limitations of playSound3D in terms of audio length and file size?
most likely none, or maybe 4GB historically
@winter rose Ok. Because I'm having troubles looping a 3 min. long audio (700 kB) to a truck.
The truck just plays 2-3 seconds before going silent.
This is my code:
[] spawn {
while {true} do {
_this = truck;
playSound3D [getMissionPath "media\lehjani.ogg", _this];
sleep 195;
};
};
That's weird - maybe the file has an issue?
You can also use the following, given the sound is defined in CfgSounds:```sqf
truck say "myCfgSoundsDefinition";
(also, _this = truck? why not using truck directly)
Yeah that could be it. I might need to try to convert it again.
I had the code inside the truck's init field and it was giving me errors because the "truck" was not defined
Thanks guys, but I think it’s specifically the unitTrait I’m after. So you would only allow a sniperSpecialist (I think it is) a sniper rifle
maybe you were using _truck instead of truck
there is no specific trait for snipers
You can set a custom trait, but I don't think that helps
Tankbuster setUnitTrait ["Bellend", true, true]
I think the solution is to use apply
[0] apply func
will be [result]
and properly be [nil] when your func ended with a assignment
Its a bug in SQF language
mandatory? which parts?
I plan to fix that soon.
The vehicles Init eg.
Gonna fix that too
so no more empty value stack after assign soon™️?
ye
Is there any way to interrogate and selectively delete from the USERNAME.vars.Arma3Profile file? When it gets to large sizes, it causes huge input lag in the editor. Until now I have been deleting the file to allow the creation of a fresh one, but this causes the loss of Arsenal loadouts and some other stuff I don't want to constantly lose.
It literally is profileNamespace, so you can set/getVariable
I would like a way to see everything that is stored in there, not just the variables I specifically save. It seems like a variety of data is saved there.
allVariables profileNamespace```
Thank you very much man, that's a huge help.
"input lag"? can you explain?
it shouldn't cause input lag at all
I have had cases where the editor becomes very sluggish. For example, clicking to switch from BLUFOR assets to OPFOR, Arma would freeze for 5 seconds or so. Any clicking action in the editor would cause the same delay, even with no mods installed (my friend had the same problem with a fresh install of Arma on a freshly formatted SSD, but using his old profile). Pressing ESC ingame, the menu would not pop up for several seconds. This "lag" disappears when I delete my Drongo.vars.Arma3Profile file. In some cases this file is over 400mb.
Some of my friends who have the same problem find it disappears when deleting their vars.Arma3Profile file. I suspect the bloating of this file may be connected to my Map Population mod.
But I'm not sure so I want to check as much as possible what is going on in the file.
400 MB for a binarized file that should be used to store numbers, Strings and maybe arrays thereof? How often do you have to use and subsequently save profile namespace to get there? 
Use it to store custom user settings, by all means, but for nothing else.
The user's keybind for your server's custom earplug script for example.
Can you reproduce that? I can fix it if you can give me a repro case for it
I need a FT ticket, and the .vars.Arma3Profile file (at best 7z compressed)
The Map Pop saves shortly after mission start to store an array of arrays of positions for each unique mission where is it enabled. However, I find if I exit out of such missions, the file expands each time, despite saving in the same variable name. This index array is usually fairly small, but vars file keeps increasing. I am trying to find out what exactly is causing this.
please give me ticket to fix the performance problem
you can check what causes the size by just debinarizing your vars file (its just a config.bin)
I'm creating a COF in the editor, I'm currently activating and deactivating the popup targets using an addaction. I create an "Activate" addaction that when called calls a function with a bool argument (true -> activate the pop up targets, false -> deactivate them).
Simple in theory, however, my function works only one way for some reasons. It activates the targets (and adds the action to disable them) but then it soen't execute the code to disable them.
the function code is as follows
params ["_target", "_caller", "_actionId", "_arguments"];
//true -> Activate targets
//false -> Deactivate targets
if (_arguments) then {
{_x animate ["terc", 0];} forEach UpClose;
_target removeAction _actionId;
upCloseAct = _target addAction ["Deactivate targets", "R3D_fnc_UpClose", false, 10, false, true];
} else {
{_x animate ["terc", 1];} forEach UpClose;
_target removeAction _actionId;
upCloseAct = _target addAction ["Activate targets", "R3D_fnc_UpClose", true, 10, false, true];
};
It's like the else part of the code doesn't get executed. No errors in the RPT.
where UpClose is the array of targets
What do you use to uniquely identify a mission?
I don't think R3D_fnc_UpClose is code, so I'm surprised it does any work at all.
It should be (if you ask me):
_target addAction ["Title", {_this call R3D_fnc_UpClose;}, false, 10, false, true];
R3D_fnc_UpClose is that snippet of code itself
_this would pass the object (target as the wiki says) itself, but I need to pass a bool to that function
however the function itself gets called
I use:
_saveName=format["dmpIndex%1%2",missionName,worldName];
I'll make a ticket when I have a large file again, at the moment it is 794KB and no problem occurs. Thank you for your help.
_this contains all parameters.
Try if my code yields a different result, I don't see anything else that could be wrong.
nevermind, I think I got the issue
yup, got it
the first addAction (and the only one that was working) was in the init field of the object I was attaching to
and that was with call R3D_fnc_UpClose
me after 3 hr straight at looking at the same code and wondering why it doesn't work didn't think about it.
3hrs... those are rookie numbers
oh no...
Anyway.
If you set a variable in a trigger OnActivation code, can you access it in OnDeactivation?
Question for Spectator Cam: I got that code working fine, if calling it from the debug console in MP. if i use it from a script, for example "onplayerkilled.sqf"it just shows the normal specator cam with third person and all options, not my customized one. ["Initialize",[player,[],true,false,false,true,false,false,true,true]] call BIS_fnc_EGSpectator;
depends on how you set the variable. loca variables no but setVariable ones yes.
Ok. Thanks!
is there something better than boundingBoxReal to get more accurate dimensions of an object?
if its a building... the alternative syntax is pretty accurat
but some of the buildings have inexplicably large boxes
try the alt syntax using clipvisual
like a gun or small object. there are too many objects with massive boxes
ooo, dunno, never done boundingboxes with things that small
how to script two kill objectives to enable two more?
heya leopard hows been, thanks for the other day
how can I simply attach a parachute (not a steerable one) to a crate?
I dont need to do anything else, just attach it to a parachute
one of those big round ones that supply drops come in would be nice
attachTo?
okay
supplyDrop attachTo ["NonSteerable_Parachute_F" [0,0,0.5]];
can I use a string for "object2"?
"NonSteerable_Parachute_F"
no
ok
you must create it first
create it dynamically:
https://community.bistudio.com/wiki/createVehicle
Are there any RHS guys in here?
you can go ahead and ask the question
maybe some non-RHS guy already knows the answer
and what are you doing with it (and how)?
SP?
Tried on both SP and local MP
sleep 1;
private _parachute = "NonSteerable_Parachute_F" createVehicle getPos supplyDrop;
@little raptor I already have a script in the initServer.sqf file that randomizes the location of the crate
If I just attach the supply drop to the parachute, will that move the supply drop to the position of the parachute?
that is why I did getPos supplyDrop
supplyDrop attachTo [_parachute [0,0,0.5]];
That's what you thought would happen. But let's just say getPos is not what you think it is ( it's in AGLS format ):
https://community.bistudio.com/wiki/Position
but yes, it does move the supply crate to the attached position (if you provide a relative position)
what do you mean?
private _parachute = "NonSteerable_Parachute_F" createVehicle [0,0,0]
_parachute attachTo [supplyDrop [0,0,0.5]];
no
attach the parachute to the supply drop instead of the supply drop to the parachute
I am guessing that object1 cant be an array?
the wiki already tells you what it can be
if you don't see your type there, then it's not supported
ok
so I need to create the parachute AFTER the supply drop's position has been randomly selected, at the location of the supply drop
sleep 1;
private _parachute = "NonSteerable_Parachute_F" createVehicle getPos supplyDrop;
supplyDrop attachTo [_parachute, [0,0,0.5]];
so the only problem with that code is that getPos doesnt work the way I want it to
also, missing comma in attachTo
better?
no, worse
maybe
which is why I gave you that link to read, which you didn't
long story short, don't use getPos
yea
ok I read the page you linked
so how do I know which format I am using
private _supplyDropPos = getPosATL supplyDrop;
does that work ^
@little raptor
you're still using getpos
yes
but I thought that it would work the way I thought it would in this scenario
what else can I use?
ok
what I recommend is getPosWorld and setPosWorld
Don't just pass the position to createVehicle. Also set its position after the object is created
ok
here is what I am confused about
all these different position formats
which one is the correct one to use?
what is the default one used in the editor?
I don't know. It's probably AGL (or ATL)
what is AGL?
i know it is Above Generic/Ground Level, but what does that mean?
wait
actually i think it IS AGL
yea
but then what is the difference between ATL and AGL?
in the editor when I set an object's Z to 0, it went at the bottom of the ocean
not the surface
so yea, I would think it is ATL/AGL but is there a difference between them?
i think i just had a conversation with myself ^
if you have to ask you didn't read that page
ohh
ok
so AGL is ATL when over land, and when it is over the sea, it is just sea level + waves
yes
so it basically counts the water as "ground"
yes
so it's ATL
so I dont think it matters whether I use AGL or ATL because all of these objects are over land anyway
how does that look?
@little raptor
post the full code
ok
one sec
private _supplyDropPos = getPosATL supplyDrop;
sleep 1;
private _parachute = "NonSteerable_Parachute_F" createVehicle _supplyDropPos;
supplyDrop attachTo [_parachute, [0,0,0.5]];
I know that _supplyDropPos cant be used as a position
but that is all I have right now
it can
oh
cool
position: Position - Desired placement position. If the exact position is occupied, nearest empty position is used.
it didnt say array, so I thought that meant it wouldnt work
positions are arrays
oh yea
position = array with three SCALAR elements [x, y, z]
_randomPosATL = ...;// the random editor pos you selected
sleep 1;
isNil {//isNil is used to do all of this in 1 frame (to avoid objects colliding and exploding)
private _parachute = "NonSteerable_Parachute_F" createVehicle _randomPosATL;
//you don't need to set the supplyDrop position, since it's being attached; you only need to set the parachute's pos
_patachute setPosATL _randomPosATL;
supplyDrop attachTo [_parachute, [0,0,0.5]];
};
wait
private _supplyDropPos = getPosATL supplyDrop;
_supplyDropPos vectorAdd [0,0,1];
sleep 1;
private _parachute = "NonSteerable_Parachute_F" createVehicle _supplyDropPos;
supplyDrop attachTo [_parachute, [0,0,0.5]];
would this work?
@little raptor
try and thou shalt see!
you cannot add a comma or change arguments order then ask if it will work - you have to understand how it works
I did not read your code, I mean generally
Leopard20 is not your personal compiler, the game is 🙃
we cannot be behind your every step, but be assured that we will fly for help and explain if you don't understand a part
yea, thanks
i guess I will just test stuff out before I ask for your guys' confirmation
so the script isnt working, but it also isnt giving me an error message
it just drops from the sky
instead of just randomly writing stuff, you should look at the example I posted.
#arma3_scripting message
I've even added comments that explains everything
_supplyDropPosition = selectRandom [[12679.601, 13332.028, 1000], [13875.363, 13456.195, 1000], [13193.535, 13493.376, 1000], [14068.655, 12965.528, 1000], [12531.175, 12785.974, 1000], [13619.896, 13188.942, 1000], [12383.82, 13265.418, 1000]];
isNil {
private _parachute = "B_Parachute_02_F" createVehicle _supplyDropPosition;
_parachute setPosATL _supplyDropPosition;
supplyDrop attachTo [_parachute, [0,0,0.5]];
};
if that's all of your code, why do you use sleep?
Hey there i need some help. So i'm working on a mission where you get the task to capture a Gorgon (gorgon1). In the trigger for the task completion i put as condition " (vehicle player) == gorgon1 " earlier i tried " player in gorgon1 ". It works perfectly fine in Singleplayer but not in Multiplayer.. any ideas?
the player is different on each machine
https://community.bistudio.com/wiki/player
also, instead of triggers, you might want to use the getIn event handler:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetIn
alright that one works. thank you
np
but note that if you're using it in the object init field, it'll execute for every computer that later connects to the network (which is bad)
yeah i know that (:
its working!
@little raptor @winter rose
\o/
GJ!
my battle royale is finally finished
if anyone wants to look at the mission, I can send it to them
As soon as you publish it, you can even advertise it in #production_releases!
how do I publish it?
I just made this so me and my friends can play
but I might publish it
if its easy to do
any idea why this one isnt working:
class CfgSounds { sounds[] = {radioambient29}; class radioambient29 { name = "radioambient29"; sound[] = {"\A3\Sounds_F\sfx\radio\ambient_radio29.wss", db+10, 0}; titles[] = {0,""}; }; };
in Eden: Export to Workshop 🙂
playSound "radioambient29"
ok
returns NOID <no shape>
thx, solved...!
what was the issue, wrong path? ah no, the "speed" param I suppose
ah true, true!
how can I make it so that civilian vs civilian is not deemed friendly fire
change the shot parent
or make civilians enemies to themselves
or use addRating to make the unit a Renegade
How to hide my sounds in the CfgSounds?
They are showing on triggers but I don't want they to be there, there is sounds in the game that do not show on triggers without but can be use in script
scope = 1
were it should be placed? here is a exemple
class CfgSounds
{
sounds[] = {};
//Words
class AWACS_US_Home_Plate_at
{
// how the sound is referred to in the editor (e.g. trigger effects)
name = "AWACS_US_Home_Plate_at";
// filename, volume, pitch, distance (optional)
sound[] = { "RTG_AWACS\RTG_AWACS_Sounds\dub\AWACS\eng\Home Plate at.ogg", 80, 1};
// subtitle delay in seconds, subtitle text
titles[] = { 0, "" };
};
inside the class obviously
which one?
class CfgSounds?
because there is over 170 defined sounds and im lazy to put in everyone.
well you did it wrong
thinks in macro's
you should've used inheritance
But still #arma3_config and not scripting
well rip.
use regex find & replace
Which is why you test with one thing, make sure it works and only then start adding the masses
That was a verry late thing
you can still "fix" it. do what I said
the find and replace seems to not work when I need with two lines does the spaces with tab
use regex 🤦
🙄
Even a simple find&replace should work...
At least when you don't use Notepad or Word
Ctrl+H name = → scope = 0;\n\nname =
even if you don't add a next line it'll be fine;
I was thinking this (which is why I said regex):
name *= *(.*?); -> name = \1; scope = 0; (or 1)
I know; but I wanted to keep it clean 😛 (and forgot tabulations on the way)
yeah I was explaining to @astral tendon
that does not do anything, is that with notepad++?
now that worked, thanks.
Neither 1 or 0 worked, they are still showing in the triggers, lol
then look in the config. see what other invisible cfgSounds classes are using
#arma3_config please, this is still scripting... 🤦♂️
Most likely have people there who know more about it
any way I can use soundNames for sounds in playsound3d? I'm not sure why it has you supply the full file name when every other sound command just uses the sound name from your config
why no say3D?
it's far superior
because im doing death sounds. the unit wont be alive so I have to use their death position instead
//Workaround for dead bodies:
private _dummy = "#particlesource" createVehicleLocal ASLToAGL getPosWorld _corpse;
_dummy say3D "whatever";
_dummy spawn {
sleep 5; // at least the length of your sound
deleteVehicle _this;
};```
or alternatively, you can still use playSound3D and get the music file from the config
i think i might have to create a sound source using say3d like you posted... I think something is up with the soundPosition param on playSound3d. It says optional and that the default is [0,0,0] but if you do the default, it will override the position. but if you do [], the command fails as well. so I can't use the farther parameters at all.
playSound3d [missionpath "blahblahblah.ogg", unit] //works at player
playSound3d [missionpath "blahblahblah.ogg", unit, false] //works at player
playSound3d [missionpath "blahblahblah.ogg", unit, false, [0,0,0]] //Sound fires at 0,0,0
playSound3d [missionpath "blahblahblah.ogg", unit, false, []] //errors
provide unit's position 
playSound3d [missionpath "blahblahblah.ogg", unit, false, getPosASL unit,...]
then whats the point of soundSource at all if you have to provide the positions later in it lol
I don't know 🤷
I didn't make that
they probably wanted to make the sound object follow the source, but they forgot
So about respawn: does someone know how to put the player into spectator and respawn at a certain point in time at a position selected by the player? I tried:
- https://community.bistudio.com/wiki/Arma_3:_End_Game_Spectator_Mode#Spectate_when_dead
Result: Player respawns on position of death respawnTemplates[] = { "Spectator", "MenuPosition" };
Result: Best result yet, player can respawn on custom position BUT spectator is very limited- Option 1 +
respawnTemplates[] = { "MenuPosition" };
Result: Respawn map and spectator collide. Unusable.
for campaign making, whats the best way to organize folders of files such as music, sounds, etc that you want carried from mission to mission? right now I have them in each mission and I realize I'm wasting file size. Is there anything complicated with referencing outside of each mission folder to the general mission folder?
create an assets mod
because it's not possible to reference stuff from one mission in another
not sure how that works with campaigns though... or with the fancy method that Old Man uses
well i mean if i had campaignFolder/sounds/ couldn't i reference that each missions' individual cfgSounds?
campaignFolder/sounds/
campaignFolder/missions/mission1.blah
campaignFolder/missions/mission2.blah
I can't reference out to the root campaign folder?
Other files may appear at the root of myCampaignDirectory for sharing resources between missions, or storing the campaign overview image for example. No files should appear in myCampaignDirectory\missions , only mission directories Mission names do not matter nor impact the missions flow. Zmission.VR will not load after Amission.VR for example. The order is, again, defined in the description.ext file.
documentation helps 😉
linky for further reading?
yeah i just finished my second mission and I'm like... okay, so how do i put them together now lol
- Check the pinned to format.
- Looks like the trigger is executed globally. Use
isServerto make sure it's happening only once
...Why did you removed your post?
what does The minimal distance projectile needs to be from target position to enter ballistic mode mean?
well i mean ballistic mode
Uh hmm. Never tried that function so
@fair drum Probably means that if the target is closer than minimum distance defined, the missile is not able to acquire target and manouver according to that?
how do i reference files in a campaign's folder, outside of the mission folder? I want to create a pool of files that every mission can access so I save on space.
campaignfolder\missions\mission01.blah
campaignfolder\img\image1.blah
how do I reference that image to mission01?
I've noticed that when a vehicle that has multiple color variants is spawned by script on a dedicated server it's always the same color, however on a local hosted multiplayer it properly spawns with random textures.
Is this intended behavior or is this a bug?
bug, please report with a ticket on the #arma3_feedback_tracker
My understanding was that vehicle textures for vehicles with randomized textures have always appeared differently to each client. For example, to one player a hatchback might appear red and to another it might appear blue. Is that still the case or was that fixed?
I don't think so, I've experienced the same recently
Its annoying
but wasn't it fixed? I'm sure Tom wrote that the disableradomizarionwas fixed
any ideas for one-liner code?
private _id = _unit getVariable ["custom_variable", 0];
_unit setVariable ["custom_variable", (_id + 1)];
That said, I never tested it because I have a vehicle init function that fixes it and does loads of other mission related stuff
Last time I tested it, it wasn't fixed.
Tested it just now... unexpected results
disableRandomization[] = {} and spawned a load of C_Hatchback_01_F on the host
host saw different colours, client saw all white cars
Any experience with this ? this setVariable ["BIS_fnc_initVehicle_customization", false, false]; The biki says it would disable randomisation
But it doesn't work and I don't see how it should, looking at the function
disablerandomisation {"Allvehicles"} host and clients saw all cars as white
never used it revo
i gave up with it and wrote my ow
own
Yeah, seems bugged all over the place
I know when I placed a bunch of hatchbacks in the editor and loaded the mission on a dedicated server with 2 clients (all clients and dedicated on same pc) the hatchbacks had different camo but was synced between the clients.
yes, sounds like what i saw just now
the hatchbacks you saw, were they all white?
mine were
No they were all different colors, but the colors matched for both clients. So a green car on one client was green on the other.
But this only seems for editor placed vehicles.
In game with the debug menu or from the editor?
Not even _vehicle setVariable ["BIS_enableRandomization", False];works for disabling randomisation
WTH
its rubbish, mate
_unit setVariable ["custom_variable", (_unit getVariable ["custom_variable", 0]) + 1];
We need a setGetVariable command 😮
so a setGetVariable, and a getSetVariable, and a mayOrMayNotSetGetVariable 🤣
don't see the benefit of a new command which just adds more confusion...
I think R3vo's joking
I might be German, but yeah, sometimes I make a joke.
But you can still use macros for "setGetVar":
#define setGetVar(x,y,z) (x setVariable [y, (x getVariable [y, 0]) + z])
```🙃
IOT disable the vanilla throw binding, does anyone have any insight on what the best practice would be? Removing the throw weapon? Having a CBA playerEvent handler for "weaponMode" and switching mode from there? I would prefer disabling the ability to throw rather than interrupting with a fired EH or something along those lines.
I think removing "THROW" might be the best solution.
not sure if it's possible (but it should be)
That would disable all grenade throwing yes but not sure if ace systems also rely on it.
I'm quite curious on why it would need to be disabled.
IIRC we script the projectile
Sure, i find the speed at which people can throw grenades is simply too quick
but I'm not sure if removing Throw muzzle will not block you from selecting the nades.
And depending on method of removal it might mess with AI
I would be handling this locally on players via an addon, all AI on HC and their grenades are all scripted
Projectile spawn
Why not just change the reload speed?
cant you throw grenades at the same speed with ace throwing? if not quicker
Assuming that you're throwing the same kind of grenade, and not switching between them to throw quicker
I am altering the ace throw
Afaik, the vanilla system is simply throw + animation
There is no "prep" animation
how about removing the "Throw" weapon from the unit config?
That might make it incompatible with modded units
altho most of them inherit from default man class
any mod which doesn't inherit from default classes won't work with ACE either
I was finally able to solve it after hours of frustration :) You can use these settings:
respawn = 3;
respawnTemplates[] = { "MenuPosition", "Spectator" };
``` and to get the full spectator you have to set some variables in the uiNamespace of the player:
```sqf
//--- Enable full spectator in respawn screen
{
missionNamespace setVariable [_x, true];
} forEach [
//"BIS_respSpecAi",
//"BIS_respSpecAllowFreeCamera",
//"BIS_respSpecAllow3PPCamera",
//"BIS_respSpecShowFocus",
//"BIS_respSpecShowCameraButtons",
"BIS_respSpecShowControlsHelper",
"BIS_respSpecShowHeader",
"BIS_respSpecLists"
];
``` I will also add this to the BIKI :)
guys should i make all my sqf into functions?
do functions execute faster than execVM ing a sqf?
executing once, no problem
more than once, → functions
execVM reads and parses the file everytime, so it is slower
oh i see
so if its only once theres no improvement at all
?
well its easier to remoteExec at least i guess
yep, and safer
Have a question to debriefing. So in a coop mission when all players died i want a custom debriefing screen. I tried to overwrite the "loser" ending with the code from the wki
class CfgDebriefing
{
class loser
{
title = "You all died!";
subtitle = "";
description = "Everyone is dead.";
pictureBackground = "";
picture = "KIA";
pictureColor[] = {0.6,0.1,0.2,1};
};
};
but it still shows the standard "all players died" screen
Is there a way to detect who's placing markers on map during the briefing screen? (NOTE: Arma 2!)
Also, are you aware of any cheats that require user to place a certain marker on map (you can DM me)
Arma 2 you can replace the UI dialog that opens when you place a marker
and add a eventhandler on the OK button
@still forum I think there is one in place already, but it doesn't work in the briefing screen
Found this
fnc_marker_keyUp_EH =
{
private["_handled","_display","_dikCode","_control","_text"];
_display = _this select 0;
_dikCode = _this select 1;
_out = false;
if ((_dikCode == 28) || (_dikCode == 156)) then
{
_control = _display displayCtrl 101;
_text = ctrlText _control;
if (_text == "") then
{
_text = format ["%1", name player];
}
else
{
_text = format ["%1: %2", name player, _text];
};
_control ctrlSetText _text;
_display displayRemoveAllEventHandlers "keyUp";
_display displayRemoveAllEventHandlers "keyDown";
};
_out;
};
It works when the mission is running but not before it
fnc_map_mouseButtonDblClick_EH =
{
private
["_display"];
disableUserInput true;
(time + 2) spawn
{
disableSerialization;
while {time < _this} do
{
_display = findDisplay 54;
if (!isNull _display) exitWith
{
_display displayAddEventHandler ["keyUp", "_this call fnc_marker_keyUp_EH"];
_display displayAddEventHandler ["keyDown", "_this call fnc_marker_keyDown_EH"];
};
};
disableUserInput false;
};
true;
};
if (local player) then
{
waitUntil {sleep 0.1; !isNull (findDisplay 12)};
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["mouseButtonDblClick", "call fnc_map_mouseButtonDblClick_EH"];
};
Hmm, wait a minute
waitUntil {sleep 0.1; !isNull (findDisplay 12)};
^ Is this line to blame for it not working in the briefing screen?
Is anyone aware if enableEnvironment is local or global for MP scripting?
https://community.bistudio.com/wiki/enableEnvironment
…E-L means Effect Local 😄
Holy moly im blind. Thank you!
you can hover your cursor to have a description 😉 welcome!
Is there any reason that the below code would not work on multiplayer but work in the editor?
0 = player createDiarySubject ["Intel Packet","Intel Packet"];
0 = player createDiaryRecord ["Intel Packet",["CIA Hostage","Pictured on Left: MATTHEW STEWART:<br></br><br></br><img image='images\2.jpg' width='300' height='180'/>"],taskNull,"",true];
0 = player createDiarySubject ["Intel Packet","Intel Packet"];
0 = player createDiaryRecord ["Intel Packet",["HVTs","Pictured from Left to Right: KAREEM AL-BEN, MUFEED AL-KAMEL (KIA), LABEEP AL-BEN:<br></br><br></br><img image='images\hvt.jpg' width='300' height='180'/>"],taskNull,"",true];
yes
if you run this code on a dedicated server, no one will have records
run this in initPlayerLocal.sqf, and remove these useless 0 = 🙂
yeah that's the advice I gave my buddy, he put the code in the Eden editor General tab > init box
oh so this box is server-side only, good to know
the code was generated using Eden Enhanced's "Briefing Creator" tool
Its good to know that the box is server only
the code is not wrong, since it works!
but you have to have it run locally yes
I thought it had something to do with the commands
or remoteExec it, but meh
w/ pleasure!
Any idea why playsound3d audio has a distance delay like it should, but this delay is only experienced clientside? I will explain the situation, I have a custom target I've made with a Onhit Eventhandler to play a sound in 3d when hit. Shooting the target at like 1000 meters the audio has a nice delay to it before it reaches the player, but this only works if you shoot the target yourself. Having another player shoot it you will hear the sound right when the target is hit, while the shooter hears the delay.
Seems like a locality bug, since the command is supposed to have global effect
report it on: https://feedback.bistudio.com/project/view/1/
Tying to fix a stupid issue by I just can't figure it out. I'm trying to make a trigger that closes a door a little while after deactivation
Since sleep timers can't be used directly in triggers I made a simple little sleep script that I can pass an argument to for the time (hoping to use the for a few different triggers)
[5] execVM "scripts\sleep.sqf";
sleep.sqf
params ["_sleepTimer"];
sleep _sleepTimer```
Unfortunately it seems to simply be skipping over the sleep timer. It's not kicking back an error in the rpt, so I assume it's "working"
well, it waits
but it won't wait from within the trigger; it creates a new thread, wait in it, then closes
unless there is something after that sleep
Ok, so I just need to add an addition 'something' that basically does nothing
Just so it will actually wait before it continues on
I'm experiencing an issue with Virtual Arsenal messing with a PIP camera attached to a UAV drone that renders on a tv object. The feed works until the Arsenal is opened.
params ["_uav", "_tv"];
fn_createCam = {
params ["_uav", "_tv"];
/* create camera and stream to render surface */
screentime_cam = "camera" camCreate [0,0,0];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];
/* attach cam to gunner cam position */
screentime_cam attachTo [_uav, [0,0,0], "PiP0_pos"];
/* make it zoom in a little */
screentime_cam camSetFov 0.1;
/* switch cam to NVG */
"uavrtt" setPiPEffect [2];
/* adjust cam orientation */
addMissionEventHandler ["Draw3D", {
_dir =
(uav selectionPosition "laserstart")
vectorFromTo
(uav selectionPosition "commanderview");
screentime_cam setVectorDirAndUp [
_dir,
_dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
];
}];
_tv setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
};
fn_destoryCam = {
params ["_cam"];
_cam cameraEffect ["terminate","back"];
camDestroy _cam;
};
uav = _uav; //for the addMissionEventHandler ref
call fn_createCam;
/* Arsenal Fix */
while {alive _uav && alive _tv) do {
waitUntil { !isnull ( uinamespace getvariable "RSCDisplayArsenal" ) };
diag_log "arsenal open";
[screentime_cam] call fn_destoryCam;
waitUntil { isnull ( uinamespace getvariable "RSCDisplayArsenal" ) };
diag_log "arsenal closed";
[_uav,_tv] call fn_createCam;
};
tv setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"]; was locally executed after the arsenal was opened/closed and that didn't help to fix the issue
Is it possible to have a different callsign for a unit but let them stay in whatever group they are?
I want to have different callsigns for certain roles in our multiplayer squads
Well, callsigns are for groups
But you can change the UI name with setName
and setNamesound for the word used to call them
Thanks that helped out and I got the trigger running with that.
Now I'm just trying to make a solution for a specific case that this doesn't account for. It a player enters the trigger, then leaves it, and another player (or the same) enters it the deactivation will trigger. I'm looking to put in a check for players in the trigger area after the sleep timer and either run if there are none or loop back to the sleep timer if there is a player
_handle = [] spawn {
while {getPos (_this select 0) inArea gateTrigger} do {
sleep 5;
gate animateSource ['Door_1_sound_source', 0]}
};```
I've gotten this far but I'm thinking while isn't quite what I'm looking for
terminate the camera effect first before using screentime_cam cameraEffect ["External", "Back", "uavrtt"];
Am I not already doing that?
before that
the terminate is called in fn_destroy which is called before screentime_cam cameraEffect ["External", "Back", "uavrtt"];
you only do it when you destroy the camera
so between ```sqf
screentime_cam = "camera" camCreate [0,0,0];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];
seems redundant?
you should do it after the camera is created
screentime_cam = "camera" camCreate [0,0,0];
screentime_cam cameraEffect ["terminate","back"];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];
having the last param be the same should be better right?
screentime_cam cameraEffect ["terminate", "Back", "uavrtt"];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];
according to the wiki, yes, that's better (and actually that's what you should do, otherwise all other r2ts will be gone)
Anyone know?
Should I take the sleep 0.1 pff?
Not sure the context. Is it call'ed?
@tender fossil ^
I suspect it's an error because you're trying to do waitUntil and sleep in an Unscheduled Environment
@warm hedge It's executed in scheduled environment and it works after the (de?)briefing when the mission starts
https://ibb.co/LxJkLDH
How can we return state highlighted with a red border?
no can do afaik
