#arma3_scripting
1 messages · Page 698 of 1
I'm not sure I understand. In this scenario, literally first time ever the function is invoked to my knowledge, uiNamespace should have no idea what the _oldFactoryView was. so should be []. But yet isEqualTo is reporting true, 'no change'.
are you sure _newFactoryView is not an empty array then?
This is the log:
13:03:22 [MY] [15511.9] [PRODUCTIONMGR] [fn_productionMgr_onChanged] Entering: [count _oldFactoryView, count _newFactoryView]: [21,21]
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^
well then you're setting it somewhere else before this function is ran
obviously, but I am scanning the code for those opportunities, I do not see it.
uiNamespace doesn't reset with mission iirc
that might very well be it
oh wait what?
so I should explicitly nilify variables I know I would be using...
like onLoad, etc
VERY good to know
i mean what are you even storing in there?
maybe you should just store it in missionamespace
(or localNamespace if you fear storing UI elements)
yeah perhaps. I was trying to keep UI things in a place I thought would be 'all theirs'. and avoid missionNamespace clutter. but I did not expect that.
thanks
now it works, beauty. thanks all.
I use it a lot, but mostly in init, not in mission running time
Oh Arma you are so much fun...
I managed to almost get my script to disable looting of anything bluefor working last night, except for some reason the sidearm is still able to be taken once, but when you swap sidearms then your previous sidearm is put on the body is unable to be removed..
¯_(ツ)_/¯
At this point...I'm tempted to code up a completely different kind of script: If player is holding any NATO items, just have nato soldiers shoot him if within 50m 😛
any time a player has nato items, spawn a missile and peg them with the guided projectile function
I'm trying to have different colors represent the difficulty based on the difficulty and this is my best attempt. Anyone able to point me in the right direction?
_difficulty = "Easy";
_waveNum = 4;
{
switch (_difficulty) do
{
case "Easy" : { _waveColor = "#00FF00" };
case "Moderate" : { _waveColor = "#FFFF00" };
case "Hard" : { _waveColor = "#FF0000" };
case "Nightmare" : { _waveColor = "#000000" };
default { hint "!Error!\nChoosing Difficulty Color\n!Error!" };
};
titleText [
format ["<t font='TahomaB' size='6.0' shadow='1' shadowColor='#000000' shadowOffset='0.05'>Wave %1</t>
<br/>
<t font='PuristaSemibold' size='2.0'><</t> <t font='PuristaSemibold' color='%3' size='2.5'>%2</t><t font='PuristaSemibold' size='2.5'>> Difficulty</t>",
_waveNum, _difficulty, _waveColor],
"PLAIN",
3,
true,
true];
titleFadeOut 3;
} remoteExec ["call", 0];
It's displaying:
Wave 4
Easy > Difficulty
with no color change
do you now want it to say "Difficulty"?
Thanks for the help! Although I do prefer a pointer rather than handout.
I got it from here
Was trying to have it be like "<Easy> Difficulty"
Yeah I'm making it into a fnc but just showed what I couldn't figure out
I was going to keep those white and change the color of the difficulty
Question I couldn't find the answer to when googling and looking at CBA Wiki.
When using the XEH events like InitPost is that executed on a per unit basis or per client?
I'm trying to register CBA eventhandlers to specific AI units, but I don't seem to have wrapped my head around the relationship with AI units and adding eventhandlers just for them. How do I target specific AI units with code as part of "their" init?
I looked at CBAs Class Event Handler and then do an init version that registers the CBA eventHandlers, so I would be able to run targetEvent from other clients to be executed on the AI unit.
Context: Trying to use targetEvent on a specific type of AI unit, which should then run the corresponding code on the AI. e.g. disable part of the AI.
tbh im not sure how to add < to structured text. im sure someone else here will
Yeah I'm struggling with that too. You can do > but not <
Do < %2 > Just tested it. It supports them as HTML character codes.
Holy crap that's beautiful. Thanks
Darn I got ninjaed
When using the spawn ai module, it gives you the option to blacklist a group that you dont want to be able to spawn. But you need the classname of the group you want to blacklist. I cant find one for any group. I can only find classnames for individual men/objects/vehicles. Does anybody know where to look?
Is there anyway I can return a list of all available Module Icons?
Something like:
"\a3\modules_f\data\portraitmodule_ca.paa"
"\a3\Modules_F_Curator\Data\iconCAS_ca.paa"
"\a3\Modules_F_Curator\Data\iconOrdnance_ca.paa"
Or, even better...
Is there a way I can view all available Module Icons from within Arma?
Using configClasses to get all modules, and get the icons path perhaps
It works. Thanks!
3den Enhanced has a sweet Texture Finder😉
Just "sweet", @cosmic lichen? Not "the best Texture Finder you will ever find"? 😆
I'll take a look. Thanks!
Anyone know how i can make UAVs just be owned by a singular person instead of the entire team?
/UGVs
see
https://community.bistudio.com/wiki/enableUAVConnectability
https://community.bistudio.com/wiki/disableUAVConnectability
but beware, as
This command has effect on a UAV terminal
!
If I was to add custom code that should be run on init for specific type of AI units, how would I go about that? So it also gets applied if zeus spawns new units of this type?
If you're OK with using CBA;
https://cbateam.github.io/CBA_A3/docs/files/xeh/fnc_addClassEventHandler-sqf.html
[
"I_helipilot_F", // classname
"InitPost",
{
// code
},
nil,
nil,
true
] call CBA_fnc_addClassEventHandler;
I am already using CBA. And was convinced it had something, but couldn't quite figure it out.
So using that, would I add that in init-code for all clients, or only the server? As I recall it would only run on clients where the units were local?
Or should I ideally add it to the XEH initPost as classname config?
I've used in init.sqf in the past with local condition inside the code.
Everything seemed to work as expected.
alright Cheers. I'll try that
Is there a way to grab the position of the muzzle of a players weapon?
not out of the blue like that, but what is the use-case?
It's possible now? Via creating the weapon model, check the memory point, apply it to the player's position
Trying to draw a line between player's muzzle position and the end point where the barrel is pointing
then ↑ what POLPOX said 🙂
Thanks, will have a look into it
I'd love to be able to have the muzzle of the gun automatically rest on things like curbs or the tops of the solar towers properly...
mussels of Belgian weapons I assume
I thought it was hillarious when I was watching the lambs-danger demonstration video and one AI was shooting at another ai but it was hitting the corner of the wall right in front of itself.
Sorry, early onset dementia from having 40 tabs of BI function calls across 3 chrome windows...
…ouch
Hello, I am currently trying to set up a vehicle so that it cannot be completely destroyed. I came across a solution in the forum, but the vehicle is still simply destroyed. Is it possible, since ACE is running, that I need something special here?
// First try
this addEventHandler ["HandleDamage",{!(_this#7 in ["HitHull","HitAmmo"])}];
// Second try
this addEventHandler ["HandleDamage",{!(_this in ["HitHull","HitAmmo"])}];
// Third try
spz_1 addEventHandler ["HandleDamage",{!(spz_1 in ["HitHull","HitAmmo"])}];
I was excute this code in the vehicle init field.
How can I change the icon of the task when making a task with the BIS_fnc_taskCreate command? I want to have the Intel one instead of the default GPS destination thingy.
[player1, "secretTask", ["Find any additional info about your Lieutenant.", "Find more intel", ""], [0,0,0], "CREATED", -1, false] call BIS_fnc_taskCreate;
you need to provide a CfgTaskDescriptions class name
see example 3
but what's the file name of the intel icon
afaik there is already a task description for that
you don't need to create one yourself
just find it in the config
@meager epoch
is this what you wanted? (the icon I mean)
there's also this:
"documents"
ACE does interfere with those afaik, yes
but what you wrote (first one) may only prevent damage to HitHull and HitAmmo selections, which may not exist at all.
the second two are nonsense
it's this one
do i just type intel_ca.paa or the whole path?
under icon=..
whole path
I notice the UGV have two AIs in them. One for driver and one for turret. Can they have different locality between them?
As currently I am executing the following in an event raised on target-client to the driver:
{
_x disableAI "all";
} forEach (crew _unit);
systemChat "disabled all AI";
However I notice on repeated toggle of "enableAI" and "disableAI" that sometimes the turret still fires some rounds after it has been disabled. But the driver always stops moving.
like I said, no need.
[player1, "secretTask", ["Find any additional info about your Lieutenant.", "Find more intel", ""], [0,0,0], "CREATED", -1, false, "intel"] call BIS_fnc_taskCreate;
that should work
does the handle damage EH even do anything if you return a boolean into it? i think it must be scalar type
and yeah, pretty sure ACE adds handledamage too
Stupid question: How compile sqf to bytecode (sqfc)?
Could be its firing a burst
yeah. I think you are right. Probably the burst I am seeing
armascriptcompiler on github
The game will automatically detect the sqfc or do I need to define it somewhere in advance?
use compileScript
how can i get the pbo name of an object through debug console
Any ideas as to how to make a popup target not go down until 2 rounds have hit the target? I know we would have to do an event handler. But Im not sure where to even start.
Also, I can make a target move in single player, but when I do multiplayer, it doesnt move but teleports to the position as if the animation is being played on the server but not the clients. This is the block of code placed in the Init of the Table Object that Im using with an addaction. Should this be in a remoteexec?
this addAction ["Move 35m", "[l3t, [l330m, l320m]] spawn BIS_animateMoveSmooth;"];
this addAction ["Move 30m", "[l3t, [l30m, l330m]] spawn BIS_animateMoveSmooth;"];}```
Would there be a way to restrict spectating only to the same side?
I'm currently using MenuPosition and Spectator respawn templates and having respawn options next to the spectator options is working perfectly fine and I was able to make players unable to use freecam, etc. Now I just need to make sure that they couldn't spectate the opposing side.
I'm wondering if there's a variable or something I can add to initPlayerLocal.sqf or if I have to edit the spectator mode through another file. This is what I've got in it currently.
missionNamespace setVariable [_x, true];
} forEach [
"BIS_respSpecShowFocus",
"BIS_respSpecShowCameraButtons",
"BIS_respSpecShowControlsHelper",
"BIS_respSpecShowHeader",
"BIS_respSpecLists"
];
I know of BIS_fnc_EGSpectator and I tested it but couldn't make it function properly alongside the respawn menu
Another option would be to disable the respawn menu and instead have players automatically respawn on new locations. Currently I have it set so that respawn locations are available only when the mission tasks are not in progress and then a new respawn pops up after a task has been completed, so people who die during the task would have to spectate until it is finished.
Might just go with that actually.
does anyone know a list of nearentities types
thanks also how do you use nearentities with a side as the type
you can filter results with select
like```sqf
private _westResult = _foundEntities select { side _x == west };
thank you
Anone got any idea on how to get the AI to use rocket-launchers on buildings? F.ex
If (_Building IsTypeOF "CargoTower") then {
Add building to target-list;
};
So that The AI will use an rpg on the Building itself if he is not previously engaged with other enemies
buildings are never potential targets, but you could maybe create invisible targets and script the AI to shoot at them
Hmm so like a invisible(hideGlobal) turret attached to the structure, then delete it if the building is detsroyed?
Hmmm
Nice
I'll try that
could I do something like this:
_location = selectRandom [
[14085, 18347, 0],
[12938, 13874, 0],
[9028, 20100, 0]
] or [[], ["water"]] call BIS_fnc_randomPos;
``` would `_location` return either one of the given locations, or a random location with a 50% chance of each?
i feel like ive seen something like this before
So, I have this bad guy and I want a trigger to be activated only when he gets killed by a certain soldier.
How can I achieve that (if possible)?
put the following code in onPlayerKilled.sqf:
params ["_oldUnit", "_killer"];
if ( _oldUnit == badGuy && _killer == certainSoldier ) then {
//code
};
@meager epoch
will give it a shot, thanks
btw, does the onplayerkilled.sqf run on its own or do i need to run it with an execvm? @past wagon
it runs on its own when a unit dies
cool, thanks
If I have say 10 variables and I want to be able to pick a random var and for a statement to return true if that random var is the same as two others in my list of 10 could anyone give me some pointers on how I would do this?
Cheers
I huh, sorry? 😄
gimme one min just making up an example
private _A = "This is A";
private _B = "This is B";
private _C = "This is C";
private _D = "This is D";
//etc
if ( (_A isEqualTo (_B && _C)) || (_A isEqualTo (_B && _D)) || (_A isEqualTo (_C && _D)) ) then {
//its true so do some stuff...
};
not sure if that illustrates what I mean a bit better (its just a random example)
5 check [1, 2, 3, 4, 5, 5, 6] // something like this?
{ _x == 5 } count [1, 2, 3, 4, 5, 5, 6] == 2 // could that be enough?
ok thanks ill mess around with something like that tmrw 🙂
okido! tell us here if needed
I think I found a better way of doing what I was thinking:```sqf
_locationsArray = [
[14085, 18347, 0], 1,
[12938, 13874, 0], 1,
[12011, 13241, 0], 1,
[9028, 20100, 0], 1,
[8371, 18273, 0], 1
];
_randomLocation = [[], ["water"]] call BIS_fnc_randomPos;
_locationsArray pushBack _randomLocation;
_locationsArray pushBack 5;
_location = selectRandomWeighted _locationsArray;
how does that look?
should work
50% between custom pos and auto pos
then either equal chances between custom pos
or
the auto pos
@past wagon
How to make it so when everyone in my group is dead (i have team switch on) my group respawns back at base so I can keep playing?
you could also save the BIS_fnc_randomPos call by doing a private _isRandomPos = random 1 > 0.5;
what would others do when "dead"? stay on "respawn in 9999 seconds", freecam, seagull, ?
yep
Sorry im confused. Let me explain better. My squad is all ai. I want to team switch when I die, untill eventually all the members of my squad are dead. Then I want to want my group to be "restored" I guess. Basicly i want myself and all my squad members to respawn at our starting position from beginning of the game.
oh okay!
or if you die, respawn everyone there no?
I want to have the chance to play as other members of the squad UNTIL EVERYONE IN THE SQUAD IS DEAD. Thanks for any help ahead of time btw.
ah, that
I didn't know you allowed team switching
then make a killed EH for each unit, checking if there is still one alive, and when not, create the new group, re-add the EH, selectPlayer the leader, set everyone playable, and you're good to go!
Probably a stupid question, but whats EH? Thanks btw!
Event Handler, which is a script that will fire when the condition is met
If I do _target = cursorTarget; and do all the checks to verify that the target is a man, is there a way I can set a variable inside _target to tell if the target has already been checked once?
like _target hasBeenChecked = true; ?
No
Use setVariable
Thanks.
_locationsArray = [
[14085, 18347, 0], 1,
[12938, 13874, 0], 1,
[12011, 13241, 0], 1,
[9028, 20100, 0], 1,
[8371, 18273, 0], 1,
[[], ["water"]] call BIS_fnc_randomPos, 5
];
Is there any way to pull a players profile/steam name and use it as a variable?
I looked at that briefly but must've been using it incorrectly. I'll give it another go. Thanks
Cool beans...I got my script to identify dead soldiers and mark them for retrieval almost finished...
at scale this would be not optimal , but it would be a useful tool to have for custom scenes
Oh yeah that makes sense.
Hello, little question about a script ... In my "addAction", I would like to see the Display name (??????) appear and not the Classname. Do you know how I should do it? (I begin...😆 )
ListVehicle=["B_Truck_01_Repair_F","B_Truck_01_covered_F","B_Quadbike_01_F"];
{
_this addAction [format ["Buy : ??????", _x],format ["
if (cash < 200) exitWith {hint 'Insufficient cash'};
_veh = '%1'createVehicle getMarkerPos 'Mrk';sleep 1; _veh setDir markerDir 'Mrk' ", _x]];
}forEach ListVehicle;```
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
getText(configFile >> "CfgVehicles" >> _x >> "DisplayName")
Also read BIKI: https://community.bistudio.com/wiki/format
To replace a part of the string using format, use %1, %2, %3...
You forgot "CfgVehicles"!
No 😛
Disregard then 🙂
Thaanks, I'm going to try ^^
@upbeat quartz also that code is just written badly. pass the classname to the code:
{
_this addAction [format ["Buy %1", getText(configFile >> "CfgVehicles" >> _x >> "DisplayName")], {
params ["", "", "", "_type"];
if (cash < 200) exitWith {hint 'Insufficient cash'};
_veh = _type createVehicle getMarkerPos 'Mrk'; sleep 1; _veh setDir markerDir 'Mrk'
}, _x];
} forEach ListVehicle;
no
params is a command
in simple terms, it maps the elements of an array to the given variables:
[1,2,3] params ["_var1", "_var2", "_var3"];
//now _var1 = 1, _var2 = 2, etc.
when you use that as a unary command (no array to the left, i.e. just params ["_var1",....]), the array is _this
so what I wrote above in that action code is actually:
_this params ["", "", "", "_type"];
It's quite complicated to understand, but I'm going to take it little by little
Your first code works perfectly, I'll take it from there to do more
well in sqf you can pass arguments to the code like this:
[1,2,3] call {
//_this in this code is [1,2,3]
};
when you call a code, you get a _this, which is what was passed to the code. in the above example, _this is [1,2,3]
@upbeat quartz if you're wondering how I passed _x to that code read this:
https://community.bistudio.com/wiki/addAction
I see, I'm going to practice more and go to the wiki
object addAction [title, script, arguments,...]
and then inside the code:
params ["_target", "_caller", "_actionId", "_arguments"];
I just skipped _target and _caller and _actionID:
params ["", "", "", "_type"];
you fetch the argument like that
you could just write:
_type = _this#3;
For now I'm just going to do a simple trade addAction
Yes!! But it's going too fast for the beginning, I started yesterday haha
_target setVariable ["markerstr", createMarkerLocal ["markername", _target]];
_target setVariable ["markerstr", setMarkerShapeLocal "ICON"];
_target setVariable ["markerstr", setMarkerTypeLocal "mil_dot_noShadow"];
_target setVariable ["markerstr", setMarkerAlphaLocal 0.5];```
Is it possible to create a marker inside _target this way or do I need to create a new function and pass _target as a variable then do it internally?
inside _target
Define?
I didn't said “what is the definition of _target”, but “what do you mean”
Oh, inside _target, well. I just don't want to reuse the same variable for each marker. So I figured internalizing it to the object was the way to go.
setVariabledoesn't take commands, just like every commands don't- You can use ANY name (string) to create a marker (even if it doesn't make sense for humans)
setMarker**commands do need the marker to run- I assume the goal for you is
sqf _marker createMarkerLocal ["somename",somewhere]; _target setVariable ["marker",_marker];
Oh that would work even when the function is run again and again? Oh! I just pass the whole marker after it's made?
Will try it!
Hmm, second time I go to run the function it doesn't create a new marker...
Oh well, got darkmode working in notepad++ so who cares if it's a long night!
I haven't done much MT programming my self so I wonder why exactly its such a bad idea
A3 simulation is handled by a single thread as far as I know.
Aside from that: You have 200 AI. That means you have 200 separate threads (all of them more or less fairly simple FSMs), all competing for the same resource(s), causing increased scheduler load, overhead and congestion.
is also would require basically an engine rebuild
probably wont even get it in arma 4
for a cpu with N logical cores, N realtime threads is a solid choice. you can have more lower priority background threads for lower priority background work, I/O, etc. but more threads doesn't mean more faster. much of AI would be considered realtime work, though there might be some tasks which could be done in the background
Someone in another discord just mentioned to me that if you need an AI to run smoother (like VCOM) run it on a headless server...
Oddly, I wonder why they don't change single player Arma to do that...
because it wouldn't be helpful in any way
actually i lie. it might be helpful if the engine is limited to a single thread for realtime work
hmm I wonder how multithreaded arma actually is
The headless client does nothing but run AI that is local to it, thus taking that load off the actual server.
The performance increase originates in more efficient use of the available hardware: If you have 8 cores, A3 doesn't really use all 8 of them (at least not all the time); and as the community has figured out, it's actually beneficial to run a second A3 process (the HC) at the same time which then uses some of the remaining available cores.
probably they do some background tasks on background threads, maybe they have a dedicated rendering thread, but in all likelihood it's still mostly single threaded.
ok
From what I've read: A single simulation thread, and the renderer is tied to that (which is why your FPS are also tied to that, which is why the A3 bottleneck is the CPU).
No doubt there are more threads for some other stuff, but from what I understand, that's the core.
Headless client is just a "normal" player in a multiplayer game.
Singleplayer Arma is obv not multiplayer, and adding all the multiplayer things (network sync mainly, but also savegames) into singleplayer is not viable
Some jobs can be multithreaded but only if the task doesn't interfere with eachother.
For example AI simulation, take for example "I'm a AI and I need ammo, I want to pick up this ammo on the ground"
now if you simulate 200 AI's in parallel, and they all try to pick up that same ammo.... uh.
Same for getting into vehicle, and hundreds if not thousands of other things
But there are ofc also things that can be done in parallel. 50 AI groups want to pathfind from point A to point B.
Well the pathfinding doesn't actually modify any data, it can be done in parallel without interfering with eachother, and that is what Arma does.
@still forum makes sense thx
maybe if they don't produce any SQF events with return values and you defer the rest
or you lock for any SQF event, which would be pretty bad
Most of the simulation multithreading is in form of micro jobs.
"I need to calculate this thing a thousand times, lets do it on all CPU cores" and there are tons of micro jobs running every frame.
I'm now upgrading some script commands to make use of it and they become like 5x as fast.
But again can only do that if the jobs don't interfere with eachother
maybe you can make whole scripting engine run on its own thread?
no
well yes. if you pause the mainthread in the meantime
which wouldn't make any sense
hmm ok
running untrusted user scripts concurrently would require an entirely different approach to scripting. it would be kernels with restrictions on what they can do, and they would have to declare up front the resources they touch and how they touch them
The synchronization overhead of that would probably results in even worse performance, since you can't declare many things up front. You don't know what object might trigger an event handler, and you don't know which objects a nearestObjects call will return. The alternative would require scripts to "lock" stuff and etc. and kill the entire scripting scene except for 1%
no you would never do this for events
it would be more like "each frame, for each vehicle: given read access to its position and rotation i want to mutate its damage"
You can do such things in Intercept if you really want to.
For some things it makes sense
All script commands can only be accessed in main thread, but you can do maths and logic and calculations all outside of script
so if i was looking to have a script that will, spawn X then they move to Y when players enter Z, what am i looking for?
Several commands. createVehicle or createUnit, doMove or some move commands, some trigger commands
but if i was to place said units in editer?
Then omit createVehicle/createUnit part
is there script to make units disable simulation but also invisible?, then when activated it would make the unit visible and enable simulation? as a question
hideObject/hideObjectGlobal
thanks
iirc they're still "simulated"
as in they can move around
not sure
They are... I thought your question was just how to hide and you know how to disable simulation. To disable, enableSimulation/enableSimulationGlobal
i want to place 4 squads down, with a set path, but i dont want them visiable or able to shoot/move untill the tigger is tripped
disableAI with hideobject?
Hello again, once I buy my unit, is it possible to have it join my group directly? With joinSilent for example?
ListUnit=["B_officer_F","B_Soldier_F","B_soldier_LAT_F"];
{
_this addAction [format ["Buy %1", getText(configFile >> "CfgUnit" >> _x >> "DisplayName")], {
params ["", "", "", "_type"];
if (cash < 50) exitWith {hint 'Insufficient cash'};
_veh = _type createUnit getMarkerPos "mrk_5";
}, _x];
} forEach ListUnit```
I don't know where to place the line
you're not using the syntax correctly
createUnit I mean
first of all, there are two syntaxes, and you use neither
second of all, one of them doesn't return anything, which you shouldn't use
Yes I think he's full of mistakes ^^
ok give me the correct syntax from the wiki and I'll help you out with the rest (I know it myself, I just want you to learn, since you're new)
Okey I'll try to do that 🙂 it's true that it's better to learn by yourself. I will come back to you in .... few hours 😆
afaik arma 4 only has zombie-tier AI
@pulsar bluff
can you stop spreading nonsense? thank you.
For all official information related to Arma 4, see https://community.bistudio.com/wiki/Arma_4.
DID IT YAY
Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.
To get to your RPT files press Windows+R and enter %localappdata%/Arma 3
Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files
To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.
anyway, what you should've done is:
ListUnit=["B_officer_F","B_Soldier_F","B_soldier_LAT_F"];
{
_this addAction [format ["Buy %1", getText(configFile >> "CfgVehicles" >> _x >> "DisplayName")], {
params ["", "", "", "_type"];
if (cash < 50) exitWith {hint 'Insufficient cash'};
_veh = createGroup west createUnit [_type, getMarkerPos "mrk_5", [], 0, "FORM"];
}, _x];
} forEach ListUnit
Thank you 🙂
and if you don't need listUnits later, don't make it a global variable. make it local
change it to _listUnits
Noted,
https://community.bistudio.com/wiki/File:Vectordirandup.jpg anyone can explain me how it works?
_pipcam setVectorDirAndUp [[0,0,0],[0,0,-10]];
what is this numbers
?
Just read the article?
https://community.bistudio.com/wiki/setVectorDirAndUp
the "point up" direction (e.g from feet to head for a soldier)
so [0,0,1] means "point up", [1,0,0] means "point right" etc
i know
but setVectorDirAndUp have two coordinates
if the vector would 1 coordinate it would very easy
I think I have already understood
the first coordinate is the vector and the second is the rotation of the vector
no?
obj setVectorDirAndUp [theVectorDir, theVectorUp];
```at that point I think I don't know what you do not understand?
idk
vectorDir is the direction of vector [0,1,0] of the model in world space.
and vectorUp is the direction of vector [0,0,1] of the model in world space
vectorDir select that if i want to see to X= +1 [1,0,0]
but i dont know what do vectorup
rotate the object?
Im configurating that script
_pipcam = "camera" camCreate [0,0,0];
_pipcam setVectorDirAndUp [[0,0.66,-0.33],[0,0.33,0.66]];
_pipcam cameraEffect ["Internal", "Back", "piprendertg"];
_pipcam camSetFov 0.4;
_campos = getposatl car;
_campos set [2,30];
_pipcam setpos _campos;```
is for a camera
@thick chasm
the red one is vectorDir
green one is vectorUp
(in model)
for example, for the model to point to North ([0,1,0]) and lie on its left side:
_obj setVectorDirAndUp [[0,1,0], [-1,0,0]];
a model pointing north but standing upright:
_obj setVectorDirAndUp [[0,1,0], [0,0,1]];
if you still don't get it, you need to learn some space geometry
also one obvious fact: vectorUp dot vectorDir must be zero
(they must be perpendicular)
for cameras, vectorDir is where you want the camera to point
vectorUp usually sets the pitch/bank
if you don't want the camera to bank (only pitch, i.e look up down) you can obtain vectorUp from this:
_vectorDir = _point1 vectorFromTo _point2;
_vectorUp = _vectorDir vectorCrossProduct [_vectorDir#1 * -1, _vectorDir#0, 0];
stupid question probably, but i'm trying to get the classname of a fired projectile from unit _x .
i have therefor put the following in unit _x init
'_x addEventHandler ["Fired", {hint (typeOf (_this select 7));}];'
this however returns the classname of the unit (_x), not the projectile. What have i misunderstood about eventhandlers?
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
if you read https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired (or https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#FiredMan), you can see that the projectile is #6 (use params 😉)
...because arrays start at 0 excuse me while i facepalm
heh no worries 😄 hence params, doing all the dirty work for you 😉
when using string as key for hashmap are there any special characters to worry about, which can't be used?
Ive been trying to script an A-10 strafe run and every time i think its correct i start the mission and instead of waiting to be called it starts flying right away
well we can't help you without seeing any code so
none afaik, why?
Im having user input for hashmap key
try and thou shalt see I presume ^^ if that's the case, please tell so we can adjust either hashmap or its documentation
ok
thanks!
np 🙂
The hash function used in A3 applies directly to binary data 🙂
well all special characters seem to work here but Idk about unicode and whatnot characters
æÆ¥¿¡œŒˇ«»“”‹›‘’±‰ you're welcome 😄
seems to work
kewl! thanks for the tests again, and go for your script with your mind at ease! 👍
🙂
Hello everyone. I'm having an issue lately wich is: In Editor i put an Insignia in a controllable unit. When i press respawn the Insignia doesn't appear on the arm.
Lou Montana provided me a code to add in .sqf file but so far didnt worked I dont know if i did something wrong in what i did or there is something that i am missing.
Code:
{
_x addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
private _insignia = [_unit] call BIS_fnc_getUnitInsignia;
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
} forEach units playersGroup;
If the units are all players, you could (probably) just do https://community.bistudio.com/wiki/Arma_3:_Respawn#Restore_Loadout_on_Respawn with BIS_fnc_getUnitInsignia and BIS_fnc_setUnitInsignia instead of the loadout.
they are all players
have you defined playersGroup?
not sure if you can get a dead unit's insignia
params ["_unit", "_corpse"];
private _insignia = [_unit] call BIS_fnc_getUnitInsignia;
probably should do [_corpse] call BIS_fnc_getUnitInsignia;
_unit is the new unit that spawned instead
so you're doing nothing (setting unit's insignia on unit) 
if that doesn't work either, store the unit's insignia in the unit's var space using setVariable and use that when it dies
ill make the first change and see
ah true that
use corpse to get the info from the corpse, indeed
I fixed BIS_fnc_getUnitInsignia doc at the same time
so the code should be like this ? :
{
_x addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
private _insignia = [_corpse] call BIS_fnc_getUnitInsignia;
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
} forEach units playersGroup;
yes
nothing changes ;_;
where did you put the code?
in a file called initServer.sqf
oh, not "initServer.sqf.txt" ?
no
are you the server?
yes
I recommend that you put the code in initPlayerLocal.sqf, and change it as follows:
params ["_player"];
if (group _player == playersGroup) then {
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
private _insignia = [_corpse] call BIS_fnc_getUnitInsignia;
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
};
roger that
if all players are in that group you can omit the if
i did not understand what do you mean by that
with the code that you provided, it didn't worked.
are all players in that group?
yes
i even created a new world with only 1 player and 1 respawn in VR
and it didnt worked there.
so this'll do:
params ["_player"];
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
private _insignia = [_corpse] call BIS_fnc_getUnitInsignia;
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
ok
but if that didn't work I'm not sure if this'll help (unless you did something wrong, e.g. playersGroup not defined)
sended you a photo in DM's
so still didn't work?
no ;_;
the squad leader is the one that (for now) has a insignia so im always testing that unit
but nothing..
does ACE have anything to do with it ?
does ACE have anything to do with it ?
I don't think so
try this:
params ["_player"];
[] spawn {sleep 1; systemChat "init..."};
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
[] spawn {sleep 1; hint "activated..."};
private _insignia = [_corpse] call BIS_fnc_getUnitInsignia;
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
if the code actually executes you'll get a hint
hold on
added another one
you should see two messages: one saying init... which is shown at startup, and another one saying "activated..." when you respawn
im back, ok im going to test it now
both messages showed up
the init message and activated hint
but the insignia not there
@dark pecan what about:
params ["_player"];
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
private _insignia = [_corpse] call BIS_fnc_getUnitInsignia;
systemChat str _insignia;
hint str ([_unit, _insignia] call BIS_fnc_setUnitInsignia);
}];
one second
so it doesn't set it
nop
it should say true
where should i put that ?
not that
what I'm about to write
params ["_player"];
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
private _insignia = [_corpse] call BIS_fnc_getUnitInsignia;
[_unit, ""] call BIS_fnc_setUnitInsignia;
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
this ^
change it to this
params ["_player"];
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
private _insignia = [_corpse] call BIS_fnc_getUnitInsignia;
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil];
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
it's faster
the script was preventing change if it thought insignia is already set
so first I remove the insignia
then set it
actually remove the true
done
now it's better
less network traffic
ok thanks, ill save this one then
but Leopard since this subject about insignias is on the table
this is great
but what if i wanted to make for example, if a player profile name has "[OR-1]" it provides that unit that the player is using a specific insignia
If the Character name is [OR-1] the unit that he picks should have the insignia "Insigna name" if [OR-2] = "insignia name"
you can use something like this:
_insignia = call {
if ("[OR-1]" in name _unit) exitWith {
"insignia1";
};
if ("[OR-2]" in name _unit) exitWith {
"insignia2";
};
if ("[OR-3]" in name _unit) exitWith {
"insignia3";
};
//default insignia in case none of the above match:
"insignia0";
};
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil];
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
you can also use profileName instead of name
and the word that should be replaced with "insignia1" is the actual name of the insignia right ?
private _vObjectsArray = [];
private _vObjects = [];
private _vObject = objNull;
private _dist = 1.8;
if (cameraView == "EXTERNAL") then {_dist = 2.8};
private _startPos = positionCameraToWorld [0,0,_dist];
private _radius = 3;
//_vObjectsArray = nearestObjects [_startPos, ["ALL"], _radius];
_vObjectsArray = nearestObjects [_startPos, ["ALL"], _radius];
if (_vObjectsArray isNotEqualTo []) then {
_vObjects = _vObjectsArray select {
([player, _x, 0.1] call BIS_fnc_isInFrontOf &&
(((getPosVisual _x) select 2) >= 0) &&
{!isObjectHidden _x});
};
};
yes
and obviously this goes where insignia was being defined in that code
It seems that _vObjectsArray = nearestObjects [_startPos, ["ALL"], _radius]; is even getting triggers and markers near the player?
alright and i should replace "name" with "profileName" ?
idk
what if the person name is [OR-1] Hugo
works
is going to change anyway ? cool
triggers maybe
but markers are not objects
¯_(ツ)_/¯
I only want it with caps lock [OR-1] should i let it be the code with [OR-1] ?
ok so I'll change it back
done
can i put that code after the one that you did before about applying the insignia ?
Like this ?
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
private _insignia = [_corpse] call BIS_fnc_getUnitInsignia;
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil, true];
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
_insignia = call {
if ("[OR-1]" in name _unit) exitWith {
"insignia_fap_5";
};
if ("[OR-2]" in name _unit) exitWith {
"insignia2";
};
if ("[OR-3]" in name _unit) exitWith {
"insignia3";
};
//default insignia in case none of the above match:
"insignia0";
};
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil];
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
no
params ["_player"];
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
_insignia = call {
if ("[OR-1]" in name _unit) exitWith {
"insignia1";
};
if ("[OR-2]" in name _unit) exitWith {
"insignia2";
};
if ("[OR-3]" in name _unit) exitWith {
"insignia3";
};
//default insignia in case none of the above match:
"insignia0";
};
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil];
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
}];
and both problems are solved?
yes just fix the insignia names
ok im testing it
What’s the best way to add an image to a flag ? I have tried using slide show but it can’t find the image according to the error code, I have tried everything but it’s not working, I have even tried to use an init code but that ain’t working either - lemme know if this is the wrong channel for this thing
so far so good, thanks a lot !
np
Apparently only is the one that the insignia script works
i made a few fellow friends of mine joining and it didn't worked for them
yes, it only worked for them
How can I use the "Select" command to filter Triggers from my array_
?
I need something in the lines of : !isObjectHidden _x;
but: !isTriggerObject _x;
it didn't worked for them
it only worked for them
what?
They are reporting me that they can see the insignia from one guy, but not from another and they have the same name
not sure what you mean
so we are 5 people
2 of them can see an insignia on me and in player1
but i can only see the insignia on myself. Those who are reporting they cant see theyre own insignia
idk let me look at the function again
if they see the insignia on one another it's a network sync issue
@dark pecan can you test this too?
params ["_player"];
_player addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
_insignia = call {
if ("[OR-1]" in name _unit) exitWith {
"insignia1";
};
if ("[OR-2]" in name _unit) exitWith {
"insignia2";
};
if ("[OR-3]" in name _unit) exitWith {
"insignia3";
};
//default insignia in case none of the above match:
"insignia0";
};
[_unit, _insignia] spawn {
params ["_unit", "_insignia"];
sleep 3;
isNil {
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil];
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
};
};
}];
sets the insignia after 3 seconds
i will test but a bit later, right now im on an operation but when i do it i'll let you know
Sure.
while {true} do {
{
Billboard setObjectTexture [0, _x];
sleep 10;
} forEach ["A.paa", "B.paa"];
};
So I have a script that gets the nearest marker to a trigger and then sets its color differently but if a player places a marker closer to the trigger it colors the players marker instead. How would I filter out the player placed markers?
https://community.bistudio.com/wiki/createMarker#Notes - see the last note: Filter out marker names starting with "_USER_DEFINED".
Anyone know if it is possible to use the RTT feature to render text?
For the purpose of making something like an Ingame scoreBoard / message-Board?
I don't believe so but you could always use hidden selections and paa's of characters
Or Is it possible to attach different textures to the same surface? Like making several jpg files with letters and then place them inside a billboard in the desired fashion
Yes
Really!
Nice
You got any resources available I could read up on?
I've been googling but cant seem to find anything
use hidden selections
and write a function to convert user input to a bunch of setobject texture stuff
but you would need to make the model also
oooh, so I couldnt just use like the vanilla bigScreen, and then ```sqf
_Screen setTexture "H.jpg";
_Screen setTexture "e.jpg";
_Screen setTexture "l.jpg";
_Screen setTexture "l.jpg";
_Screen setTexture "o.jpg";
nope
It would have to be some kind of mod rigth, not compatible with vanilla arma
oh ok, how would I do that?
as far as i know
np
Send your script
call{
_pos = getPosWorld thisTrigger;
_s = [allMapMarkers,[],{_pos distanceSqr getMarkerPos _x},"ASCEND"] call BIS_fnc_sortBy;
_s deleteAt (_s find "_USER_DEFINED"); // Tried something didn't work
_s params ["_mark"];
_mark SetMarkerColor "ColorWest";
titleText ["<t size='5' valign='top' shadow='0'>Captured</t>", "PLAIN", -1, true, true];
titleFadeOut 2;
}
here ^
Are you familiar with https://community.bistudio.com/wiki/Scheduler ?
(the solution is simple: wrap the code in spawn)
Yeah It's probably better to make an external function
_s = _s select {!("_USER_DEFINED" in _x)};
```(instead of the `deleteAt` expression)
0 = [] spawn {
//The code I sent
};
_Handle = [] spawn {
while {true} do {
{
Billboard setObjectTexture [0, _x];
sleep 10;
} forEach ["A.paa", "B.paa"];
}
};
Like this
yes but this less spaces
Indeed.
Billboard is supposed to be the variable name of your billboard 🙂
Could be, yes. Try converting to .paa.
So I think I might have a solution for making an ingame leaderBoard.
If you want to write 5 letters:
"Warning, pseudo code coming"
_CharSlot1 = CreateVehicle "UserTexture10m_F";
_CharSlot2 = CreateVehicle "UserTexture10m_F";
_CharSlot3 = CreateVehicle "UserTexture10m_F";
_CharSlot4 = CreateVehicle "UserTexture10m_F";
_CharSlot5 = CreateVehicle "UserTexture10m_F";
{
_x setObjectScale 0.1;
_x AttachTo _Billboard [x, y, z];
_x SetDir 180;
[_x] Call Fnc_SelectCHaracterTexture;
} ForEach [_CharSlot1, _CharSlot2, _CharSlot3, _CharSlot4, _CharSlot5];
That way you avoid Using a mod and you can make some function that will allow you To match the ingame letter (.paa file) with a character from a string (Such as playername, score etc etc)
I didnt think of that, smart move
Thank you thank you! Love the praise!
I just wonder why createVehicle buddies were not eligible to join to rest of commands in forEach.😔
did you read the warning?
Warning?
"Warning, pseudo code coming"
Here lies the remains of @winter rose 's warning ignorance sent 2 mins ago. (or what's left of it after deleting it)
no
ah
im afraid this isnt working 
i've put the following code in the onPlayerKilled.sqf file which is placed in the main mission folder
if ( _oldUnit == bandit2 && _killer == scout1 ) then {
scout1 sideChat "(radio) Got him.";
};```
but nothing happens when my fellow scout1 over here shoots the bandit2 in the head
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
@meager epoch
_bomb = "groundweaponholder" createVehicle getPos this;
_bomb addMagazineCargoGlobal ["M16",1];
_bomb attachTo [this,[-0.1,0.05,0.6],"righthandmiddle1",true];
is saying local variable in global space but it is in ab objects init, so i have no clue what the issue is
anyone got a clue?
still nothing
Is the dying unit a player?
No
Wrap it with this call {<your code>}; (convert this to _this as well in ur code) or use bomb instead of _bomb but bomb will obviously be accessible
Well if dying unit is not a player, then a playerKilled event wont help

i can fix it
i believe in u
gimme a bit
sure thing
bandit2 addEventHandler ["Killed", {
params ["", "_killer"];
if ( _killer == scout1 ) then {
scout1 sideChat "(radio) Got him.";
};
}];
@meager epoch try this
put that in initServer.sqf i guess
that did it, thanks 
It worked thanks.
so im trying to make a script to sort radar and non radar vehicles and could use some help
params ["_unit"];
_Radarrange = getnumber (configFile >> "CfgVehicles" >> _unit >> "components" >> "SensorsManagerComponent" >> "Components" >> "ActiveRadarSensorComponent" >> "AirTarget">> "maxRange");
if !(_Radarrange == 0 && !(_unit isKindOf "Land")) exitwith {true};
false;
but im getting an error
_Radarrange = getnumber (configFile >> _unit >> "components" >> "SensorsMana>
1:01:20 Error position: <>> _unit >> "components" >> "SensorsMana>
1:01:20 Error >>: Type Object, expected String
1:01:20 File fza_ah64_controls\scripting\functions\fn_targetisADA.sqf..., line 24
1:01:22 Error in expression <];
typeof _unit, _unit just returns an object.
so just replacing it should do?
at least thats what I assume unless u didnt use an incorrect variable name
yeah, _unit -> typeof _unit
u want a class name of a unit to access its config properties
I am getting a zero divisor error with this code in Warlords Redux. I am not sure why.
{
if (count (WL_PLAYER_REQUISITION_LIST # _forEachIndex) > 0) then {
_purchase_category lbAdd _x;
};
_purchase_category lbSetValue [(lbSize _purchase_category) - 1, _forEachIndex];
} forEach [
localize "STR_A3_cfgmarkers_nato_inf",
localize "STR_dn_vehicles",
localize "STR_A3_WL_menu_aircraft",
localize "STR_A3_rscdisplaygarage_tab_naval",
localize "STR_A3_WL_menu_defences",
localize "STR_A3_rscdisplaywelcome_exp_parb_list4_title",
localize "STR_A3_WL_menu_strategy"
];
Suspect the select part
is there a way I can get an array of which "areas" (triggers or map markers) a unit is in? if I have 15 map markers/triggers, and I want code to run when the unit is not in any of them, how can I do that without doing something repetitive like this:
waitUntil { player not inArea "marker1" && player not inArea "marker2" && player not inArea "marker3" //etc...
Loop (findIf)
Get their type (or was it simulation?) from the config
so, something like this?
waitUntil { ["marker1", "marker2", "marker3", "marker4", "marker5"] findIf { player inArea _x } == -1 };
Yes but since the array is constant save it into a variable outside the waitUntil
okay
what does constant mean?
Not changing 
what I'm saying is that you're creating the array every time inside that loop
but it's always the same ["marker1"..."marker5"] ([] tells the game to create a new array)
So saving it outside the loop saves performance
ohhh. makes sense. and when the game sees [] and makes a new array, does that array get thrown away when it is done with that line of code unless it gets saved to a variable?
Yes
private _unit = player;
private _uniforms = [];
private _haveUniform = [true, uniform _unit in _uniforms] select { _uniforms isEqualTo [] };
diag_log format ["_haveUniform: %1", _haveUniform];
returns _haveUniform: [true,false]
I should have _haveUniform as boolean
() instead of {}
also it's reversed (I think)
and I don't see why you're not using if (doing that is slower than if)
one-liners ❤️
_haveUniform = if (_uniforms isEqualTo []) then {true} else {uniform _unit in _uniforms}
one liner still
although since the array is empty maybe not much performance diff:
_haveUniform = [uniform _unit in _uniforms, true] select ( _uniforms isEqualTo [] );
should be benchmarked in the game. idk
_uniforms isEqualTo [] || {uniform _unit in _uniforms}
yeah that's even better
thank you both, going with @copper raven's example
no
createSimpleObject would be more efficient
configOf _unit >> "components" >> ..
Dedmen treating backlog requests 😄 good morning!
can anyone help me with setting up !alive condition in setWaypointStatements because for some reason this doesn't work
_wp1 setWaypointStatements ["!alive thisList", " hint 'worked'"];
{ alive _x } count thislist == 0
// or, more perf friendly
thislist findIf { alive _x } == -1
oh wow thank you so much i broke my head for hours on this
Yeah, you know where I could find the model names?
you can use classnames
or
getText (configOf CreateVehicle "UserTexture10m_F" >> "model")
there's a 1 meter variant too
UserTexture1m_F
can anyone help me with this script it seems that everything works but the condition and i have no clue how to fix that
_grp4 = [getMarkerPos "spawn3", East, (configfile >> "CfgGroups" >> "East" >> "CWR3_RUS" >> "Armored" >> "cwr3_o_bmp1_section")] call BIS_fnc_spawnGroup;
_grp4 setVariable ["groupa", 123, true];
_wp1 = _grp4 addWaypoint [(getMarkerPos "Alpha"), 0];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "NORMAL";
_wp1 setWaypointStatements ["thislist findIf { alive _x } == -1","hint 'worked'"];
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
what is this?
what it says. syntax highlighting
like this
#arma3_scripting message
you should post your code with a syntax highlighting here
_grp4 = [getMarkerPos "spawn3", East, (configfile >> "CfgGroups" >> "East" >> "CWR3_RUS" >> "Armored" >> "cwr3_o_bmp1_section")] call BIS_fnc_spawnGroup;
_grp4 setVariable ["groupa", 123, true];
_wp1 = _grp4 addWaypoint [(getMarkerPos "Alpha"), 0];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "NORMAL";
_wp1 setWaypointStatements ["thislist findIf { alive _x } == -1", "hint 'worked'"];
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
still doesn't work tho
wdym
_grp4 = [getMarkerPos "spawn3", East, (configfile >> "CfgGroups" >> "East" >> "CWR3_RUS" >> "Armored" >> "cwr3_o_bmp1_section")] call BIS_fnc_spawnGroup;
_grp4 setVariable ["groupa", 123, true];
_wp1 = _grp4 addWaypoint [(getMarkerPos "Alpha"), 0];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "NORMAL";
_wp1 setWaypointStatements ["thislist findIf { alive _x } == -1", "hint 'worked'"];
how can the waypoint be completed if everyone's dead?!
thislist findIf { alive _x } == -1
means everyone in the group is dead
i want it to trigger when everyone is dead is that not possible?
with waypoint no
ah shit is there another solution then?
loops, or event handlers
if the units die, the group gets deleted and its waypoints with it yeah 🙂
big braindead moment from my side thank you very much for the help tho!
trying to refer to a group name of _groupe that i spawn with the code below, but it says that the variable doesnt exist. Help?
_groupe = [getMarkerPos "SPAWN", EAST, 7] call BIS_fnc_spawnGroup;```
this code only should work. you may be trying to use this variable from outside its scope
i have a loop in its own .sqf, i have this condition ```sqf
if ({alive _x} count units _groupe == 0) then {hint "dead"};
thats where the error happens
yep, and it does not* know _group that is a local variable 🙂
okay, any way i can refer to it? Set it to global, or....?
global yes
!alive <group> instead
wait
it doesn't exist 🤔 why did i think it exists
The On Activation part returns a generic error in the expression. Can someone point out where I fucked up?
Thanks in advance.
Condition:
!(alive bandit1) && !(triggerActivated triggerX) && !(triggerActivated bonusChat3_1);
On Activation:
deleteVehicle bonusChat3_1;
waitUntil {triggerActivated triggerX};
0 = [] spawn {
sleep 8;
player1 sideChat "(radio) I know. He's already dead.";
sleep 5;
scout1 sideChat "(radio) Oh, good job. Carry on then.";
bandit2 enableAI "MOVE";
}
can't waitUntil in unscheduled
so uh, how do i schedule it
just move the waitUntil one line below, it should do 😉
o ait, thanks
thank you for the help, i knew that the _ thing meant something but wasnt sure.😘
Hey can someone help me with something.
Currently im working on a mission but I want the End Scenario to happen when the music is done playing
use music event handlers then
alternatively, you can use sleep
which is safer
Alright I will see what I can do
playMusic "blabla";
sleep _musicDuration;
["end1"] call BIS_fnc_endMission;
Alright thnx
I'm making a zeus module that will allow me to call in reinforcements and supply drops similar to how the fire support works. Got a bit stuck and would appreciate some input, I believe what I'm after has something to do with the velocity part / atan calculations. I'm a script noob and unsure how to adjust it so the flight path of the plane is a height of 200 or so above the logic module to simulate paratroopers jumping from the aircraft
this is the link to the code I have so far, copy paste from the current zeus fire support
can I achieve recursion with some magic variable ?
// script.sqf
params ["_unit"];
[_unit] execVM "script.sqf";
// [_unit] execVM _thisScript;
// script.sqf
params ["_unit", ["_code", {}]];
[_unit] spawn _code;
// usage
[player, { [_this] execVM "script.sqf"; }];
yea, but not really
don't execVm over and over again
you're recompiling the script everytime that way
compile it once, i.e compileScript
then use spawn/call accordingly
will probably rewrite to wrap code to function and do recursion calling function
CfgFunctions plz
[] execVM _thisScript should work, but not sure how execVM handle full path
no it wont work
[] execVM str _thisScript
stahp 🤣
wat? spawning a new code? don't
and i mean i assume that he wont call it without a condition and crash his game 😄
^
explosion was heard in the distance
disregard this now, think I figured it out
quick question to check if i've understood something correctly concerning multiplayer scripting.
scenario is as follows: i wanna spawn something upon a units death via script. if i just put the "killed" eventhandler into the unit's init field in the editor, this will cause as many eventhandlers as there are players, and subsequently as many spawns.
Is this correct? and if so, how can i circumvent this?
correct
solution: add the event server-side only:
either withsqf if (isServer) then { this addEventHandler ... }; // bad or, more smarterest, initServer.sqf 🙂
thats... suprisingly simple. initServer wouldnt work sadly as i won't know at mission start what unit to add the script to.
that you definitely set it from the beginning of a mission
in a script it can happen later
it'll be a zeused mission, i've tested it on a player-hosted local mp server, adding the script into the init box via Zeus interface works.
thank you very much for the info
Anybody know of a way to get the position of the closest trigger from an array of triggers?
closest to what?
to a marker or some other object I select
I think nearestObject works 🤔
if not just use:
_triggers_sorted = [_triggers, [], {_x distance _pos}, "ASCEND"] call BIS_fnc_sortBy;
sorts them by distance to pos
the closest one is _triggers_sorted#0
this looks awesome. Will check it out.
@neon swift yes nearestObject works too:
_nearestTrigger = _pos nearestObject "EmptyDetector"
but:
Hardcoded radius is 50 meters
@wind hedge regarding the question you asked before: just do:
_objs select {!(_x isKindOf "EmptyDetector")};
all commands are better than functions
altho I think BIS_fnc_selectRandom is now a wrapper for selectRandom...🤔
it's only there for backward compatibility
a wrapper with param checks yes, confirmed
Hey, Iv'e been working with this function since I need to find/select a trigger from a specific array of triggers. But when I use it I keep getting Error Generic error in expression
from the following portion.
{ _x distance _pos }
pls help
how do you use it?
I have several arrays defined in the mission description.ext, each array is a collection of triggers on the map. I'm bringing the array into the funtion by...
_fArray = getArray (missionConfigFile >> "arraysBeaverTrail" >> "myArrays" >> _array);
where _array is the name of the array I want to sort.
Then,
`
_distSortArray = [_fArray, [], { _pos distance _x }, "ASCEND"] call BIS_fnc_sortBy;
_trig = _distSortArray select 0;
`
_trig should be the trigger I want but the code gets stuck at the BIS_fnc_sortBy
they're not triggers
you're just bringing in an array of strings
feared that
you can convert it to an array of triggers if they're defined in the mission namespace like so:
_fArray = _fArray apply {missionNamespace getVariable [_x, objNull]};
but I recommend using array of triggers and not using config
that's not what config is for anyway
¯_(ツ)_/¯
how would I define the array in the initServer.sqf? Would it be:
missionNamespace setVariable ["TAG_myArray", [trig_1, trig_2, trig_3]];
what you wrote is literally:
TAG_myArray = [trig_1, trig_2, trig_3];
@little raptor sorry about all the pings I fixed it.
yeah sorry @little raptor 😋
Hey, I need some help mod making wise.
Me and @paper fulcrum are working on a ace drug extension mod, and we need some help:
We have setup a Medical Menu action, where they can take the drug. The thing is, we want some extra effects to apply after the action, such as stamina increase and chromatic aberration etc. However, we can't figure out how to get those effects to apply after usage (we don't know what and how to add and make sure the script runs). How do we do that?
check https://community.bistudio.com/wiki/Post_process_effects for the effects,
and
https://community.bistudio.com/wiki/setUnitTrait (loadCoef)
or
https://community.bistudio.com/wiki/Category:Command_Group:_Stamina_System for stamina management
Ah, you misunderstood what I meant.
Lemme rephrase.
Okay, so I have my mod folder.
taking drugs with your friend? this is not a quackhouse
What I want to know is how to find out after the action is done, and how to apply the effects that I want.
Like how do I get an .sqf to run after the medical action is done
you would have to check the ACE documentation for that I'm afraid
I only know vanilla Arma
@little raptor says no problem
I'm trying to put NMD sandbox on a few of my subscribed maps and I can't figure any of this out. The editor just doesn't make any sense
for instance, how do i put player slots down and why tf is this editor so counter-intuitive
How would i go about scripting fire on a static plane crash
Need help here I want to remove only the uniforms from the virtual arsenal but it deletes all the items I have a bunch of other codes but can't make them work
[Box_1, ["%ALL"], true] call BIS_fnc_addVirtualBackpackCargo;
[Box_1, ["_availableHeadgear", "_availableGoggles", "_availableVests", "_availableaccs"], true] call BIS_fnc_addVirtualItemCargo;
[Box_1, ["%ALL"], true] call BIS_fnc_addVirtualMagazineCargo;
[Box_1, ["%ALL"], true] call BIS_fnc_addVirtualWeaponCargo;
Fatigue (https://community.bistudio.com/wiki/enableFatigue) no longer works in Arma 3 and was replaced by Stamina (https://community.bistudio.com/wiki/enableStamina) right?
Does anyone know the best way to profile units for zeus jip?
@wind hedge fatigue does work yea
Is there anyway to apply a sound effect (just like deafness when player is in unconscious) which is defined in CfgSoundEffects or something, by a script command, not engine-side hardcoded something?
Ok thanks but then what is the difference between Fatigue and Stamina?
Is there any way to whitelist the use of drones to specific roles? Because as far as I know if the role has access to the UAV Terminal they can access a drone. I just don't want to blacklist terminals and hand them out individually
@wind hedge iirc stamina controls sprint
fatigue controls effects (screen darkening)
dont know anymore tho
It also seems that Stamina controls player sway while fatigue controls Ai sway!?
Both systems overlap and have different effects on players vs Ai units... too bad it is probably too late to overhaul and/or clarify the whole system....
Thank you for your input thou!
Does anyone know the script codes for different parts of the orca helicopter
Elaborate?
can some one help me I just want to delete the uniforms from the arsenal but only the uniforms
is for a SP mission
Like for the rear rotor and and main rotor and such
Doesn't make sense for me. You want what for those?
So a line of my code SetHitPointDamage[“HitVRotor”, 1]
Will disable the rear rotor of the helicopter. I was needing to know what other sections are able to be damaged in this way
Need help here I want to remove only the uniforms from the virtual arsenal but it deletes all the items I have a bunch of other codes but can't make them work
[Box_1, ["%ALL"], true] call BIS_fnc_addVirtualBackpackCargo;
[Box_1, ["_availableHeadgear", "_availableGoggles", "_availableVests", "_availableaccs"], true] call BIS_fnc_addVirtualItemCargo;
[Box_1, ["%ALL"], true] call BIS_fnc_addVirtualMagazineCargo;
[Box_1, ["%ALL"], true] call BIS_fnc_addVirtualWeaponCargo;
use true instead of "%ALL"
from here https://community.bistudio.com/wiki/Arma_3:_Arsenal @fair drum
and what are these "_availableHeadgear" coming from?
if they are local variables, you are trying to make that a string which makes no sense
my scripting knowledge is minimal manege to read some forums put where to complex @fair drum
i'll write something so you can fill in the rest real quick
basically I just cannibalize the from different codes
thanks @fair drum so from lines 4-24 ill just add the classnames right?
yes, make sure they are individual STRINGS
be mindful of commas and brackets
keep in mind, if you use this in a init box in the editor, you have to take out the //comment
understood
Can you populate a crates' cargo with the return value of getUnitLoadout?
Trying to make a script that spawns a crate with the contents of the players loadout but can't seem to get it to populate the items/magazines/weapons. Only the clothing.
Using the
SupplyCrate addItemCargoGlobal [vUniform, 1];
method currently.
Can you populate a crates' cargo with the return value of getUnitLoadout?
not directly. It gives a loadout array that would be difficult to sift through, but not impossible, probably above the level of coding you want to do currently.
@elder sail
Is there a trigger code for when a vehicle is empty
you mean event handler?
lets see your full code you have so far
I dont have a code yet. But a condition code that starts the “on activation” command string
I see I'll have to look at how to sift through the array or try another method I suppose. I'll share what I have working so far.
Along the same lines as the istouchingground condition
if (crew vehicleName isEqualTo []) then {
};
Ok thank you
if you are just using the trigger box, take out the if then and just leave the condition
there's a much easier way than using getUnitLoadout
SaveGear.sqf
if (isDedicated) exitWith {};
waitUntil {!isNull player};
vUniform = uniform player;
vVest = vest player;
vHeadgear = headgear player;
vGoggles = goggles player;
vItems = items player;
vAssignedItems = assignedItems player;
vBackpack = backpack player;
vBackpackItems = backpackItems player;
vPriAmmo = primaryWeaponMagazine player;
vSecAmmo = secondaryWeaponMagazine player;
vHandAmmo = handgunMagazine player;
vPriItems = primaryWeaponItems player;
vSecItems = secondaryWeaponItems player;
vHandItems = handgunItems player;
vMagazines = magazines player;
vCurrentMagazine = currentMagazine player;
vWeapons = weapons player;
vUnitLoadout = getUnitLoadout player;
vGearSaved = true;
hint format ["Currently equipped gear has been saved."];
SupplyDrop.sqf (Too long to fit entire script so I'll just post the relevant section)
SupplyDrop addItemCargoGlobal [vUniform, 1];
SupplyDrop addItemCargoGlobal [vVest, 1];
SupplyDrop addItemCargoGlobal [vBackpack, 1];
SupplyDrop addItemCargoGlobal [vHeadgear, 1];
SupplyDrop addItemCargoGlobal [vGoggles, 1];
Currently have it saving each part separately and then loading them in that way, though I can't seem to get the items/weapons/mags to work
because your addItemCargoGlobal you are not using right. you are giving it an array of class names, it needs a single class name. you need to use apply or forEach
for example
vUniform apply {
SupplyDrop addItemCargoGlobal [_x, 1];
};
Ohhh I see
Works perfectly now.
Thank you so much for the explanation!
So if my command is in the trigger box it should go
Condition box: Crew evaccrash isequalto [0]
On activation box: evaccrash allowdamage true; evaccrash setpointdamage[“hithull”, 1];
Im trying to make the helicopter blow up after everyone is out of it
not the best at scripting but make a trigger spawn in the position of the heli then set it blufor not present, onactivation: Heli setDamage 100 @gusty bone hope it helps
no, an empty vehicle, crew returns just []
remove the 0
@fair drum in the strings if I want to add everything what should I put because %ALL, true are not working for me
did you even init the box first?
@fair drum what does that mean if I name it Box_1 in the variable name?
no, the arsenal needs a box to be initialized. I didn't know you didn't have that done before...
add:
["AmmoboxInit", [_box, false]] spawn BIS_fnc_arsenal;
after line 29
may or may not need a slight delay after that line though we shall see.
it says Init: Invalid Local variable in global space
thats an old bug oversee from the engine. do this whole script external from the editor
external?
like, make a file, name it, then call it from init.sqf. like this
if (isServer) then {
call compile preprocessfilelinenumbers "scriptname.sqf"
};
where do I put that?
in init.sqf
my scripting skills are basic like kindergarten level
time to learn kiddo
I know, so I saved the mission but I don't have that file
got to create it yourself
the engine will look for that file automatically as with all event scripts
im headed to bed. ill help you tomorrow if you are still stuck
ok thanks I'll watch some YT videos
start here #arma3_scripting message
thank you
private _isAlive = alive player;
while { _isAlive } do { ... };
vs
while { alive player } do { ... };
#1 example will continue check that condition or only first time ?
The first, shouldn't. It won't exit. The second, you should
in the first case you define a variable value; the content will never be changed. a working equivalent would be```sqf
private _isAlive = { alive player };
while { call _isAlive } do { ... };
while _isAlive do
tru
if (typeOf _plane == ["classname1","classname2"]) then {}; Is it possible to have typeof with a list of classnames to check? the above doesn't work
brilliant thanks
use toLowerANSI typeOf _plane along with all lowercase classes to be sure 😉
or use proper case classnames :U
yyyeah, no - here yes, but some commands return all lowercase things sooo 😅
afaik they don't have hidden selections, so not possible
You can change their border colour though, iirc
setObjectTexture commands.
Last comment.
https://community.bistudio.com/wiki/setObjectTexture
looks like this works (for some reason):
{
_block setObjectTexture [_forEachIndex, "#(argb,8,8,3)color(0,0,0,0)"]
} forEach getObjectTextures _block;
only works if alpha is 0 (always black, even if you change the color)
¯_(ツ)_/¯
e.g #(argb,8,8,3)color(1,0,1,1) doesn't work?
heh - funny
changing the material works!
{
b setObjectMaterial [_forEachIndex, "\a3\data_f\default.rvmat"];
} forEach getObjectMaterials b;
{
b setObjectTexture [_forEachIndex, "#(argb,8,8,3)color(1,1,0,1)"]
} forEach getObjectTextures b;
makes it yellow
you need to change b to this
Good day. If I want to move some sqf files out of the mission pbo because they are used only on server side, where do I start? What are the best practices?
why would you want to do that?
"so nobody can look at my sicrits"
paa texture
I have a bunch of exported object loadouts to load dynamically on demand... quite a lot actually, so I would really like to decrease pbo size for clients
no
A.paa) is incorrect
No, that is not the reason
bingo
but really, how much you actually talking
not worth it (unless you're talking about hundreds of MBs)
now how many script files do you have 
cause I bet one sound file for your mission is bigger than all the script files combined
you'd need to make an addon
do you want it for a mission, or mod?
I think you need the absolute path then
b setObjectTexture [_forEachIndex, getMissionPath "A.paa"]
You mean extension? Or something else?
https://community.bistudio.com/wiki/Extensions
no, an addon
and load it serverside with your code, then execute it normally in the mission
nope, not for this one 🙂
@torpid swift ok then just "A.paa". no need for getMissionPath
@copper raven Do you have have any docs or tutorials on that by chance? All I can find is how to install them. Also, would it work on Linux dedicated server?
so addons don't really have any good tutorials on them unfortunately. what you are going to do is in the root folder of your addon, you are going to need a config.cpp and in that file you'll need a CfgPatches, a CfgFactionClasses and treat the rest of it sort of like a description.ext
Why does nothing from inside the if statement gets executed? The only thing that pops up is the first sideChat from miller1 and that's it. Where did I fuck up?
Thanks in advance.
chat3.sqf
miller1 setRandomLip true;
miller1 sideChat "Good job, Sergeant. Thanks to the laptop you've found, we now know the location of the Lieutenant.";
if (triggerActivated makeDocumentsVisible==true) then {
//unnecessary sideChats...
} else {
//more unnecessary sideChats...
};
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
kind of like this. I've only dabbled in addons a tiny bit but here's mine if you want to look through it. https://github.com/hypoxia125/Hypoxic-Editor-Modules/tree/main/%40hyp_Modules/Addons/modules
miller1 setRandomLip true;
miller1 sideChat "Good job, Sergeant. Thanks to the laptop you've found, we now know the location of the Lieutenant.";
if (triggerActivated makeDocumentsVisible /*== true */) then {
//unnecessary sideChats...
} else {
//more unnecessary sideChats...
};
if (triggerActivated makeDocumentsVisible==true)
triggerActivated makeDocumentsVisible
are you sure the trigger even exists?
that's not your issue though
what is inside the code blocks?
it does exist
inside the what
the if?
Thank you very much, I'll look into it
Why does nothing from inside the if statement gets executed?
in thethenand theelsecode
just turned it public
I sure hope you use -showScriptErrors too
well, that's what i dont know. it's only a couple of sidechats in both
no error gets shown
never heard of this, what's its purpose and how do i use it
show - your - code
if you simply put a hint "then" and hint "else" do they work?
see Launcher's advanced options
its like a screaming baby when you make a mistake in the form of a black box on the screen
lol
if you're testing it in eden it's always shown
except in unscheduled scopes iirc or some funky stuff like that 😄
i am testing it, no black box pops up
then put some hint like Lou said
does your unit have a radio?
also your player has a radio right?
like i said, the first sideChat pops up, just the sidechats inside the if statement dont
the player has one as well
if the first sideChat shows but the second one doesn't, it's probably because that trigger isn't defined (like I said before)
well now you know where your error is. its at the conditional
send pic of trigger menu
and it does its job
execute triggerActivated makeDocumentsVisible normally in the debug console
see what it gives you
if it doesn't give you anything it's not defined
https://community.bistudio.com/wiki/CfgPatches that's basically all you need
- cfgFunctions preferably
and that part is basically what you do in missions
gives a false at the start of the scenario, probably gonna give a true once it gets executed
gotta get to the point where it does first to see
but like i said, the trigger does its job
hint format ["activated = -%1-", triggerActivated makeDocumentsVisible];
```to be sure 🙂
the thing is that if the if condition returns nil and is unscheduled, we believe that it simply "breaks" the then/else and goes to what's next
hence be sure of the values with which you work
Thanks a lot
in english, please :)
short answer: make sure your if condition returns a boolean (true/false)
trigger doing its job was never a problem. the variable not being defined could've been (which you confirmed it isnt)
why not just post the full script anyway?
where do i define it
and how
it seems to be defined already
just the chat3.sqf?
just the file this one is in, I don't know what it is called 😐
you do realise I don't see your screen right 😄
when you give an object a variable name: varName = obj
it's defined by Eden
Ive typed it earlier 
xd
yeye doing it rn
my pc is shitting itself from running arma 3 and chrome at the same time
So give it a sec
post linky
Oh
now you keep the generated link for you
post the generated link here so we can see it
so
enjoy my top notch coding
you see the colors right?
you have a "
don't you see something wrong here? 🙂
uh oh
L16: sleep 8;";
use Visual Studio Code with the SQF plugin to save you (and us) some time
really, use it
just use syntax highlighting
but, shouldnt it execute till that part
no.
well thanks for the help lol :d
(and don't look at line 34, either)

with what do you edit SQF?
Notepad++
…VSCode please
even N++ has a syntax highlighter for SQF if you want
How do I enable it
your code shouldn't even compile
maybe, by negotiating with the interpreter, it will work? 😅
ty
map and _map?
are you sure that _map is defined?
no
if you want to add animations to the main map, use the commands without ctrl prefix
the ctrl ones are for user-defined map controls
?
did you even read?
Does anyone know what could possibly cause all of the code in missions various triggers, inits and such in call {} ?
I'm thinking it might be a mod or something
You updating your CBA version
CBA added that (but hid it from you because its confusing) to workaround a bug.
Bug was fixed, CBA removed it (and is also not hiding it anymore)
Ok so this is an intentional feature of CBA?
was* yes