#arma3_scripting
1 messages · Page 86 of 1
Looking at it, kinda. You can kick off with allUnits spawn H8_addDrag I think, but after that youll have to Spawn it on any newly added units.
P1 in thisList AND P2 in thisList AND P3 in thisList AND P4 in thisList
i have this trigger that i need to activate only when all players currently playing the mission are inside
right now when i simulate the players with ai and move them into the trigger it works fine however when i play the mission without AI the trigger does not work (because P2 P3 and P4 are not preset)
for refrence AI will be turned off for the mission
i feel like it should be simple but i cant find anything online
call BIS_fnc_listPlayers findIf { !(_x in thislist) } == -1;
it's ugly, but it works
it says "of all existing players, if there is any outside thislist, don't do poop"
@jaunty nestand don't crosspost, thank you
pick one channel and stick to it
I cleaned #arma3_scenario
call BIS_fnc_listPlayers findIf { !(P1 in thisList AND P2 in thisList AND P3 in thisList AND P4 in thisList) } == -1;
so if im using P1 P2 P3 P4 it would look like this?
no - just what I wrote (if your players can only be P1/2/3/4)
my code says "activate once all players are in this area"
if you have enemy players, it does not fit
count (call BIS_fnc_listPlayers - thisList) == 0
or count ([p1, p2, p3, p4] - thisList) == 0
this one no, as P roles may not exist
call BIS_fnc_listPlayers findIf { !(_x in thislist) } == -1;
just so i understand
i dont need to change any variables
Does anyone know why createUnit is creating a unit per client? Its being executed from the server
are you… remote-executing it?
no, its an addon and the script exits if it isnt the server
How sure are you that it exits?
the first line of the sqf is this if (!isServer) exitWith {};
I havnt verified it with some kind of print or anything though
Another issue, Im creating the unit and then moving it into a vehicle. However when I try and move it into the vehicle with moveInAny it actually creates a new unit and puts that unit in the vehicle, leaving the old one standing there
if (isServer) then
{
["C_Offroad_01_F", getMarkerPos "create"] remoteExec ["createVehicle"];
};
```will create a vehicle on each machine, resulting in big boom boom
I smell shenanigans in all the cases you mentioned
what kind of shenanigans lol, I dont smell them
vanilla: if you create a unit server-side, it is created server-side and replicated on each client.
createUnit does not create a unit per client.
I know it shouldnt, It is the result of my code however
May we see the actual line of code containing createUnit?
Heres the block
_group = createGroup civilian;
_group deleteGroupWhenEmpty true;
_unit = _group createUnit ["B_Soldier_F", getPosATL _vehicle, [], 0, "NONE"];
//Attaches variable to be used later
_vehicle setVariable ["bb_attachedUnit", _unit, true];
//Removes passengers ace options
[_unit,_unit] call ace_common_fnc_claim;
//need a delay for the name change to work
[_unit,_item,_vehicle]spawn{
params ["_unit","_item","_vehicle"];
_unit setCaptive true;
_unit allowDamage false;
_unit hideObjectGlobal true;
_unit setSpeaker "NoVoice";
//Puts the ai in the stretcher
_unit moveInAny _vehicle;
^the spawn ends a few lines later
when the moveInAny happens, a visible unit is in the vehicle, and an invisible(because of hideobject) one is standing next to it
Have you restarted the server and/or verified game files recently?
servers been restarted multiple times, its an addon so it needs to be to do changes. Game files.. maybe I guess I can try that
all files validated.. yay
Whether a command is also executed by JIP clients depends on whether they are told to execute it. For example, a command in init.sqf will be executed by JIP clients because they run init.sqf when they join - same for Editor init fields. A command will also be executed by JIP clients if it's in the JIP queue as a result of being remoteExec'd with JIP true.
- Do you have any mods loaded?
- Have you checked all your Editor init fields?
- It's impossible for us to say whether your code contains a hidden setPos as we don't have your code
tried removing the spawn, didnt help
what does
Does every client execute the setPos command when they join?
mean?
How would this look of you wanted all BLUFOR players inside a specific vehicle, say “helo1”, to activate the trigger?
how would you do?
I was thinking I'd have to add that line to each AI I had placed haha.
Thanks, I'll give this a go
You will have to consider for every unit created during mission, but thats a whole other deal :p
I can see how that's possible considering that I am only asking specifically because of the aforementioned GitHub issue 🥲
Hi, I'm making a mod for ARMA 3. Is it possible to make a script that increases an AO based on how much food you deposit in the safe zone?
sure. what have you got so far?
I don't have anything so far...I just wanted to make sure it was possible before delving into it.
I hope someone can help me.
I am running a dedicated server with the following in the initserver.sqf
MOUT_hostileVicArray =[];```
however when I run the following from a dialog button the script fails unless I manually execute the above by logging in as Admin and running it globabaly from the esc menu input box.
```MOUT_hostileAliveCount = {alive _x} count MOUT_hostileArray;
if (MOUT_hostileAliveCount > 0) then {
format ["Hostiles Remaining, %1!", MOUT_hostileAliveCount] remoteExec ["hint", 0];
sleep 5;
"Is their anyone already running this training scenario?" remoteExec ["hint", 0];
sleep 5;
"If not, Clear MOUT Hostiles first" remoteExec ["hint", 0];
sleep 5;
"" remoteExec ["hint", 0];
}
else { REST OF MY CODE };```
Thanks for the response. I'm new at scripting, so any pointers in the right direction would be helpful.
while { /* condition */ } do {
// check amount of food in storage
// linearConversion to make the comparison from # food to total area size
// grab your area
// modify your area
// sleep for your delay on checking this
};
Thanks!
hey im looking for some help with scripting a list that will pull items from the arsenal and put them on a list for deletion i have some code made already but it seems to just give me a "error undefined variable in expression" for the code to populate the list and the deletion button i really appreciate the help i have some knoiwlege of this but i hit a wall.
https://sqfbin.com/iponugukamihumehoqut
https://sqfbin.com/bucoxeyofotukuxagoxu
https://sqfbin.com/culodopucabefaregado
please edit your message to use https://sqfbin.com/
You're referring to classnames as if they were controls.
You need to find the controls with functions like displayCtrl
okay somethigng like this // Clear the list
((findDisplay 12345) displayCtrl 198) lbclear;
// Add each weapon to the list
{
((findDisplay 12345) displayCtrl 198) lbaddText _x;
} forEach _arsenal;
Some UI commands have a version where you specify the IDC instead but they're a bit dangerous.
yes, but more readable to pull it into a local variable:
private _listCtrl = (findDisplay 12345) displayCtrl 198;
You also broke the syntax of both commands there.
should be lbClear _listCtrl and _listCtrl lbAdd _x
aaahh thats what it suppose to be it was throwing syntax errors and i could not find a way around that thanks man
see the only problem now is how do i pull the items from the arsenal to go onto the list to delete them
after testing the code im still getting "error undefined variable in expression" thanks for the help
You had the same issue with RscListBox.
what do you mean by that?
okay i changed it, but for the script that handles populating the list it still shows error undefined variable in expression i don't know what else to do to address this.
The error does say exactly which variable is undefined if you read it.
ohhh man im so dumb i now see what it was saying
You should look in the RPT though. You get a better version of the same error there.
[] call populateDeleteList;";
i never changed the action and where can i pull the RPT from
thank you!
hey guys, looking for a bit of a hand making a script that saves a vaariable to a players namespace on disconnect and retrierves that variable on load.
Current server is a dedi server.
Looking to save "credits" to a players namespace
then retrieve it when they load back in
''
private _uid = getPlayerUID player;
_playerfundsvar = [];
_playerfundsvar = ["Playerfunds", missionname, _uid];
_playerfundsvar = _playerfundsvar joinString " ";
_kills = profileNamespace getVariable [_playerfundsvar, 0];
[player,_kills] call grad_lbm_fnc_setFunds;
diag_log _playerfundsvar;
''
this is the code i want
just bnot sure when/where to fire this.
Well you could use a postInit script so it loads when they log in. If it's in a mission file or a mod it's just setting up the config.cpp file...
If this is for a mission file only you could simply call the function in init.sqf... or ideally probably inside initPlayerLocal.sqf
If you don't know what that means just say
Is this the correct way to have it written up and does it matter where I place this line?
I did this and just tested it but it didn't work
Or is this something I run on a local/global execute after the mission has started?
how do i change the weather/time with triggers inside the game
setOvercast, skipTime or setDate
thx
Use the admin box to test script; if I had to guess, server side is the way to go with that command.
and how do i turn off Fatigue for everyone using game logic
will this deactivate it for everyone on the server?
Read the page, then read each element.
It enables/disables for every unit passed on the left of the command. That can be a specific unit, allunits, allplayers, etc.
ok thx
what's the right null command for null triggers? objNull?
Watcha mean by null triggers?
variable that is null
Triggers are objs so yes
ok thx 👍
No. Yes.
Servers don't have full texture files to save disk space. The commands work the same though
^ above
I am the author of the mod and looks like now I need to find a way to get the texture RGB data to a dedicated server
You can upload client pbo's to the server.
But you won't be able to get every mod user to do that
I'll probably just make the clients send known texture RGB data to the server
The texture files are still present though, just incredibly small? I can make it work if the texture name is returned identically. The dedi needs to know the name of the surfaceTexture
yes
Does anyone know if hideObject cant be used on a unit inside a vehicle? Same goes for any parameter, like enable damage, etc
Q: looking for general guidance on weapons, attachments, etc... for inventory use.
i.e. if I have a weapon loosely speaking i.e. the class name, i.e. gathering I would never have a proper OBJECT, needing to know which sights, muzzles, mags, are supported by the weapon (class).
so far I have this bit of guidance, wondering if there are any other or better source materials... thanks...
https://community.bistudio.com/wiki/Arma_3:_Weapon_Config_Guidelines
sounds like you could use these for starters: BIS_fnc_compatibleItems & BIS_fnc_compatibleMagazines
possibly? will have a gander, thanks...
could be useful, thanks. and from there I gather mag bone connected to the ammo bone, for things such as characteristics, mass, etc.
Check the pinned.
This works way better than ChatGPT: https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
ChatGPT is awful at writing SQF, although maybe not so bad at commenting working code.
but generally you should be looking up every command on the wiki.
ChatGPT is awfull at anything... Especially when you don't know anything about the subject to begin with...
That introduction to scripting page is actually quite good these days. I'm surprised :P
GPT needs to read Arma Wiki one more time.
Hello, im still having trouble with this convo from yesterday. I found a discussion online with a similar issue, but its solution did nothing for me https://forums.bohemia.net/forums/topic/179753-creategroup-in-multiplayer/
What im trying to do is create a unit, make it invisible and take no damage, and then put it in a vehicle. Essentially filling the seat in the vehicle so no one can enter it. This works fine in sp. However in multiplayer what happens is the unit is created, but when the moveinAny command is run, it creates another unit to put into the vehicle, there are now 2. The invicibility is applied to the unit in the vehicle, but not the one outside it, the invisibility is applied to neither. I am VERY confused as to why this is occuring.
Note: All of this code is happening within a if (isServer) then{ block. The server is being ran through TADST, tested with loopback on and off
that's something I do not regret pinning
ChatGPT is like German TV "Reportagen"
Sounds amazing and informative and you'll think you learned alot, IF you know nothing about what they're talking about.
If you do know, you'll have considerably less hair afterwards after ripping it all out in rage of the blatant bullshit they are spreading
I feel like that when i see my country in an movies, series, cartoons and games 😐
not wrong. it is fairly slanted...
I can't blame "Reportagen" since i did like this on most of my School presentations.
Coleages: Wow! Professor: Hmmm!
yes why not?
Note that hideObject is local-effect. On a DS you'd want to use hideObjectGlobal or remoteExec the thing everywhere.
It isnt working in mp for me, I get the unit with the crew command, and then do hideobjectglobal and it does nothing.
All of this code is happening within a if (isServer) then{
where do you run it?
Its being run from the server
I’m looking for scripting commands to make AI units run inside buildings. In particular the Sogpf crater “buildings”. Any pointers?
I mean where as in which file, etc?
oh its being run from a eventhandler which is inside an sqf which is set to run postinit
are you running hideObjectGlobal from the server? if so maybe it's bugged. use hideObject locally
can you show me the script?
yup one sec
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
reading it now makes me wonder if the server check should be inside the function....
L52 is an attempt to correct an issue of the unit not just moving and being duplicated btw
this is being run everywhere not the server 😑
because of this?
They need to be, but the code shouldnt run everywhere
thanks for the help
its been driving me crazy and all it was is a silly locality issue
well yeah that's what I meant. tho in the case of other EHs they only execute where the object is local even if you added them everywhere. I guess this one is an exception 
ah I see ok thanks, if putting a server check in them doesnt work then ill just set them to remoteexec the function on the server
they might be executing locally
they do
they only execute where the object is local
I have a question... Whats the difference in the AI skill set between "aimingAccuracy"
and "aimingShake"https://community.bistudio.com/wiki/skill. Can someone explain to me the difference?
how can I quickly get an array of multiple markers with the same prefix in their names? I remember a script that was searching for all marker names that had travel in their names but I can't find any info on how was it achieved.
I'd rather have this instead of manually writing down all the marker names, even if it would be a heavy piece of code - I'm debugging my setDriveOnPath stuff and the amount of markers changes frequently.
allMapMarkers select {_x select [0, 123] == "blablabla"}
hopefully a very quick question. Portable Helipad Lights, is there away to force their on/off state like you can with other lights.
this switchLight on;
this switchLight off;
this switchLight auto;
you can do it with portable lights too. you just wrote it wrong
oh, I took the syntax from the biki
https://community.bistudio.com/wiki/switchLight
clearly I am not understanding the syntax. I am using the code in the objects init field
What kind of condition / script should I use if I want a trigger to activate when a player(s) walk on a flare mine in a mine field, created with the minefield module. I assume this is correct channel because I think it needs bit of scripting 😅
I started thinking, could something like isKindOf -> Mine -> Killed be possible?
I need some help getting this mod's menu to actually work the way I want it. So far I've already got it to launch on any mission startup.
It adds a radio support menu for "Vehicle Tuning Module" but when I select it-
it just adds an add action to "Tune Vehicle". Selecting that opens the actual menu I want it to open.
I want it so that when the radio support option is selected, it just goes straight to opening the actual menu.
I have no clue how to read sqf or all this coding but it's a pain in the ass to figure it all out just to fix this issue.
Also when I keep hitting "Vehicle Tuning" radio support, it adds the same action to the action menu and it accumulates on each use. unless I have " removeAfterExpressionCall = 1; // 1 to remove the item after calling" on 1 instead of 0 so I can circumvent this...
GOMALA already does everything the way I want it- and I tried to reference the code in it but I still can't get it to work properly
The radio menu calls VTA_fnc_vehicleTuning.sqf which runs the addAction. You'd just need to change a couple of lines at the start and end of that.
mmmm could you help me find what lines to change at start and end. my attempts just end up breaking the mod
Replace lines 12-14 with private _activator = _object;
Remove line 188
you'll lose some conditions but it should do something.
Alright will give it a try
throws these errors and stops mod from functioning hm
You removed the wrong line.
throws this error though
nvm deleting that fixes it- was a line of code i added to experiment
Thanks for your help again. Mod works awesome now and jumps to menu. 
for some reason I couldn't get this to work but allMapMarkers select { _x find "path" >= 0} worked, now I have to figure out convertig this to an array of positions
should normally be something like _x find "path" == 0 to avoid false positives.
I’m looking for scripting commands to
Projectile Exploded event handler
You should've written _x select [0, 4] for it to work. But the find one is better and faster
As for converting it, use apply
allMapMarkers select {} apply {getMarkerPos _x}
Aight, how should it be utilized if I want it to trigger a trigger 😅
You don't need to use triggers when you use event handlers
I'd need it to init a spawn module, is that possible without a trigger? Because without a trigger the module inits at mission start
Dunno
You can create the module using scripts tho
True
Wait a sec.. I think Rimmys OP tutorial had a script for spawning a search squad.. Lemme check.
Well you can also use a global var instead
Or a var on the trigger
The condition would be:
thisTrigger getVariable ["triggered", false]
Yes
Aiight
I'm not really sure how to start on it
_projectile addEventHandler ["Explode", {
searchParty setVariable ["triggered", true];
}];
Got a error about undefined variable, not sure what variable to run on that
What is projectile?
(I'm a smooth brain with scripting)
Also you should set the var to true
Yeah I noticed that
Uh
I'm not sure what variable to use because I want it to be triggered by a RHS flare mine
And there is about a 150 of those mines
Hello!
I want to draw on the main map upon a script call, but that call can happen consecutive times in parallel to each other, and I don't want the previous "draws" to dissapear.
So I'm trying to create some kind of random-generated seed with each script call, so I can draw with the information from those seeds and not overwrite the previous ones.
The problem is, I cannot wrap my head around on how to pass the seed information to the "onDraw" EH without using global variables (which would defeat the purpose of the seed).
I'm using #define but to no avail, since I may not fully understand it's complete purpose and mechanic.
In the image below I try to pass the seed information to the #define PING_POS with a local variable (since I have to use this variable again in the script). That doesn't give PING_POS the content of the variable, but the string "_seed".
Can someone help?
Is there any way to assign slots in mp lobby via script? 🤔
There is, much like server to server connection by KK. You need to simulate clicks etc
ah, ty - will look at kks tutorial once i have time
toggleable radio triggers are possible, no? I mean having two triggers activated by Radio Alpha for example and they just disable each other. I'm trying to add an option for player to enable or disable playing certain music during a mission. What works now are two triggers for Radio Alpha and Radio Bravo that change a variable rng_music to true or false and just hide eachother with setRadioMsg "NULL"
what I want to achieve is that once player enables Radio Alpha trigger #1 setting rng_music to false, the other Radio Alpha trigger #2 is available which would set rng_music to true
I tried repeatable and non-repeatable triggers and can't figure out how to have them both available because every time one of them does not want to activate.
Fun with Arma networking. Run this on your client:
"netTestVar" addPublicVariableEventHandler {
systemChat format ["EH: %1", _this#1];
};
And this on the server, assuming client is owner ID 4:
netTestVar = 1; publicVariable "netTestVar";
{ systemChat format ["RE1: %1", netTestVar] } remoteExecCall ["call", 4];
netTestVar = 2; publicVariable "netTestVar";
{ systemChat format ["RE2: %1", netTestVar] } remoteExecCall ["call", 4];
netTestVar = 3; publicVariable "netTestVar";
{ systemChat format ["RE3: %1", netTestVar] } remoteExecCall ["call", 4];
Results:
EH: 1
EH: 2
EH: 3
RE1: 3
RE2: 3
RE3: 3
Now I'm just hoping that there's some order guarantee regardless of packet loss...
It does make sense, since remoteExecCall is running unscheduled, meaning netTestVar is already set to 3 (since it's secheduled) before it can print it in the chat.
However addPublicVariableEventHandler is being called the moment netTestVar changes, so it will print the correct numbers
Everything there is unscheduled. It's not clear whether the publicVariables & remoteExecCalls get reordered on the sending or receiving end.
I did wonder if there's a send priority, like publicVariable always gets sent before remoteExecCall, but it might just be receiving-end mechanics.
Update:
So I dropped Draw EH and chose Markers instead, since I don't really need the marker to move on the map. The seed concept works in this case and I now have parallel created markers as originally intended.
If I execute a function on a client will the function communicate with the server? If not is there any way I can make the function send data back to the server?
I’m planning a saving system and I want it to get data from clients and then save it to the server using the server’s profileNamespace
// on server
[] remoteExec ["TAG_fnc_SendDataToServer"];
``````sqf
// client's function
// ...
["my data"] remoteExec ["TAG_fnc_SaveClientData", 2]; // 2 = server
that could be a structure, maybe not the ideal one
the question being "what does the server need from the client"
If you use CBA:
// on client
["Your_Custom_Event", ["data you want to send"]] call CBA_fnc_serverEvent;
// on server
["You_Custom_Event", {
params ["_data"];
// your code which handles the data
}] call CBA_fnc_addEventHandler;
Does the same as what Lou posted, just (IMHO) nicer and easier to write
the server needs client variables such as health, position etc... so it can save it to a profileNamespace and load it from the server
health & pos should be findable server-side
Note that health and position are globally accessible anyway
itll also need some custom variables that are set on the clients such as hunger and thirst
How often are those updated?
only before the server restarts or closes
Sometimes it's easier just to set those globally as well if it's low-traffic.
(speaking about hunger and thirst here)
Consider if a player disconnects.
that too
Once they disconnected, you're not gonna get a remoteExec ping-pong out of them.
You can't pause unless it's SP.
I was suggesting that you just do something like player setVariable ["MyTag_thirst", _val, true];
i mean when they press esc
It doesn't seem like it's a variable that needs super-frequent updates.
^ Not correct.
nil == ""
nil isEqualTo ""
Both return nil (without error message).
can that be accessed without the need of remoteExec?
Yes, it's just a variable set on the player object globally.
just don't update the thing every frame if you do that :P
yeah ofc
There is no SQF command that returns anything other than NIL, if one of the arguments is NIL.
(Including isNil, because you actually use isNil SRING or isNil CODE)
is it a bug that allMapMarkers select { _x find "path" >= 0} will not see markers that are in a custom layer?
copying these markers from Markers layer to a custom one will give an empty array, when I reverted the change all markers are now in wrong order and I have to redo the path again :/
You should use isEqualTo if:
- you want to compare types that
==doesn't accept. (BOOL, ARRAY, some other I think) - you want to compare variables with potentially different types (which should be avoided imo)
- you want to compare STRINGs case sensetive
use an array
right now you're adding an EH for each icon...oof
for best performance use one EH for many things, not one EH for each thing
if (isNil "map_markers") then {map_markers = []};
map_markers pushBack ASLtoAGL getPosWorld _pingObj;
private _map = findDisplay 12 displayCtrl 51;
if (_map getVariable ["my_old_EH", -1] >= 0) exitWith {};
private _EH = _map ctrlAddEventHandler ["Draw", {
params ["_map"];
{
_map drawIcon ["...", [..], _x, ...];
} forEach map_markers;
}];
_map setVariable ["my_old_EH", _EH];
One use is:
_array isEqualTo [] being slightly faster than count _array == 0
Or when
https://community.bistudio.com/wiki/currentMuzzle
https://community.bistudio.com/wiki/currentWeaponMode
decide to return 0 instead of a STRING
Hello, I have a question. I want to make a DLL for arma 3 to interact with Rcon from the game itself. To check, I used "KillZone Kid's callExtension" in which everything worked, but as soon as I tried to use it in the game, my connection to the BattlEye server stopped working. Can someone tell me what the problem is?
If the extension is whitelisted by BattlEye, it will be allowed to load. If it is not, it just will be blocked causing any callExtension attempt to fail.
https://community.bistudio.com/wiki/Extensions#Can_I_join_BattlEye_protected_servers_with_my_extension.3F
it is stored on the server and called remotely, the extension is called, but the connection to the Rcon server does not work
Doesn't apply to server
And also doesn't explain why BattlEye would fail
Maybe you're sending a bad command that crashes or freezes the BattlEye code that handles the rcon
The extension does not reach the execution of the command. It cannot connect to the Rcon server.
it dont works on this code fragment ```cs
BattlEyeClient client = new BattlEyeClient(credentials);
client.Connect();
if (!client.Connected)
return "Not Connected";
Also isEqualTo is a fuck ugly name for a command like this. Why not ===?
did you create BattlEyeClient or does it come from a library? just wondering
I took BEClient from ```cs
using BattleNET;
I also tried BytexDigital RconClient, but it's also don't working
does it throw any exceptions?
it freeze for 5-10 seconds (probably trying to connect). and works return on "not connected"
Hey folks! I've been looking around the BI command wiki and I'm pretty sure this won't be possible to do, but figured I'd ask y'all anyways.
I'm a bit unsatisfied with some of the Electronic Warfare mods available. They're great! But, not necessarily realistic. Generally, how they work is that if you get a UAV within its range, UAV is destroyed and that's it.
I want something a bit more fine-grained.... one of the effects I want, for example, is severely degrading the quality of the feed, as thats what most videos show on both sides in the current Russian-Ukrainian war.
Can y'all think of any way to accomplish that? I know how to disable NV/Thermals from UAV, for example, but not how to degrade the feed itself. Does the engine allow for that sort of thing?
you can show a static overlay over the UAV feed
Oh! How would I do that? I've never messed with overlays
(general pointers, happy to do my own work)
depends where you want to show it. if it's over an ingame screen (e.g in game TV) it's a bit more difficult (I think you might need a custom TV?) but if you want to show it while controlling the UAV you can create a RscTitle with only an image in it. then you just cycle the image to another one to simulate the static effect.
Awesome, thanks Leopard. I'll look into this! Brand-new territory for me.
Anyone know if addForce is actually a force (for one frame or what?) or a more sensible impulse?
impulse afaik 
Because BIS.
Anyone know how to script the VLS launcher to act as fire support or hit a specific area?
@tough abyss because that would make sense, i'm sure they have hidden operators
tinfoil hat mode on
I am currently attempting to update the PIR ace medical compat as it was broken with the latest update of PIR
I believe it added a new shrapnel system because the error message shows up whenever a player or ai is damaged by an explosion
this appears to be what's wrong:
||_count = round ((18 + (random 18)) * PiR_frags_on);||
but i do not know what is wrong and why it works with PIR but not the compat
or may more likely be:
||if ((!isServer) or (((agltoasl _this) select 2) < 0) or (PiR_frags_on == 0)) exitWith {};
params ["_position","_frag", "_frag_correct", "_count", "_speed", "_xv", "_yv", "_zv", "_angleXY", "_angleZ"];
_count = round ((18 + (random 18)) * PiR_frags_on);
_position = _this;||
yes, but I'm in bed now so I'll help you tomorrow
The error's saying that PiR_frags_on is undefined. You would need to figure out why that's the case when it wasn't before.
Sounds good just ping me whenever
so the frag system was added to PIR and the compat was not updated
so this is the code in question that god added to PIR is
@lone glade If there were any hidden operators, I would expect the guys that derap everything BIS makes to report it somewhere. :)
If there's a very simple/obvious way to do this, I apologize in advance.
Is there a way to quickly execute and get the output from getPosASL or getPosATL for an object while still inside the Eden editor? I.e. without loading the mission and using a script mid-mission.
top menu - tools - debug console
Ty, i appreciate it
https://community.bistudio.com/wiki/get3DENSelected to get currently selected object
right-click → log → position to clipboard iirc
Oh that's even easier. You're a legend
better late than never: thanks a bunch for that I'll check it out 😄
@quiet burrow
findDisplay 46 displayAddEventHandler ["KeyDown",
{
params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"];
if (_key == 46)
then
{driver vehicle player forceWeaponFire ["CMFlareLauncher", "AIBurst"];
}
}];
Hi guys question. Does anybody know any fnc or command or something to make a pull force. Basicly make entity get pulled towards a certain position ?
addForce adds a force in a direction for physx objects
Oh i see addForce if the force is positive is a push and if the force is negative its a pull ?
so if i understand this corretly
params of AddForce are:
- Object on to witch apply Force.
- Force with is vector if its positive its a push and if negative its a pull
- Position relative to object Position.
I've never tried a negative force, but it could work. If not then just apply a positive force behind the object so it gets pushed towards the point you want it to
There's no such thing as negative force
Yea but isnt the force in addForce* vector so just negative vector ?
The force vector is in world space, it's like velocity. Negative numbers just mean the direction is towards world [0,0,0] (assuming your position is positive and not outside the map)
The force vector controls the direction of the impulse in world space, and its magnitude. The position parameter is the position on the object's model to which the force is applied. For example, if you apply [0,-1000,0] force to the centre of an object, it will move south a bit. If you apply [5000,0,0] force to the top of an object, it will move east with the top leading, possibly causing it to tumble or roll depending on mass and force.
Zeus can delete anything it can select, in my experience.
So no.
Is this client/server?
So to create a Pull force i would need a vector that constantly point towards the position that i want. And to and inverted Vector Magnitude would be strenght of the force. Meaning if the distance is bigger from object to Position that i have the force is lower ?
I mean the setup in general.
sounds like pretty bad network overload.
No, it's a black box.
Often the start is the worst.
Lots of data to distribute to clients.
shrugs
Default basic.cfg bandwidth settings are very low these days so if you have more than a handful of players then you might need to edit that.
But then if you're spamming public vars then that's gonna cost too.
Usually clients don't send much data. If they are then you're probably doing it wrong.
client->client has to go through the server anyway.
correct.
Use vectorFromTo and vectorMultiply
Word of warning with addForce: PhysX apparently sucks so much that an addForce in a long frame has a massively different effect to addForce in a short frame. And Arma can have some very long frames.
adding any network is bad.
now what is the least evil 🙂
Yeah, like we remoteExec setMass because it otherwise transfers too slowly and people kill each other with crates.
The remoteExec is preferable to the accidental death.
But ideally you remoteExec minimally.
publicVariable is still network.
Probably similar to a remoteExec with no parameters.
Depends on what's in it, I would think. If the var has a short name and a simple value it might be better than a long command with big arguments.
It's still a name and some arguments. Unlikely to be better.
remoteExec was specifically made to efficiently remotely execute stuff
why would you try to find a non-remoteExec way to do the exact same
remotely executing things is "bad"
but public variable with EH is the same thing, its also remotely executing things, just a different way of doing it
As an example of improvements, sometimes you can replace stuff like _object setVariable ["wibble", _val, true] with setVariable that specifically targets the server, if no other clients need to see it.
but often it's high-level design stuff to keep data local.
apparently BIS_fnc_convertUnits is omitting the measurement unit for me, not sure why
edit: the localization keys it uses such as STR_HSIM_unitFull_m aren't defined
network trafficking = highway usage
storing in RAM = storing in the trunk
if you load the truck but don't use the highway, there are no traffic jam risks
If the final parameter is false or missing then it causes no network transfer.
It's only setting that variable locally.
setVariable true -> setVariable false, less traffic
does anyone know how to make jet pilot ai only start moving in its airstrip upon trigger?
if not, i could just set a waypoint trigger to make the pilot go into the jet & begin their air campaign
disableAI probably works.
for some reason doesnt
honestly i think ill just do the pilot going into jet
Arma :D
if you can store it while broadcasting it you can store it without broadcasting it
the truck's suspensions will break the same whether it drives or not
I guess disableSimulation on the jet would work, but may have other unwanted consequences.
So sitting the pilot next to the plane might work out better.
set the variable to nil and it's not there anymore. Kinda.
At a low level, adding a bunch of vars to an object and then nilling them may not reduce the hashmap size. Dunno.
Similarly, adding one var to an object may be proportionally much more expensive than adding additional vars, but CBA adds the first one anyway.
In SQF, data storage capacity is generally the least of your concerns.
Expensive caching strategies that you'd never do in a fast language often make sense.
@lone glade https://community.bistudio.com/wiki/supportInfo
your "hidden operators" can be discovered
i'm sure there's something, SOMETHING HIDDEN tinfoil intensifies
Hello,
What is correct/best or is there an extension to Visual Studio Code to show Arma cfg files ?
I have extensions to sqf but i want a working extension to config.cpp etc
ye ... also that would be discoverable because you are having arma here
you would just have to analyze all those fancy existing pbos
even thought, the supportInfo has no hidden commands which is why some debug commands are also known ...
CPP is just C++ file.
except it's not 🤷♂️ Close, but not.
wrap with isNil { /* code */ };
thanks a bunch, couldn't find that in the docs
i could
Im trying to make a task complete when I pick up an object but not sure how to do it
Got all the tasks and triggers set up just need a script
Basically the task is to pick up a remote designator so it gets packed and put on the player as a backpack. idc if it completes from just being packed or put on the player, either one is fine
backpack player == "backpackClassname"
Okay but when I get the classname how can I make the trigger register that ive picked it up?
Classname is "B_Static_Designator_01_weapon_F"
That is how. It is a check to see whether the player's backpack is of the correct type. When that's used as a trigger condition, the trigger will repeatedly check it at whatever frequency you set.
Quick question: why does eyePos give me a wrong pos for where player is "looking" from?
I was trying to Draw3D a line from where players are to where they're aiming at, by using weaponDirection, but the line shows up several meters above the player unit.
(I know I can use PositionCameraToWorld; I'm just trying to figure out what's up with eyePos)
Is there a mission failed version of BIS_fnc_endmission?
Or would this work
"fail1" call BIS_fnc_endmission;
Don't you just set the second parameter to false?
Syntax: [endName, isVictory, fadeType, playMusic, cancelTasks] call BIS_fnc_endMission
So, just put false for isVictory
Why do you need the first part tho
I ususally just do this for mission completed "end1" call BIS_fnc_endmission
And it does all the vanilla mission end stuff
You can configure endings that say whatever you want and call them.
https://community.bistudio.com/wiki/Description.ext#CfgDebriefing
I also recommend reading this to see what those other parameters do. https://community.bistudio.com/wiki/BIS_fnc_endMission
I got it to end on failure with this
["epicFail", false, 2] call BIS_fnc_Missionend
Screen fades to black but it doesnt play the fail music
Says default for music is set to true so it should play without any code added right?
The automatic music may only play if the standard closing effect is used, rather than the black fade
What is the number for the vanilla fail close effect?
eyePos returns a position in ASL, drawLine3D requires a position in AGL. The vertical offset is the difference between sea level and ground level.
Oh I just need to set that to true instead of a number
Okay I got the vanilla mission fail working
["epicfail", false, true, true, true] call BIS_fnc_endmission
That will also cancel all tasks
Is there a way to get the suppresion value of an AI unit?
I want to quantify the effects of suppresion on AI
OH. I didn't even think about that as an option. Thanks Nikko.
Yes, I just didn't pay attention to the wiki to see if it was a AGL/ASL issue
I cant understand why I cant get air vehicles to listen to hold waypoints they always just take off and ignore them
Seems to be fixed wing only
That's just how the fixed wing AI is
If you absolutely must stop them taking off, remove the fuel
Well I want them to take off but not until I hit the trigger
you can.......you can give the fuel back later
Can you remove the remote designators batteries?
anyone has a way to disable voice chat for side chat?
https://community.bistudio.com/wiki/Description.ext#disableChannels
There's also an option for this somewhere in the server config. I'm not sure which takes priority.
{if (side_x == east) then{ _x enablegunlight "forceOn";};} foreach (allUnits);
What am I doing wrong here
unit enablegunlight "forceOn";
I dont see whats wrong with this either...
The games telling me its supposed to be like this
unit ;enablegunlight ;"forceon"; wtf??
Shits gotta be bugged
Your code (with highlighting and a bit of markup):
{
if (side_x == east) then {
_x enablegunlight "forceOn";
};
} foreach (allUnits);
I already see 2 issues:
side_xorside _x?enableGunLight**s** "ForceOn"
Is "east" opfor only? How do I get this to work for indy?
Check the possible values for side https://community.bistudio.com/wiki/Side
Nice got all gun lights on with 1 execution, thanks
Hi yall, i'm having issues with some debug type code to export maps as an SVG
diag_exportTerrainSVG ["C:\Users\Gebruiker\Desktop\Song_Binh_tan.svg", true, true, true, true, true, false];
it's giving me an error message for a missing ; however i can't find where that would be missing
(if it helps i am in the Dev branch of arma for this)
does anyone have any ideas what's wrong with this?
Did you also start the game through arma3diag_x64.exe instead of the normal arma3_x64.exe (or launcher=?
Because I don't see any typos in that code
i started arma just through the launcher, i'll try that diag exe
is that in the regular arma folder?
that was indeed it, thanks!
How can I hide a unit on the map? I have a VLS turret that simulates a cruise missile strike but I dont want it to be visible cause its just off in the desert somewhere
figure it out?
Ya sort of got it working with a remote designator
you can also use https://community.bistudio.com/wiki/reportRemoteTarget
Ya that works without a laser right? Think ive seen that
yes
My mission kind of revolves around a laser marking the target but that could come in handy for future missions
supportInfo didn't help with the local / private keyword.
And I'm pretty sure == isn't listed in supportInfo either
How can I check Arsenal is used by player?
Arsenal scripted EHs
https://community.bistudio.com/wiki/Arma_3:_Scripted_Event_Handlers#BIS_fnc_arsenal
but you cannot check on another machine
Myb something like this:
[missionNamespace, "arsenalOpened", {
player setVariable ["ArsenalOpend",true,true];
}] remoteExecCall ["BIS_fnc_addScriptedEventHandler",[0,-2] select isDedicated];
``` And now you have Variable on Player ArsenalOpend where you can check stuff...
"ArsenalOpened" +
(...) remoteExecCall [
"BIS_fnc_addScriptedEventHandler",
[0,-2] select isDedicated,
true // for JIP
];
```+ closed EH ofc
but yes you need to use the "local machine" to get that info (a nice, light solution)
I want to make it so that a player is "captured" instead of killed, so right before death, they are teleported, healed, and forced into a captive state. Q: How can I run these methods just before death? I know about the killed event handler in CBA, but if I'm not mistaken that happens after the death has already happened
Arsenal has an IDD so you don't need any EHs
you can just check for the display
you cannot, you can only define a threshold…
or toy around with a HandleDamage and apply said damages to another unit and see if it dies from damages, which is not great
I don't recall the death thresholds, I believe if the "" damage > 0.95 or if spines damage == 1, you will have to do experiments
unit setSkill 1; does not appear to work on already created units midgame? Any idea what im doing wrong?
is unit defined?
also unit needs to be local
There's no depth of field postprocess effect, right? 
nope
you can have this effect with cameras only afaik
rip, there goes my idea for depth of field with nv
Is it possible to make the civilian side a combatant?
Using setFriend to make BLUFOR, OPFOR, and INDFOR hostile towards the civilian faction, and vice versa, just leads to them aiming at civilians, or walking towards them menacingly without ever actually attacking. Meanwhile, the civvies themselves are more than happy to shoot the shit out of the RGB factions.
So clearly something's causing the RGB sides to still consider civilians as at the very least neutral. I'd set the civvies to renegade, but that'd cause in-fighting amongst them, which isn't ideal to say the least.
I'm running this on a random object's init:
civilian setFriend [east, 0];
civilian setFriend [resistance, 0];
west setFriend [civilian, 0];
east setFriend [civilian, 0];
resistance setFriend [civilian, 0];```
Am I, uhh, missing something?
Sad!
Oh god I just thought of a horrible solution, putting a script on each would-be-civilian group that changes its side based on the two nearest sides, checking every X seconds
It'd work at least I guess lmao
Wouldn't marking them as renegades work if no "civ"-to-"civ" teamplay is intended?
It would yeah, but said teamplay is intended in my case sadly
Yeah I gave it quite a bit of energy trying to find a method -- even setting units on LOGIC side but no avail
where's the kill count stored?
maybe a missionNamespace variable?
probably easier to check in vanilla xD
you mean this: https://community.bistudio.com/wiki/getPlayerScores ?
no, its like a thing for all the units you've killed. "3x Rifleman, 4x Sniper, 1x Offroad"
why do i get a 'missing ;' error on the line with the forEach?
for "_i" from 0 to count _leaderArray do { { _unitArray append _x; } forEach units _leaderArray[_i]; diag_log "foo"; };
that has infantry kills
just not so detailed
yea, but I'm looking for the detailed one
you might have to keep your own count then via entityKilled or other EH.
well, when you leave a MP session to the lobby, it tells you
ye. But the sometimes my game skips the screen b/c the server shutsdown
@tidal aurora probably this: ```sqf
_leaderArray[_i];
yup didnt realize that, changed to forEach units (_leaderArray select _i); thanks
Is there a way to keep ai from trying to enter the proper formation of their squad
at least until they take contact
There is a lot of ambiguity in the request :P
im assuming its just something they want to throw in unit init so they stay in building positions
Yeah building positions thing
what a guess
yeah all you need is doStop _unit;
_unit disableAI "PATH" is the alternative one for that.
stops the AI from moving completely though doesnt it
Will they resume maneuvering if they take contact in that state?
Nah, path allows turning.
Gracias guys, thanks
oh, dostop prevents turning, right
shrugs
I didn't try using doStop in a firefight.
And it's not like anything is documented properly.
:p
Perfect! It works like a charm!
epic
just bear in mind if its in unit init it'll run every time someone joins the server as its global
would recommend you use
if (isServer) then {doStop this};
or something similar if its an issue to you
wait, doStop and stop are completely different...
yes 🙂
Now, another unrelated question. Can the death message setting be disabled via script?
wdym? player death messages? thats difficulty options
Are those unable to be configured after start time?
Ah, got it
ofc if you're making a scenario you can make it end if the difficulty options arent correct
but thats not really something i'd recommend
Is there any reason using getUnitLoadout and setUnitLoadout might not work as expected?
depends.
I had many problems with it.
#arma3_feedback_tracker message
I just found i can make the server save some non-critical info on profileNamespace instead of dealing with mySQL, wich is more dificult to do.
Do you have a quick and dirty work around for that issue?
Nope, i stoped trying when i had these issues and used the functions that came with the mod by default ^^
https://gyazo.com/ff8d314e258cacfeb3dd97920110c35c
Got it, thanks for the info!
is there any obvious reason why this script I wrote doesnt move (setPosATL) the vehicle in a dedicated server, but it works fine locally?
Halo Menu.sqf (called before Halo Jump.sqf)
https://pastebin.com/EVX4W2AH (line 79 actually assigns the object)
My halo jump script doesnt exit on the vehicle being null on line 32 so I assume it finds it?
Halo Jump.sqf
https://pastebin.com/bRAewES1
Lune 29, if (_vehicleBool isEqualTo 1) exitWith {. And i don't see it getting set to anything other than false?
grabbed from line 13, this is set elsewhere to true oncheckbox changed event with a ui. I know I get past that line as the player does get teleported
private _vehicleBool = uiNamespace getVariable["TRA_haloVehicleBool", false];
on line 59
true is not 1
right, I realised this when using onCheckChanged which returns 0 or 1, (not boolean). I didnt mean the value is switched to true, the value is switched to 1.
I know the condition returns true
Just from the fact that player gets teleported? It can be from the line 68 onwards that's outside the vehicle block 
Does the chute for the vehicle get created? Does its inventory change? Can you add some other noticeable effects specifically to that block to check (like systemChat-ting the vehicle classname or something)?
Are there any commands available to predict where the bomb or rocket will fall? Like the assistance computer in planes. Are there public commands available?
afaik the “ccip” is not available in script
Hello, I was thinking about mod that disables stamina (unlimited sprinting) but in the same time limits max speed of sprint depending on overweight - the more weight, the slower sprint up to no sprint at all.
I've found some stuff about disabling sprint but that's only part of the case, anyone can hint me with some clues? (Or make such a mod for arma? :P)
Hmm, so movement speed depends entirely on animation speed? 🤔 Interesting, but thanks for sure R3vo
Is there a way to mimic the remote control module via action? everything i've tried so far ends up not working or requires the player to have zeus which defeats the purpose. heres what i've got so far
this addAction ["Control a Strider", {
params ["_target", "_caller"];
private _strider = group player createUnit ["WBK_Strider_HL2", getPosATL strider_pad1, [], 0, "NONE"];
[_strider] call bis_fnc_moduleRemoteControl;
_strider switchCamera "Internal";
_strider addAction ["Exit the hunter", {
params ["_target", "_strider"];
player switchCamera "Internal";
objNull remoteControl _target;
deleteVehicle _strider;
}];
}];
How do I open the script to control a character?
You should be able to use remoteControl instead of bis_fnc_moduleRemoteControl
“open the script” “control a character” what do these mean
I am trying to make shit guy run around
Wrong game
I've tried those but due to webknight's custom AI and the way it reads if its controlled or not seems to not wanna work
If its any help, this is in webknight's code
_unit = missionNamespace getVariable["bis_fnc_moduleRemoteControl_unit", player];
Currently it just throws an error about _activated = _this select 2; and it being zero divisor
But does it work without any mods or custom scripts?
Because in that case it's the problem with that specific script 😉
Yeah, it just wont activate the custom control stuff, can move around and all
with my script? or the mods?
if it works without mods, the problem is in the mods
Interesting cause some of the zeus enhanced functions for remote control, when i have zeus, work perfectly
thanks for the help anyway, atleast makes me not keep trying a dead end
Yeah, but if it checks for zeus controlled units it obviously works when you remote control as a zeus 😉
Which in this case you don't have (and want?), since you're not a zeus.
Ahhhh i see, so is there a way to check for any remote controlled units?
_who = _unit getVariable ["BIS_fnc_moduleRemoteControl_owner", objNull];
if (!isNull _who) then
{
// _unit is controlled by _who
// therefor remote controller as a Zeus
};
So that will return all remote controlled units, not just ones controlled by zeuses?
no, it will check if the current unit (which you're checking) is currently being controller by a zeus
I'm struggling to figure out how I can take a weapon from a unitloadout _loadout select 0 and add it to a container _this addItemCargo [ <item>, <count>];
I'm guessing there is another method (not addItemCargo) that allows adding an item from an array instead of by type
getUnitLoadout you mean?
Yeah, I use getUnitLoadout select 0 to get a players weapon, I want to then add it to a container box I have nearby
Thank you @warm hedge 🍻
I'm trying to collect items from the ground and put them into a crate. Q: Are items on the ground found via nearbyEntities? OR is there a ground Cargo I need to access?
@granite haven The alternative syntax for createUnit (type createUnit [position, group, init, skill, rank], referred to as SYNTAX1 in the example on the CfgDisabledCommands page) has the init parameter which can be used to run arbitrary code when the unit is created.
The other syntax (group createUnit [type, position, markers, placement, special], referred to as SYNTAX2 in the CfgDisabledCommands example) does not have this parameter.
I don't know, I've never looked into CfgDisabledCommands. But now that I've seen that page, I have to say that it is a little confusing and could use some polishing.
Solved:
nearbyObjectsreturns object_weapon = getWeaponCargo <object>returns array[[<item_class_str>],[<count>]]
What's the usecase?
you know how some animations let you rotate your character around while playing? don't want that
Probably you can use attachTo to a Logic object
I just found https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onMouseMoving. might try that
I don't think that would interrupt it
didn't think of this, let me try it
Keep it mind that you would need to have some workaround to work in MP environment
yup yup
If that's your answer, I don't need to elaborate I guess. gl 👍
I always struggle with understanding where to execute a script. I am using call CBA_fnc_addClassEventHandler to do stuff when a player is killed, if I'm zeus and I want to add this handler for all players, how should I be calling it, and in what exec scope?
What's the intention? To trigger for all players when any player is killed, or just trigger locally when the local player is killed?
What my script does is when a player dies, it collects their stuff and puts it in a crate nearby
So, just for a single player when he dies
addClassEventHandler doesn't seem to be fully documented.
Easy way to do what you want is just add an EntityKilled missionEventHandler on the server and check whether the entity is a player. Loadout-shifting shouldn't have locality requirements.
so it works well for not moving the character around, but the game still stores mouse input behind the scenes, so say I move my mouse all over the place while attached, when i detach, it throws my character view around.
just confirmed, it does run. The system chat "_vehicle bool was 1" runs as expected.
if (_vehicleBool isEqualTo 1) exitWith {
systemChat "_vehicleBool was 1";
_veh = _vehicle;
if (_veh isEqualTo objNull || _veh isEqualTo "") exitWith {
systemChat "No Vehicle Selected...";
};
_veh setPosATL _position;
_veh addBackpackCargoGlobal ["B_Parachute", count (crew _veh select {isPlayer _x})];
_chute = createVehicle ["B_Parachute_02_F", [0, 0, 1000], [], 0, "NONE"];
_chute allowDamage false;
_chute enableSimulation false;
// Make chute wait until certain altitude to deploy (not very smooth, insta stops vehicle mid air)
[_veh, _chute] spawn {
params["_veh", "_chute"];
while {((getPosATL _veh) select 2) >= 350} do {
sleep 1;
};
_vehPos = getPosATL _veh;
_chute setPosATL _vehPos;
_chute allowDamage true;
_chute enableSimulation true;
_veh attachTo [_chute, [0, 0, 2]];
};
{
// Current result is saved in variable _x
_space = random 15;
_x setPosATL [(_position select 0) + _space, (_position select 1) + _space, _position select 2];
_x setVariable ['TRA_lastHalo', diag_tickTime];
if ((backpack _x) isNotEqualTo "") then {
[_x] call bocr_main_fnc_actionOnChest;
};
_x addBackpack "B_Parachute";
} forEach _players;
};
I added a system chat to line 15 as well, systemChat str (typeOf _vehicle); it gives the expected vehicle class name
u:private ARRAY,STRING
u:local GROUP```
b:STRING == STRING
b:OBJECT == OBJECT
b:GROUP == GROUP
b:SIDE == SIDE
b:TEXT == TEXT
b:CONFIG == CONFIG
b:DISPLAY == DISPLAY
b:CONTROL == CONTROL
b:TEAM_MEMBER == TEAM_MEMBER
b:NetObject == NetObject
b:TASK == TASK
b:LOCATION == LOCATION```
they are ALL listed in there
however, the command is kinda broken
so to get all informations you have to execute it like so: supportInfo ""
hmm actually I was able to see the vehicle this time
it looks like a parachute does open on it, but it stays where it originally was?
That makes zero sense to me though, im doing _veh setPosATL _position. _veh certainly exists, that is how the parachute attaches to the correct vehicle. _position is certainly correct, the player gets teleported to it
is there something that can lock a vehicle in place?
Does the parachute stay where it is as well?
It looks like you're assuming that a parachute will fall at some speed without a driver unit in it.
it opens where the vehicle is, then goes away as the vehicle is still on the ground
I think it may actually be that the mission im running on, Invade & Annex does something to the vehicles (maybe simulation disabled or something? not sure).
I tried getting in and driving the vehicle closer to where the halo jump addAction was, and it worked fine. The vehicle teleported with me and parachute opened as expected
I dont see anything in the mission files disabling vehicle simulation, ill need to go search for whatever file spawns the vehicles
What's _position?
You have a general lack of private on your local vars, and given your generic var names that's extremely dangerous.
Like if you call one of your functions from another then you have no guarantees about what your local vars are afterwards.
that isnt the entire script, several of those variables are created above that section of code but your correct I do need to private some more of these vars
_position is a param provided earlier in the script
this is currently what I have
https://pastebin.com/HL4iSHjP
it really doesnt make sense to me. I have found the script that spawns vehicles, and followed it to all other functions is appears to pass the vehicles to for modification and nothing seems to disable simulation or anything of the sort. At one point the vehicle was locked, _veh lock 2 then unlocked _veh lock 0
even if simulation was disabled, I dont see why setPosATL wouldnt move the vehicle
oh wait
could it be a locality issue? the vehicle is on the server, hence why the setPosATL doesnt work as setPosATL is technically executed on the client?
and when the player gets in the vehicle its local to him or something, hence why it works after he drives it? still doesnt make total sense to me
Making a CO-OP PVP mission and I'm using the High Command function, but I think it's too easy-mode to have enemy markers on my map/HUD especially since it displays Player units uniquely. is there a way to turn enemy markers off? I've tried looking for mods that do this, but found none, also tested many stock-game difficulty options to no avail.
Any help/guidance would be appreciated.
when i tested it in pvp with my friends it effectivly gives you wall hacks is what i mean
Yeah, there's no stock option to turn it off. Script might be able to do it.
what i was hoping
Ok, easiest method is to run this as local:
setGroupIconsVisible [true, false]
That turns off all group icons on the HUD. You still get enemy icons on the map.
If you want to turn enemy icons off entirely, or still want friendly markers on the HUD, then you'd probably need to use setGroupIconParams on every group.
let me play around with it
on setGroupIconParams would i put that into a groups init
quick video showing what i mean
@granite sky i put setGroupIconsVisible [true, false] into init.sqf is that incorrect?
who's the unit local to? unit or server?
A unit created with createVehicle?
i cant get it to work
i did
_loopHandle = spawn "loop.sqf";
in init.sqf
and
setGroupIconsVisible [true, false];
in liip.sqf
loop*
it doesnt work but when i execute
setGroupIconsVisible [true, false];
``` using debug it works just fine
If the loop version doesn't work then you screwed up the loop. Try initPlayerLocal anyway though.
I'm pretty sure the left argument for spawn is not optional
Try _loopHandle = 0 spawn "loop.sqf";
(you can remove _loopHandle = if you don't actually use it - saving the handle is not required)
hm loop method doesnt seem to work
doesnt make any sense that it works just fine on debug
maybe if it had a repeating script in itself?
Spawn only works with code anyway. If you want to execute a file then it's execVM, but if you're running something small then you can just declare the code inline:
0 spawn {
// code goes here
};
Try initPlayerLocal though, runs later than init.sqf.
After module init, which might be important.
oh wait, that's not true for multiplayer :P
(init.sqf timing is completely different for SP vs MP)
doesnt seem to work
I don't have time to investigate it anyway. You're probably fighting against some stock high-command code on timings.
Maybe loop setting is fine.
i put
setGroupIconsVisible [true, false];
``` into initPlayerLocal.sqf btw
0 spawn {
while {true} do {
setGroupIconsVisible [true, false];
sleep 10;
};
};
i havnt tried the loop method nikko suggested
Try that in initPlayerLocal.
You know you need an actual loop, right. Just executing a file called loop.sqf doesn't do it :P
There should be no need to loop it.
Make sure the locality is correct. If in doubt use remoteExec on the target unit
Just keep i mind that teamswitch breaks it
or rather, you need to re-execute it after team switch
wont be doing any teamswitching
initPlayerLocal again:
addMissionEventHandler ["CommandModeChanged", {
setGroupIconsVisible [true, false];
}];
Don't. I was right about needing the left argument for spawn, but wrong about being able to spawn an SQF file. As John said, you would either execVM an SQF file, or spawn code.
The loop method would kinda work but you could still cheat by repeatedly toggling HC mode so that the icons pop up for a few seconds.
EH worked absolutely perfect. Exactly how i needed it to
So the issue was the if you exit HC view it resets the group icon visibility? If so I am going to add a comment to the command page.
Oh I see, the HC module actually sits on top of this stuff.
So you can set group icon visibility even if you're not in HC mode.
Once you understand that then it makes complete sense :P
The existence of the CommandModeChanged EH then becomes the curious part.
ive been testing it in single player and is working flawlessly
Should probably change to:
addMissionEventHandler ["CommandModeChanged", {
params ["_isHighCommand", "_isForced"];
if (_isHighCommand) then { setGroupIconsVisible [true, false] };
}];
whats the difference
Otherwise the group icons will be shown on the map even when you switch back from high command.
ah okay
i get an error
And what does it say?
copying it rn
(If you exactly copied the last posted code without reading it, it's because you need to replace the last }; with }]; - the event handler arguments array is not closed)
thats exactly what i did
i can deactivate a script by turning it in to a comment right
putting // infront of it
so i dont have to delete then repaste stuff
That is indeed what comments do
addMissionEventHandler ["CommandModeChanged", {
params ["_isHighCommand", "_isForced"];
if (_isHighCommand) then { setGroupIconsVisible [true, false] };
}];
doesnt seem to be any different than the previous script
i can see friendly and enemy group markers on the map same as before
no group markers on HUD is still working how i want it (no markers)
im putting this in initPlayerLocal.sqf btw
I want to do a feasibility check on something. Can you remove a players input, give their character an AI, and have it move for them?
A player and an AI can't both be the brain of a unit at the same time
You could possibly use selectPlayer to move the player into another body. If AI was enabled on their unit in the slotting screen, it should take over (if it wasn't, the unit might just die 🤷 ).
Alternatively/in combination, you can use switchCamera to let the player see through the eyes of an AI-controlled unit.
Hmm, Okay, thanks!
Can someone help me come up with a script? Been having troubles thinking of a good way to do it. Essentially I'm having a dog that spawns, I want the dog to either hold a waituntil script that deletes the unit when I leave the lobby or have an ondisconnect script do it, but I might be over thinking the entire process.
Solved
Does anyone know how I could carry two launchers at once because I really like to use static weapons but cannot because have to bring the tripod and gun separately
So either a mod or a simple script to let me carry two launchers
Is there a way to remove a specific magazine from a player's inventory? I have a CT_LISTNBOX display which shows every magazine in the player's inventory and the number of rounds in each mag. Selecting an entry and clicking a button will send the list box index to a function which will then remove that mag from inventory and add a number of other items equal to the number of rounds in that mag. The only part of this that I can't figure out is how to address the inventory to remove a specific mag or a mag that matches the description including number of rounds.
_index = _this select 0;
_magX = magazinesDetail player select _index;
player removeItem _magX;
yields [""45rnd RPK-74 7N6M(35/45)[id/cr:10000828/0]"",""45rnd RPK-74 7N6M(45/45)[id/cr:10000829/0]""] but those entries don't appear to be recognized by the removeItem command. I could dumb it down and filter to allow only full mags but I'd rather not.
Other workaround suggestions are welcome.
Have you tried Dual Arms from the Workshop?
Dual arms is specifically two primary weapons, haven't seen anything about double launchers
Firstly I'm pretty sure you want removeMagazine, not removeItem.
Secondly, there are not currently any relevant commands that can target specific magazines. They only accept classnames, not magazine IDs.
The only way I can think of is to use magazinesAmmo to see what mags there are (since that command provides a usable classname), then use removeMagazines to take away all mags of that type, then use addMagazine to give back all except the one you wanted to remove.
What's the default font for scroll wheel actions?
Looking at the font section and want the same font as it normally is, just bold
https://community.bistudio.com/wiki/Structured_Text#Font
I'm pretty sure it's Roboto Condensed. Here's a chart. https://community.bistudio.com/wiki/File:Arma3Fonts.png
Yeah dual arms would work but I wouldn't have a gun. Anyways I use no stamina mods so I can have the gun in my backpack.
Thank you
I just realized I was thinking of WebKnight's "Two Primary Weapons" mod
Ok it's late Sunday evening here so forgive me if the answer to this is staring me in the face, but if I have the groupID O Alpha 1-1:1 how do I reference the group that unit is in? Or can I just not do that?
You must have got that ID by having a reference to the unit. So you can use group _unit to get a reference to the group the unit is in.
Problem is I'm editing the ALiVE mod and the groupID comes from a hash which is well outside my wheelhouse at the moment. I'll go bug the ALiVE discord about it see if I can't get more info
From what I see, my guess is that O Alpha 1-1 is the groupID and the :1 is the unit it is referencing.
You can get the group by doing something like this.
private _aliveStr = "O Alpha 1-1:1"; // Will get from hashmap I guess?
private _grpStr = _aliveStr select [0, (count _aliveStr) - 2]; // remove the ":1" from the string
private _group = nil;
{
if (str(_x) == _grpStr) exitWith {_group = _x};
} foreach allGroups;
did not test, but this is how I would go around doing that
It doesn't meantion the keyword functionality of local at all.
Thats the conventional usage of the local commad
upvoted both issues
is it safe to delete elements from an array while forEaching through it
no, it will skip the next iteration
Is there a proper way to do something like this other than making an empty array to juggle the new list?
_item = [1, 2, 3];
{
if (_item == 2) then { _item = _item - [_x]};
} forEach _items;
Thank you!
https://community.bistudio.com/wiki/forEachReversed should be available with the next update
hey is it possible to sort array of variables? lets say i have a markers with names path_1 to path_11. When i use sort command it looks like this ["path_1", "path_10","path_11","path_2", ...], which don't work i think. But when i use BIS_fnc_sortAlphabetically it looks like this ["path_10","path_11","path_2", ... , "path_9","path_1"]
surely ["path_1","path_10","path_11","path_2",...]
If you want that sort of thing to be sorted "correctly" then you need to pad with zeroes, like "path_001"
damn, no other options? I mean i already placed about 150 markers
hmm maybe changing name of every point in array to number and then sorting?
will have to think about it
You could write your own sorting function
well, an apply to break the marker names into string + number and then they'll sort properly.
https://community.bistudio.com/wiki/BIS_fnc_sortBy is a thing. _string select [4] to get a substring is also a thing. parseNumber is also a thing
so, something like
private _meme = ["path_10","path_11","path_2", "path_9","path_1","path_5","path_7","path_003" ];
[_meme, [], {parseNumber (_x select [5])}] call BIS_fnc_sortBy``` returns expected `["path_1","path_2","path_003","path_5","path_7","path_9","path_10","path_11"]` 🤷♂️
but it's still better to have a more usable names in the first place
oooooh thats exacly what i was looking for. Thank you my good man
_objects = nearestobjects [start_pos,[],500];
{
_objPos = getPosASL _x;
_zCord = (_objPos #2) - 0.5;
_objPos set [2, _zCord];
_x setPosASL _objPos;
} foreach _objects;
I am using this code to move my objects, but since some of them are rotated, they move in other direction. For example, upside down object will move up instead of down (uses his own z coordinate)
Is it possible to use world's z coordinate to move all objects down?
use getPosWorld/setPosWorld
_items = _items select (_x != 2) // Remove all 2's
Or simpler.
_items = _items - [2];
As that's the same thing, remove all 2's
Thank you. My use was to filter out all locations that aren't at least a certain distance away
I agree, _items - [2].
although I'm not sure what _items select BOOL would return, the 0th or 1st item, depending on _x. if it did any of them, i.e. if isNil '_x'.
given a players unit, what's the best way to get their machine ID for use with executing remoteExec on their machine?
Ah perfect, that should work then. Thanks!
Bear in mind that player units don't transfer locality to the client immediately on creation.
Okay, is there a safe time to wait or should I test it somehow
I was looking at that, in which case would it not be an option?
Well, you need the playerID. I guess you could wait until the object has a non-empty-string playerID.
(that's not necessarily immediate either)
In both cases the potential problem is with "given a player's unit".
"Also isEqualTo is a fuck ugly name for a command like this. Why not ===?"
Java for example uses equals(), it's almost the same
Does anyone have any idea how ModuleRadioChannelCreate_F works? It doesn't seem to kick in on dedicated servers but nondedicated it functions fine?
what are the ui elements called that display information, are not interactable, but display information without inhibiting player movement / actions
select BOOL doesn't have a _x... not sure what you're talking about
You wrote () instead of {} 
meltededmen
cutRsc if you are referring to commands, it's called HUD if you are referring to its technical name
because === is stupid
How can you check if a string is in an array that consists of arrays?
_magArray = [
["30Rnd_65x39_caseless_black_mag","65",30,2],
["30Rnd_65x39_caseless_khaki_mag_Tracer","65",30,2],
["150Rnd_556x45_Drum_Green_Mag_F","556",150,2],
["30Rnd_762x39_AK12_Mag_F","762",30,2],
["30Rnd_762x39_AK12_Mag_Tracer_F","762",30,2],
["10Rnd_127x54_Mag","127",10,3],
// etc...
];
_magazines = magazinesAmmo player;
{
if (_x select 0 in _AmmoTemp ) then { // Something }
else { // Something else };
}forEach _magazines;
I've tried various versions of if (_x select 0 in _AmmoTemp select 0 ) with no success.
The primary array will eventually be a global hashmap if that changes anything.
if hashmap is keyed by mag classname, you can check for if (_x#0 in keys _magHashMap) 
current data organization should use something like sqf private _current = _x; if (_magArray findIf {_x#0 == _current} > -1) then { 
Ah, ok, thanks. What about in it's testing version above?
whoa there, what?
^ @grand idol
Ok, just saw the edit. Thanks again.
working with uniforms, vest, backpacks, as containers, I know how to get their loading, as a percentage. but I would also like to know their loading of what, in terms of mass. I am halfway certain how to do this for backpacks. not so much for uniforms and vests, or the same information is not available (?).
duh right, cool I think I can work with that thanks
What cool projects you all working on anyway
who, me?
Hi when I attach an object to the player and then attach a character to said object, that character has their animations sped up considerably... Is this a known issue and if so is there a workaround?
the simulation speed of attached objects changes so yes it's known
Damn, that doesnt sound like something I can change 😅
ah the comment from R3vo mentions it on the attachTo page, perhaps I just need to find an object with a similar update frequency
got around the issue :)
=== is the standard in almost every language
Is there a way to let players draw markers above images on map, drawn with drawIcon?
Dscha have you ever found out what keeps a building from being able to be used in housing?
???
what keeps the building from being buyable
like a custom building placed on the map not being buyable
if all the classnames are correctly inputted
If you refer to Life -> F that shit. I ain't do shit for that anymore.
Ah i thought you were the owner of Distrikt41 did you shut all that down
I am, i gave the Life-Server to other guys, so i can start my own non-life Mod ;)
im more of a roleplayer than a life mod person.
What it prevents? A shitty global object varibale
and there is the really rare chance that it doesn't get broadcasted
Yeah
so change this system
Kill it @sullen pulsar
@sullen pulsar here? lol :D
I lurk around here an there.
ya im not getting into the whole life mod talk for the 100th millionth time
i just wanted to know what was stopping a custom building i had
thanks anyways
Tonic, small q, why did you tried to continue developing altis life another time just to realize that it's just dead?
Custom building? Modded al?
Just because something is dead does not mean I can't work on something to pass the time.
You're bored, are you? :D
Life is all about having a hobby, a hobby which you use as a time sink.
amen to that
This is somewhat offtopic but by god do I hope that the next iteration of the engine will deprecate (keep it around as legacy option for all I care) the weird little custom langauge with funky syntax and odd semantics and instead just offer a LUA API or something equally 'mainstream'. </sqf-rant>
"next iteration of the engine"
You really believe BI is rewriting the whole game and engine for arma 4? this is funny
Why not?
I did say iteration. I'm not asking for miracles, just a LUA api ;)
I don't believe in such myths
I think it's funny that people believe in an ARMA 4. ARMA 3 wasn't even suspose to exist.
I'm trying to figure out the proper code... I need to have this trigger auto-teleport this boat full of players that drives into it and then set them facing south.
I think I want Condition: vehicle player in thisList and activation vehicle player setPos getPosASL tpMarker;
and then vehicle player setDir 180
I'm also not sure if you can just use getPos instead of getPosASL because they're in boats?
I'm not sure what the advantage of that would be
true, lol. thought i would try to help
player is null on a dedicated server
oh hm
yeah
I was gonna have it just remoteExec but that won't work, it'd teleport the boat a ton
like 8 times per boat if they're full of players...
if you know the boat, name it and call it a day?
So the idea was like, you fade out for 3 seconds and you fade back in to have the players skip a good 10 minutes of loud boat ride
.
if you don't know or there can be multiple boats… do you want to teleport them all to the same spot all at once wherever they are?
yeah I need to rethink how I'm doing it
_wprgsl setUnitLoadout [
["CUP_arifle_AKM_Early","","","",["CUP_30Rnd_762x39_AK47_M"],[],""],
[],
["CUP_hgun_TT","","","",["CUP_8Rnd_762x25_TT"],[],""],
["CUP_U_B_BDUv2_dirty_OD_NK",["CUP_8Rnd_762x25_TT","CUP_8Rnd_762x25_TT"]],
["rhs_6b5_officer",["CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","CUP_30Rnd_762x39_AK47_M","rhs_mag_rdg2_white","rhs_mag_rdg2_white"]],
["rhs_sidor",["rhs_mag_f1","rhs_mag_f1","rhs_mag_f1","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit"]],
"PO_H_SSh68Helmet_NK_2",
"",
[],
["ItemMap","","ItemRadio","ItemCompass","ItemWatch",""]
];```
I wrote this script to customize the loadout of a unit with a specific classname. But the script didn't work and I found "_wprgsl = LOP_NK_Infantry_SL;" was the cause, but I don't know how to solve it. Log says I need to write a phrase in Object, but I don't know how to write it.
you can't use getPosASL on markers
and you can't use ASL pos with setPos either
and you should never use setPos at all. it's broken
I guess you need to do something like this:
_units = [];
{
if (typeOf _x == 'LOP_NK_Infantry_SL') then {_units pushBack _x};
} forEach allUnits;
{
_x setUnitLoadout [];
} forEach _units;
Is it okay to change _x to _wprgsl?
No, check this
https://community.bistudio.com/wiki/forEach
Then one more question. Is this below the right way to put units of different classnames into each different loadout?
{
if (typeOf _x == 'LOP_NK_Infantry_SL') then {_units pushBack _x};
} forEach allUnits;
{
_x setUnitLoadout [];
} forEach _units;
{
if (typeOf _x == 'LOP_NK_Infantry_MG') then {_units pushBack _x};
} forEach allUnits;
{
_x setUnitLoadout [];
} forEach _units;```
No, you need to create separate arrays for MG and SL units, otherwise their loadouts will be same.
Right version would look like this
_unitsSL = [];
_unitsMG = [];
{
if (typeOf _x == 'LOP_NK_Infantry_SL') then {_unitsSL pushBack _x};
if (typeOf _x == 'LOP_NK_Infantry_MG') then {_unitsMG pushBack _x};
} forEach allUnits;
{
_x setUnitLoadout []; // insert SL loadout here
} forEach _unitsSL;
{
_x setUnitLoadout []; // insert MG loadout here
} forEach _unitsMG;
or… do it all in one loop?
Is there a known way to change the height of an entire map without aboslutely bogging it down and freezing the game
@rich bramble But where is <sqf-rant>? when does the rant begin?
@vocal mantle See, I'll call that bit of code later, in a scope where <sqf-rant> is defined! Isn't dynamic scoping great? :P
Not as cool as 360 no scope
There's a problem. I wrote a loadout like below, but there's nothing in unit's inventory but only 5 of FAKs in backpack. Also, weapons are not loaded with a magazine. Did I write it wrong?
P.S: I also want to improve readability by dividing text by color, what should I do?
_x setUnitLoadout [
["CUP_arifle_AKM_Early","","","",["CUP_30Rnd_762x39_AK47_M"],[],""],
[],
["CUP_hgun_TT","","","",["CUP_8Rnd_762x25_TT"],[],""],
["CUP_U_B_BDUv2_dirty_OD_NK",[["CUP_8Rnd_762x25_TT",2]]],
["rhs_6b5_officer",[["CUP_30Rnd_762x39_AK47_M",10],["rhs_mag_rdg2_white",2]]],
["rhs_sidor",[["rhs_mag_f1",3],["FirstAidKit",5]]],
"PO_H_SSh68Helmet_NK_2",
"",
"Binocular",
["ItemMap","","ItemRadio","ItemCompass","ItemWatch",""]
];
} forEach _unitsSL;```
I'm not an expert, but instead of typing it out by hand you could build the unit in editor/arsenal and copy the loadout array to your clipboard and be certain of it's format
When a unit dies it drops their weapons, so getUnitLoadout isn't getting me the weapons they drop.
I've been using nearObjects to get an array of nearby dropped items, using weaponCargo on it, and getting them name of the weapon from that array. The problem I'm running into is I cannot get whatever attachments it had on it via this method. Is there a better way to get the dropped weapons a unit had after it dies, and if not, is there a way to get the attachments a weapon via the way I'm attempting?
Solution: weaponsItems
If you put a Put EH on the unit it'll give you the weapon holder they drop their weapon into when they die.
That weapon holder is internally linked to the corpse and it's deleted when the corpse is, but I don't think there's any direct way to determine it.
You can use nearSupplies to find weapon holders near the corpse and getCorpse to select the right one
is the _corpse returned by Respawn EH the way I get this?
I wanted to start learning by messing around with some workshop mods, managed to extract the .pbo and start making my own changes to the sqf files. However when I repack the pbo, install local mod in the launcher, and run, none of the changes I made are reflected in game. It's as if I'm running the unedited mod. Anything completely obvious I'm missing?
There is a lot to bite off there
First, you must be certain your change is obvious and detectable
Okay. HUD is defined in configuration as a class correct?
Class has idd, idc, etc. then it’s components as children?
I'm just adding systemChat ("test"); to code I know is being run
https://community.bistudio.com/wiki/systemChat
Doesn't take ().
The brackets won't hurt. They're just not required here.
I had some with systemChat format (); as well
Did you unload the old mod?
Now format () is probably wrong ;P
format takes an array, like this: format ["my var = %1", _myVar]
Ok well that's a separate issue to what I'm trying to fix, because even editing the text of the mod's groupChat messages is not being reflected ingame
Is this the only mod you're loading?
It's a mod that requires ACE and is using ace medical, so I'm just digging through the code and adding systemChat to help me see what's being run
But even editing the text of the pre existing _player groupChat "mod initialised" for example is not working, I still see the unedited message in game
It's definitely not running from the workshop folder and should be using my edited pbo from the game directory
is your mod on the launcher mods list?
Yes it is, I even tried unchecking it and clicking install local mod after making a new edit lol
no need
Yeah I figured, that would make launching the game thousands of time for testing even more frustrating
you're building the wrong pbo...?
I only use Addon Builder so, check your path if you're using that.
Using pbo manager right click and then manually placing in the directory. Thanks anyway, I'll go see if I can figure out what I'm doing wrong
don't use that, it's bad for building. Good for extracting though.
Thanks, will install add-on builder
_face = selectRandom [face1,face2,...];
_voice = selectRandom [voice1,voice2,...];
_units setFace _face;
_units setSpeaker _voice;```
I wrote a script like this to make the units in _units set randomly among the faces and voices below, but I get the error that I need an Object type and it doesn't work. I don't understand what the Object type is, can anyone tell me what it is?
unit is object. Vehicle is object. Building is object. Game logic is object.
array is not object 
Arma is like a side project that bi has as a fun thing to do with all that sweet military contact vbs money.
Then do you know how to write it down and it works?
The problem is that you're trying to apply setFace and setSpeaker to the entire _units array at once. Those commands only accept a single unit at a time. You have to iterate through the array, applying the command to each unit.
_units = [ ... ];
{
_face = selectRandom [ ... ];
_voice = selectRandom [ ... ];
_x setFace _face;
_x setSpeaker _voice;
} forEach _units;```
As long as vbs exists, there will be arma built on top of it.
I'm using _x in another script in the same file, is there no problem writing it the same?
_x only exists in the scope of forEach, so no problem at all
It would be a problem if you were using a forEach inside another forEach, but if the other use is separate then it's fine.
That being said, we have like 5 more years until hardware overtakes arma 3.
I only renamed _units, _face, _voice and wrote it as it is, but it still requires an Object type and doesn't work.
Please post the exact code you tried
Is it okay to upload as the file? It's too many to write in the chat.
Do you mean the first forEach doesn't work?
It is because _unitsWPRG only contains empty arrays
Then will it be solved by written the classname of the unit instead of those?
A classname is just a string, not an object
It is very hard to answer what/how to fix since I don't really understand the intention there
Line 16 should probably be _unitsWPRG = _unitsSL + _unitsTL + _unitsMG + ... ; rather than making an array of arrays
These scripts are scripts for equipping custom loadouts for specific units to be spawned.
Yes check cutRsc command for more info on how to create your custom HUD
which is the path to loaded addons, want to use addonFiles ["path/pbo", ".hpp"] to get the header files
You can't use pbos themselves. You should use the pbo prefix
BIS_fnc_deleteTask seems to not be working? when I create a task and set it to completed it does not delete it from the tasks list? (it also returns true for some reason while in biki it says that it returns nothing)
[player, "task_1", ["Destroy It", "Destroy Comms Tower", "marker"], [0,0,0], "ASSIGNED", 0, true, "Attack"] call BIS_fnc_taskCreate;
sleep 5;
["task_1", "SUCCEEDED", false] call BIS_fnc_taskSetState;
["task_1",player, true] call BIS_fnc_deleteTask;
apparently using the last two optional parameters of the function is what caused it to not work...
["task_1"] call BIS_fnc_deleteTask; //works
Hi guys question. How can i make it so unit takes same damage no matter where is hit with HandleDamage ? Basicly how to make it so units damage counts the same no matter where he is hit ?
this addEventHandler ["HandleDamage", {
0.25 // 4 hits to die
}];
something like that, if I got the return value right
AFAIK HandleDamage's return is not the damage it produces but the entire health
If code provided returns a numeric value, this value will overwrite the default damage of given selection after processing. Return value of 0 will make the unit invulnerable if damage is not scripted in other ways (i.e using setDamage and/or setHit for additional damage handling). If no value is returned, the default damage processing will be done. This allows for safe stacking of this event handler. Only the return value of the last added "HandleDamage" EH is considered.
so current damage + wanted damage
huh interesting, so getMagazineCargo does not tell you spent roundages left in each mag.
for that matter, neither does actually strike that, I think I misread that, it is telling me the current number of rounds.weaponsItemsCargo tell you spent roundages in loaded mags.
https://community.bistudio.com/wiki/getMagazineCargo
https://community.bistudio.com/wiki/weaponsItemsCargo
hmm, well for cargo inventory management purposes maybe it is a non issue.
would be more precise perhaps, is there a way to add magazines to container inventory with a different ammo amount?
Have you checked magazinesAmmo and magazinesAmmoCargo ?
https://community.bistudio.com/wiki/magazinesAmmo
https://community.bistudio.com/wiki/magazinesAmmoCargo
Not sure if it's possible to add magazines with reduced ammo counts though 🤔
You can manually set the ammo count of the current weapon/muzzle with setAmmo, but not for individual magazines
thanks. it's okay, probably a non-issue all things considered. although it is interesting that the weapon loaded mag ammo amounts, AFAIK, would be preserved.
It's because each magazine will have an unique ID and therefor unique ammo count (see: magazinesDetail). However there are simply no commands available to get/set the ammo count for a single magazine, even though it should technically be possible.
yeah I see that. no worries, thanks.
_doctor addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit"];
private _health = (1- damage _unit)*100;
systemChat format ["%1",_health];
private _currentDmg = if (_hitIndex < 0) then {damage _unit} else {_unit getHitIndex _hitIndex};
private _takenDmg = _damage - _currentDmg;
hintSilent format ["Current DMG: %1 \n Taken DMG: %2",_currentDmg,_takenDmg];
_currentDmg + _takenDmg / 5;
}];
``` This is the code i currently have. But if i hit arm or leg then the _health of the unit changes depending on the _selection where was hit. How would i make it so that i can change how mutch dmg unit can take and save that in variable so i can later show it as a health bar ?
player setVariable ['TAG_currentHealthPercentage', ((1 - damage player) * 100)];
Or replace player with _unit when using it inside the EH

👍


