#arma3_scripting
1 messages Β· Page 95 of 1
OK so does it depend on what side takes said objective?
yeah
If blue has 2 objectives than delete first captured one objective right
delete a untill b falls to red
you get the idea
disable would be better.
once b is controlled by red, then a becoumes an active obj
now i have a mission file i found that does some of this, it also has a script that interacts with the objectives. the only problem is, i cant spawn the objectives in with sqf
Why not? Do they need to be global executed or something
refrence sqf file
idk why, it just doesnt spawn them
im on eu 02 testing it rn.
if i spawn the objectives myself in zeus and name them correctly the script still doesnt work on them. so i think they need to spawned in from sqf
Are you putting that code directly into a init box / comp and throwing it into public zues?
Why are you getting a bi scope variable on a null object to then make the module? Also pretty sure instead of createunit it is recommended to use createmodules for modules
idk, thats just what the sqf thing prints out
Wa
you fine with hopping in a call, i think it would be easier to communicate
On mobile rn so na sorry hopefully someone else can help
For pub Zeus though I usually just go to a place called zam for help as they seem to know more around restrictions etc
What is the main difference between functions and commands?
a command is an engine base command
a function is a collection of such commands
setDir is a command
params ["_unit", "_dir"];
_unit setDir _dir;
```is a function
@little raptor on ADT, when I click export config, nothing happens. Is it creating a file somewhere I need to look for?
is there any chance that multiple calls of setWaypointStatements on the same waypoint add statements instead of overriding existing statements?
But what is the difference between functions and scripts then? Just that functions are pre-compiled?
a function is a script
a script is just a load of code
(a script of things that the computer will do)
set, not add
yeah i just got some behavior that looked like they were added but it musta been a bug in my code
this madness finally seems to work (the arrows aren't markers. they represent actual abstract objects in game)
it's basically my hand-written Warfare mode
i survived the init order hell
there's no easy way to port it to OFP. but i also want to play it in OFP lol
@tough abyss maybe a happy guy being friendly to everybody here
well
thx to SQF
i dont have to be "that guy"
no
it does nothing
<3 sqf
script is a general term. it doesn't really mean anything. you can call any group of SQF expressions a "script"
commands are functions too. but they're defined by the game engine
functions are user-defined SQF scripts
ha ha ... still have to finish my SQF guide
its title is "SQF - Hell on Earth" (actual title is "SQF - HΓΆlle auf Erden" but as that guide is written in german ... ye .. translated for ya)
that just came up into my mind as i saw that message of you @jade abyss
a lie just like the π°
the cake was a lie
LIAR!
how would I disable the eagle eye zoom (RMB) on a server?
I can't find one answer in any of the forums I could use some help please
It's not possible AFAIK.
it's possible, I played in a unit that had it, I would have asked the dude but that was like a year ago
Might be visionAid in the difficulty settings but wouldn't know never tried to disable it.
https://community.bistudio.com/wiki/server.armaprofile
I'll try that
no vision aid colors enemies and friendlies
Colors how? Like an overlay? Or in the corners of the screen when looking away?
yeah he's right
it'll add a transparent overlay over enemies
it shows like small circles, so if an opfor is on your right it will show a red circle (somewhat transparent)
how the heck do I disable RMB zoom then ffs, my old unit had it and VTN mod also have it
I guess you can override the button
Ah though that was enemyTags. Wouldn't know have all that stuff disabled anyway.
what do you mean override the button?
as in make the button not do anything
or better said override the action
not button
you can do it via addAction
oh
that's for LMB (fire) tho
idk what the action name is for zooming temporarily
I guess opticsTemp?
I am about to ask ChatGPT
π€£
looks like it doesn't work with RMB
sigh, chatgpt gave me some weird gibberish as well lol
// Function to disable RMB zoom (Eagle Eye) for binoculars
disableEagleEyeZoom = {
player addEventHandler ["MouseButtonUp", {
params ["_unit", "_click", "_button", "_shift", "_ctrl", "_alt"];
if (_button == 2 && (currentWeapon _unit) == "Binocular") then {
forceCommandingMenu "#USER:vehicleZoomOut"; // Use any harmless command to override RMB behavior
};
}];
};
// Execute the function when the player respawns
onPlayerRespawn {
_id = _this select 0;
_unit = _this select 1;
if (hasInterface) then {
_unit spawn disableEagleEyeZoom;
};
};```
like wth
A good reason why you shouldn't use chatGPT for arma... Well unless you know what you are doing...
Yeah no, never, I just wondered if he could find any answer, but idk wtf that is
It's trying to prevent the user from using binoculars.
lol
what is?
this
this?
oh
how lol
what did you change?
not gonna say π
$100
ain't no way this is happening
EmptyMenu = [
["",true]
];
findDisplay 46 displayAddEventHandler ["MouseButtonDown", {
params ["_disp", "_button"];
if (_button == 1 ) then {
showCommandingMenu "#USER:EmptyMenu";
};
}];
findDisplay 46 displayAddEventHandler ["MouseButtonUp", {
params ["_disp", "_button"];
if (_button == 1 ) then {
showCommandingMenu "";
};
}];
well you still do see the menu π
but at least you can't zoom 
the menu is referring to the AI command menu?
yeah it's a commanding menu
well you can show a message in it
EmptyMenu = [
["Server Admin",true],
["Zooming is Disabled", [], "", -5, [["expression", ""]], "1", "0"]
];
there's probably a way to hide it too 
this actionKeys ["RMB", false]; will disable the use RMB completely I assume?
ah lol, I am noob at this sorry still trying to figure out stuff
ok I know chatGPT is somewhat dumb with arma 3 stuff but does this look right?
// Function to disable the AI command menu
disableAICommandMenu = {
// Create an empty invisible control to capture mouse events and prevent AI command menu
private _ctrl = findDisplay 46 createDisplay "ControlsGroup";
_ctrl ctrlSetPosition [0, 0, 0, 0];
_ctrl ctrlSetBackgroundColor [0, 0, 0, 0]; // Set the control background color to transparent
_ctrl ctrlEnable false; // Disable the control so it doesn't capture mouse events
};
// Execute the function when the player respawns
onPlayerRespawn {
_id = _this select 0;
_unit = _this select 1;
if (hasInterface) then {
// Disable the AI command menu when the player respawns
call disableAICommandMenu;
};
};
// Execute the function every frame to prevent the AI command menu from showing
onEachFrame {
// Find the displayed Commanding Menu and hide it (action menu ID 48)
_ctrl = findDisplay 46 displayCtrl 48;
if (!isNull _ctrl) then {
_ctrl ctrlShow false;
};
};```
to disable Command menu
no
hahaha
a friend sent me this, said he saw this somewhere long time ago
{
class disable_zoom
{
units[]={};
weapons[]={};
requiredVersion=1;
requiredAddons[]=
{
"A3_Functions_F"
};
magazines[]={};
ammo[]={};
};
};
class CfgVehicles
{
class All;
class AllVehicles: All
{
class ViewCargo
{
initFov=0.75;
minFov=0.75;
maxFov=0.75;
};
};
};
nvm it doesn't work, just for vehicles I guess
dummy = "logic" createVehicleLocal [0,0,0];
dummy attachTo [player, [-0.0441161,0.152569,0.131032], "neck", true];
dummy setVectorDirAndUp [[-0.403727,0.856752,0.320582],[-0.0251403,-0.388644,0.920953]];
addUserActionEventHandler ["zoomTemp", "activate", {
dummy switchCamera "internal";
}];
addUserActionEventHandler ["zoomTemp", "deactivate", {
switchCamera player;
}];
@brisk lagoon probably the best thing you can hope for 
I'll try one sec
also it only "disables" the temp zoom
normal zoom still works (using Numpad+- or mouse thumb keys)
so I found a mod that disabled zoom when you don't ads, and it works with vanilla weapons but nothing else, SPS and all those don't work with that
i did not forget i had launched arma and just walked off
https://sqfbin.com/dituhibugurinepuroki
Nothing that was done afterwards yesterday made any improvement in this 
lmao
are you still attaching it?
yes but same thing happens when submarine isnt attached
its just there to provide a better visual
I doubt that it's the same
(and i also attached a submarine to your example and it looked fine)
with the sine wave thingy
i shall record a very zoomed in video
no plz don't 
i must prove my point
you sure you tried this properly?
oh also I forgot to ask last night: is your server FPS stable?
yes and yes
as in locked exactly in a specific FPS?
i remember trying that one properly bc i had to relaunch it to correct the _newDirAndUp select 0 stuff
45 fps +/- .5fps or so
well the example I sent you should've worked just as fine as the rotation thingy
the only thing wrong with it is this:
but it should only be a problem if your FPS is not stable 
well it doesn't hurt to fix it still 
whats wrong with it aside from the fact i hate it
what is it?
not accounting for diag_deltaTime
ah
well you should test the submarine not the "logic"
suppose it's just a straight multiply by diag_deltaTime?
the submarine is just attached to the logic object
it doesnt get moved or touched at all
{
private _turnSpeed = (_config_TurnSpeed select _forEachIndex) * 45 * diag_deltaTime;
_newOrientation pushBack ((_x min _turnSpeed) max _turnSpeed * -1);
} forEach _targetOrientation;
to get the same thing as when you test in 45 FPS
(β―Β°β‘Β°)β―οΈ΅ β»ββ»
mood
at this point its usable but it could be better as you have evidenced 
for some reason the controls always seem to be flipped too regardless of their order in the controls array which is quite funny
but thats able to be fixed somewhat easily
and i still say that for jitter to happen you either need to have orientation applied not every frame or for multiple orientation sources to fight 
well that's because Arma's directions are reversed
they're CW not CCW
no as in pitch is now yaw etc
so back then when you used BIS_fnc_rotateVector3D it was rotating them CW
i could try take it out of a cba pfh?
maybe you wrote them wrong?
unlikely that is the issue but its a possibility
could be causing orientation not being applied every frame on dedi π€
nope, exact same
Anyone got any ideas why restarting a server normally saves mission progress, but an admin running the #restart command in-game would cause it to lose all progress/save data?
The mission in question is a modified version of liberation
though I dont believe the modifications are the issue. The issue apparently only started happening recently but no changes have been made to the mission in that time-frame
Hello, I saw I can use the function backpackItems to get a simple list of every item in a unit's backpack. Is there a function that does the same for a container?
I think your looking for this
https://community.bistudio.com/wiki/getItemCargo
that seems to only get item type, erm, items. It doesn't get magazines, for example. Also, if an item repeats, it stores the count in a separate array, where the result of backpackItems just adds another entry with the same item to the array it returns.
For the same format as backpackItems, use itemCargo.
There isn't one command that returns everything in a vehicle; you'd have to combine the results of itemCargo, weaponCargo, and magazineCargo. There might be a function that does this, but it's pretty simple to do it yourself.
* when I say "vehicle" that also means crate inventories, they're the same system
Related, what's the difference between addItemCargoGlobal and addItemCargo and similar functions?
Network locality.
addItemCargo works only on objects that are local to the machine where the command is executed, and only adds the item on that machine. That means that if, for example, a client runs the command on an object that's currently local to the server, nothing will happen, and if it runs the command on an object that's local to that client, only that client will see the item. (Though inventories might be synced at some point regardless, not sure)
addItemCargoGlobal works on any object no matter where it's local to, and adds the item for all machines.
On the command page, this is displayed as argument locality (whether the object provided as an argument to the command must be local) and effect locality (whether the effects of the command are visible globally), using the small icons just below the title.
I see, thank you, that really helped me make sense of it π
Is it possible to make draw3dIcon local to one player only? Meaning only one player gets to see the 3d icon and the rest doesn't?
The event handler Draw3D seems to be client side so I'd imagine that's how it works by default
For an MP mission, what command can I use to get the names of all Mission Parameters? I know I can use BIS_fnc_getParamValue to get the value of a parameter, but I want the names of all the parameters so I can set them with my mod.
iirc you need to loop MissionConfigfile >> "Params"
i got a q on CfgRemoteExec i have it on whitelist only, can the server still exec functions thats arent in the whitelist?
because i want to have a function wich the server can RE but the clients can't
https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec
These rules only apply to clients. The server is not subject to any limitations, everything is enabled and allowed for it.
my bad i didnt see that line, thank you
even tho its the first one on the page... smh
Do event scripts work in an addon? For example im putting initServer.sqf in my pbo's root and it doesnt seem to run
no
Oh, that's really odd. I'll see what I can do. I have some checking that basically finds if it's code vs text and forces to SQF if not text only, it must be breaking. Not sure why that would kill it though. Maybe the site hates x and decided to block hashtags 
which library do you use for syntax highlighting? iirc in highlight.js # is listed as an illegal character for SQF
(I made a PR but iirc it was never merged)
so if you use that, that's why π
dunno about the rest tho
Is it possible to save a composition and use a script to spawn it?
yes
although it requires a workaround as iirc there is no way to "really" spawn a composition, instead you use BIS_fnc_objectsGrabber to get an array of data of nearest objects and then BIS_fnc_ObjectsMapper to place them.
https://www.reddit.com/r/armadev/comments/alkycw/how_to_spawn_in_compositions_an_updatetutorial/ see this, should be up to date
11 votes and 3 comments so far on Reddit
Does anyone know why creating a display using the ui on texture stuff takes forever to be findable by findDisplay? Its taking up to 5 seconds before findDisplay is able to actually find the display by its unique name
You mean the game freezes for 5s?
are .ogv file formats able to support transparency? figure best place to ask is here
(video format arma uses)
Im using a sleep between the creation and the findDisplay
the game continues just fine
And you do this in SP?
Nope
sadge, thx
on a dedicated server, sorry forgot to say that. In sp it only takes about 0.1 seconds
I can work around it with a sleep and a faster loop, so I guess its not major
A bigger issue, is perhaps this one:
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if (_entity isKindOf "CAManBase") then{
_entity addEventHandler ["Hit", {
params ["_unit", "_source", "_damage", "_instigator"];
[_unit] call J3FF_fnc_handleHit;
}];
[_entity] spawn J3FF_fnc_createBloodDisplays;
};
}];
The hit event refuses to run. This whole script is being executed on the server. The spawn works great, but the eventhandler does not
Is the entity local to the server?
EntityCreated fires on non-local entities as well, and Hit won't trigger for those.
The entity should be local to the server. Its an ai being spawned through zeus. I was under the impression all ai were local to the server, apart from ones on a headlessclient
I also tried remote executing the eventhandler onto the server
depends. If you spawn them into a player group then they'll be local to that player.
Ah, no they arent being spawned into a group
ai spawned via zeus are local to the client that spawned them too iirc
I would expect them to be spawned local to the curator object, but if in doubt, check it.
ugh, exitWith does that non-obvious-escape thing when used in a getDefaultOrCall.
_testHM = createHashMap;
_testHM getOrDefaultCall ["wibble", { if (true) exitWith {0} }, true];
_testHM
[["wibble",<null>]]
Christ, HandleDamage generates two different general damage results for the same bullet in different frames
I shudder at the thought of the weird spaghetti code underneath this.
Hi guys, who know how to set turret target by default for UAV. I set AR-2 Darter in Editor on 250 height, but when I connected to UAV, pitch of direction equals 0, how to set custom target for UAV turret(when I connected turret watch on target). Analog of uav lockCameraTo [guy,[0]]; without freezing turret.
Currently I'm writing a script with a buddy of mine that involves sending hints to specific units. In this snippet, _initiator can be a unit or an array of units (vehicle crew). The friend wrote this with the intent for it to be a multiplayer-compatible script that only displays the hint to the vehicle crew, but this means when in singleplayer, I can see the hint whether I am _initiator or not. This is obviously immersion-breaking (and would confuse anyone toying with the mod in SP), and I'd like the script to also be SP compatible because it is tied to a bunch of mod vehicles' config event handlers.
Is there some way I can check if the player is in SP, and if so, only display the hint if player is in _initiator?
"Scan complete:\nInitializing repair." remoteExec ["hint", _initiator, false];```
Edit: I believe I have solved this by placing the hint calls in an `if` statement which checks a variable previously evaluated to be `player in _initiator`
Feck... yep 
if player summons a rain of cars that fall from the sky, and they kill someone on impact, how do i make it so the kill counts as being done by the player?
if the unit is killed by some object, who will be "killer" in the Killed EH?
basically i want the falling cars to be treated as projectiles
as if they were shot from player weapon
doc says it's the unit itself in case of collisions
what if it wasnt a collision but explosion of a grenade that was spawned using createVehicle
Quick question. Lets say i have a variable saved in player/server profile during run time on a mission. And i do restart the mission will that variable still be writen or will it desapear ?
It says here variable would be save persistently when the game is closed, but it dosen't say if the game was restarted that is my question.
It's persistent until the profile corrupts itself :P
Closing the game properly will save the profilenamespace to disk, or you can force it with saveProfileNamespace (do not spam. It's extremely slow).
I'm not exactly sure when missionProfileNamespace saves to disk.
can you change the engine added actions (scroll menu) somehow? like change the text?
No
ok thats what I thought too
Woah, so this is finally happening? π https://community.bistudio.com/wiki/createHashMapObject

Alright lads, I'm completely new to scripts and was curious to see how difficult it would be to make a script that would allow you to switch between uniforms in your inventory. Does anyone have any idea if that's possible in Armas engine?
Depends on your programming background. In general it's not difficult
Basically 0, I've written a couple of configs for uniforms but that's it
In Arma 3, setDamage
In older ones, dunno. If they support setShotParent you can create a fake projectile
I think I'm missing something, how do I set up an outro for scenarios? Wiki says that initIntro.sqf is run when intro or outro is started but from what I have tried so far it activates only for the intro phase. Do I need some variable to make a part of the initintro.sqf to be run in outro phase?
I'd say it depends how you end the mission
Well then it's kinda difficult
You need some SQF knowledge to understand this:
- Get the list of inventory items using something like
itemscommand - Iterate over the items and check if item is a uniform. iirc uniforms are defined in
cfgWeapons(orcfgMagazines). You can also use BIS_fnc_getItemType, I think - Switch to the uniform using
forceAddUniformand remove it from the inventory (removeItemiirc), and put your old uniform in your inventory (addItemiirc)
Oh I should of mentioned, I wanted to do it in a way that allows the scroll wheel menu to have the option to it; I wanted a dynamic change mid missions
I don't think I follow
I know that Outro can be either Win or Lose but there seems to be no getter or any function to set a part of initIntro.sqf to be played in any of the outro phases.
For that you need addAction
(or BIS_fnc_holdActionAdd)
thanks
Oh right wanted to look into that but forgot. Might need a ticket for me not to forget
Was finally happening months ago
Now is too late to make any more changes π
Does anyone know if there's an order that should be done between setVectorDirAndUp and setPos[...] like setDir? π
(i am running out of ideas on how to fix my code)
if there is its not what was breaking it
have tested vectormagnitude of the new vectordirandups in both world and modelspace and theyre fine too
https://sqfbin.com/iwadevuhasoruzovubay same orientation stuttering as before
wait, does curatorSelected give everything all curators have selected or?
It's very likely that it's local only. It'd be really hard to do anything with it otherwise.
It's local, yeah. Probably interface rather than logic object related.
how to unify vehicles in array across clients ? I would like to record on server all vehicles on mission and get some of them on client later by publicvariable
By making a function that receives an array as parameter, and appends to an existing array, and remoteExecing this function by the clients
[_clientArray] remoteExec ["my_fnc_add", 2]
params ["_arr"];
serverArray append _arr
This would not be very useful tho as you can't tell what belongs to who but it should give you an idea
seems I wrote incorrectly. I would like to compare vehicles by some "ID"
is vehicle object have unique id like players ? Which must be same across all clientsis vehicle object have unique id like players ? Which must be same across all clients
Normally you can compare objects by comparing objects.
yes but objects have netid which are different across clients, isn't it ?
No, that's the point of a netId.
Also the objects... are the same across clients. Mostly.
Map objects are generally local, so a separate copy of them exists on each client.
you can create local objects intentionally with script as well, but every normal function will create objects globally.
Understood, appreciate for answer
For a practical example, you can publicVariable an array missionTrucks on the server at init, and then any client could do cursorObject in missionTrucks.
in the eden editor the units/vehicles are listed via categories right?
for instance USA (USMC - D) and USA (USMC - WD), and each contain categories like Infantry (etc) Cars Tank etc
Is it possible via SQF to just grab units from a certain category without knowing any classnames?
I have taken a look at a script that grabs all units from one side:
_data = [
[ [], [], [], [], [], [], [] ], //EAST
[ [], [], [], [], [], [], [] ], //WEST
[ [], [], [], [], [], [], [] ], //INDEPENDENT
[ [], [], [], [], [], [], [] ] //CIVILIAN
];
{
if ( getNumber( _x >> "scope" ) isEqualTo 2 ) then {
_index = switch ( true ) do {
case ( configName _x isKindOf "CAManBase" ) : {
0
};
case ( configName _x isKindOf "Car_F" ) : {
1
};
case ( configName _x isKindOf "Tank" ) : {
2
};
case ( configName _x isKindOf "Helicopter" ) : {
3
};
case ( configName _x isKindOf "Plane" ) : {
4
};
case ( configName _x isKindOf "Ship" ) : {
5
};
case ( configName _x isKindOf "StaticWeapon" ) : {
6
};
default{ -1 };
};
if ( _index > -1 ) then {
_side = getNumber( _x >> "side" );
if ( _side in [ 0, 1, 2, 3 ] ) then {
_data select _side select _index pushBack configName _x;
};
};
};
}forEach ( "true" configClasses( configFile >> "CfgVehicles" ));
this would work I guess, but is there a way I can determine if a unit/vehicle is from a specific mod?
do you know the mod name
Yeah, currently using RHS but I would be able to find out mod names yes
they're called "editorsubcat" iirc in config
but mods sometimes define their own
there's no standard
I forget the command for it, but you can see what addon something is from
unless ya type object type
hmm it might just be better to go about it the way this script is doing it and then filter based on mod
configSourceAddonList, configSourceModList
oh that looks like what I need, thanks
unitAddons typeOf player;
also there's that
although, that gets the addon- err- "sub" addon.
OPTRE_UNSC_Units_Army in my current mission, as opposed to "OPTRE"
gotcha, ill fiddle around with these and see what works best for me
this seems to be abouts what I need. When playing as a RHS USAF unit it returns @RHSUSAF which is the mod name. Good enough for me
hint str (configSourceMod (configFile >> "CfgVehicles" >> (typeOf player)));
Incase anyone is curious or needs it, I modified the above script like so to get units/vehicles etc from specific mods.
https://pastebin.com/86msrrTV
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.
is there a way to reduce overall brightness of lights?
It seems like EVERYTHING is blinding here xD
... Configure - Video - AA & PP?
Correction: for reflectors.
Or- wait- idek, all I know is headlights are blinding at night. But the decor street lights are perfect
gas price sign. obviously it's washed down b/c of how close I am, but still
maybe it is my brightness?
oh wait- nvm
ok, not something I can script to fix either x3
You can try playing with setApertureNew
is there a similar function to addHeadgear and addVest that lets you assign an insignia?
Hello, I'm trying to write the contents of a container to an inidbi file and then read them back and add the items to the container to create a persistent stash. I keep getting an error that I'm trying to pass a string and it expects an array and if I try to convert the string to an array, I get an error that it expects an array and receives a string. Can anyone tell me what I'm doing wrong? Here is my code:
_cargo = ["read", ["Stash", "Weapons", ""]] call ionStorage;
{
_currentItem = parseSimpleArray _x;
operationStorage addWeaponWithAttachmentsCargo (_currentItem);
} forEach _cargo;
It's tricky to diagnose this without knowing what ionStorage is actually returning.
Try doing copyToClipboard ["read", ["Stash", "Weapons", ""]] call ionStorage; (or copyToClipboard str (["read", ["Stash", "Weapons", ""]] call ionStorage;) if the first one gives an error) and seeing what it's giving you to operate on.
is there an upper limit to light flare range
so say I want my params to expect multiple data types, how would I go about that? something like this as far as I can tell?
_var should be either a string or an array of strings
params [
["_var", "", ["", []]];
];
also, say I was expecting a side what would I put for that?
any side
You can consider it checking the input with isEqualType
ah I see.
then for a function that will want the name of either one or multiple mods, and the side it should be getting for those mods I have something like this
params [
["_mod", "", ["", [""]]],
["_side", east, [east, [east]]]
];
I did read though would the length of the innermost array affect how many elements can be passed?
looking at examples on the wiki confuses me a little
["_mod", "", [""]] for only accepting strings
["_side", east, ["", east]] for accepting side or string
["_array", [0,0,0], [ [] ], [3,4]] for accepting only arrays of length 3 to 4
alright I think I understand it a little more. so for my _mod var I would want to instead do something like so? and do I need to define the expected length of the array?
[ "_mod", "", ["", []], [1, 5] ],
I need to format large numbers to strings with comma seperators. The following works but it seems like there has to be a simpler way:
_number = 58976504;
_string = [_number,100] call BIS_fnc_numberText;
_stringLen = count _string;
_iterations = floor (_stringLen / 3);
_leftOver = _stringLen - (_iterations * 3);
_array = [];
for "_i" from 1 to _iterations do {
_sel = _string select [(_stringLen - 3), 3];
_string = _string trim [_sel , 2];
_stringLen = _stringLen - 3;
_array pushBack _sel;
};
_array pushBack _string;
reverse _array;
_newString = _array joinString ",";
This gives "58,976,504", which is exactly what I want. So is there a simpler way?
I feel like there might be a function for it, but you can also use insert to avoid cutting up the string
_number = 58976504;
_string = reverse(_number toFixed 0);
_array = [];
for "_i" from 0 to count _string - 1 step 3 do {
_array pushBack (_string select [_i, 3]);
};
_newString = reverse(_array joinString ",");
also just a side note: your number is too big
numbers in SQF are floats
you shouldn't use any integer larger than 16.7M
because it's not accurate anymore
for example, 58976503 and 58976504 produce the same output
Great, thanks for that. That number was for testing, I won't be processing numbers larger than 9M, but that's very good to know.
array length is optional. [ "_mod", "", ["", []] ] would accept string or array of any length 
gotcha yep, I kept it anyway. My params appear to be working as intended.
is there a way to tell what side a unit is from just from the typename?
getNumber (configFile >> "CfgVehicles" >> (typeof _unit) >> "side") 
https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#side
oh perfect, thanks
just to refresh my memory, missionNamespace getVariable "TAG_var"; is the same as just using TAG_var right?
yes, outside of some specific circumstances (like with uiNamespace... block)
so I should be able to do something like (missionNamespace getVariable "TAG_var") set ["index", "value"] assuming TAG_var is a hashmap?
it works
awesome, dunno if what im fixing to do is considered janky or not lol. in my head it seems like a good idea
hey so after all those questions this is my final result. It appears to be 90% working.
https://sqfbin.com/ixasutolonikavaqupaf
I am having an issue though, it seems like its missing some things? specifically aircraft. I know RHS USAF has more helicopters and jets than the results I am getting (a single jet listed as a helicopter, and a single type of helicopter with multiple variations)
anyone see any obvious problems?
I have checked, one of the missing helicopters (AH-64) does inherit the Helicopter base
triggerActivated end_task_1;
How do I make the trigger activate when both end_task_1; AND a second trigger are complete?
Simple question but new to scripting
triggerActivated end_task_1 && triggerActivated yourSecondTriger in trigger condition
https://community.bistudio.com/wiki/Operators#Logical_Operators here's more info on operators for the future you
Thank you!! I couldn't figure out how to word my search earlier, but this is exactly what I needed
line 78: set ["helicopter", _plane]; π
also, there's no need to set those arrays, they would be changed in-place. And setting the third parameter of getOrDefault to true would auto-create empties when attempting to get them 
and after that heli/plane typo the counts seem sane on my machine? [["car",259],["static",26],["plane",4],["tank",44],["ship",1],["helicopter",37],["man",281]]
the problem with not all classes getting checked is likely caused by use of if (...) exitWith {}; in the body of forEach loop (or maybe that's just after my edits in the code). if (...) then {continue}; should be used instead
(another styling tidbit: in line 49 if ( getNumber( _x >> "scope" ) isEqualTo 2 ) then { can be changed to if ( getNumber( _x >> "scope" ) isNotEqualTo 2 ) then {continue}; to save the entirety of block from extra level of indentation)
Anyone able to help me pass parameters from a module to a function? I tried following the docs example, but that broke the bis music function call, so I reverted to an earlier iteration of my parameter setup, but now the script only uses the default switch case.
Edit: solved by replacing everything above _tracklist with:
_logic = _this param [0,objnull,[objnull]];
_TrackListIndex = _logic getVariable ["TrackListIndex", 5];
_TrackDelay = _logic getVariable ["TrackDelay", 5];```
wow cant believe I missed that, thanks. Ill also try your other suggestions now and see if I get the correct results
yep that solved it thanks. Cant believe I missed that still
Howdy people, and welcome to today's episode of "I can't make a simple thing work".
I'm using this script : this setObjectTexture [0, "AT4meme.jpg"];
It's meant to display a little meme on some AT training. For some reason,whenever I close/open again the mission file, the image disappears from the mpmission folder, and therefore the script can't execute, any idea ? (I've tried closing arma, and only then adding the image, but once I reopened the mission in editor, the JPG disappeared again
Firstly, you're misunderstanding a bit - the code will be executed anyways, just it can't find the image.
How do you put the jpg? Where? and what do you mean by
I close/open again the mission file
?
Hey, it was the mission folder (next to the mission.sqm in Mpmission)
Apparently now it's fixed (Idk why, tbh)
Now another problem that I have is that the image displays only a part of the image (like my image would be too big). I've put the dimensions I found online for the whiteboard (1024x1024) using photoshop, but it doesn't seem fixed
Big or small is not even a concern. Which is your billboard?
Whiteboard
This is the texture that is used in Altis' Whiteboard
You already know why it does show bigger
I see
Blank whiteboard texture is located in \A3\Structures_F\Civ\InfoBoards\Data\MapBoard_Default_CO.paa
Where/how do I access that ?
Opening PBO
Imma look stupid but where do I open PBO ?
Well, Google can suggest. There is more than one ways
Hello, I am still having issues using findDisplay to get a display created by a procedural texture on a dedicated server
It consistently gives No Display no matter how long I wait after I create it
This is the line that creates it:
_unit setObjectTextureGlobal [_forEachIndex, format ['#(rgb,%1,%2,1)ui("RscDisplayEmpty","%3")', _texSize#0, _texSize#1, _uniqueUIName]];
How's _texSize?
_texSize = getTextureInfo _x;
if (_texSize#0 > J3FF_UIE_TexQuality) then{
_texSize set [0,J3FF_UIE_TexQuality];
};
if (_texSize#1 > J3FF_UIE_TexQuality) then{
_texSize set [1,J3FF_UIE_TexQuality];
};
This script works perfectly fine in singlePlayer, but mp breaks the display bit
What is J3FF_UIE_TexQuality?
Okay then, how do you verify it is No Display?
I use finddisplay and then remoteexec systemchat it
More precisely. More like the code itself
//Buffers until the display is created.
_breakTimer = 0;
waitUntil {
sleep 0.25;
_breakTimer = _breakTimer+1;
if (!isNull (findDisplay _uniqueUIName)) exitWith {true};
if (_breakTimer>100) exitWith {true};
false;
};
_display = findDisplay _uniqueUIName;
[(format["Display:%1",_display])] remoteExec ["systemChat", 0];
in theory it shouldnt be leaving until the display exists or until the timer exits it
Is this running on the server itself? I don't know if the DS can do display/UI stuff since it... doesn't have a display or UI
Might need to do it locally on each client
Its running wherever the ai is local, and the ai is placed in 3den, so very likely the server
hm alright, I could give that a try
Ok I think that worked @hallow mortar ! Im creating the displays on a client now. A slight problem is that I cant then find said display inside of a hit EH, it gives the No Display again
EH is being added wherever the client is local
mm maybe its because the display only exists where it was created... so on the client
okok
nah, on listen server setObjectTextureGlobal from any machine does create display on all (both checked) clients
what's _uniqueUIName? How is it synced between machines?
its attached to the unit as a variable when the display is created, and then is grabbed later
and ive just confirmed that the variable is valid and correct
Also, when I try saving the display itself instead of the name, it prints back as No Display in the hit event
saving display on any one machine is pointless as all displays are local 
So is there a way to do it then?
I even tried remoteExecuting the bit of code from the hit EH on the client where the display was created
what you're doing now: save unique name as a string, findDisplay locally on machine where it's needed 
Ill try it again, but it didnt work last time
I might have made a mistake with the publicity of the variable, testing it now
and given that each and every change to the UI texture would need to be remoteExec-ed (as all displays are local), just changing to remoteExec-ing setObjectTexture on every machine can work as well
Alright I have it working mostly. Now I need a script to make sure the client that the display exists on is still in the game
all displays are local
Ya... Ive modified it to be handled by the clients with just setObjectTexture like you suggested
How can I loop a sound "AlarmCar" for 10 seconds? Shoud I use playSound or createSoundSource?
Depends if your sound was created in cfgSounds or cfgVehicles
Hey all, wondering if anybody has any advice about an issue I'm having on my life server.
After the server has been up an hour or so and the population gets high, some players start becoming invisible to one another. I've seen this mentioned in other Arma 3 bug post on google and haven't found any solutions.
It was mentioned it may happen after a ragdoll has occurred to a player (such as being hit by a vehicle). I've got a few actions happening once the player stops playing the 'unconscious' animation, but hasn't helped the issue at all.
Could anybody offer any insight? I'm quite lost with this one.
Need some help with a module setting a variable to true, which is checked by a trigger...
My trigger has the condition _B47_WZ_ModuleMissileLaunched = true;, but it won't activate when the sequence reaches zero. Is it something wrong with the trigger? Module? I'm not really sure what since to my knowledge that's a global variable.
I don't know much about how the cfg thing works. But the sound plays only with the playSound command, without defining new sounds. So I looped it with while do. What else can I do? Or what's the difference between those two sound commands?
Negative, the _ at the start of the variable name denotes a local variable
Ah, thanks. I noticed that in a function a friend wrote, he used a setVariable command. Would it also be in good practice to use that on this variable in the missionNameSpace?
I would follow this:
https://community.bistudio.com/wiki/Variables#Local_Variables
how can a random sleep time be synchronized if the script is executed globally? i just noticed that it doesn't choose the same random sleep time for everyone
Store the value of the random sleep interval in a public variable
@opal zephyr display might only get created when it's visible on screen
@quiet pagoda
Look at disableAI and doSuppressiveFire
thanks a lot!
Hello and thanks for replying. I tried using the copyToClipboard commands and they don't copy the value. I can show the value of Weapons on screen through *hint str _x; * and it's ["hgun_P07_blk_F","","","",[],[],""] from the Weapons key in my inidbi file. The whole file looks like this right now (it only has a handgun, a separate mag and a bandage in there I put for testing):
[Stash]
Weapons="[["hgun_P07_blk_F","","","",[],[],""]]"
Magazines="[["16Rnd_9x21_Mag"],[1]]"
Items="[["ACE_fieldDressing"],[1]]"
Backpacks="[[],[]]"
When I try to pass it to addWeaponWithAttachmentsCargo it complains that it's a string and if I try to pass it to parseSimpleArray first, it complains that it's an array
ionStorage is a inidbi object made with ionStorage = ["new", "ionStorage"] call OO_INIDBI;
copytoclipboard takes string
thanks, so it's not a string and it's not an array... what is it? :))
oh but parsesimplearray should return a string 
Good thing one of the commands I gave them was copyToClipboard str ... then
yes, I tried that one and the clipboard was empty
is it emptying the clipboard or just not copying it
erm, it's returning something now so I must've done something wrong with it before. This is the result from copytoclipboard str _x: ["hgun_P07_blk_F","","","",[],[],""]
Edit: so that specifically doesn't work with copytoclipboard (without str), but if I try to use it with addWeaponWithAttachmentsCargo it's telling me it's a string
Ok, I think I figured it out by feeding it the value directly and noticed I had ["hgun_P07_blk_F","","","",[],[],""] and it expected [["hgun_P07_blk_F","","","",[],[],""], 1]
How to give player a backpack? This player addBackpack "B_Messenger_Grey_F"; does not work.
guessing https://community.bistudio.com/wiki/disableNVGEquipment doesnt work for players if so is there any way to disable night vision without removing it from players?
using a backpack classname that actually exists does help
player addBackpack "B_Messenger_IDAP_F" for example
π Where do I get the names then? This is the exact name from the list of objects in the editro.
in arsenal when editing unit loadout the classname is shown in popup. Or you can dive into config viewer
also, in editor it's "grAy", not "grey"
Backpacks are not included in this list
ah mb thought it was included in equipment
CfgVehicles West is not CfgVehicles Equipment :|
so im looking in the wiki for Dynamic Simulation and I see it mention Global Dynamic Simulation settings, is there a way to set Dynamic Simulation settings per unit/object?
For instance with a unit chasing after a player, the player may easily get away but I dont want the unit to stop there with dynamic simulation, I would like for it to complete a waypoint back to where it came from or something like that.
Describing it to myself now it would probably be better to just write a script that manages Simulation for units huh?
you can seed the rng and obtain the same set of randomized numbers across clients
I'm using drawIcon3D and need to set the default value for textSize because i want to change drawSideArrowns parameter.
What is the default value for textSize? See Wiki description:textSize: Number - (Optional, default: size of system) text size
What is wrong with this piece of code? It says that I use wrong data type. if ((restrictedAreas select {player inArea _x;}) == []) then {suspicious=false;};
you are selecting from a list using a boolean while comparing an empty list πΏ
arrays should probably be compared with isEqualTo
I donΒ΄t get it, a select should return an array of items that satisfy my expression, then I ask whether it is empty or not.
does select has that type of syntax? im half zombie right now
look here
Is it possible to immediately cut the sideRadio of a unit without killing the speaker (it's a preset identity)?
You were right, this solves it.
font="RobotoCondensedBold";
sizeEx="(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
``` seems to match default values, found in `configFile >> "CfgSimpleTasks" >> "Icon3D"`
screenshot for comparison. Left with those values manually set, right with defaults
you should also use findIf instead of select
also, wiki seems to list incorrect default font
stop finding wiki faults
is there a way to just grab all map Locations or should I really just use nearestLocations with a radius the size of the map?
okey thanks then
Holly molly! Thanks a lot, i was expecting a number.
I will use that as the valuesqf (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)
I have a function that's printing out weird remoteExec errors, and I don't know why. A null object passed as a target to RemoteExec(Call) even though I believe that the function handles all possible null scenarios? This is the only place where this function gets remote executed so it must originate from here
https://pastebin.com/MgH6bPQ2
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.
All I can think of is _unit being deleted while this function is running, but what are the odds of that happening?
it says _unitObjectParent is null not the unit
ctor must never have side effects. ctor must never have side effects. ctor must never have side effects. ctor must never have side effects.
i had to reinvent the concept of "constructor" because SQF doesnt have that lolg
How do I convert a string to a variable name? _CustomSender is a string parameter from a module, and defaults to an empty string '', which causes the if statement to return true and work perfectly fine.
However, if I place a unit in 3DEN called missileman and enter that into the string entry box of the module, the else condition fires as shown. Currently, this is causing errors saying that B47_WZ_ModuleMissileSpeaker is undefined.
Secondary question - how can I include a check to make sure that a unit with a custom name exists? (If it does not, I will fall-back to the if statement condition and make one.)
so call compile _CustomSender;?
yeah
Yep, that's how the wiki shows it
https://community.bistudio.com/wiki/compile
it does
for example?
getVariable can also do this, as well as having a default fallback if the requested variable isn't defined
hello, i want to open the two gates at the front with a trigger Land_Airport_01_hangar_F
ID animate ["door_1_rot",1]
works at the back entrance
["door_2_rot",1] or ["door_3_rot",1] does not work for the two doors at the front
how about the command for the two front doors?
there is in config animate class
class animate {
}
[["door_1_rot",0],["door_1_locked_rot",0],["door_2_move",1],["door_2_locked_move",0],["door_3_move",1],["door_3_locked_move",0]]
so you can use
// Close
private _hangar = cursorObject; // or this , testing with cursorObject
_hangar animate ["Door_2_move", 0];
_hangar animate ["Door_3_move", 0];
// Open
_hangar animate ["Door_2_move", 1];
_hangar animate ["Door_3_move", 1];
thanks π
how can i check if a number is negative or positive
im not trying to make it so -4 becomes 4
but i need a check that only returns true if a number is positive not negative
_x > 0 
Do people have a simple pop-up text script for a zeus op? Go on youtube and google and all I can find is "how to add pictures and videos to your intel" or "how to make it go into the map" and "this works in sp scenario" -_-
I just want simple pop up text like the one that comes when you complete a task in vanilla scenarios
Why not just use the hint module to send all players a hint then. Advanced hint in achillies works well.
If that's not what you mean you need to give more context
I'll test that out, thanks!
But to give more context: I want my team to go to a laptop, interact with it (take intel), and when that's done they will get a short pop-up message that says the intel
Intel module in achillies does exactly this
No other way? I really don't want achilles in my ops
Well sure. Here's a vanilla friendly way
- Put down the object in editor
- In the init create an add action
- Within the addaction use the hint command and write what you want
- The above works for sending the hint to the player interacting. If you want to send to all players you need to remote execute hint
I ended up doing:
this addAction ["079001 or 074006", {}];"
And it satisfies my needs, even if it's very dull and amateur ish. You got me there, thank youπ
just change it slightly:
this addAction ["Search Laptop", {hint "YourMessageGoesHere"}];
Well aren't you a saviour
How can I hide a display without closing it?
I saw someone in a forum post use <layer> cutRsc ["default", "PLAIN", 0.5]; to hide an element, but that still seems to "delete" it.
I thought it may have just been because of how I was creating it, because I the display saved to a mission namespace variable. I thought that since I wasn't setting the variable to the new display value (when creating it), that's why it wasn't showing up.
It was because of that, forgot to update the other part of the code that I set up the display. Although I did use cutFadeOut to make it look nicer
Does anyone know how to make like a underground complex turn dark because rn i Made one on the airfield but it has light coming through the outside
did you make it programatically or by editing the map/terrain
why does this create a new task every time it's called
oh i see now
wait no, i don't
The createSimpleTask is executed regardless of whether it's used.
It's just an element in an array that's passed to getVariable.
i see, thanks
How can I check if something returns "No Display" (when trying to find a given display/dialog)?
displayNull
isNull
That too, realized the reason I was getting an error is because getVariable returned [No Display] and I forgot to select the first element
i didnt edit the terrain
Do I need to use deformer
Changing ground level won't change the map lighting, and you can't make tunnels in Arma because it's only capable of ditches, you have to cover the roof with objects. All you can do is change the daytime to nighttime
Alternatively set the overcast to 1 so light is very dim.
What is the best way to implement a script trigger without using a trigger entity or an indefinitely repeating if cycle? It seems like a very inefficient way to check a condition every x miliseconds. Can I, for example, create an event handler for when a player picks up an item or enters a vehicle? What are the other options?
You can change the number of seconds trigger checks for its condition. And it's in seconds, not milliseconds
you can indeed use event handlers
Do you know why this command might not work? KillSpongebobTask setTaskState "Succeeded";
I have a create task entity with task ID KillSpongebobTask. But when I try to call this command, it does nothing.
task id?
https://community.bistudio.com/wiki/setTaskState takes a Task type
Should I put there the variable name instead?
a task ID is a string
I have no idea what you have at hand, but I can only recommend you to use the Task Framework
https://community.bistudio.com/wiki/Arma_3:_Task_Framework
https://community.bistudio.com/wiki/Arma_3:_Task_Framework_Tutorial
Does anyone know how to put images into intel documents for missions and they get a new task from grabbing them?
theres some weird html like language
i saw today, trying to find it
setDiarySubjectPicture and createDiaryLink, i think
idk what the expressions in <> are supposed to be and where to find their syntax
https://community.bistudio.com/wiki/Structured_Text
Do you mean this
looks like it, yep
though it also has an "execute expression" in it , so it's not just formatting text
I is confused
hi confused, I'm dad!
π
Any ways on how to make 3rd person locked only on specific vehicles?
You can actually lock TPP only for infantry but not vehicles via Description.ext, but is that not something you look for?
How to make a separate AI squad leave an AI driven helicopter when it reaches a land waypoint? I tried leaveVehicle command, Unload, Unload Transport on the heli driver, and GetOut waypoints on the passenger group. They are just stuck inside. π
surprised that Unload Transport on the heli group wont work
maybe you need to synchronize the waypoints
did you place both groups in the editor? or via script
In Editor. One group - heli driver, second group - passengers. When I use Unload Transport with the driver, he just waits for them to get out.
But they dont.
did u try syncing with getout wp?
That doesn't work either.
hmm well I personally just use moveOut on the whole group
mods?
like, AI mods?
None.
what I use: ```sqf
manLeaveVehicle =
{
params ["_man"];
_man remoteExec ["unassignVehicle",_man];
[_man] allowGetin false;
moveOut _man;
};```
The problem was that I disabledSimulation of the vehicle, and then enabled again.
But somehow it disabled even the passengers.
When I apply, for example, flyInHeight 20;, should I give this command to the pilot or the vehicle itself?
doc doesn't say
please try and report back so I can amend
I had been having a problem lately where a certain mod and my personal system for a mission conflicting in regards of animations, it looks like sometimes I can get locked in an animation where the phase never gets completed and get stuck in a weird camera position.
I've tried adding some countermeasures after my system ends its operation, which just does a switchMove or Playmove for the animation "" but that doesnt seem to reset my animation. This is a problem because the hip-torso position gets locked and the main display camera ends up pointing just to the direction of the head.
Had anyone had the animation get locked like that and if so, had found a solution for that kind of errors?
The mod that conflicts with my system is "Animate", and seems to happen when the "position detection" for large weapons happen (that changes the animation while the weapon is too close to a surface) and my animations play at the same time. I have some probable solutions in mind but other opinions/suggestions are appreciated.
Asking in a general way, since this seems like an issue on "stacking animations" rather than the mod itself being the issue.
Hey guys, what is the "cleanest" way to empty a hashMap ?
I'm doing like this right now
// init
CACHE_PLAYERS = createHashMap;
// add data
CACHE_PLAYERS set [_steamID, _data];
// reset cache
CACHE_PLAYERS = nil;
CACHE_PLAYERS = createHashMap;
// CACHE_PLAYERS = nil;
CACHE_PLAYERS = createHashMap; // is enough
```now depends if you want to keep reference to the object or not
Hello, I'm trying to get a persistent container using inidbi and thanks to your previous help I've gotten persistency to work for items, weapons and magazines, but now I need help with backpacks.
Is there any way to get the contents of a backpack? I tried using backpackItems but that doesn't return magazine ammo count or attachments.
Ideally, I'd like players to be able to place their backpacks in the containers and have them saved exactly as they are.
nope i don't need it, i just want to choose the option that takes the minimum memory on the server. So if i just create a new hashmap, the engine is smart enough to remove the old reference from the memory as it's not used anymore ?
yes, everything unreferenced is dropped
(hopefully)
have a little faith, Arthur
I have less faith in Arma the more I learn about it :P
Use a getter along with backpackContainer
More related to math than scripting specifically, but I currently have a UI element and decrease its height to represent a value lowering. It currently shrinks towards the top of the screen, since I'm just decreasing the height, but I'd like to have it shrink towards the bottom; which will require lowering the height and then moving it down.
Not sure if it will look janky in-game, but I'd like to try it to see if it's alright.
This is my current setup:
// Get current display values
private _ctrlFuel = _display displayCtrl 9001; // Idc for the fuel control
// Sizes for the fuel display, these values MUST match the ones defined in BNA_KC_Jet_Dialog
#define WINDOW_HEIGHT 0.3
#define FUEL_HEIGHT WINDOW_HEIGHT * 0.95// 95% height of background
// Animate the display lowering
_ctrlFuel ctrlSetPositionH (FUEL_HEIGHT * ([_jetpack, true] call BNAKC_fnc_GetJetpackFuel)); // Returns value from 0 to 1
_ctrlFuel ctrlCommit 1;
0 is screen's top
In this case you'd just increase ctrlSetPositionY by however much you decrease ctrlSetPositionH by.
There's not a way to just get the current position is there?
Didn't see any on the wiki
ctrlPosition
Ah I was looking for "ctrlGet..."
That makes that easier, thought I'd have to rely on "make sure to change the same value in two places" like I did for the height
SQF commands usually skip the get
Oh it returns the height as well, handy. Not as useful here, since I always need the max height of it
"usually" is not the word I'd use. More like "basically at random"
There are a lot of get... commands
if (random 1 < 0.5) then { _string = "get" + _string };
All the commands were named by Chat GPT
I think they'd be more consistent if they were
Also throw would have been for AIs chucking grenades :P
"captain, the AI just threw a⦠string at the enemy?"
inb4 CT_PROGRESS π
Thank you for replying, can you explain what a getter is in this situation?
Any sort of command that gives you a list of something. Like items and whatnot
Ok, thanks, this opened up new possibilities to me. I saw I can do this with vests as well, but vests are also picked up by getItemCargo, is there any way to get items but exclude vests and get those separately?
can I define custom units with custom loadouts in mission config file?
it doesn't work when i do it with "createUnit"
There is generally not much you can do with mission config.
import B_Soldier_F from CfgVehicles;
class CfgVehicles
{
class test: B_Soldier_F {};
class unit_rifleman: B_Soldier_F
{
displayName = "test unit 1";
editorPreview = "img\wl_logo_ca.paa";
uniformClass = "gear_UAF_kit01";
linkedItems[] = {"gear_platecarrier_UAF_02","gear_ach_UAF_01","ItemMap","ItemCompass","ItemWatch","ItemRadio"};
weapons[] = {"rhs_weap_ak74m"};
items[] = {"FirstAidKit"};
magazines[] = {"rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_mag_rgn","rhs_mag_rgn"};
};
};
this is my config
createVehicle won't look in mission config.
well i'm using createUnit
Before you start listing all the creation functions you're using, just assume that none of them will look in mission config.
there's no way around it? I have to use addons?
Well, you can setUnitLoadout...
but you can't define vehicles or weapons in a mission.
arma 4? π
well, you can save a loadout in missionconfig and eyyy, actually reading messages can save me from typing all of thissetUnitLoadout it onto freshly created unit, if i understand the question now 
I need to gradually increase fog and overcast over time, in a MP mission.
But when i try to script it, the changes are not smooth, probably because as is written on the wiki, the weather system cannot process two commands at the same time (ie. fog and overcast).
(and i haven't even tried to see if it even works in MP reliably - i see a lot of complaints regarding the weather system, that it has syncing issues - but i can't tell if that is indeed current state, or if that's how it used to be ages ago)
Obviously, i could just set the appropriate sliders/values in the mission Intel settings.
But then i have no ability to control when the transition starts happening (i want to have an option of configurable and random delay).
I imagine i could divide it into stages and alternate between increasing the fog just a bit, then after its done do the overcast a bit, then fog again, then overcast, and so on, until both reach the desired value.
But that is just crazy talk! Surely there must be some less insane way?
Am i missing something?
has anyone ever made a script where you can only get the items in arsenal from addons (like RHSAFRF, RHSUSAF)?
No, it's already locked for infantry, but I want to lock it for some vehicles
You can use a user action event handler (https://community.bistudio.com/wiki/addUserActionEventHandler) to detect when someone tries to switch view, then check whether they're in an allowed vehicle, and if not, use https://community.bistudio.com/wiki/switchCamera to instantly switch back to first person.
uniformContainer _unit
vestContainer _unit
backpackContainer _unit
do them all individually instead with the getter of your choice
Hi, im trying to work on something for the tanks in the DLC, i have the tank set up with a custom ammo loadout, and it is linked to a respawn module, however when the tank dies and the respawn module respawns it, it fully resets the vehicles ammo to default, as well as its appearance and its inventory.
How can i set the respawn module to respawn the tank exactly as it was set in the editor before it died?
You see that expression box? That's where you can feed another function/script to be used with the object as a argument
You'll have to do some scripting
i have tried by removing the shells and then adding in the custom loadout ammount of shells but even that gets reset when it spawns
show me what you have so far
yeah unfortunatly i deleted the whole thing, been trying for quite some time and kinda rage quit at it xD
what is the tank class, and what do you want to modify. give me specifics and I can write something
lemme just boot up my arma again and see if i can dig it up
It would appear displays that are created while a player is tabbed out of the game turn black
To get around this, does anyone know a method of checking if a player is focussed on the game? This just seems like a really weird issue
heck ya, couldnt find that with googles, thankyou
So the tank class is: "SPE_M4A1_75"
We are trying to give the tank the following ammo every time the respawn module triggers, and trying to get it to clear everything from its inventory:
(i believe all the shell class names are correct)
[APHE x 40] - SPE_M61_M1_AP
[HVAP x 20] - SPE_T45_M1_APCR
[HE x 20] - SPE_M48_HE
[WP x 5] - SPE_M64_WP
[Smoke x 5] - SPE_10x_M89_SMK
but for some reason the respawn module keeps reverting it to the default loadout, and appearance, though we had the following in the module to force the appearance but even that doesn't work?
_veh = createVehicle ["SPE_M4A1_75",position player,[],0,"NONE"];
[
_veh,
["standard_4AD",1],
["armour_hide_source",0,"star_hide_source",0,"stowage_hide_source",0,"rhino_hide_source",1,"logs_hide_source",1,"skirts_hide_source",0]
] call BIS_fnc_initVehicle;
Pretty new to coding with arma so not etirely fully sure on a lot of things atm :/
alright give me a few
Much appriciated
have to download the compatibility data since i don't have the dlc
ah, if its too much trouble dont worry about it
its not, just takes some time. 20 gigs
how can I make an arsenal where you can only equip items/clothing from RHS for example?
normal or ace arsenal?
normal, BIS arsenal
params [["_newVeh", objNull], ["_oldVeh", objNull]];
if !(local _newVeh) exitWith {};
// Delete all mags
private _mainMags = _newVeh magazinesTurret [0];
_mainMags apply {
_newVeh removeMagazinesTurret [_x, [0]]
};
// Add mags
private _mags = [
["SPE_M61_M1_AP", 40],
["SPE_T45_M1_APCR", 20],
["SPE_M48_HE", 20],
["SPE_M64_WP", 5],
["SPE_10x_M89_SMK", 5]
];
_mags apply {
_x params ["_class", "_count"];
for "_i" from 0 to _count - 1 do {
_newVeh addMagazineTurret [_class, [0]];
};
};
confirmed working
ah sweet, where would i apply this?
pic 1 is your module
pic 2 is the file, you would just put that file in the root of your mission. or change it to whatever and update the path in the module
name it whatever. this is just to show you how its done.
you would change the starting amount, cause this only applies to respawns
ah, is there any way i can apply this directly to the module itself so it can just run off of that or would this be the only way to do it?
yeah..?
I know how to open arsenal
look under the "ammoboxinit" section
oh im tarded. one sec. thats just making it all avail
no, you'll want it separate. don't jam that much code in that box
is there a way I can get all items from a mod?
ah, any hints on how id go about that?, never done it before
yuppers. you'd iterate through the classes using configClasses with some conditionals
i'm thinking of getting all entries in cfgVehicles and selecting those that are added with RHS but i'm not entirely sure how to do that
meet me in voice channel
unable to atm, extremely noisy :/
okay
1.) Create a file in the root of your mission folder and name it shermanLoadout.sqf
2.) Copy paste the code I wrote into it
3.) Save file
4.) Open game
5.) Place down the tank you want
6.) Change the tanks ammo loadout, or place in the init box [this] execVM "shermanLoadout.sqf"
7.) Put down your respawn module
8.) Connect your tank to the respawn module
9.) In the expression line place: _this execVM "shermanLoadout.sqf"
10.) Profit
11.) Repeat for other tanks (or sync the same tank type to that single module - other tank types need a different set of code+module)
I don't think I can make it more clear unfortunately
ah ok, thanks alot man really appriciated
is it just RHS you want added?
yeah
i want to basically exclude all vanilla content
well any item type really lol
from mags to backpacks and weapons
standby
// Build array of things
private _configs = toString {
"RHS" in (toUpperANSI configName _x)
} configClasses (configFile >> "CfgWeapons");
// Filter usable
_configs = _configs select {
getNumber (configFile >> "CfgWeapons" >> configName _x >> "scope") == 2
};
private _classes = _configs apply {configName _x};
// return
_classes
thanks! i'll check tommorow as it's a bit late right now
since agents are groupless (i suppose they can't join a group at all?) , does it mean they will never use vehicles automatically to travel large distances? (because i can't addVehicle to them)
yuppers. they don't even respond to waypoints really. have to use setDestination
The actual way to check this is using configSourceAddons
Another easier way is just reading what's under weapons[] in cfgPatches
I went the whole ordeal to script a sound to a object to and have it be a 3d sound while the object is moving (like a loud speaker on a vehicle). but i want EVERYONE to hear it. unfortunately, i can hear it in my own server because i have the sound in my sqm. if i export the pbo to a server host the sound doesn't work.
so, i'm basically writing my own FSM for them but in SQF
is there any advantage in putting that in an actual fsm file? like performance
my goal is alive world with lots of AI agents living their routines
easier to manage multiple pathways in it. its also every frame.
so is it worse for performance? my update tick is 1 per second
idk how the engine handles when there's many FSMs, maybe it's hella optimized and despite running every frame it'll still be faster
idk if the distance calcs here being done every second for dozens/hundreds of agents is potentially a problem
Nah, it sucks :P
What you can do is set preconditions to early-out, but it's still running a chunk of SQF per frame per FSM.
You need to use something like so
[objectParent, ["yourmusictrack.ogg", 100, 1]] remoteExec ["say3D"];
Im pretty sure that should work.
*Tho check for errors i wrote it on my phone
is there a way to flag a specific AI to not be handed over to headless client?
You can probably just setVariable and check if you're about to pass AIs to headless
hmm yeah true
So in my quest to make a persistent storage container, I got how to get weapons, magazines and containers such as uniforms, vests and backpacks.
How do I get misc items like medkits from a container, though?
getItemCargo returns those, but it also returns uniforms and vests, which I already get from everyContainer
what about https://community.bistudio.com/wiki/itemCargo ?
That did it, thank you! My bad, thanks for replying, but that only ignores backpacks. It still picks up vests and uniforms along with misc items.
not sure where to ask but how does ragdoll work in Arma? If a dying body (through a script) is within 500m distance to player, the ragdoll will activate and body falls on the ground which is very nice. If it's outside that 500m radius (and killed through a script), it just immediately switches to that animation of lying on the ground with weapon in hand. But if I, a player, kill another unit that is in any distance, or it's killed by an AI that is close to the player, the ragdoll will play. Is there any FSM tied to that? Or some function? Or how could I bypass that ragdoll limitation to have it played on any killed unit no matter how far it is from the player?
the requirement is that the player's unit has to be constantly playable and it's a singleplayer mission, so teleporting player on Killed EH (or Hit) is a no no
how do I apply it to my virtual ammo box now?
?
[missionNamespace, _classes] call BIS_fnc_addVirtualItemCargo;
[missionNamespace, _classes] call BIS_fnc_addVirtualBackpackCargo;
[missionNamespace, _classes] call BIS_fnc_addVirtualMagazineCargo;
[missionNamespace, _classes] call BIS_fnc_addVirtualWeaponCargo;
["Open", missionNamespace] spawn BIS_fnc_arsenal;
``` this excludes unfiroms, vests, etc
configSourceAddons?
Well iirc yes
But what Hypoxic wrote should work too
can't find any documentation on that
well there are no uniforms, vests, helmets, etc in my arsenal
rifles pistols launchers magazines work tho
IDK just see all config commands maybe
They're not mags
They're vehicles/weapons
will nearestObject "Road" work for finding nearest road segment?
nearRoads requires a radius, and i need the nearest road at any distance
is that a hard coded magic number
Kinda
It's ~70m
If the geometry LOD is larger then the size limit, it gets glitchy (collision does not work for example and the object may disappear at certain view angles). The exact value of the limit is not yet known, but it is somewhere around 50-60 meter from the center of origin (meaning that your object can be 100m wide/long at max if it is symmetrical to the center of origin).
Basically you can rest assured no object is bigger than that
Otherwise it won't work
In which case you can just ignore it
As does the game
And the reason why I said "road" doesn't work is because it's not a class
Roads usually don't have a class at all
Except maybe bridges
i'm really not connecting how "object size" is relevant. i'm trying to find the nearest road to some arbitrary position
You said you didn't know the radius for nearRoads
What I said is max radius for any object
Even nearestObject uses a max radius of 50
wait, is it creating an invisible sphere and testing it for intersections with geometry, and the radius limit for that sphere is 70 meters
No
The game uses some kind of quadtree
But don't know how exactly it does the search
Anyway that size limit is probably related to how small the smallest leaf node can get or something
I think you're talking at cross purposes
ok so like, if there's a huge forest like 200x200 meters, and i take some arbitrary point deep in that forest near the center, there's no chance i can find the nearest road to it?
You can
With nearRoads
But not with nearestObject
But you know fot sure no single road is on that point
Due to size limit
nearRoads with a radius of worldSize or something would probably do it.......
.........but you can't use that because it's not in OFP
i'm only confused because i'm unsure size of what is involved here, the meshes that make up the road surface?
like, it's not 1 huge mesh but many and their individual size doesnt exceed 70 m across
Roads are made of segments. The size of a segment can vary but can never extend further than ~70m from its centre point. I think commands like nearObjects detect objects by their centre point, so in theory, you could have a road segment that extends into your search radius by up to ~70 metres, but is not detected because its centre is not in the radius.
I think there was a bit of confusion between what you were asking about and what was said, because this doesn't really matter for what you're trying to do.
Unfortunately, a lot of the commands that would be useful for what you're trying to do, were only added in A2 or later. So you're really limited on ways you can do this.
ah
uniforms, vests, helmets, etc are vehicles right
so how do I whitelist RHS uniforms
@queen cargo I think "SQF - Against all Logic" would be a better title..
I'd like to have a normal arsenal that is RHS only, is it possible?
Vests, helmets, and uniforms are all CfgWeapons
SQF - How to not language
in OFP i would probably check if the vehicle hasn't been reaching its top speed for X seconds, which means it has steered off the road and driving on dirt. that's how i'd know it reached the closest point it could on the road
they must have some weird naming scheme for their containers then. you just have to find that scheme and modify the code. I don't use RHS so I can't look it up
do buildings have any "tags" ? ways I can distinguish if they are medical, military, civilian buildings etc?
im looking into my options when it comes to spawning items/units based on the location type and so far my best plan is just to use Ellipse and Rectangle areas to mark out a radius/position of different types of areas and then also searching for specific types of buildings probably based on text in the typeName
no idea if there are any existing ways to get a "building type".
But you could just use the building model for it, or the class name - unless your situation is that the map or mission is using let's say a "garden shed" as a hospital, then this approach would miss it.
I guess you could also get some config information from the config of a given class name.
Buildings don't have any information like that. Unless they actually have a working support functionality (like fuel stations etc), the building's notional purpose is purely aesthetic. You can guess from the classname but there's no guarantee that tells you anything useful.
Yeah so far im thinking my best bet might just be to either grab every building type on a map and classify it myself in the mission, or grab buildings on the go and guess what they are based on the class name
just wanted to be sure though
if ("hospital" in myclassnameofmyhospitalbuilding) then {}; etc
but obviously not guaranteed
I think im just gonna go with the former option and classify all buildings myself. Though this does make it difficult if I or someone ever wants to port to a different map
is anyone familiar or could offer advice on how to implement an SQL database to work in tandem with a MP server? I'm working on a mod that would add "combat effects" to a player. The player would be less affected by these effects over time.
personally i would go with something like
if ("hospital" in toLower myclassnameofhospitalbuilding || {myclassnameofhospitalbuilding in myarrayofhospitalbuildingclassnames}) then {};``` so you don't have to do *everything*
sqfbin plz
or at the very least
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
//
// Define the key to store the player data in the profileNamespace
private _playerDataKey = "MyTrainingMod_PlayerData";
// Function to retrieve the player data from the profileNamespace
private _getPlayerData = {
profileNamespace getVariable [_playerDataKey, [0, 0]];
};
// Function to save the player data to the profileNamespace
private _savePlayerData = {
profileNamespace setVariable [_playerDataKey, _this];
};
// Function to calculate the training level based on hours played
private _calculateTrainingLevel = {
private _playtime = (_this select 1) / 3600; // Convert playtime to hours
// Adjust the formula as per your preference
// For example, linear formula: _playtime / 10
// Exponential formula: 2 ^ (_playtime / 10) - 1
_playtime / 10;
};
//
// Function to decrease combat horror effects based on training level
private _applyTrainingEffects = {
private _trainingLevel = _this;
// Adjust in-game variables based on the training level
// For example, reduce screen shake:
player setUnitTrait ["camShake", 1 - _trainingLevel];
// Adjust other effects as per your design.
};
// Function to update the player's training level and apply effects
private _updateTraining = {
private _playerData = _getPlayerData call _this;
private _trainingLevel = _calculateTrainingLevel call _playerData;
_applyTrainingEffects call _trainingLevel;
_savePlayerData call [_trainingLevel, (_playerData select 1) + 1];
};
// Initialize the player's data and training level when they join the server
if (isServer) then {
if (isMultiplayer) then {
// Use the unique Player UID as a key to store player data
private _playerUID = getPlayerUID player;
private _playerData = [_playerUID, 0];
_savePlayerData call _playerData;
}
// Apply training effects when the player spawns
player onPlayerRespawn {
_updateTraining call _playerUID;
};
};
// Periodically update the training level (e.g., every 5 minutes)
if (isServer) then {
private _updateInterval = 300; // 300 seconds = 5 minutes
while {true} do {
sleep _updateInterval;
{
_updateTraining call _x;
} forEach allPlayers;
};
};
did chatgpt write this
i used it to assist, yes
fair enough, I can unfuck that -- question still stands on the SQL stuff though
and i dont know why you're using profilenamespace if youre intending on using an sql database as well
but you will need to write an extension for that
unless someone has made one for a3 which is possible
I'd replace that so that it can't be stored locally and thereby edited by a player directly
is it possible to make agents walk instead of running? they ignore setSpeedMode
Is there a way to force a players vehicle radar to be turned off?
Yeah I was afraid of that, that removes the whole sensor though and would require me to re-enable it, I was looking to have it just switch off so the player is forced to turn it on manually, something like setVehicleRadar but working for players
You rock buddy, didn't even occur to me to look there π
good idea @keen stream
think i will steal it
How do I test if an owned DLC is loaded or not? I use the following to determine if Spearhead is owned, but I also need to test if Spearhead was checked as loaded on the DLC page in Arma launcher.
_hasSpearhead = (1.17538e+006 in (getDLCs 1));
Check for it in CfgPatches, I think
isClass (configFile >> "CfgPatches" >> "WW2_SPE_Core_t_Core_t");
Thanks gents, that works great!
or
isClass (configFile >> "CfgMods" >> "SPE");
Does anyone know how to stop a turtle (spawned as Agent) from being deleted as soon as surfaceIsWater returns true?
If you don't need him animated,then maybe createSimpleObject. If you need him animated, then you could try attaching him to a hidden object that is in water at some relative position where turtle is out of water. Not sure if that would work though.
iirc you should disable its animal behavior
Thanks for the Answer!
The (sort of stupid) idea is to have a giant flying turtle, by having it attached to a helicopter.
and i want it to do the swimming animation.
Calling playMove or animate on the turtle created with createVehicle does not work (or i am doing it wrong)
But the turtle is deleted as soon as surfaceIsWater returns true for the turtle
:'(
I also have not found a eventHandler i could override to stop it from detecting surfaceIsWater
Did you even try disabling the animal behavior like I said?
yes
Does it disappear or get deleted?
99% sure it gets deleted
Well verify using isNull (I'm pretty sure it doesn't)
Nevermind, that works! Forgot to restart my mission correctly
Thank you!
limitSpeed
Not in OFP~ :D
Hello i have edited the RHS su-25 to use skin from Ukraine faction and was able to change side, add sensors etc. But i am now stuck trying to change the pylons in the cfg and the patch doesn't seem to stick (or) I just don't have the correct base class. When i place the plane in the editor it still has its original pylon. Any help is greatly appreciated
this is a#arma3_config issue
woops didnt notice i was in wrong channel thanks
Does anyone know of a consistent way to check if an object is being rendered?
Would checking if its visible work?
- occlusion or just being on screen?
Well seen enough for a display to be created on it
Right now if the object isnt "visible" by the player the display just appears black
Right now im checking if theyre on screen and within a certain distance, and it works if theyre behind objects, but if theyre behind terrain then it doesnt seem to render the display
world to screen aimpos & boundingbox corners, + tracing with line intersect perhaps π¬
I can get a cheaper version of that with checkVisibility, but I dont want it to do it as soon as the player sees it because it creates a flicker thats unpleasant. Mainly when in buildings and close quarters its very obvious
Id rather it be able to do it through objects like buildings
you can just use terrain intersection then 
I tried that with this, had mixed results
_surfaces = lineIntersectsSurfaces [(getPosASL player)vectorAdd[0,0,1.5], (getPosASL _unit)vectorAdd[0,0,1.5], player, _unit, true, -1];
{
if (_x#3 isEqualTo objNull) exitWith {_intersectsTerrain = true};
} forEach _surfaces;
I'd say something like:
count (worldToScreen ASLtoAGL getPosWorld _obj) > 0 && {
_camPos = AGLtoASL positionCameraToWorld [0,0,0];
_bbCorners findIf {!terrainIntersectASL [_camPos, _x]} >= 0
}
wow terrainIntersectASL is a much better version than lineIntersectsSurfaces
Whats the point of the first bit?
well it only checks the terrain
making sure it's not behind the camera
similar effect to this then?
((worldToScreen (getPosASL _unit))isNotEqualTo [])
is there a sqf extension available for vscodium? Nothing is coming up in search
it's basically the same thing as vscode no? Use the ones that are for VSC
I'd like to disable some AI stuff for each unit when a scenario starts. For 3den placed units - not a big deal I guess, I can simply iterate over non-playable units. What about zeus placed units and units created/spawned during the scenario? Is there an event handler that I can insert into the mission itself that will handle those cases?
Yeah, there's a whole bunch of curator event handlers.
Their locality is a bit non-obvious though.
Got a tip from LAMBS discord to use the CBA_fnc_addClassEventHandler:
["CAManBase", "InitPost", {
params ["_unit"];
...
}] call CBA_fnc_addClassEventHandler;
If you have a CBA dependency, sure.
EntityCreated mission event handler also exists now:
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers
Thanks a ton πββοΈ
One more question - where would it be safe to call the addMissionEventHandler for e.g. EntityCreated. It has a local effect from what I see. So init.sqf would be fine?
UI, Sounds, Music, Effects should be local. All else, have on the server. For things like the inits of units, put it on the server.
hey, could someone please help me. I am trying to get an array of buildings within a rectangular marker.
I was hoping the inAreaArray would do it but its returning an empty array.
This is how I have attempted so far:
buildings = ["Building"] inAreaArray "MOUT_RED";
hint str buildings; // testing to see if it works.
I have also tried with "House".
I was hoping the
inAreaArraywould do it but its returning an empty array.
that's because you provide an array of strings, and strings are markers in that case
see the doc
https://community.bistudio.com/wiki/inAreaArray
You're looking for something more like nearestObjects
nearestTerrainObjects
yes but nearestObjects uses a radius
Then filter using inAreaArray afterwards.
will, try this. thank you
nearestObjects and nearestTerrainObjects have different classification methods. Both of them suck.
so my understanding is this
allBuildings = nearestObjects [gameLogic, ["Buildings", "House"], 200];
redBuildings = allBuildings inAreaArray "MOUT_RED";
I am not able to test yet but will be soon.
Be sure that the radius of the circle is large enough to fill the square area.
if it is a square with equal sides, you can use the coefficient 1.42 from the side of the square
its not an equal sided rectangle π¦
sqrt 2 π
calculate the rectangle's diagonal and times sqrt 2
π
okaaay, mister maths
(:p)
((divided by 2 if x/y are rectangle sides and not half sizes, ofc))
what is a working equivalent of doFire/doTarget for agents
none
they are not meant to fight
It's kind of a shame that you can't use agents as a raw do-exactly-what-I-tell-you AI.
I wish yes, but then "target something" is⦠AI-related
make normal AIs and disable most of their AI with disableAI?
can i use setDestination on normal units the same way as on agents, e.g "LEADER DIRECT" when the unit is stuck, so that it fazes through walls and gets unstuck?
agents are reliable because they can do that
i tried to setDestination a unit yesterday and it didnt work
yep, they're standing still
doMove and waypoints work, setDestination doesnt
Have you tried using doStop on the AI first?
it did put some of them in motion but it's weirdly inconsistent and they don't drive after entering vehicles
also tried _grp setCurrentWaypont [_grp, 0]; and it's similar
I would say it's better to know what you are trying to achieve
in short...
In the countryside there is a hidden suitcase with secret documents. Its location is completely random. There are locals that travel around the map, on feet and in vehicles. They enter buildings, climb ladders, and create a feeling of an alive world. You can approach them and ask about the suitcase. They either don't answer, or tell you an approximate distance to it. You should ask in multiple places to triangulate and narrow down the suitcase location. Some locals are secretly killers. They will be alerted when you ask them about the suitcase, and start stalking you at a distance, and then ambush and attack when you approach the suitcase. You are unarmed. Your home base is far away. Your goal is to find and return the suitcase.
doesn't tell me why you mix agents and AIs
agents are reliable for navigation. i can trust that they get to their destination.
because they can go through walls if stuck
they climb ladders, enter buildings etc
and if my code detects that the agent is stuck, it changes it from "LEADER PLANNED" to "LEADER DIRECT"
is it possible to make a normal unit use simplified pathfinding like that, so that they ignore obstacles?
use AIs where needed, use agents where needed
like, delete the agent and spawn a unit in its place when it's meant to engage in combat?
i used to keep them (the unit's logic and the unit itself) as separate objects before, but didn't expect it to become necessary lol
it was in my different module where they could change profession and respawned as different class
How do you open car door?
Specifically the Tanoan police car, model offroad_01_unarmed_f.p3d,
class B_GEN_Offroad_01_gen_f.
Shouldn't it be something like _car animateDoor["door1", 1, true]?
...i tried any "door<whatever>" i could find in the p3d, but nothing works
i tried all these, just to make sure:
door1, door2, door3, door5, door7, dashboard_door_l, dashboard_door_r, hide_dashboard_door_l, hide_dashboard_door_r, hidedoor1, damagehidedoor1, door_L
...why would i not be able to? i mean the animation is clearly defined, otherwise yhou wouldn't be able to open...
OMG, crap, yeah, you are right, i just realized, the door may not be actually animated.
AAAAAAaaaaa, LOL
I keep forgetting that the game was made by "morons" like me π
I guess nobody thought it would be useful to be able to animate the door
it was planned during alpha but ditched to focus on better things
yeah, well, i know exactly who to blame, what an irony π
btw, tried animateSource?
yep, same result - nothing.
And its not surprising me, i just forgot all about the game - the car simply doesn't have openable doors.
You can only hide them, but not open.
The irony is that i may have been the one who made the config back then π ...although, maybe not, i don't remember.
π
Can't really think of a good way to word this, but I have some code that gets a list of units near a given point, runs some code, waits, and then finishes.
The thing is, if a unit walks towards the area after the list of units has been made, then nothing happens. I thought of maybe creating a trigger object and placing it there, and then running the code that way; but I feel like there'd be a better way.
Here's some omitted pseudocode for the rough kinda structure of my code
// nearEntities is faster than nearestObjects for normal units, but it does not sort by distance
private _nearbyUnits = _position nearEntities ["Man", _radius];
// do X for each unit in _nearbyUnits
// wait Y amount of time
// cleanup
The thing is, if a unit walks towards the area after the list of units has been made, then nothing happens.
well obviously in that case the unit is not in the list. so you need a loop
nearEntities ["Man", _radius];
it should be "CAManBase"
(otherwise includes goats)
But how exactly?
I get obviously I'd need to check the nearby units again, and then just run the same code for any potentially new units.
I run this code, sleep for some amount of time, and then run some cleanup code. I just don't see where/how I would check for new units
// nearEntities is faster than nearestObjects for normal units, but it does not sort by distance
private _nearbyUnits = _position nearEntities ["CAManBase", _radius];
{
_x call BNAKC_fnc_someFnc;
} forEach _nearbyUnits;
sleep _duration;
// Delete smoke grenade, remove all handlers
deleteVehicle _projectile;
Goats need some love too
But how exactly?
it depends what you're doing
one example is:
private _units = [];
for "_i" from 0 to _duration step 0.5 do {
private _nearbyUnits = _position nearEntities ["CAManBase", _radius];
private _newUnits = _nearbyUnits - _units ;
_units append _newUnits;
{
_x call BNAKC_fnc_someFnc;
} forEach _newUnits;
sleep 0.5;
};
or
_end = time + _duratioon;
while {time < _end} do {
sleep 0.5;
};
I definitely wouldn't have though of using a for loop to step through the time, that's smart
Duh it's just a number, but didn't think of it that way
I'll give those a shot, seems simple enough
i did it, it now changes to Unit for the ambush and back to Agent for chase/roaming
it's meant to be spooky. while you're looking at the map, calculating where the next stash may be, and hear a car approach.
so a While loop will always finish itself up before rechecking its condition, right? It won't cut off mid-loop?
It only checks at the start of each iteration, yes.
If you need to check in the middle you can do if (condition) exitWith
Okay, thanks.
lobby is tricky because not all commands work in there. I ended up creating admin dialog when the mission starts and when user clicks start then the mission loads up
I want to disable the automatic 4, Regroup and Contact, infantry, 300 meters west callouts, is there a way to have that automatically be disabled when the server starts?
no, you can't "replace" vehicles
either make your own version that supports both AA and AT rockets (Iguess it would be a matter of config entries but it's not me who does that stuff) or just have player leave the launcher and make an action to "change mode" of launcher which would hide one turret and show another in the same place.
I ran this code in init.sqf
but when I host the scenario, the laser is not visible to other players. I noticed that drawIcon3D is visible but drawLaser is not.
addMissionEventHandler ["Draw3D",
{
if ((player getVariable ["moved",true])) then
{
drawLaser
[
eyePos laserPointer vectorAdd [0, 0, 0],
(eyePos laserPointer) vectorFromTo (eyePos player),
[1000, 0, 0],
[],
0.7,
0.3,
500,
false
];
};
}];
It's in a draw3d eh so single frame isn't the problem (probably)
Locality is though
so in the best case each player can only get a single laser that points directly into their camera
which type of files can u load with loadFile ?
text files
ok thanks
its possible to detect with BE filters when someone tried to execute a disabled command?
there are regexes, buuut
thats a option, load the rpt and regex for the invalid command thing, but i thought there would be a easiest way 
https://forums.bohemia.net/forums/topic/125102-new-battleye-features-for-server-admins/ this claims something similar to be possible, but i don't have actual hands-on experience
always have this doubt:
params dont "privatizes" the variables isn't it?
so this:
private _myvar1 = _this select 0;
is faster than:
params ["_myvar"];
i guess i should use private ["_myvar"]; before?
params dont "privatizes" the variables isn't it?
it does
the first one is probably faster but it has nothing to do with private. the cost of private _var is 0 (but not private ["_var"])
it's because with params ["_myvar"] you also create an array. also params returns a value
it'll never work, because of how SQF works.
it'll just be exactly the same as arrays
also the array creation cost for params will go away with sqfc.
So while the params is slower in debug console, if compiled from bytecode it would probably be faster
Ah, i guess this would work, right?
addMissionEventHandler ["Draw3D",
{
{
if ((_x getVariable ["moved",true])) then
{
drawLaser
[
eyePos laserPointer vectorAdd [0, 0, 0],
(eyePos laserPointer) vectorFromTo (eyePos _x),
[1000, 0, 0],
[],
0.7,
0.3,
500,
false
];
};
}forEach allPlayers;
}];
I would usually use playableUnits + switchableUnits for that kind of thing. allPlayers includes dead people, virtual units etc. which you probably don't want.
For a server-created public variable, are you supposed to re-declare it as public every time the server modifies it? If so, does the server publish specific indexes of an array? Eg: I have a variable that I created server-side, added an array value to is and then made it public:
BSFFlagPositions = [];
BSFFlagPositions pushBack [123,456,0];
publicVariable "BSFFlagPositions";
Then, in later scripts other values gat added so that we have [[123,456,0],[11627.4,11903.5,0.045191],[11362.8,11438.5,0.054359]]. If I log the variable on the client side, I only get the 1st array [123,456,0], but if I log it on the server, the whole package is logged. If I publicVariable "BSFFlagPositions"; after every entry the client has access to the whole package as well.
I was surprised by that.
!!!! Is it possible to get a refuel script so I can make a refuel station players can driver up to and get refueled?!!!!
There are already objects that can do that. Refuel, repair, etc.
You thinking of the trucks?
No, the Huron crates.
and the repair depot thing.
B_Slingload_01_fuel_F
Land_Pod_Heli_Transport_04_fuel_F
Land_RepairDepot_01_civ_F
Land_RepairDepot_01_green_F
Land_RepairDepot_01_tan_F
Every time you modify you have to redeclare. Using setVariable with the global tag is functionally the same. For less lines.
I don't use ACE, so I can't help there. Are you placing the refuel objects directly in your mission.sqm file, or in another script?
Just placing them using eden editor then loading in
Are you using the fuel pump lines? With ACE, it's not a proxy refuel
They don't seem to work in Eden, but when I've placed them on the map on a MP server they work fine.
