#arma3_scripting
1 messages Β· Page 77 of 1
Question
is there a way to force everyone's characters to override their existing identities - in this case, assigned randomly by the mission - and load the face they have in their profile instead
setFace command does
Right, but how would I get the face from their profile
{ _x setFace ?Profile.MyFace? } forEach units player;```
or thereabouts, there's an easy way to get just the players out of the units list, I know
you grab the face at the start before changing their faces in the mission the first time with face
1.) Grab faces
2.) Assign randomly by mission
3.) Re assign saved face that was initially loaded by the profile
Well, you can just set position for your trigger to a marker position
_trigger setPos (getMarketPos "Extraction_1");
Ah, alright. I swear I tried using setpos getpos, but went away from that for a reason. Not sure why though.
Is there a different way to do this?
Rather, is there no way to grab the face out of the profile, server-side?
And of course now you dont need to compile your string, because getMarkerPos accepts marker names in string.
It doesn't look like it, the closest thing is this command: getUserInfo but it doesn't get face info. The way Hypoxic suggested seems to be the only way, unless you store it in the profile namespace of the player, but that seems redundant
Ugh, I feel like a damn idiot now. I'm not sure why I went down the attachTo route. I even knew setpos getpos was a thing I could use.
Thanks, man. Sorry for all the annoyance haha.
So, to be blunt, my friends are having fun playing Vindicta
but they want their custom faces and the mission keeps setting it back to Generic Random Face
it sucks that there's not a way to grab the face from the profile but meh, what can you do
Change mission behaviour to stop assigning scripted faces perhaps?
Ctrl+F setFace and see which function does it
See if there is a way to stop it, otherwise overwrite it somehow
there is
You have my attention
https://community.bistudio.com/wiki/Arma_3:_CfgIdentities#Faces
myUnit setFace "Custom";
but in MP, this is the default behaviour!
so either there is a script that replaces the default custom face with another one, or eventually the used soldier models have a static (non-random) face that cannot be changed
Who knows what Vindicta is doing. It saves the loadout you log off with, but not the face, giving you a new random one when you come back in. I should pry it open and look it over.
So if someone's profile-chosen face is PersianHead_A3_03, and they run this script, it will set it back to that? Or does this only work if they've uploaded a texture and such
ah, no, when you mentioned custom faces I thought "the custom face one can have", my bad
In arma3 tools you have bankRev that can depbo pbos, so you can depbo vindicta, find where it changes face, and bypass it. My guess would be some respawn event handler
On that topic, im a little confused as to what exactly lockIdentity is supposed to be?
perhaps preventing any identity change, whether game-generated identity or logging player entity replacement, but I do not know
Like so it cant be changed later, in lets say ace arsenal?
This will disable default identity.
This is whats mostly confusing me, what default?
no idea at all, sorry
there is no unlockIdentity, there is no lockedIdentity, so it seems quite⦠isolated
the default "give CSAT Pacific Chinese identities"
they may all have "Default" face, default voice, default pitch, etc etc
Ugh.
can i force structured text to be displayed on one line only (even if the text is too small)?
the ST_SINGLE style doesn't do this
class WTK_ExcludeGroundLabelPath: RscStructuredText {
style = "0x00 + 0x0C";
colorText[] = {1,1,1,1};
class Attributes
{
font = "RobotoCondensed";
color = "#ffffff";
colorLink = "#D09B43";
align = "left";
shadow = 0;
size = 0.85;
};
text = "text";
w = 0.375 - 0.018;
h = GUI_GRID_H * 1;
colorBackground[] = {1,0,0,0.5};
};
Wdym it doesnt show as structured text?
From what i understand you need to parseText, not just put in xml as a string
_control ctrlSetStructuredText parseText "<t size='2'>Hello!</t>"; from wiki
https://community.bistudio.com/wiki/Structured_Text
Oh, crap, ive misread. No i dont think you can force it to become one liner if you have line breaks in there
You could probably regex remove the line breaks
there are no line breaks
the text is just wrapping
and there's no solution for it with structured text ctrls
except for stretching it
but for this you don't even need structured text. it can be shown with a normal text box
Hello.
If I have two different .p3d models, can I use somehow 2nd color in 1st object.
Objects are
empty_barrel_f.p3d and
Empty_barrel_grey_p3d.
because only thing what I want to do , is change color of object (without deleting old and re creating new at position of old)
anyone got an SQF that brings down natural lighting down?
Setaperturenew, or some pp effect
(Post prosess no actually pp)
Only if they have hiddenSelectionsTextures defined and spawned as entity (createVehicle) or simple object through class (createSimpleObject)
Then you could do setObjectTexture
with CT_EDIT?
static
anyway I moved onto a simpler and better solution
simply allowing another line to be drawn
like so
perhaps in the future I could make it one line by increasing the width but i'm fine with what i have for now
plus it only affects players with their game set to french so, not a big issue
Is onPlayerKilled.sqf executed locally or on the server whenever a connected player dies?
locally I believe
Excellent, thanks
do I need to disable serialization if I define a button with params?
this way
addMissionEventHandler ["OnEachFrame", {
_thisArgs params ["_button"];
}, [_button]];
ideally yes
should it be disabled inside the EH or outside?
every time you have a variable holding a UI element (display, button, etc) disable serialisation in the code block
i'll keep that in mind
does the disableSerialization statement location in the script matters?
it should be done before assignation
note that this makes the entire script not saved in a save/load, so make it at the earliest scope (after spawn, at the start of an unscheduled code, etc)
since I'm working on an addon the script will not be saved whatsoever right?
I don't want it to be saved
I have no idea what you mean
I don't want any of what my addon does to be saved
what I mean is that if you have a script running, e.g```sqf
while { sleep 1; true } do
{
hintSilent format ["Health: %1/100", damage player * 100 toFixed 2];
};
this is an issue as UI elements are _not_ saved, hence why disabling the serialisation of the script is done - there is no way to restore a UI, it has to be re-created on load
daft question - how can I createVehicle with a variable name, but also tell all clients what the variable name is for the vehicle?
is it fine if I run this every second ?
_button spawn {
disableSerialization;
_this ctrlSetText "stuff";
_this call (util get "fnc_update_buttontext");
};
β¦spawning a thread every second may not be the best thing to do? it won't break the game, it's just not ideal
i do this in an OnEachFrame EH so I need the rest to be serialized
I can move this to a while loop tho, like the code you just sent
your call depending on your structure
otherwise, disableSerialization is used correctly here
publicVariable
cracked it, but thanks anyway
now have this issue
player addEventHandler ["InventoryClosed", {
params ["_unit", "_container"];
_containerString = format ["%1", _container];
Hint format ["%1", _containerString];
if ("deadBag_" in _containerString) then
{
if (count (items _container) == 0) then {
deleteVehicle _container;
};
};
}
];
The container just gets deleted anyway
just testing something actually
itemCargo perhaps?
I'm not sure, I'll have a play, but basically, any container that has "deadbag_" in it is just deleted, empty or not
will feed back
Can someone explain disableSerialization to me like im 5 years old.
What exactly does it mean by "disable saving of script"?
yeah, count (items _container) returns 0
items is for units
see doc https://community.bistudio.com/wiki/items
this @stark fjord?
yeah - seen, not using on unit, my bad
So it only comes in effect if scenario is to be saved/loaded?
I see. So for non saving ones, you could just toss disableSerialization out to begin with
Ah yeah i see in the comments. Only if you store display elements into variables, since displays are recreated and element would not be the same.
Does it play role anywhere else except loading save?
nope
really, disableSerialization is just "do not save/load this script as it will have variables pointing to UI elements"
use it when you refer to UI elements with variables, otherwise don't use it, there is only that to it
Gotcha...
Well then it plays absolutely no role in multiplayer env since you cant save or load anyways. All other functions handling players would also fail if they were stored in vars
you can save in MP when player-hosted
Arma is moddable and not just dedi-MP, don't forget! π
Yes but: save with 10ppl on, load with 1, where are we then xD?
Like idk you have global var on server lets say "my_commander =playerObj".
You save, then load but player that was commander isnt there or is but diffrent object. What would my_commander be then? Nil or would it somehow be objNull?
objNull, if the player units are set to be deleted and not be taken over by AI
Uhh so how does it save player positions (if at all), if players are set to be deleted. By slot in role selection?
it most likely loads the save, creates the unit, then checks if the player is connected and deletes it
or it might be smart and check "no player = no createUnit"
Ah. So if someone then jips, straight back to original spawn?
most likely
the slot still exists, the unit doesn't until someone connects
of course, if you have variables pointing to these units, the references will be objNull (like when someone disconnects, too)
Okay. I thunk its a bit more smarter and restores position when role is taken again.
But oh well. I never messed with vanilla* saving anyways.
Anyone know of a way that I could modify an optics resolution for a UAV? My unit uses the AR-2 darter with a custom config. I currently have the IR camera on it disabled because Arma IR is very high-resolution/futuristic, and makes the Zeus's life hell cause they can see everything (real sUAS IR is usually max 320p and short distance).
Wondering if there is a way I could artificially degrade the video quality on the Darter's turret and/or artificially reduce the max view distance with it.
you could, using the Resolution post-process effect π
https://community.bistudio.com/wiki/Post_Process_Effects#Resolution
Reducing view distance you could maybe setViewDistance while in camera and reset it when exiting
If you're allowed to change that custom config, you can limit the resolution of the UAV's thermal imagers (https://community.bistudio.com/wiki/Config_Properties_Megalist#thermalResoluton.5B.5D_2.10). That's probably the "best" solution since it makes the IR camera usable and applies automatically to all missions, but obviously it requires your unit to accept and allow that change as it must be done through a mod.
Yeah I already do the current Darter config (with IR-disabled entirely) through a mod
You 3 are my heroes, congrats
is it possible to make an entire side forget about a player without having to iterate through all its groups? 
nvm, need to iterate through all groups regardless so is ok
ya i got it now
cba server event for every group making them forget about the player on postinit 
Yeh, I assume this one. but if I config my own object from barrer_f is there possiblity to use rvmat, paa or something to get hidden selection my new class. so I can use hidden selection to change color?
what is the syntax for "next" in a forEach please?
continue
amazing, thanks
is it possible to add your own custom building positions by script (or editor), so i can have units automatically fortify for example walls of sandbags bunkers etc?
if you mean changing buildingPos' return value then no
but nothing prevents you from having building's relative positions somewhere
Ok, I wanted to add new points behind a line of sandbags for example. So that garrison scripts would pick those up. Guess that is not possible then?
I have no idea what those garrison scripts are nor what they use, so I cannot tell you
As far as I know they use the buildingPos of nearby buildings
getResolution
(it's not really needed if you use GUI_GRID to position your ctrls)
CBA has a building position object but it doesn't allow the AI to path find to that point. it simply allows them to stay there
using Large scale breaks my UI layout
because the debug window UI and my UI collide
so I'd essentially like to move the UI to the left if the scale is set on large or higher
Is there a way to modify a certain function of a mod with my own function in another mod file?
and would it be possible to do that through mission scripting without having to add another mod file?
ah nice, that is useful to know! unfortunately it won't work in this specific scenario as the group is respawned on death and move back into position. so they will need to path find.
Will this command work to check if a function has completed? scriptDone (i.e. [_missionParams] spawn fnc_missionExample;)
Yes
private _thread = [_missionParams] spawn fnc_missionExample;
waitUntil{scriptDone _thread};
That's absolutely pointless tho
^ If you're doing this just call the function instead. No waitUntil or scriptDone is necessary
You can wait until several missions are done though, but I guess if he asks this question its not what he's doing π€
Depends what kind of function
CfgFunctions ones can be bypassed using allowFunctionsRecompile
https://community.bistudio.com/wiki/BIS_fnc_recompile
CBA ones can't afaik
In general, any other function not compiled using compileFinal can be replaced too
Collision is only checked locally afaik so I guess wiki is wrong
But wiki does say local arg
No
That's never what local arg means anyway
It means the vehicle must be local to where you execute the command
The target vehicle can be remote
Looking for a function to compare 2 unsorted arrays for duplicates and return a difference;
// examples
private _one = ["a", "a", "b"];
private _two = ["a", "b", "c", "a", "c"];
private _diff1 = [_two, _one] call TAG_fnc_getDiff; // return ["c", "c"]
private _diff2 = [_two, _one] call TAG_fnc_getDiff; // return []
hmm, I guess simple _array1 - _array2; would do
That definitely looks like the best solution
why do i keep getting thrown out of the helicopter when i paste this script into the helicopter h1 setHitPointDamage["HitEngine", 1];
How do I prevent macro definitions from removing my commas in my string?
#define WRITE(arg) arg call _fnc_stream_append_line
// WRITE("16,02,2022") -> 16022022
Do you have any mods running?
yes
is it possible that its because of 3den enhanced?
I dont think so, but I use that so rarely I couldnt say.
But if I were to guess, you have a mod installed that forces occupants of a disabled vehicle out, and its reacting to you destroying the engine.
but when i destroy the tail rotor i am not getting kicked out
and the other passengers are also still inside
i am not the pilot of the heli but a passenger
Are you the subordinate of a group, or a leader?
Eh, even of you were getting quiet ordered out, itd just as likely kick everyone out. Still betting on mod issues
this workaround doesn't work
all this does is add 2 additional double quotes to the strings
@meager granite @little raptor it's a mission handler and I'm trying to implement not allowing more then one mission to be accepted until the current mission is complete. #arma3_scripting message
Yeah you can store your thread handle and check if its done later
Thanks
it doesn't seem to even be a workaround for the case you mention at all
try perhaps escaping them, e.g \,
it still just ignores the comma
this is exactly the issue i'm facing, i'm passing an argument that contains commas
!quote 6
_ https://cdn.discordapp.com/attachments/105462984087728128/1096430025504473209/image.png _
Lou Montana; Friday, 14 April 2023
I want to save loadout and position on disconnect and I got this script here and made a init.sqf but it doesnt work. any help on making it work?
https://sqfbin.com/ufujehaduwamagozedet
This quote is more useful than I thought it would be! π
Here's the cleaned up version: https://sqfbin.com/kifeyodagonogafaqoye
for who?
Just the mission handler that I'm working on

@still sedge Is there a way to the game time when server loads in... In your admin tools?
Hi, I am trying to add markers on the map by clicking. The objective is that the markers are unique and do not overwrite each other. Unfortunately my code overwrites markers. What am I doing wrong?
markercount = 1;
openMap [true,false];
addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
_markerName = format ["_USER_DEFINED #%1", markercount];
createMarker ["_markerName",[0,0,0]];
"_markerName" setMarkerType "mil_objective";
"_markerName" setMarkerPos _pos;
markercount = markercount + 1;
hint format ["%1", _markername];
}];
hint "EH active";

so much hate towards commas
anyways this works
#define WRITE call _fnc_stream_append_line
(...stuff) WRITE;
it makes a bit less sense because it's after the arg but whatever
Any idea why it is overwriting the markers?
You are not creating a marker with the name "_USER_DEFINED x". You are creating a marker with the name "_markerName". When creating the marker, you're providing a string containing the exact text _markerName - not the variable called _markerName.
I want to save loadout and position on disconnect how would I do that?
Sorry, not sure if I understand. Can you tell me what is wrong with the code pls?
createMarker ["_markerName",[0,0,0]];
"_markerName" is a string - plain text - not a variable name. It is the literal exact text "_markerName". The name of the marker is now "_markerName". Not the string you generated, that would be contained in the variable _markerName.
You are not using a reference to the variable _markerName. You are using the plain text "_markerName".
Direct comparison:
_markerName
"_markerName"
See the difference?
Oh I see
but when I use
createMarker [_markerName,[0,0,0]];
...then no marker gets created.
You may need to set its colour as well to make it visible
Also, you don't need to setMarkerPos, you can just use _pos as the position when you create it
how could I go about getting currently loaded ammunition in a players primary, secondary, and launcher slots?
primaryWeaponMagazine and related commands
Nah, still not working. The marker is visible when it gets overwritten.
setmarkertype should make it visible, no?
Did you remember to also fix the _markerName references when you set its type and pos?
ah, thanks.
primaryWeaponMagazine,
handgunMagazine,
secondaryWeaponMagazine
https://community.bistudio.com/wiki/createMarker
tirpitz
When creating a marker with the name format: "_USER_DEFINED #n1/n2/n3". n1 can be used to set the owner, n2 I think is an incrementing index to ensure markers are unique, to this end also mangle some more characters onto the end of the string, and n3 is the channel ID the marker is in.
I had a typo. It works now. Thanks a lot!
Last question, is there an easy way to delete all these markers in one go?
Add the names to an array when you create them. Then you can deleteMarker forEach the array.
I have two more questions
How does the params syntax like this work? I seen this being used in another script, is there a group object I should put instead of bool/objNull?
and if I want the ability for this param to not be used, do I need to change anything for the params or can I just check if the variable exists and not use it if it doesnt?
params[ ["_group", false, [false]] ];
https://community.bistudio.com/wiki/params
See the "array" syntax for the elementN parameter
ah thanks thanks
would player be a correct datatype to have passed in? I plan to use the player to get all units in his squad
player is just a command that returns the player object. So if you do [player] call my_fnc_whatever, it will evaluate the command and then pass the resulting object to the function.
And object is a perfectly valid data type.
alright thank you
How would I convert my function to run for each player in a player's group on mission complete?
["advance", 1500, player] call sog_server_contract_fnc_handleRating;
params ["_condition", "_amount", "_unit"];
private _unitRating = rating _unit;
private _companyRating = companyRating;
switch (_condition) do {
case ("advance"): {
if (!isNil "_unit") then {
_unitRating = _unitRating + _amount;
} else {
_companyRating = _companyRating + _amount;
};
};
case ("deduct"): {
if (!isNil "_unit") then {
_unitRating = _unitRating - _amount;
} else {
_companyRating = _companyRating - _amount;
};
};
case ("reset"): {
if (!isNil "_unit") then {
_unitRating = _amount - _unitRating;
} else {
_companyRating = _amount - _companyRating;
};
};
};
hello, look remoteexec
will do thanks
is there a way to check if an array index actually exists? could I just do (_array select _i) isNotEqualTo null ?
So this should work then? ```sqf
["advance", 1500, (units player)] remoteExecCall ["sog_server_contract_fnc_handleRating", 2];
You can count the array for say if the index exist, but if index is set to null you must check with condition
no 2 is executed on the server
["advance", 1500, player] remoteExecCall ["sog_server_contract_fnc_handleRating", (units player)];
so this shouldnt be a bad idea then?
for "_i" from 0 to (count _primaryAmmo) do {
_projectile addItemCargoGlobal [_primaryAmmo select _i, 6];
if ((count _handgunAmmo) > _i) then {
_projectile addItemCargoGlobal [_handgunAmmo select _i, 3];
};
if ((count _secondaryAmmo) > _i) then {
_projectile addItemCargoGlobal [_secondaryAmmo select _i, 2];
};
};
-2 is executed on every client and not the server if thats what your looking for
I'm looking for just the players in a player's group
inb4 sog_server_contract_fnc_handleRating function is server-only
If a group decides to do a mission and succeed then only the players of that group get rating added. The whole mission module/system is on the server not in the mission or client side
oof
I know it's not pretty but that's just the way I have my framework structured, lol
never used remoteexec in my life, never will
if you mean the index itself exists: index < count _array
if you mean the element at index exists, you have to check it via commands that check for your type of existence
e.g. not nil -> !isNil {_arr # idx}
not null !isNull (_arr # idx)
i mean. If the function is in servermod (sounds like it?) and, probably, mission success is checked on the server as well... then just sqf { ["advance", 1500, _x] call sog_server_contract_fnc_handleRating; } forEach (units _winnerGroup); wherever mission success is defined?
at least that's how i read "on the server not in the mission or client side" 
This won't work because player is evaluated on the sending machine, before the remoteExec is broadcast. So every machine in the sending player's group will run the function, but they will all run it with the originating player's unit as the argument
So would the forEach loop that artemoz mentioned work then if not then how would I go about this?
artemoz's solution is probably right, unless you finish by plugging that calculated rating stuff into addRating. That's a Local Argument command, so it needs to be executed on each player's machine to take effect. If you don't, then it should be fine.
does the CfgFunctions postInit function run on both client and server ?
This is what my function looks like for calculating the rating. (the framework communicates with ArmaRedis to update.) https://sqfbin.com/garawuvepobobifabeve
yes it gets called wherever the function is defined
yeah I mean index itself, I dont want it throwing an error when I call it. I believe im using the example you showed but reversed
anyway I've come to the conclusion of doing it this way, and while I have it posted is this a decent way of doing what im doing, any suggestions to improve it?
if ((typeOf _projectile) isEqualTo "Box_NATO_AmmoVeh_F") then {
if (_group isNotEqualTo false) then {
_primaryAmmo = [];
_handgunAmmo = [];
_secondaryAmmo = [];
{
// Current result is saved in variable _x
_primaryAmmo pushBack ((primaryWeaponMagazine _x) select 0);
_handgunAmmo pushBack ((handgunMagazine _x) select 0);
_secondaryAmmo pushBack ((secondaryWeaponMagazine _x) select 0);
} forEach ((units _group) select { isPlayer _x });
for "_i" from 0 to (count _primaryAmmo) do {
_projectile addItemCargoGlobal [_primaryAmmo select _i, 6];
if ((count _handgunAmmo) > _i) then {
_projectile addItemCargoGlobal [_handgunAmmo select _i, 3];
};
if ((count _secondaryAmmo) > _i) then {
_projectile addItemCargoGlobal [_secondaryAmmo select _i, 2];
};
};
_projectile addItemCargoGlobal ["rhs_weap_M136", 5];
_projectile addItemCargoGlobal ["rhs_weap_fim92", 2];
_projectile addItemCargoGlobal ["rhs_fim92_mag", 5];
_projectile addItemCargoGlobal ["ACE_elasticBandage", 100];
_projectile addItemCargoGlobal ["ACE_epinephrine", 12];
_projectile addItemCargoGlobal ["ACE_morphine", 12];
_projectile addItemCargoGlobal ["ACE_salineIV", 12];
_projectile addItemCargoGlobal ["ACE_splint", 15];
_projectile addItemCargoGlobal ["ACE_tourniquet", 15];
_projectile addItemCargoGlobal ["1Rnd_SmokeRed_Grenade_shell", 5];
_projectile addItemCargoGlobal ["1Rnd_SmokeGreen_Grenade_shell", 5];
_projectile addItemCargoGlobal ["rhs_mag_M585_white", 5];
};
};
basically adding ammo to a crate based on the squads currently loaded ammunition when the script is called
oh, apparently the weaponMagazine functions return an array, I didnt realize this
don't forget the all-important https://community.bistudio.com/wiki/binocularMagazine π
bro thats actually been annoying me lately
also, why not just run 3x forEach loops? I doubt that would be slower
thanks for pointing that out, im literally gonna need add this to the respawn handler so people stop complaining that their binos dont have batteries
you think? ill do that then, I just didnt think it would be very efficient
better than an unrequired if check + less readable code
make it work, make it readable, then optimise (if needed!) π
- a possible bug where there are more secondary/handgun mags than primary ones
mind pointing it out? I dont notice that
don't mind me, the way the arrays are constructed should prevent that
ah ok. Oh I actually didnt think about what would be returned if the player doesnt have a secondary or handgun
although it should prevent you from needing the count > _i check as well
actually I did think, just not hard. Thats why I had the count > _i check
assuming nothing would be appended to the array if they didnt have anything

I see now it would just be full of empty strings
well, isNil {secondaryWeaponMagazine player select 0} is True when no secondary is available, so the array lengths wouldn't be consistent after all
{ _projectile addItemCargoGlobal [_x, 6] } forEach _primaryAmmo;
{ _projectile addItemCargoGlobal [_x, 6] } forEach _handgunAmmo;
{ _projectile addItemCargoGlobal [_x, 6] } forEach _secondaryAmmo;
```neater
no?
yes, had the for loop because I was only planning on a single loop
inb4 "just run addItemCargoGlobal in the first forEach loop without storing intermediate result"
im thinking replace that part with
{
// Current result is saved in variable _x
_primary = (primaryWeaponMagazine _x) select 0;
_handgun = (handgunMagazine _x) select 0;
_secondary = (secondaryWeaponMagazine _x) select 0;
if (_primary isNotEqualTo "") then { _primaryAmmo pushBack (_primary); };
if (_handgun isNotEqualTo "") then { _handgunAmmo pushBack (_handgun); };
if (_secondary isNotEqualTo "") then { _secondaryAmmo pushBack (_secondary); };
} forEach ((units _group) select { isPlayer _x });
i'm talking about how it isn't "", it's straight up Nil when the weapon slot is empty
oh really
hmm, ah wait
then is it "" if the weapon doesnt have a mag?
well, I doubt players would toss away their mags even if empty, so I shouldnt need to check for empty string then
seems to also be nil (?question mark?)
I was looking at example 2, so I assumed
oh
thats primaryWeapon
balls
ok, ill look for nil then
it's nil because [] select 0 is nil yeah
then it should be fine to just check isNotEqualTo nil right?
there is an "empty array" check
and probably default to the first compatibleMagazine of the weapon if the mag isn't there
"How to featurecreep in 2 easy steps"
foreach [1,2,3]
oh so itll just grab a compatible mag if the player doesnt have one loaded, thats neat I guess. wont have to handle that myself
no it wouldn't
"and probably default" as in "you should probably write a logic for that"
I am worried about if (_group isNotEqualTo false) then {
why not grpNull
oh, I misunderstood
params defaults _group to false if its not a provided parameters
guess I could change it to grpNull default
it is more natural to have if (isNull _group) exitWith {}; yes π
actually that var name kinda lies, im just returning the player object so I can get his group from him
makes more sense, done that
you from the future thanks you for that π
ngl I kinda wish object was just obj
?
the name, idk seeing objNull makes me want to be able to use obj rather than object
well, where do you use object? this command was deprecated in ArmA 1.08 π
angry SQF noises
whats uh, whats the object datatype?
now your confusing me
so I should make the expected datatype in the params array, objNull ?
expected datatype
objNull is not a datatype
it's an object that is null (non existing object)
in params you provide "sample" data
it takes the data types from them
e.g. if you want a number, you can put 0:
params [["_myNum", -1, [0]]]
alright then, makes a little sense then
wouldnt compatibleMagazines be a little hard on performance when there is hundreds of compatible mags?
if you don't expect to run it every frame (or every second) then it's probably acceptable even if it is a bit slow. It's guaranteed to be faster than BIS_fnc_compatibleMagazines at least. And "just get the first entry from compatible magazines array of weapon's config" is apparently not a best solution?
hmm alright, ill test this in a bit, I dont think itll affect the mod its going into much but we shall see
actually you know what, I should probably do all of this after the crate has landed anyway, not mid flight
ah
what method should I use to make sure my script is only running on client?
there are too much functions to choose from
!isServer
if (!hasInterface) exitWith {};
tho if the server is not dedicated you might want to combine it with hasInterface
!isServer will cause issues if player hosted mp
"It will return true for both dedicated and player-hosted server"
mhmm
so check for interface instead
I might have a misconception on player hosted servers
or just isDedicated to solve player hosted servers
are we running it separately like a normal server and separate scripts for the client and the server or nah?
makes sense
so all createVehicle objects are local to the hosting client until locality is changed
as an example
doesn't it create a lot of load on the client since it knows everything that is happening on the server?
eh, i host antistasi myself for me and like 2 friends and get on "fine"
wouldn't having a server that knows all and a client that only knows part create more load overall?
gets a bit shit if i forget to garbage clean every half hour or so but /shrug
what's the use case here anyways?
I was just wondering because I never really distinguished a difference between player hosted and dedicated servers, but now I know
true
if (isServer && !isDedicated) exitWith { /* Running on server */ };
that should work
wait
or just !hasInterface lol
and youd also want && isDedicated not && !isDedicated
as that's if is server and not dedicated (so just player hosted lol)
mb, I'll opt for the !hasInterface solution as it seems easier to understand, thanks for the help
Hi, is there a way to hide the playerlist on the Map or shorten it to count only players by Opfor/Blufor... ?
https://community.bistudio.com/wiki/Multiplayer_Scripting#Different_machines_and_how_to_target_them
hasInterface = player-hosted server & player clients (aka all players)
(not including headless clients. Because they don't have an interface)
thanks - updated for clarity
Hi,
it's the first time that I make an addon (but I already know the principles of programming) and I would like to be able to create a mod which executes a script at the beginning of each game (which for the moment displays the angles pitch roll and yaw I'm in a plane or helicopter). I didn't quite understand the tree structure to use, especially in config.cpp and also how to properly use addon builder (source and destination).
thanks
the tree
Mod Inclinaisons v3
β config.cpp
β
ββββfnc
fn_getInclinaisons.sqf
config.cpp:
class CfgPatches {
class MyInclinationMod {
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {};
author = "Autrucheverte";
};
};
class CfgFunctions {
class SQF
{
class fnc
{
class getInclinaisons { postInit = 1 };
};
};
};
fn_getInclinaisons.sqf:
while {true} do {
if (vehicle player isKindOf "Air") then {
private _pitch = round(vehicle player call BIS_fnc_getPitchBank select 0);
private _roll = round(vehicle player call BIS_fnc_getPitchBank select 1);
private _yaw = round(direction vehicle player);
private _angles = format ["Tangage: %1\nRoulis: %2\nLacet: %3", str _pitch, str _roll, str _yaw];
hint _angles;
};
sleep 1;
};
addon builder source: C:\...\Mod Inclinaisons v3
addon builder destination: C:\...\@Mod inclinaison v3\addons
please use https://sqfbin.com/ & https://pastebin.com/ for big chunks thanks
executes a script at the beginning of each game
game as in game start or game as in mission?
I want the loop to run all the time when I'm in game
but why
because it is displayed to me as a hint the angles of pitch roll and yaw and my goal in the long term will be to make an IRL model move like the plane or the helicopter that I pilot in game
you might wanna use hintSilent
What exactly isn't working with your seetup?
https://community.bistudio.com/wiki/Arma_3:_Creating_an_Addon
might be of some help
when I open the game it's written "script fnc/fn_getInclinaisons is not found"
thank you, I found some interessants things but I don't understand all with config.cpp and build the addon
you should correct the path to your function
you can see it in my previous message
Your config is currently pointing too <ROOT>\fnc\fn_getInclinaisons .sqf
e.g if your addon prefix is test :
class CfgFunctions {
class SQF
{
class fnc
{
file = "test"; // if fn_getInclinaisons.sqf was in a subfolder: test\subfolder
class getInclinaisons { postInit = 1 };
};
};
};
ok I will test that
Must I relaunch Arma 3 when I rebuild my mod ? (because that is what I'm doing)
ok
but you should test your stuff before building them to reduce dev time
you can make a test mission, place your addon folder in the mission folder then add:
#include "addonprefix\config.cpp"
in description.ext
It still don't work...
what is your addon prefix?
mod_inclinaisons
set up in addon builder options correct?
yes
ok I will test it
ah wait you've placed the function in a subfolder haven't you?
yes, named fnc
did you use this for file?
file = "mod_inclinaisons\fnc";
no
file = "test"; // if fn_getInclinaisons.sqf was in a subfolder: test\subfolder
so file = "fnc" ?
Mod Inclinaisons v3
β config.cpp
β
ββββfnc
fn_getInclinaisons.sqf
no what I said
\\ (use it twice to escape)
\
ok
It likes yours too π
what addon folder ?
file = "3denEnhanced\functions\GUI\VIM";
Mod name = 3denEnhanced
First subfolder: functions
Second subfolder: GUI
third subfolder: VIM
I asked a question in #arma3_editor but I guess its really more like a scripting question so I guess ill ask here as well
whatever contains the config.cpp file is called an addon folder
I need help working with triggers and respawn points
- if a vehicle is not in a trigger it will check if its in another trigger if its in none of those triggers it will respawn an empty vehicle (without pilot and co-pilots basically)
- if an infantries friendly (Lets say OPFOR) are in a trigger area a respawn will be activated otherwise that respawn wont be active (this can be with multiple respawn points at a time)
- when should it respawn? based on a timer?
I removed your post from there to avoid crossposting, and you will find more answers here π
If you have some experience with sqf you might wanna check out inAreacommand https://community.bistudio.com/wiki/inArea
zero experience I tried with the basic triggers only one respawn was working but not the other ones
I rephrase my question:
I want to try a mod who execute a script when I spawn.
while {true} do {
if (vehicle player isKindOf "Air") then {
private _pitch = round(vehicle player call BIS_fnc_getPitchBank select 0);
private _roll = round(vehicle player call BIS_fnc_getPitchBank select 1);
private _yaw = round(direction vehicle player);
private _angles = format ["Tangage: %1\nRoulis: %2\nLacet: %3", str _pitch, str _roll, str _yaw];
hint _angles;
};
sleep 1;
};
What should be my map folder tree ?
What should be written in config.cpp ?
And then how to build it ?
What you had so far was correct. Just something wrong with the path.
if you simply made the change I mentioned it should work
Would something like postInit or preInit fit your needs? (also hello fellow frenchman)
He had that already (postinit)
my bad, I can't read
but not to relaunch arma every time I want to try your solution of putting the script in my map folder but in don't understand all
here's my setup if you are interested
class CfgFunctions
{
class WTK {
class InitScripts
{
file = "Arma3ModTest\addons\main\functions";
class init { postInit = 1 };
};
};
};
make an empty mission
save it
go to Documents\Arma3\Missions\Mission_Name
make a description.ext file
make a folder in it called: mod_inclinaisons
put the config.cpp and the fnc folder in it
add this to description.ext:
#include "mod_inclinaisons\config.cpp"
I have a folder inside my main addon called functions
any sqf file named fn_<function class name> (fn_init in my case) will be executed upon mission start if it has postInit in it
zero experience I tried with the basic
ok thanks, it's working
and now to build it ?
you mean turn the files into pbos?
yes
download Arma 3 tools on steam
just use that mod_inclinaisons folder as the source folder in addon builder
and set the pbo prefix to mod_inclinaisons too
it's by far the easiest solution
ah
to run the code in every mission
no
ok
ignore what i've said
so you want to build your mod without having to restart your game?
I don't really get it
and the destination folder ?
whatever you want π€·
not now because the tests are finished
ok
you can put the pbos in the Addons folder
off a new folder
why the meowsweat
that's how it meant to be right?
hemtt does it that way so
well depends which addons folder you meant
I figured you mean the one in the root of the game folder
and in arma launcher I select the parent of addons (build for you)?
you select the folder where there is mod.cpp
ok ok
Mod <--- you select this folder in the arma launcher
β mod.cpp
β
ββββaddons
β
ββββ whatever mod
ββββ config.cpp
β
ββββ fnc
β
ββββ fn_getInclinaisons.sqf
and the pbo file ?
next to whatever mod folder
oh so the dlls go in root
I overwrite it
nice to know
DM me the pbo
One suggestion id make is keeping stuff in lowercase, because of linux servers and case sensitivity
Idk if its still such an issue, but i had to make scripts to lowercase everything
Things outside pbos that is.
when I open it with PBO manager I have this. Is there any problem ?
It seems way better
Yup
must I restart arma 3 laucher to
If you use any other extensions you need to list them there
No, just need to restart arma.
You are adding it as local mod, yeah?
Hello everyone, I would like some help to understand a bit more scripting in this game (I just begin with the editor). My question is... How to made plane drop bomb with this script : null = this spawn {_this dotarget t6; sleep 0.5; while {alive t6 and alive _this} do {sleep 4; gl action ["useweapon",vehicle _this,_this,0]; }};
This script gives target t6 to plane, waits 0.5 seconds then starts looping the following code until either plane or t6 are destroyed:
Wait 4 seconds, then It makes plane fire its current weapon.
So how would you make THIS exact script make plane drop bombs? I guess if only weapon plane had is bombs it would drop them? given that object g1 IS the plane.
Ah right it uses logic, then ignore last part
I try to made a CAS with RHS plane but the SU-25 don't drop any bomb even with pylon full of FAB-250 or 500
you could try to use following instead of action:
https://community.bistudio.com/wiki/BIS_fnc_fire
How does it work ? Like I say
I'm just starting π
Could you give me a exemple ?
scroll a bit down, has a few examples below
also you may wanna here: https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
So you have a better understanding whats going on with with scripts
Thank you very much I will take a look and return if I need help. Thanks again
I'm trying to create a waitUntil loop that skips setting the private variable _result equal to 1 if the number of captured hvts have been met. (If the private variable _result is equal to 1 then mission fails). So will this work: ```sqf
_startTime = floor(time);
waitUntil {
sleep 1; // Use sleep on server side!
// Check if hvts are killed
_hvtsAlive = ({ !alive _x } count _hvts);
if (_hvtsAlive >= _limitFail) then { _result = 1; };
// Check if hvts are in extraction zone
_hvtsInZone = ({ _x inArea _extZone } count _hvts);
// Check if hvts are captive
_hvtsCaptive = ({ captive _x } count _hvts);
// Timeout check
_currTime = floor(time);
if ((_hvtsCaptive >= _limitSuccess) && (_currTime - _startTime <= _time) || (_hvtsCaptive >= _limitSuccess) && (_currTime - _startTime >= _time)) then { _result = 0; } else { _result = 1; };
// Trigger Conditions
(_result == 1) OR (_hvtsInZone >= _limitSuccess) OR (_hvtsAlive >= _limitSuccess);
};
why not try it?
there is a very easy way to test that π (just run it in game).
One mistake youve made is that waitUntil has to have a return value.
It will wait while return is false and stop waiting when value is true
The return value is if one of the Trigger Conditions are met, or did I code that wrong?
remove ; in trigger conditions line
ok, and I haven't tested it yet because it one small part to an entire system and it's within my server addon, lol. I guess I could create a quick test mission though
wut
?
why did you say that?
cause // Trigger Conditions (_result == 1) OR (_hvtsInZone >= _limitSuccess) OR (_hvtsAlive >= _limitSuccess); <---- That?
keep it
it is a 22yo false idea that a semicolon prevents returning a value
private _value = call { 0; }; // _value == 0
though I have to admit⦠now I am unsure regarding waitUntil
The hell? Was i living a lie? so
_var = if (true) then {123;} esle {321;}; works too?!
yep
other than the else typo :P
trololo
but all the examples on wiki seem to amplify that lie
β¦no?
there is never ; in last-return line
It's a 50/50 convention in Arma whether you bother with the trailing semicolon on one-liners.
tested```sqf
0 spawn {
waitUntil { speed player > 0; };
hint "OK";
};
or if youre me, 50/50 usage
{ _x setDamage 1 } forEach allUnits;
```looks better than```sqf
{ _x setDamage 1; } forEach allUnits;
```but that's about it; _looks_ π
well im throwing my pc into the toilet
make a backup first!
this is as much as a revelation to me, as the time when i first learned that vehicles actually do have brakes (x) and braking doesnt "just suck" in arma....
I lost that keybind somewhere, don't really miss it :P
X is the handbrake specifically. Normal brakes is just pressing backwards (S) while going forwards.
The handbrake doesn't trigger the brake lights, doesn't count as braking for things like disableBrakes, and doesn't work on tracked vehicles.
True but some vics just have bad brakes, but when you handbrake it, they stop almost on a dime.
Can i use the command setParticleParams (https://community.bistudio.com/wiki/setParticleParams) to set just the onSurface parameter of a particle source?
you have to provide all the non-Optional values
I find them in the config?
perhaps
anyone know if i can get the side that a uav terminal belongs to?
getNumber(configFile >> "CfgWeapons" >> "B_UavTerminal" >> "ItemInfo" >> "side")
ok so that returns a number, how do i get the number into a side?
private _side = switch(getNumber(configFile >> "CfgWeapons" >> "B_UavTerminal" >> "ItemInfo" >> "side")) do {
case 0: {opfor};
case 1: {blufor};
case 2: {independent};
case 3: {civilian};
default {sideUnknown};
};
There are more sides but I don't think there are terminals of other sides, it would make no sense
can i get the same type of number from a unit for a conditional statement? i cant find ItemInfo in the config for the GPS either
GPS only has mass info
Yes you can get same side number from unit
side but units might be in a group of different side so getting number from config is not gameplay-reliable
UAV crew is created by vehicle's config side (but again you can change UAV crew sides during gameplay)
Ive been looking and looking for a way to implement xenos ammoload script into my own mission file but just cant seem to find it nor find something like it if anyone is able to help id be much appreciative! If you dont know what im talking about its a script that sets a certian helipad to have the option of loading an ammobox into a cargo oriented vehicle or air type vehicle. basically you land on it open the cargo option of the vehicle and it says load box etc etc.
can someone please explain this? am i just not seeing this or am i losing my mind?
switch (playerSide) do
{
case west: { hint "You are BLUE"; };
case east: { hint "You are RED"; };
case guer: { hint "you are GREEN"; };
default {hint "WHAT ARE YOU!?";};
};
so if i have a NATO unit it works
if i have an OPFOR unit it works
if i have a GUER unit it fails or errors out.
case resistance: {};
Yeah it's resistance not guer
I wouldn't use playerSide personally since it doesn't update if you change sides mid mission
Depends on the use case I suppose
i dotn want the currently allied side, i want the config side of the unit.
Makes sense
resistance still returns GUER ao what am i missing here?
OK. . . . that works all I want to know is why. im trying to understand the code instead of just accepting "it is what it is"
It's a decades old engine and it's held together by duct tape and glue
^ Pretty much, resistance is the actual hardcoded Side while guer is merely a string output.
funnily enough independent also works
GUER is a string name for resistance/independent side
CIV is string name for civilian
i see
resistance, independent, civilian, blufor, etc. are scripting commands returning side value
When you turn SIDE type into STRING type, you get these WEST, EAST, GUER strings
so switch isnt comapring the string output of the command playerside but instead is using comparison of the output of the two commands? (in this case playerside == independent)
Yes
so i dont have to have both independent and resistance in the same switch because they are going to both match?
Yes
does it not use lazy itteration?
Switch's look for the first matching case
You can also use it like so
_i = 1;
Switch (true) do {
case (_i == 1): {hint "_i equals 1"};
case (_i == 2): {hint "_i equals 2"};
case (_i == 3): {hint "_i equals 3"};
default {};
}
A more concise version of this would be
_i = 1;
Switch _i do {
case 1: {hint "_i equals 1"};
case 2: {hint "_i equals 2"};
case 3: {hint "_i equals 3"};
default {};
}
yes, do something corespoding to value
i tought i got lucky and had found a fucntion that would activate twice like
jhonShoots = true;
sleep 1;
TimShoots = true;
//the distance the bullets must travel is at least 2 seconds
switch (true) do {
case TimShoots: { John setdammage = 1; };
case jhonShoots: { Tim setdammage = 1; };
default {};
};
but NoOoOoO, only Jhon dies because lazy evaluation
It would exit out at the TimShoots case
I would use two If statements for something like that.
it's not lazy evaluation, it's how a switch works
just reading this code, if it executed twice I would be worried (code not doing what it says)
Just thinking of how many of my own functions would break if a switch executed everything π¬
hi there guys, having some problems when respawning. We're keeping most of our gear, but losing odd bits or all first aid kits. I've tick store load out in eden editor, plus I'm using spyder addon loadout manager. I also have a:
onPlayerKilled.sqf
player setVariable ["Saved_Loadout",getUnitLoadout player];
and
onPlayerRespawn.sqf
player enablestamina false;
player addEventHandler ["Respawn", {player enablestamina false}];
player setCustomAimCoef 0.2;
player addMPEventhandler ["MPRespawn", {player setCustomAimCoef 0.2}];
player setUnitRecoilCoefficient 0.3;
player addEventHandler ["Respawn", {player setUnitRecoilCoefficient 0.3}];
player addEventHandler ["Respawn", {player setUnitTrait ["medic",true]}];
player addEventHandler ["Respawn", {player setUnitTrait ["engineer",true]}];
player addEventHandler ["Respawn", {player setUnitTrait ["explosiveSpecialist",true]}];
player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
am I missing code that should be in the one of the init files? cheers
I think you can wrap a lot of those into one handler instead of that many
Respawn event handlers are kept between unit objects
Here you keep piling them and they trigger only on the second death
initPlayerLocal.sqf would suit better for these, since it only fires once locally on each player when they connect
(you don't need all these event handlers as the file itself is one and you apply the wanted changes already)
I can work with out the setunit and stamina stuff.. agree I'll ditch all that.. Would you just have this for onPlayerRespawn.sqf
player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
or would you put that in the initPlayerlocal.sqf? cheers
Forget what I said I had a brain lag, putting those in the onPlayerRespawn should be sufficient, since as Lou said it basically functions like the Respawn Eventhandler
thanks @sweet zodiac andf @winter rose legends π
onPlayerRespawn.sqf
player enablestamina false;
player setCustomAimCoef 0.2;
player setUnitRecoilCoefficient 0.3;
player setUnitTrait ["medic",true]
player setUnitTrait ["engineer",true]
player setUnitTrait ["explosiveSpecialist",true]
player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
However If the scenario has Respawning At start turned off they may not apply, but I would need to double check that.
trying it now.. There's so many versions these days.. I can't believe I'm having issue with this π¦
It happens to everyone, I wouldn't worry.
Just yesterday I nigh on had a fit because one of my Functions was complaining about a Variable not being defined, of course the game was right but my brain didn't agree for an hour.
lol, learnt that one the hard way too π
@sweet zodiac all looks good.. What should I add to that script so my respawn loadout = my stored loudout.. At this point I am respawning with the current loadout and ammunition I die with.. i.e If I have used half a clip then, I respawn with the remainder of that clip only? cheers
Well you would have to change separately when the Loadout gets "saved" to really solve that
I'm using the spyder addon for loadout manager and saving and respawning with loadout
I'm not too sure what spyder addon is so I'm not sure how to help you
yeh ok cool.. thanks mate. I think I am really close.. I'll play with some previous scripts and see if I can rectify π
appreciate your help
you are grabbing player's loadout on death (onPlayerKilled.sqf) so it is normal you get the loadout with which you died π
You could add something basic like an Action on an Arsenal Crate if you want, It's a little bootleg but should serve the purpose.
//Init of Box
this addAction ["Save Loadout", {player setVariable ["My_CoolLoadout", getUnitLoadout player]}];
//If Executed from Debug Console while looking at it
cursorObject addAction ["Save Loadout", {player setVariable ["My_CoolLoadout", getUnitLoadout player]}];
//Lastly if done from Zeus
_this addAction ["Save Loadout", {player setVariable ["My_CoolLoadout", getUnitLoadout player]}];
//Modified Respawn Snippet
player setUnitLoadout (player getVariable ["My_CoolLoadout",[]]);
Use one of the three options that best fits.
Note that addAction is local so this would need to be executed for Everyone.
your best bet is giving the box a Variable name in the Editor and putting
BoxVariableName addAction ["Save Loadout", {player setVariable ["My_CoolLoadout", getUnitLoadout player]}];
Inside initPlayerLocal.sqf
makes sense, thanks mate.. will make the adjustments now
Double Edit once again, the Init of an Object in the Editor is executed for everyone so using that Top option will do just fine
Hello
How Can't die from fire ?
I try with addEventHandler damage but i dont fine a good solution π€
I don't think there is an easy way to stop fire damage, I haven't found a reliable way to detect if the damage is from a fire without making it check many things inside the handler
#1107046367160963184 can someone help me with something??
Do you mean something like that?
I wanted the notification like the mission marker but I got it thanks
lets say
a certain area has been cleared of OPFOR now I want to send a Notification saying "Area Secured" and send another one
So once a zone has been cleared of Opfor you want it to send a Notification that it's clear?
The absolute simplest method is just a trigger, set for Opfor to Not be Present
That's a little more complicated to do but very possible
it uses the BIS_fnc_showNotification
Off topic but how is vscodium as a enviornment?
Does the VSC Addons work on it ?
Yup
okay follow up to this and than turn on a marker on the map like a mission and keep it active till the objective has been completed
Place a Area marker and just change it's alpha to 0 when the Trigger activates for clearing the zone.
"AreaMarker" setMarkerAlpha 0
Lets say Snoppy chose to go Cedras
so after they capture cedras it will trigger to capture ambergris
description.ext
class CfgNotifications
{
class TAG_SectorCleared
{
title = "Sector Cleared";
iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIconDone_ca.paa";
description = "You Cleared a Sector";
color[] = {0.7,1,0.3,1};
priority = 7;
};
class TAG_SectorClearedRespawn
{
title = "Sector Cleared";
iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIconDone_ca.paa";
description = "You Cleared a Sector, A New Respawn has been Activated";
color[] = {0.7,1,0.3,1};
priority = 7;
};
class TAG_SectorLost
{
title = "Sector Lost";
iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_ca.paa";
description = "You Lost a Sector";
color[] = {1,0.3,0.2,1};
priority = 7;
};
class TAG_SectorLostRespawn
{
title = "Sector Lost";
iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_ca.paa";
description = "You Lost a Sector, Respawn Deactivated";
color[] = {1,0.3,0.2,1};
priority = 7;
};
};
or if they captured ambergris first after they capture ambergris it will show the marker to capture cedras
I was trying to avoid using description.ext any way around it ?
For Notifications like this, No
so I do call descriptiom.ext instead of call BIS_fnc_showNotification;
"TAG_SectorCleared" call BIS_fnc_showNotification
the description.ext is a way for you to load configs into missions without the need of a Mod
It however doesn't work for everything
so I put the description.ext in the MPMissions Folder yeah?
i got it thanksss
When you export to multiplayer from the editor it will include all the files inside the missions folder
Why not just have both Objectives active at once?
Thank you for this btw
it is turned on right now but I want them to know which is the next point to capture basically
Is this a bug? But when deactivating an UXO the "delete" event handler for projectile doesn't trigger.
If it's merely just markers we are talking about then just changing the Alpha of the Markers is enough.
@sweet zodiac so when all 4 of the Sectors has been captured I want to than remove all the markers in those sectors and only show the markers in black
Having a standalone trigger with this in the condition
triggerActivated trigger1 && triggerActivated trigger2 && triggerActivated trigger3
trigger1, trigger2 and so forth should be the Variable names of the 4 Triggers you want, then you can make it just hide all 4 markers.
Could anyone write a script that uses removeCuratorEditableObjects for all npc's every second? Because i honestly can't do Arma 3 Scripting.
I tried like 6 different approaches now, all didn't work at all
This is more a Editor Question if anything but having this Option NOT ticked should solve that, unless you are playing a mission which has a script that adds them to the Curator.
My goal is just to remove a certain side from the zeus
basically allow the zeus to edit BLUFOR, move em, etc
but not see REDFOR units
even if they are spawned in by a script
@sweet zodiac
I see
Yeah, so help on that matter would be appreciated
wait is the Notification Visible to all the players in the Server ?
Yes
Oh wait, the Function is actually Local, but it being Called by a Trigger would make it global yes
Ok so i came up with:
while {true} do {
sleep 1; {
if ((side _x) == east) then {
_this removeCuratorEditableObjects[[_x],true];
};
}foreach allUnits;
};
But it gives me "Type Array, Expected Object"
Not sure what _this is, that's probably your Array
replace _this with the variable name of the Zeus Module
alr
Also let me stop you from bricking your System
I believe he wants all Units of a Side, including ones spawned by Scripts and not Zeus
About all Units
Spawned via other zeus, spawned via script, spawned in eden
EntityCreated Looks like it would work actually let me test
I find the way but i cant disable damage when its by fire :/
Little late, whole thing froze lol
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if ((side _entity) == east) then {
ZeusModuleVariable addCuratorEditableObjects [[_entity],true];
};
}];
That does the trick
putting that in the initServer.sqf will work fine
You can add this along side it as a one time run to add all Opfor
{
if ((side _x) == east) then {
curatorModule addCuratorEditableObjects [[_x],true];
sleep 1;
};
} foreach allUnits;
You can change the sleep if you want it faster.
The Result was the Opfor were added to my Curator without me doing anything
Hey guys, a friend made a script for me, but he is busy and can't answer me, it's basically an MQ-9 fuel tweak the value he set is fuelCapacity=14000; but I don't know how does the 14000 convert in game, anyone knows?
Is it possible to communicate variables from an sqf script to an arduino or to a python script, with sockets or by bluetooth?
My goal is to give in real time the pitch, roll and yaw angles of my plane/helicopter to an arduino card (by blutooth?) or if this is not possible to a raspberry pi (with sockets recovered by a python script?) .
The script to get the angles is already done.
you could do that by creating a custom dll
I'm glad there is a solution. Can you expand, I didn't really understand ?
I want to remain thin, I don't want to expand!
basically, the game can call an extension (a custom dll)
the dll can then do whatever you want it to do, provided you know what you are doing with it
You got Pythia as extension: https://github.com/overfl0/Pythia
Idk if it's accepted by battleye though
thank you, I think it will help me
for some reason cameraEffectEnableHUD true doesn't help to drawIcon3D over camCreate effect, an I doing something wrong here?
See the ArmaCOM mod for Arduino support
Basically you can write one yourself by using CreateFile (see win32 api) on the COM port and adjusting the BaudRate, etc.. But don't connect the Serial Monitor at the same time obviously.
Ah you said Bluetooth didn't see that. Never used Arduino with Bluetooth so no clue 
Hey guys, my addAction isn't showing up at all and its just telling me something like 'this **|#|**addAction ["Switch Lights On"...' Expected Error Type Code, Expected String
Its in a black box on the top of the screen
Im extremely novice in scripting so I barely even know what that means. Im trying to make it so that the player can use a laptop in the base to turn on and off the halogen lights set up around.
@ me if you have a response to this plz
Post the whole script
Alright wait one
What the error means is you've placed code {} in a place that needed string ""
Oh ok
Ill post in a second
this addAction ["Switch Lights Off",{Halo1 switchLight "OFF"},{Halo2 switchLight "OFF"},{Halo3 switchLight "OFF"},{Halo4 switchLight "OFF"},{Halo5 switchLight "OFF"},{Halo6 switchLight "OFF"},{Halo7 switchLight "OFF"}];```
Most of this is guesswork to be honest
This is placed in the laptop's init
Uhh
Well yes it's wrong
I assumed so lol
I've gone thru that wiki page so much, I just don't understand it really
see the examples, they will help
I did though, thats how I ended up doing this
Ive gone to it over and over and I just dont understand wtf a string and a statement and all that are
From what I can understand you just want to turn a bunch of lights on and off?
issue is you are giving it too many scrip params
so addAction takes [string - name, script, arguments, number - priority, etc...
and you are giving it [string -name, script, script, script, script, etc
what you wanna do is convert these multiple script blocks into one single one like so:
your code: {Halo1 switchLight "ON"},{Halo2 switchLight "ON"},{Halo3 switchLight "ON"}, etc
becomes: {Halo1 switchLight "ON"; Halo2 switchLight "ON"; Halo3 switchLight "ON"; all others}
Oh okay
Testing it rn
Oh and heres the real kicker: will it be able to run in multiplayer? I havent had issues with addAction running in multiplayer before but I dont understand much abt scripting so idk
addAction has a local Effect, meaning it needs to be executed on each persons machine
addAction should. Im not sure about switchLight as it has localEffect. SO one guy will be switching lamps on off. But effect will be visible only to him
Ah damn
Is there a way to make that work? Is there another global light switch? Lol
And it doesnt even work in single player anyway lol. The addactions show up but the lights dont activate. Theres no error code tho
infact there is π but not so obvious one.
You could always use remoteExec to run the script globally on all clients. But for sake of simplicity
setDamage has global effect and light will turn off if sufficient damage is dealt to it.
So you can light setDamage 0.99; - Turn light off and light setDamage 0; light on π
you dont wanna destroy the lamp with setDamage 1 (1 means 100%), because you cant bring it back to life after
Oh thats creative
Note I haven't tested anything but this might help
lights.sqf
params ["_target", "_caller", "_actionID", "_arguments"];
_lightList = [Halo1,Halo2,Halo3,Halo4,Halo5,Halo6];
switch (_arguments) do {
case "ON": {
{
[_x, "ON"] remoteExec ["switchLight", 0];
} forEach _lightList;
};
case "OFF": {
{
[_x, "OFF"] remoteExec ["switchLight", 0];
} forEach _lightList;
};
default { };
};
Init of Light Switch
// PathToScript needs to point to lights.sqf or whatever you name it
this addAction ["Switch Lights On","PathToScript", "ON"];
this addAction ["Switch Lights Off","PathToScript", "OFF"];
Oh typo
Thanks guys, Ill try both and see what I like best. If the damage one works ill probably use it cuz it seems very simple
is the player dead?
oh wait, if i add cameraEffectEnableHUD true; right before drawIcon3d on each frame it works
Hi there, would anyone be willing to hop in a call and answer some very nooby questions? Just started looking into scripting today and struggling a lot
why not ask them here?
I could for sure but feel it would be easier to just talk through them, I'll post them if no one bites though!
There is a way to destroy buildings instantly, with no dust, particles, destruction sounds and animations?
Just change them direct into destroyed state.
setDamage alt syntax with useEffects = false
However IME nearby objects still take damage from the destruction, which feels like a bug.
So we still use the stupid buggy createRuin hack.
So im trying to set certain respawn points to certain groups within my unit for example say I want reaper 1-1 to spawn only at the markerPos ReaperSpawn(using the marker text not variable name) how would i do so cause the code I've used isn't working and im assuming its due to the lack of scripting knowledge I have here's my code so far. Any help would be greatly appreciated! Ive placed the code in my initPlayerLocal.sqf note this is for my multiplayer server https://sqfbin.com/ixihagowelequdoxajuv
not sure if my method is a proper way of going about this
Wow! Amzing, thanks a lot.
please edit your message to use https://sqfbin.com/ thank you
@winter rosedo i just paste the code there and share it?
yes, it will create a new URL you can insert in your message π it is to avoid walls of code in the channel
I cant really test anything at the moment but I bet you probably could use Markers as the respawns and depending on the unit you selected, what group its in you could locally create Markers through code, that is under the assumption that respawn positions can be local, I will have to test it tomorrow
@sweet zodiacthanks appreciate it no rush ive got other things i can work on within the mission files in the meantime! If you figure out a way lmk in dm!
They can be local, I believe
https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
has anyone made a multiplayer campaign utilizing disableMP = 0; in their campaign description file?
why?
(most likely someone did)
to use as reference when setting it up since it really isn't referenced well on the wiki if its possible or does anything. referencing the EXP campaign, it looks like they just define the missions and then have a normal server cycle through the mission levels instead.
if no one has made a functioning mp campaign utilizing a campaign description file, then I'll just go run head first into it and see what works and then make a post later
disableMP = 0 is the default setting
the Arma 2 campaign is a (player-hosted) MP campaign
the Apex campaign is a (dedi-compatible) MP campaign
sooo I would say it has already been done?
didn't think about looking into arma 2
I guess the question is, has someone made a arma 3 campaign that is player-hosted out of the campaign menu vs hosting it out of the mp menu (like apex)
When I destroy a building, the building's ruins appear, but the building itself is still there as well. I'm trying to remove the original building by placing an Edit Terrain Object module on it, and putting this in the module's "Object Init":
_buildings = vehicles select {_x isKindOf "Building"} inAreaArray _this;
if (count _buildings > 1) then { hideObjectGlobal _this };
}```
The first line should see if there's any other objects around the original building (which should be referred to as _this according to the module) and then the second line should remove the original if there's any other structures (the ruin) detected in the area.
It's not working, nor is it giving me any errors. What did I do wrong?
use the position of the terrain object and use nearestTerrainObjects to grab and modify
don't use the module
Where would i use the code instead? Im planning to use this on multiple buildings so I dont want to have to copy and paste over and over, can i make this a function
you can, then feed the function world positions
actually, you shouldn't even need to clone, nor hide the terrain object you grab. just set its damage right there
its something with the edit terrain object module that is just wonky
But without the module, how would i assign this function to a terrain object?
Or is this supposed to apply on all of them at the same time
it would be after mission start. you'd build a whole script that runs after postInit that modifies your terrain objects
let me see if i can dig up something from an old terrain modification that I did via script rather than builder to show you
Im not setting them all to ruins though, it would have to remove only the specific original, only when it specifically spawns in its ruined form
here is something from an old modification I did to create a war torn type feel
https://sqfbin.com/aludeyuxaqiruguyozeg
I have questions about scripting for respawn position. Is it possible for having different respawn position for different player on same side ?
For example, Person1 sees the available respawned point is Respawn1 . But Person1 does not see Respawn2 (as it is only available for Person2). Anh vise versa
[_playerOrUnit, [0,0,0], "My Respawn"] call BIS_fnc_addRespawnPosition;
"_object = call compile "Extraction_1";"
@torn hemlock
Dont, use missionNamespace getvariable ["Extraction_1",objNull];
How can i change the probability of presence using a script within a modules init? Any idea to the code to that? Maybe this setVariable ["#probabilityofpresence",1]; ???
But mom, we like compiling things.
might as well compileFinal :D
^ this guy has the right idea.
a = compileFinal "a"; << game crash in last version :P
akward.
your module doesn't have the probability of presence under the presence tab?
Yes, BI did with Arma 2
maybe others too, I don't get why it is important
"if nobody did it, you want to be the first, if someone did it already, nevermind"?
@fair drum yeah but i want to do it via a script. modify it on the start of the mission.
long story... just can it be done?
yes, but I'm looking to see if the arma 3 menus support it.
"if nobody tried it, I'll try it. if someone tried it and found it not possible, I won't. if someone tried and was successful, I want to copy for my own so I don't have to"
think rather than chance of it being there but rather, chance of it not being there. just run a dice roll post init and delete the modules
i suppose i could justtt make my own and then delete the module.
But im pretty lazy
hahaha
Are these your own custom objects?
If both original and ruin show up it indicates botched configs that break destructioneffects class
No, it was to fix damaged models not working for the interiors with cup mod but I found a fix
Gotta save that 0.00100000ms
But this is good to know in case I make my own buildings
which I'm thinking about
then "try and thou shalt see" as always
I'm using setParticleParam to change some params on a particle source, but my changes are ignored. This is what i do:```sqf
_source = "#particlesource" createVehicleLocal _pos;
_source setParticleClass "HeavyBombExp1";
_source setParticleParams _myParams;
For example, i change size to [30,60] (original is [12,26]), but the change is ignored, the particle stays with the original size.
Here is _myParams: https://sqfbin.com/ovawakufozoyayuyahub
I have a custom mod for my group that adds a button to the multiplayer drop down to connect straight to the server, so Im sure you probably could find some way to host a thing like Apex
if ((random 1) > 0.5) then
{
//spawn, adjust 0.5 as needed
};
Don't all Objects in the editor have a presence probability attribute?
please edit your message using a https://sqfbin.com/ link to avoid the wall of code, thanks
I think 0.001ms is within the bounds of error...
cant remember if i asked weeks ago ... is there a way to get vehicle mass from config/class?
probably not? it's stored in the models geo lod
:\
so only way I know of is getMass on an actual vehicle
Is there a way to return relative position of a weapon attachment?
dont think so
Perhaps sprungMass*number of wheels could be accurate enough?
Oh nvm thats still the model :/... or maybe not
anyone know how to make the AI talk to you in sidechat?
Edited
Looky at examples. It contains exactly that:
https://community.bistudio.com/wiki/sideChat
thx m8, suprisingly simple
Hello, me again, having Syntax issues and I can't work it out
This is what I've coded and this is the result:
natoPlayers = allPlayers select {alive _x && side _x == west};
natoPlayersInArea = allPlayers select {alive _x && _x inArea sleepArea && side _x == west};
missingPlayers = [];
if (natoPlayers isEqualTo natoPlayersInArea) then{
["True"] remoteExec ["hint", 0];
}
else
{
{
if(natoPlayersInArea find _x == -1)then{
missingPlayers pushBack [(name _x)];
};
} forEach natoPlayers;
missingCount = count(missingPlayers); // to be used in further dev
missingString = missingPlayers joinString ", ";
format ["Can't sleep, \n%1 is not in the bunk room", missingString] remoteExec ["hint", 0];
};```
This is good, but obviously, missingString looks like an array, I want to format this array to be more eye friendly
It appears composeText does what I want it to do, but when I use like this:
missingString = missingPlayers joinString ", ";
missingHint = composeText missingString;
format ["Can't sleep, \n%1 is not in the bunk room", missingHint] remoteExec ["hint", 0];
I get composeText: Type String, expected Array
when I do this:
missingString = missingPlayers joinString ", ";
missingHint = composeText missingPlayers;
format ["Can't sleep, \n%1 is not in the bunk room", missingHint] remoteExec ["hint", 0];```
I get `composeText: Type Array, expected String, Text`
Any help on this please?
you don't need composeText
missingPlayers pushBack [(name _x)];
that results in
[["player 1"], ["player 2"]]
You should just select {!(_x inArea sleepArea)} in the first place.
pushback _element
append _array
composeText takes an array anyways where joinString returns a string
but as lou said you dont need it
Sorry, maybe I've not made myself clear
In my hint that pops up the player's name appears in the hint as ' ["player's name"] '
yep, its cause what Ampersand said
I'm trying to remove the quotation marks and square brackets that have come from the srray
you have an array of arrays so _arr#0 is ["iamaplayername"]
What you are doing is:
missingString = [["MyMan"], ["MyMan2"]] joinString ", ";
which return [MyMan], [MyMan2]
gotcha
Makes total sense now, thanks
sry edited
fixed, thanks @stark fjord for bringing the help from @digital hollow and @winter rose to life
thanks for the tip on the not in area select too, didnt think of it that way
bad idea to read/write to/from a .json file on arma server whilst it's running or would the performance difference be unnoticable?
havent a clue how a3 server runs and whether little more than another rpt would be detrimental to its performance
what kind of write, some kind of mission save?
writing a string to a json file
how big string?
doesnt sound like a problem then, you can run speed tests in the debug console
does callextension work for debug console speed tests 
well callextension returns a value so yes
guess im figuring out how on earth i make my code run with unmanagedcallersonly
with callextension it shouldnt be a problem anyhow. Well depends how extension is written
file read/write is slowest operation you can probably do though
either way im hosting a discord bot from my arma server thats doing database management accessible from the server because i am too lazy to script pinging the server etc
yes but with dll you can just do it in separate thread, where you just pass params to it.
So all you do from arma perspective is give function the string and forget about it.
Unless you wait for return.
thats true tbf
in which case it'd just be waiting for return for the functions that need a return value... i think
quick sense check please
[.sqf to be executed] remoteExec ["execVM", params to pass];
is this correct?
no
no.
If you call more than once. Like in remoteexec wiki , it's recommend do function of your sqf file.
seen
[.sqf to be executed] remoteExec ["execVM", locality,params to pass]; ??
if you define a function in cfgFunctions all you need is
[paramters] remoteExec ["TAG_FNC_myfinefunc", <remote target>];
also paramters are not <remote target>
// Lets remove A Specific Weapon from Everyone
[player, "WeaponClassName"] remoteExec ["removeWeapon", 0];
// Another example lets run a function that needs 2 Arguements
[_object, ["Weapon1","Weapon2"]] remoteExec ["TAG_fnc_removeCertainWeapons", 2]
// the First argument _object is the player or Unit we want
// The Next argument is an Array containing all the Weapons we want to remove
// I also set the execution target to 2 so it only executes on the server
cheers, will do this
...
to [first, second] yes ^^
can you sort array filled with systemTime/s somehow?
awful performance but if you can convert to just numbers i would imagine you could just use regular sort in a new array and iterate through that and find in the old array and so on? polpox requested sort command that takes code but until then think there's no easy way 
hmmm well I know there is BIS_fnc_sortBy but IDK if it can be used with this
well how is your systemTime formatted, array of numbers?
And the array is [systemTime, systemTime, systemTime]
I don't see why BIS_fnc_sortBy would not fit?
strings
BIS_fnc_sortBy β algorithm argument
oh
nice π
i dont get what to put there XD
ur mom
Oh damn
I have used it before but not with this
{ _x select { str _x } joinString "" } I guess?
β¦the function, right?
yes
making it a string? it can read that?
hard to believe π
A good come back to this would be "No, ur mom" but missed chance i guess.
lucky for Lou mothers day was yesterday π
yeah i know i spent some time with her
this is weird, Im looking at the code in fn_sortBy.sqf and it seems to take only scalar for the algorithm
_this select 2: sorted algorithm (Code) [optional: default {_x}]
- code needs to return a scalar
- variable _x refers to array item
that's the comment, not the code
i know....
needs to only return a scalar
so just turn ur array of time info into a long number
would that really work? Im so bad at this...
yes because lucky for us all time (currently) flows linearly
2024042403040506 is a day before 2024042503040506 so will be ordered in the order they are in this message
Well with enough energy...
i sense another mother joke incoming
so this ```sqf
_v = ""; { _v = _v + (str _x) } foreach systemTime; _v
or ```sqf
_na = systemTime apply {if (_x < 10) then {"0" + (str _x)} else {str _x}}; _v = ""; { _v = _v + _x } foreach _na; _v
please dont name your variables like that
that was just quick console test
2nd
ok
lou should dll debugging go here or #arma3_tools 
you want 2023051519025900001
not here
fuck
Slight side note, if all the systemTime's are inside one array why wouldn't systemTimeMegaArray sort false not suffice?
[systemTime1, systemTime2]
gladly
because its array of arrays of strings
meet you under the eiffel tower in half an hour
rawr x d
systemTime Returns an array of Numbers and sort can sort Multidimensional Arrays assuming they have the same elements which systemTime will always return consistently
That's what sortBy does. It builds the array for you and calls sort on it.
just using Sort lets you skip the middle man essentially
Just to note if you need to save anything alongside it lets say messages or anything else that's a string, just append an Array with your Info to the systemTime output when you run it
example
_time = systemTime;
_time pushback ["Stuff1", "Stuff2"];
This way Sort will always have the subarrays all being the same amount of elements.
Adhering to the Wiki's Warning Subarrays should be of the same structure. Subarray elements other than String or Number will be ignored during sorting.
sort's not working π¦ but BIS_fnc_sortBy does
I tested it just a second ago and it worked are you sure you are using sort correctly? Β―_(γ)_/Β―
So sort's sorta not working but other sort sorts?
probably doing something wrong I got only the BIS_fnc_sortBy to work
That some hell of a mess to sort out
ya thx π
how do I make specfic spawn positions for specific groups (eg. Alpha 1-4)?
I got like 3 groups on blufor, and I want each group to spawn on a specific spot
[_Group, _spawnPosition, "Respawn Name"] call BIS_fnc_addRespawnPosition
Anyone know of a way to "Count" time since a script was executed? Using diag_tickTime returns the time since the mission was executed
diag_tickTime - diag_tickTimeThatWasSavedAtTheBeginningOfTheScript;
Fantastic Variable name
π€
just to be curius... how long a variable need to be, to have some kind of trounble lol
If you write a novel for a variable name anyone else who reads it will throw hands, unless it's funny
the more characters the more time spent parsing, but tbh below 100-200 chars would be unnoticeable, that's a guess π
and yes, always name your variables as if the code maintainer is armed and knows where you live π
how do I do the group part if it's Alpha 1-1? it says missing "]"
Give the group itself a variable name and slap that in there
Thanks!
Hey there, is it possible to "reexecute" the init box of a unit? Or is the code stored somewhere?
I looked at all variables of the unit but wasn't able to find it. Any ideas would be appreciated!
Is there a way to get all what ground texture is assigned to a particular cfgSurface? Basically I want to go through each surface for a map as defined in the cfgSurface and get what is the ground texture that particular surface is using.
you can read it from mission.sqm. see loadConfig
unless you gave the unit a variable name it's not easy to tell which unit the config belongs to tho
but if you made the init field yourself just turn it into a function and call it later
I see. The units don't have variable names. I'll look into it. Thanks for pointing me in a direction
Is there a way to stop a specific vehicle from dropping below a certain amount of health?
In all circumstances and with all mods? Tricky at best.
More "I want them to take a missile that is sure to damage the chopper but not kill them"
even if it's an "on damage taken" event handler for the chopper
that immediately sets the damage to what I want
