#arma3_scripting
1 messages Β· Page 588 of 1
If it isn't readable for you, it translates into 1021790
I am aware, but I'm not sure if it's readable for my code. I've had issues before with e+00x type of things, notably when I was premaking missions back when Zeus had admin console.
It is
Put 1.02179e+006 into your code, it just returns 1.02179e+006. You even can do something like 1.02179e+006 + 100
private _result = 1.02179e+6 / 1000;
so
if (1.02179e+6 in (getDLCs 1))
would work?
Yes
Just weird, didn't have that happen with the Marksman DLC, it was just the flat number.
Because 1021790 is bigger
https://www.calculatorsoup.com/calculators/math/scientific-notation-converter.php?operand_1=1.02179e%2B6&action=solve
Simple spoken: It's just a "short way" of showing a long number
I get that; as I said, when I was doing admin-console-loading-shenanigans, I had issues where an object's Z position would get something like '5.2e+001', and trying to create an object with that would throw a huge fit. Had to go through my entire blocks of code to remove all e+ instances.
Hi , for open an inventory player it's player action ["Gear", player];
And for close ?
It's not a question about EHs...
My bad. I had my attention on somewhere else.
Hey Guys , iam here right for a Little ace 3 question?
just a question about an Item..
Depends on the question @inner pine
Is there a way to get a list of all the slots in a multiplayer lobby? I'm specifically looking to make a listing ingame of which slots have which players in them and which ones are empty
playableUnits does that iirc @wispy cave
playableunits only returns slots that are currently filled
only if AI is disabled for them
AI is disabled on them unfortunatly
then unfortunately IDK, unless getting the description.ext value of maxPlayers (number) is enough for you
No, it isn't. Guess I'm gonna be hardcoding it
hi, i have a question ? how to create a keybind and can custom the key if you go in "control" and "config addons" ?
With CBA iirc
yes i think but how ?
ok but i need to call the function ? or i need only to add in .cpp ?
Just call the function, everything is explained in the link I sent Β―_(γ)_/Β―
ok i will check | i'm sorry
could someone tell me what i'm doing wrong here:
trying to pack some functions into an addon
the functions themselves work just fine, however they keep getting called on the main menu for some reason
how does one prevent this from happening?
config.cpp:
class CfgFunctions
{
class TestScripts
{
tag = "TEST";
class Scripts
{
file = "function_test\functions";
class civsInit {postInit = 1};
class carsInit {postInit = 1};
class trafficInit {postInit = 1};
class combatInit {postInit = 1};
class carsRadio {postInit = 1};
};
};
};
its because the main menu is technically a mission too
mhmm, but i only want it to be called when i call it via script or w/e
does arma really call all functions once the menu is loaded? 
remove postInit then?
needs to be post init since i need to wait for the objects that will call them are loaded
im sure there is a better way, but this is what I have
private _isMainMenu = false;
private _mission = format["%1.%2",missionName,worldName];
{
if ([_mission,getText(_x >> "directory")] call BIS_fnc_inString) exitWith {
_isMainMenu = true;
};
} count ("true" configClasses (configFile >> "CfgMissions" >> "CutScenes"));
if _isMainMenu exitWith {};
could probably rework it to something like this
private _mission = tolower format["%1.%2",missionName,worldName];
private _isMainMenu = (("true" configClasses (configFile >> "CfgMissions" >> "CutScenes")) findIf {
_mission in tolower getText(_x >> "directory")
}) > -1;
if _isMainMenu exitWith {};
idk, its all the same in the end
could do it that way i guess - surely there's a better way around it though 
could do it as a module instead 
meh, too lazy for that and this works so i'll go with that, thanks 
I know that ZEN (Zeus Enhanced) has a module to export a mission to SQF. Not sure about the full extend of it, but one of the zeuses in my unit used it yesterday without many issues.
does someone has experience with laggin ogv vids? which export setting youre using .etc ...
Okay - Problem is : we cant use Surgical Kit in ACE and we Dong know why ...we had all looked up and checkt the addon Options. Could be there anythin we missed? In Mission.sqm we had had edited the NPC Units of Medics and what else...maybe some of you know the magic π
for the Surgical Kit to be useful you need to enable 'Re-open Wounds' (or ace_medical_treatment_advancedBandages = 2;), otherwise the wounds will automatically close after being bandaged and the SK option won't show up.
Dude - wtf....God Save your Soul . Best Regards
it's basically "Basic Medical" from the old ACE settings π
i have the newest Version and i work with it after 2 years again and many has changed so i feel like noobish
So...thanks i will sleep now in peace βπ» Good Night
good night to you too and have fun stitching wounds in the future
π everytime i will think at ya
if I want to override ACE server variable in mission file, where should I do it?
I just want to set ace_explosives_requireSpecialist to true and make it ignore/override server setting
cant I just do missionNamespace setVariable ["ace_explosives_requireSpecialist", true]; ?
I will set it server init, hope it will work
You know in eden when you rotate via the red rotation, is that vector up or dir?
when using setVectorX
nvm
Stationary = [23.256, 0.310, 1.582];
_currentUp = vectorUp slingMove;
if (_currentUp select 0 != Stationary select 0) then {
slingMove setVectorUp [_currentUp select 0 + 1, _currentUp select 1, _currentUp select 2];
};
if (_currentUp select 1 != Stationary select 1) then {
slingMove setVectorUp [_currentUp select 0, _currentUp select 1 + 1, _currentUp select 2];
};
if (_currentUp select 2 != Stationary select 2) then {
slingMove setVectorUp [_currentUp select 0, _currentUp select 1, _currentUp select 2 + 1];
};
I'm getting error type any, expected number on my third if statement, slingMove |#|setVectorUp Not sure why though, the first two work and its just a copy paste
Making an object rotate basically
Maybe because _currentUp select X + Y considered as _currentUp select (X + Y)
Stationary = [23.256, 0.310, 1.582];
private _currentUp = vectorUp slingMove;
{
if ((_currentUp select _forEachIndex) != (Stationary select _forEachIndex)) then {
_currentUp set [_forEachIndex, (_currentUp select _forEachIndex) + 1];
}
} forEach _currentUp;
slingMove setVectorUp _currentUp;
But, vectorUp should be normalized, just adding +1 doesn't seem right
Can someone explain what is this syntax ?
_x >> "directory"
Thanks Connor!
@robust hollow I'm trying to use it, am I using it wrong?
CfgServerSettings >> General >> TestVar call BF_fnc_log;
class CfgServerSettings
{
class General
{
TestVar = "BF Arma";
};
};
configFile >> "CfgServerSettings" >> "General" >> "TestVar"
aww
or missionConfigFile if it is in the description ext
it's not, it's an addon
ok, so configFile is the one you want π
wrap it in parenthesis
configFile >> "CfgServerSettings" >> "General" >> "TestVar" call BF_fnc_log;
or, you meanit is only logging the config path?
output:
TestVar
To output the full pathsqf (configFile >> "CfgServerSettings" >> "General" >> "TestVar") call BF_fnc_log;
to output the property value (in this case)
getText(configFile >> "CfgServerSettings" >> "General" >> "TestVar") call BF_fnc_log;```
one way or another accessing any config data is done with >> or / (slower)
read up on the commands in the additional information section of that wiki page i linked. it has most relevant config related commands.
Thanks
hit , i have a question ? how to use the ed-1d drone ? because i want to create a script when the ed-1d scan an object or units but the event handler hit part doesn't work so how to detect the laser ?
Detect the Fired event on the drone.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired
@hazy trail yes but it doesn't work for the laser only for the knife
is there a simple way to make the strider faster? would be great to get it as fast as the hatchback. is it possible to get the driving mechanics of the hatchback sport into the stabile chassis of the strider?
how to exclude server and some player in remoteExec? remoteExec ["CBA_fnc_notify", [-2, ? ];
-1 * (owner _player) ?
@sacred slate, only if you create a config addon that overides the originaL CONFIG VALUES
@spiral fractal maybe [-2, -(owner _player)] yes
yes, use sleep
what I have to do ?
If ((side player == WEST) then { hint "Hi";
sleep 1;
}
And it hint "Hi" avery 1 second?
nope. tell me what you want to do
then check while and sleep yes
Hello, I am reading about the Arma 3 equipping uniform restriction which prevents you to equip uniforms from the dead but you are still able to take items from it. I want to expend that restriction to vests and backpacks.
On the internet all I've found is how to remove the uniform restriction, nothing about expanding it. Any thoughts on this?
while { sleep 1; playerSide == west } do {
_playerXP = _playerXP + 5;
};
```@candid cape
by script? @coarse sedge
you could use the https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take event handler and script to put the item back
but the ideal way would be config, if it is doable this way
@candid cape no, wherever you want technically
I guess you are coding for the L*fe framework, and I don't know their structure. You should ask in their Discord (which is linked in #channel_invites_list)
TIL you can press F1 in Debug Console for scripting help.
and there is autocompletion, too
(in-game doc is still less up-to-date than our beloved #community_wiki!) π
@slim verge thx. do you have any more syntax where to start, i am not a coder
this is harsh to google.
ok for some quick boost i have now this:
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
if (_key == 46 && {not (vehicle player == player)}) then {
_vehicle = car1; //your vehicle
_vel = velocity _vehicle; //current velocity of car1
_dir = direction _vehicle; //current direction of car1
_speed = 50; //how much you want to add speed for the vehicle
_vehicle limitSpeed 200;
_vehicle setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+ (cos _dir*_speed),(_vel select 2)];
};
}];
but changing a vehicle statical would be great π
If something like BIS_fnc_stalk is used with group player like on the wiki example, and there's multiple seperate player groups, what will happen?
if the function is called on a dedicated server, nothing at all
how do i get the dikCode of my joystick or pad?
this isn't working:
waituntil {!(IsNull (findDisplay 46))};
_keyName = (findDisplay 46) displayAddEventHandler ["keyName", "hint str _this"];
You don't.. basically
is it possible to get [x,y,z] point on object that I aim at relative to object [0,0,0] point? I want to set positions for ACE menu items
how do i get the dikCode of my joystick or pad?
@sacred slate
https://sqf.bisimulations.com/display/SQF/DIK+KeyCodes
There are no DIK codes for anything but keyboard keys.
lineIntersect + worldToModel + math
βοΈ
bruteforce it is 
hmm is it possible that groundWeaponHolders blocks ACE interaction menu from showing on object that I set it on if they are between player and ACE menu object?
Think so ye
wow everything fights against me in my scripting activities, is it possible to ignore this objects somehow?
hmm is it possible that
groundWeaponHolders blocks ACE interaction menu from showing on object that I set it on if they are between player and ACE menu object?
@spiral fractal I don't think that is what is happening, and object can't "block" the ace interaction menu
The distance between you and the object you set the menu on is however important
I set it to 6m and I have to get to 1m to see the menu, but I can see menu items above the objects from 6m
when I set Y to -1 it seems to work
Arma is giving an error about using numbers in a string for an array and i dont know how to fix.
Here is the error message followed by the line of code.
16:13:27 Error in expression <b + [["name=Request Transport Vehicles",Β "priority=22", "permission=Squad Leade>
16:13:27 Error position: <Β "priority=22", "permission=Squad Leade>
16:13:27 Error Invalid number in expression
v_db = v_db + [["name=Request Transport Vehicles",Β "priority=22", "permission=Squad Leader", "parent=Main Menu", "parent=SquadLeader Options", "action=[] execVM 'hud_os\actions\action_request_transpo_vics.sqf';"]];
im banging my head on desk now
you may have an unclosed quote somewhere else
did you copy from BI forum?
oh i know what you guys are on about. ill find it. thanks i never thought it could be one of those damn characters. ill track it down.
use an IDE that supports SQF syntax already!
Please can someone correct my silly ways. I am using below in SP to open a menu that i created. However in MP it doesn't give the player the dialog option. I know I have missed something but I am unsure what.
player addAction["UNITAF Menu",
{
execVM "openDialog.sqf";
}]; ```
Where do you place this?
then it does
but if you have a respawnOnStart that "kills" your units, the action is on the corpse
Gotcha
Yeah removing that worked. So how would I get it to be on the player after respawn @winter rose
you can use a respawn event handler π
Rgr will take a look! Ta
is there a way a script can detect if the player is holding a weapon and then change their faction back and forth according to that?
yes, currentWeapon player != ""
how would you go about getting classnames of ammo classnames for vehicles
do you want ammo or magazine config @marble basalt?
not sure the difference but im trying to remove the ammo from a vehicle
like disableing rockets on helis
@winter rose I did it like this ```sqf
(_this select 0) addEventHandler ["Respawn",{_this execVM "scripts\UTFN\AddActionOnSpawn.sqf"}];
Perfect, that's the spirit! Thanks for sharing π
@marble basalt removeAllWeapons, removeMagazines, removeMagazinesTurretβ¦or edit the helicopter pylons in Eden
Then ref above I the sqf I call is this https://discordapp.com/channels/105462288051380224/105462984087728128/710968616312504352
No worries thank you for pointing me in the right direction π
Trying to get a script to run only if a player is in a area from my GUI.
I have placed an area and set its name to 'getdata'
then I am trying to only allow the button to work if they are inside that area.
_data = getdata;
_playerIsInside = player inArea _data;
if (_playerIsInside){
_thisPlayer = _this select 0;
onMouseButtonClick = [player, "scripts\UTFN\fn_Server_getUnit.sqf"] remoteExec ["execVM", 2];
};
false
@prime trout by area, you mean marker, or trigger?
same with inArea
but if you named your marker "getData", you should use a string "getData", e.g ```sqf
player inArea "getData";
Like this @winter rose ```sqf
_playerIsInside = player inArea "getData";
Wonderful! Will try now. Thank you. I haven't learnt 'private' yet.
See this freshly refreshed fresh page:
https://community.bistudio.com/wiki/Variables#Local_Variables_Scope
and https://community.bistudio.com/wiki/private can be fine too π
if (_playerIsInside){ also dont forget your thens
It works! Woop. Thank you @robust hollow missed that. Must have deleted by accident.
@winter rose Thank you very much, will take a look in tooooo!
how to useremoteExec function inside ACE interaction menu condition ace_interact_menu_fnc_createAction?
What's a dedicated server friendly way of teleporting players? setPos does not work (when ran on server at least).
it should work... are you sure you are giving it the correct object argument?
yeah, one moment i'll put the code snippet here
_spawnPos = [CrashPos, 1, 25, 3, 0, 20, 0] call BIS_fnc_findSafePos;
player setPos _spawnPos;
{
if (!isPlayer _x) then {
deleteVehicle _x;
};
} forEach units grp;
}
else
{
{
_spawnPos = [CrashPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
_x setPos _spawnPos;
} forEach units grp;
};```
there is no "player"
ah i skimmed right over that, thought i took that out
its a variable in the group attributes
let me fix the player thing then try again
Still will not teleport players. When _playercount > 1 it will teleport all the ai in the group, but not the players. I have it in initserver currently, do i need to do the player teleport in init?
Code looks like this now for reference if (_playercount == 1) then { // Deletes extra units if played in SP { if (isPlayer _x) then { _spawnPos = [CrashPos, 1, 25, 3, 0, 20, 0] call BIS_fnc_findSafePos; _x setPos _spawnPos; } else { deleteVehicle _x; }; } forEach units grp; } else // Keeps slots open for JIP if Multiplayer { { _spawnPos = [CrashPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos; _x setPos _spawnPos; } forEach units grp; };
@molten roost Try delaying it with a sleep or waitUntil. Also, should use !multiplayer to check if singleplayer. Can also log the units grp to see if the players are inside or use a different flavor of setPos.
oh didnt know i could use !multiplayer, i'll do that, thanks!
how would one get the ai to find a safe spot behind a object? trying to implement ai dragging wounded to cover
is there any way to edit code while in game, such as a recompile of a script. i found this command but im not how its used [] call BIS_fnc_recompile;
@winter rose it was a special character that got copied over in the section for priority. i use Visual Studio Code with all the sqf addons.
Hi, are there "structs" in SQF ? similar to struct in C ?
Or objects that I can initiate at runtime with properties?
Or are there hashes/dictionaries?
How do you detect editor placed static objects like houses, trees and such around player? They are not picked up by the nearestObjects nor nearestTerrainObjects commands
wait, they are, but under "House" it seems
basically they are picked up when no filter is applied. With makes it kinda wonky as no filter search picks up stuff like bees, footprints and such
@tough abyss no, setVariable, no... well a namespace is a hash
How do you detect editor placed static objects like houses, trees and such around player? They are not picked up by the
nearestObjectsnornearestTerrainObjectscommands
@thorn saffron editor placed things are entities, so try https://community.bistudio.com/wiki/nearEntities and
also, nearestbuilding and nearroads might be useful to you, depending on what you want to do
long shot before I start to dabble..
This post doesnt define if used in an SP environment or MP
Query: Is it possible to have an external link from the briefing, eg toi a web page.
If I get a dont know or yes, will dabble
https://forums.bohemia.net/forums/topic/169501-link-to-website-in-briefing/?do=findComment&comment=3277456
needed for MP environment
overall aim to get an auto join teamspeak link eg ts3server://teamspeak.zeus-community.net
F*** Me it works in sp environment autostarts ts if installed and joined me to my ts server, now foir an mp test
wow..... this works in mp
no reason not to π
they didnt used to allow external links and there aint many server admins that know this works
yep, you cannot do a <a href=""> the usual way
so this works via a class in a button... is there a way to have this working in a briefing with executecode rather than via a button class ?
well you know the execute expression code
something to be clicked on like the link button
so not auto no, via user interaction
hmm while I think of if, maybe ctrlCreate a button out of sight, process a click on it (if doable?), delete the button π€
i have an auto inject serverside addon that spiels out a load of stuff on the briefing, to add an auto join ts link would be a leap ahead in helpfulness
offside question, does it make Arma lose focus?
no well. i have multi monitors and am in fullscreen mode
so time to dabble a lot
am failing to find anything reasonable to explain <execute expression= **************</execute> is their a comref link anywhere that explains it ?
comref
https://community.bistudio.com/wiki/createDiaryLink
plain sqf
Anyone here with experience of BIS_fnc_initVehicle in a dedicated environment? My testings seems to indicate that the animation sources are properly transmitted to all clients but the vehicle texture set by this function is local to the machine that created the vehicle (with the function in its init)
thx for the link Lou but already have that was looking at a set of params for it eg something i could use to pass a URL,
nope, that's just code
@wet shadow I am not sure about createVehicle'd object's locality, indeed
as this function takes a local vehicle as paramβ¦
if by testing you get to know if createVehicle makes the vehicle local to the machine that called it, I can update the wiki
@winter rose You are correct, createVehicle does result in the object being local to the machine that executed that code as far as I can determine.
But I am still baffeled why the BIS_fnc_initVehicle is able to propagate the animation changes but not the vehicle textures.
I would guess because animation-related commands are global, therefore everything is sync'ed
Any way to disable group chat specificly?
enableChannel cant do it, and same for Description.ext's disableChannels[]
@sharp peak You can disable it in your servers server.cfg
I am currently running this:
disableChannels[]={{0,FALSE,FALSE},{1,FALSE,FALSE},{2,true,truE},{3,FALSE,FALSE},{4,FALSE,FALSE},{5,FALSE,FALSE}};
is that really a server.cfg thing? thought it was only description.ext
yep, there it is on the wiki π²
I see, will try it, hope it works better than in Description.ext
@sharp peak there is an issue that it doesn't apply to JIP players
a workaround is using the related scripting command
makes sence, thx too all
check the first comment here for a script you would run on player join to apply the disableChannels settings
https://feedback.bistudio.com/T117205
was about to post that π stahp ninja'ing meh!!
Is there any way to not let players join until some variable is True ?
(using a servermod)
if I delay init.sqf on mission folder, it still loads the player in
usually you would cover their screen when they load in and let them see again once the mission is ready to go. i cant think of a way to temporarily prevent players in the lobby from loading in.
Just why @tough abyss
you can alway remoteExec endMission to them
Okay, thanks @robust hollow
Is someone using ExtDB3 here?
Yeh why
@rough heart I'm using SQL_CUSTOM, with my own INI, but I can't get the protocol to always return strings (using TEXT definition)
Hi lads, do you reckon it's possible to execute playSound for one player?
If so, how?
As in, I'd like to have a sound playing for one player, but not the other
second parameter will execute the command on specific machine, server is 2 etc, 0 - everyone
also there is remoteExecCall but I still dont understand when to use what π
How do I put where a medic drags a wounded soldier and 2 riflemen are providing covering fire?
[_logic,_display,_sideBars] spawn {
disableserialization;
_logic = _this select 0;
_display = _this select 1;
_sideBars = _this select 2;
waituntil {!isnull curatorcamera && !([] call bis_fnc_isLoading)};
Does anyone know what this is for?β¬οΈ
its some code
yeah, but I would like to know what it does, since I get an error from this.
Also, is there any way to make the addon builder include subdirectories?
Or do I just have to use pbo manager?
As I have a scripts folder which I'm trying to include within my pbo
@tough abyss what exactly are you coding? Show me what you are trying...
No crossposting please @remote pendant
@remote pendant Looks like you're missing a closing bracket
how to assign all tasks to the player after teamswitch?
someone know how to use the 5th parameter in ace_interact_menu_fnc_createAction (5: Insert children code <CODE> (Optional)) https://ace3mod.com/wiki/framework/interactionMenu-framework.html#31-fnc_createaction
You can use that to createSub action i believe
Just pass it an empty {}, if you don't need it
there is not enough info in ACE wiki, right now I add sub actions when I call ace_interact_menu_fnc_addActionToObject and pass the _action, but I have to get array from server and find value in it, if I add this code to action it will get array from server for each one, I want to get the array once and use it in every child condition check
You could do something like this:
Private _fnc_childrenActions = {
private _customParams = _this select 2;
private _theArray;//Provide code to retrieve server array
_customParams apply {_x set [6, _theArray]};
};
This function would be put into the "Insert children code" spot.
And the parameters you pass your action would be an array of actions you want to display as children to this action.
The code simply sets the parameter array of every child action to the array you would want to get from the server.
@spiral fractal
in 3.6 Advanced Example there is an example of something similar to what I need, but I decided to leave this option for the next update...
for now I have to check if my code works correctly
what is the fastest way to get some unique detail about player that will also allow to find the player by it and will remain after player respawn?
is there something other than getPlayerUID ?
if I use owner what happens when player disconnects? joining player can get the same owner id the player who left?
no
if ownerID 3 leaves. ownerID 3 isnt used again. at least that how it was when i last worked with it
hmm, so I can use owner id, is it related to allPlayers position?
no. it is related to the next available increment when they connected.
yea just tested, first connection i was owner 4, second connection i was owner 5.
you connected twice or reconnected?
you use owner player?
I have 0 both times, I think I should use clientOwner instead
reconnected. this is on a dedicated server environ tho
yea owner command only works on server. clientOwner is how the player can get their own owner id.
is it possible to get the player by owner id? for example if server gets id 4, how can I find the player with that id?
you'd run that snippet on the server though.
to do it on a client you would need to somehow globally associate each client with their owner id so other clients can see which id belongs to which player.
I will check this code now, Thank you!
Hi, Im doing a really heavy mission (size) and I want to play a intro (cinematic intro). I've some troubles playing the intro in the right time. When the player click "Continue" on briefing (playing on multiplayer) it get stuck on a loading screen for several seconds and when the loading screen ends the intro its already playing. I've tried using time > 0, getClientStateNumber >= 10. Some ideas? Thanks
Have you tried running your intro from PreloadFinished EH? https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PreloadFinished
can I add my own event handlers for stuff like 'plane in catapult', 'plane cat shoots' and so forth for the Nimitz? Right now the number of if's and the whole launch and arrest(recovery) scripts are a bit messy
Maybe BIS_fnc_addScriptedEventHandler and such functions?
Have you tried running your intro from PreloadFinished EH? https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PreloadFinished
@unique sundial
it worked !! Thank you!
surfaceType getPosASL player in building returns "#GdtDirt" how can I fix it?
I tried postition, getPos, getPosATL same results
What are you expecting?
maybe at least floor_inside?
(I updated the wiki page)
it takes a 2D position, so floor is most likely the terrain surface
surfacetype will only return the terrain type, without taking in account buildings or decals (eg roads)
ah I misunderstood the
or Position3D in which case Z will be ignored
that is nice π so this function is pretty much useless right? I mean how would I ever get it to show surf_rooftiles for example?
magic
@spiral fractal you can find out with```sqf
onEachFrame {
hintSilent format ["ASL: %1\nATL: %2", surfaceType getPosASL player, surfaceType getPosATL player];
};
yep
I wouldn't rely on it too much either.. you'll find it returning things like dirt even when youre on a runway
no, this code only show the ground surface
how would I ever get it to show
surf_rooftiles
that's β to what I replied
who knows, maybe Arma 3 introduced a 2D/3D change Β―_(γ)_/Β―
(I wouldn't count on it much)
one map, can't remember which has loads of 'reddirt' while another had none
I dont understand, your code show the same result 2 times because Z is ignored
It is "to be sure there is no difference"
oh I am sure...
I tried almost every position function even eyePos π
is it was that hard to make it check Z?
@spiral fractal , I haven't read up and don't know what you're trying to do, but when I tried to use surfaceType as a helper for mission dynamics, I ended up using https://community.bistudio.com/wiki/selectBestPlaces instead
I am planning to add onEachFrame to player if he has ghillie suit, and is prone on the ground to set his CamouflageCoef to 0
ah ok
getenvsoundcontroller might help, its something I use a lot
You're specifically looking for long grass though, presumably
*pulls up getenv ~ wiki page. sees own username in notes section
this function may come in handy
How could I get animation state for pylon weapon?
https://community.bistudio.com/wiki/animationSourcePhase maybe, with the animation source name
see https://community.bistudio.com/wiki/animationNames to get some animation names (not always the same as animation sources)
@neon snow β
how can caller get result from remoteExec / remoteExecCall? called function return boolean
Hi, I want to execute some code to prevent AI move when a player disconnects from server. If I put 'this disableAI "Move";' on the init of each playable unit it works. But I don't want to do it that way. I want to do it in some script file, so when I add some new playable unit it will add this feature automatically. I tried to execute the same line in init.sqf, initServer.sqf, initPlayerLocal.sqf, initPlayerServer.sqf and it didn't work on any of those, I also tried to use eventHanddles but I don't know which event its the right one and where it has to execute, thanks
Anyone here with a windows or linux (32bit) server who can run
diag_log ["ROAds", count ([worldSize/2,worldSize/2] nearRoads 2000)]; on stratis on their server and give me the result?
Should be either 1190 or 1203... I get 1203 on windows client, not sure if thats supposed to be same on server or if 1190 is the number for server as it has different data.
@still forum , I've got a windows 64b server here, can I help?
@spiral fractal make function send back the result to sender same way you called remote function
yes I found reddit post and Adanteh suggested to run remoteExec with caller id inside the remoteExec, so I am changing my code now
Aww... I hoped it to be 1190 π’
its 1203 on both server and client
17:30:53 nearRoads 16384 98694 1634 57534
17:30:15 nearRoads 16384 98683 1621 57522
Yeah.. linux x64 is still missing 13 roads... Well atleast its not missing over 1000 anymore π π
now I need to test on 32bit linux server, I'll do that myself instead of waiting π
nearroads returns some runway peices
but some runway pieces return false for isonroad
is it possible to "fix" surfaceType function?
whats broken?
its not checking Z
...Why?
im not sure that counts as broken
no, there is only one terrain under your feet, no need to check z
yep
17:48:13 ["ROAds",1203] on linux32 bit daaang... I thought I was done...
idk when I read "surfaceType" I think about surface under something, so if I pass player pos I except to get surface that he is standing on
it grabs the terrain material, and thats intended
Better make it more clear on BIKI?
same for surfaceIsWater, surfaceGetNormal, surfaceTexture
no, better add parameter to it to allow it
I don't think that's a good idea
Make another command is better to make it compatible with older functions
(If there's even chance)
The command implementation can only read terrain, making a line intersect on any nearby objects and trying to find that and getting the exact face and its material and parsing that.. noooo. Won't happen. That'd be a completely new implementation of that command
surfaceNormal*
Ah, read the wrong column
when vehicle drowns, it becomes wreck but it seems that killed event not fire, is it true?
is it because the setDamage command executed with false as second parameter when it happens?
I think that observed behaviour predates the introduction of that parameter
I don't think the engine executes script commands internally when killing a vehicle
Sounds like a bug that should have a feedback tracker ticket
Hey guys, is there a way to determine the player covered distance in meters?
There's another weird 'vehicle gets wet bug'. If a vec gets deep in water but is able to drive out, if the driver gets out and back in, the vehicle will behave as though the engine is killed, although the indicator doesnt show red
other players can get in the vec and drive it as normal, but the player who dunked it cant
nice π
I am not skilled enough to test it to be 100% sure its a bug... maybe its something in the mission file that I edit, but that is what I saw
to me, what you are describing sounds game related rather than mission related
and it wasn't reported before?
ive never searched for reports of it
*searches own mission folder
it seems I knew about it, as my mission has a workaround
what is the workaround?
periodically, i check the health and ASL of my two main mission vecs
if they are damaged and underwater, i execute a vehicle died script
tbh, i rarely use kiiled EH on vehicles anyway
@fast harness you could add a loop that every second check the player's distance from the earlier second's save position
I thought about it but I wanted to use event instead
@winter rose Can you guess, how that affects the performance? π
you want something like pedometer?
Yep
negligible, @fast harness unless you have a million players
will this be MP?
Yep
you need to decide if you are going to do it client or server side
server side, because the values are passed to a extension
yep, good reasoning
if it run on client it will affect server?
no
So I can initiate a SQF thread per user or maybe a single thread which foreaches all players?
yes, should be OK unless theres other stuff you havent mentioned
Not at the moment π
π Sure, I'll do it...
I think its best to make client do as much work as possible
it depends....
Yeah, but then I must handle a lot of publicVariables
depends what you want to do with that value
store them in a redis database
ah you want to do something like dayz stats has?
yep
as a general rule, if its today with mission assets or enemy AI, do it on server
then send the total value to server on player disconnect once
My Idea is a rvextension, which spawn a seperate thread which takes control over the data i/o.. in the mission i make simple value calls to this extension
thats way above my paygrade, so I'll keep quiet π
But I'm not so famillar with SQF handling at the moment π
i first learnt COBOL and then SQF. I'm not sure which is the most fit for purpose yet
yes, i am old
I think getting the total value when player disconnects will be the optimal way to do it
oh wait, news just in... CP/M was the first code I actually wrote with any skill
Oh.. cobol is hunting me...
A lot of our IT workloads are running with 16 bit COBOL tools... lot of migration fun
Little lost here.
{
doStop _x;
}forEach units this;
waitUntil {
behaviour leader this == "COMBAT";
};
{
_x doFollow leader this;
}forEach units this;
};```
Getting generic error in expression `behaviour leader this |#|== "COMBAT";`
in composition init ^
maybe you have to add ( ): behaviour (leader this) == "COMBAT";
no
unary commands always take precedence
I'd say the posted error message is not the complete message
im pretty sure it is, { doStop _x; }forEach units this; works fine in the init
Will do
this spawn {
{
doStop _x;
}forEach units _this;
}
replace with _this inside the spawn
okay, that mostly worked. How do i get the leader of a group in this scenario?
getting this now https://gyazo.com/c2d38813b91f738bd09535e0228fabea
tried a few different things, cant seem to get it
[] spawn {
{
doStop _x;
}forEach _this;
waitUntil {
behaviour (leader _this) == "COMBAT";
};
{
_x doFollow leader _this;
}forEach _this;
};
};```
Hi new to this, I'm dad!
Hello All, I am wondering what is the best way to measure a unit travelling 100m or more, I have been messing with a few snippets and been unable to find the solution
hey guys, trying to find a script that allows people to respawn with their full load out, not what they died with, but the number of mags, nades, AT whatever their initial loadout has. any suggestions?
@crisp cairn 100m from the starting point or 100m total walking distance?
maybe you can use trigger
Total walking
you would have to loop, something like this:
private _distance = 0;
private _oldPos = getPosATL player;
while { sleep 1; _distance < 100 } do {
private _newPos = getPosATL player;
_distance = _distance + (_previousPos distance _newPos);
_oldPos = _newPos;
};
hint "you walked 100m!";
Thanks mate, appricate it
Hey, how can I create a GUI that just stays in the background (the player does see it) at the bottom right corner of the screen, yet the player will still be able to play?
sort of like to display players stats
https://community.bistudio.com/wiki/cutRsc does that
also #arma3_gui
π€ or you can just ctrlCreate at mission display I think
setTimemultiplier... which factor does it have ? Tick*Multiplier?
or seconds * multiplier ?
does it matter?
unless I'm fundamentally misunderstanding the concept, settimemuliplier 2 will double speed regardless of whether its doubling ticks or seconds
it's in-game time multiplier, period.
It is even written here:
https://community.bistudio.com/wiki/setTimeMultiplier
ty
configSourceMod (configfile >> "CfgWeapons" >> "arifle_AK12_F") // "enoch"
Which is Contact DLC, however this is expansion asset (Apex)
getText (configfile >> "CfgWeapons" >> "arifle_AK12_F" >> "DLC") // ""
What?
configSourceMod (configfile >> "CfgWeapons" >> "arifle_MXC_F"); // "enoch"
However belongs to "A3_Weapons_F_Rifles_MX" addon which is vanilla A3 content
BIS Consistency β’
Have a nice day
https://community.bistudio.com/wiki/configSourceMod
Returns modDir of the mod that given config class was loaded from.
maybe one overrides the other
it is not a "mod asset" command
https://community.bistudio.com/wiki/getAssetDLCInfo
might be what you are looking for, but it is not on release yet
So I'm wondering for "arifle_AK12_F" in particular. This is Apex content (expansion mod). However it has no config value of DLC it belongs to. How do you properly define that? Create a damn simple object of weapon model and getObjectDLC it?
Perhaps
POLPOX did something for the https://community.bistudio.com/wiki/Arma_3_DLC_Restrictions page, the script is at the end of it
thanks to the pointer to the scripted Event Handlers, guess I will restructure the Nimitz catapult and recover functions to make use of it. This is my very basic sample code for it, if there's more to it let me know: https://sqfbin.com/eseroyerasidihetuyuy
how to assign all tasks again to the player after teamswitch to a different squad?
if I run this code in CBA_fnc_addPerFrameHandler:
_pos = getPosATL player;
and I use _pos value 3 times, will it be faster than calling getPosATL 3 times?
_pos will be created and deleted on every tick?
not by much, but most likely yes
@sacred slate you can just add the tasks to all the potential units
because it is just returning the variable value instead of doign all the work to return the position every time.
as a general rule if I use something more than once, i assign it to a variable.
I thought so, and _pos itself, will be created and deleted on each iteration right? is it possible to keep it?
set it as a global variable
pos?
as a global variable you would want some prefixes on it. alternatively you can set the variable to a namespace just for that perframe event.
you can do it however you like, just as long as it is saved somewhere that isnt wiped when the perframe event script ends
if I pass it as argument to the handler, and change its value inside will it work?
@winter rose units get spawned mid game too
that would be the same as defining it locally on every execution wouldnt it?
@sacred slate ouch
well, no easy way I'm afraid
the pos argument would be what it was when you added the event (unless cba perframe events allow updating the event args for next execution)
ok thx, i thought about a simple snipped.
ah ok
but i can live without too
is there wiki page or something where I can see list of function benchmarks, except the Code Optimisation page?
you can benchmark yourself with diag_codePerformance
or the bottom-left button of the Debug Console, too
does that use the command now or is it still on the old function version?
it uses the command, very cool π
I saw that button but last time I clicked it my game crashed so I never used it after that π
just make sure the code your benchmarking is unscheduled and you'll be fine π
right now it shows : 0.0178ms
for 10k iterations
oh oh, I think it was registering the handler every time
π
if you do```sqf
player addEventHandler ["Hit", {}];
i pressed it like 10 times π
is this correct? if yes, where should i place it. i had it in the init. onTeamSwitch {[_from, _to] execVM "test.sqf";};
it would be better to add a mission EH @sacred slate
i am lucky to understand, that means mission event handle.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#TeamSwitch ```sqf
addMissionEventHandler ["TeamSwitch", {}];
cool! thx
and this goes anywhere into the init? π
or can it be some where else
any other exec'ed sqf's for example
I will benchmark my code to make it as fast as possible,
if I use exitWith will it be faster than nested if ?
I have 3+ checks at the top of the file, each one will exitWith
3 if exitwith, 1 if lazy eval exit with. nested ifs. dont think it makes a noticeable difference if the checks are light.
ok, Thank you!
@sacred slate depends on what you want Β―_(γ)_/Β―
when it comes to simpler stuff you may consider readability over optimisation.
@sacred slate if it is a local-run script, init.sqf yes
is there a: selectPlayer next? you even have a hotkey for that but i can't find anything.
in ArmA, it was Y/U/I iirc
there might be a key for that, just unassigned
yeah, but i need that as a script.
a combination of selectPlayer, find and playableUnits should do
the syntax of�
anything π
there is an entire wiki π€
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
β syyyyyyntaaaaaaxes! π
its frustating when you even can't find the syntax
What
selectplayer next; there is even a hotkey for that action (switch next unit)
what happens to the CBA_fnc_addPerFrameHandler when player respawn?
Nothing. It's there.
What, no. Pfh is not related to unit at all if you added it will be running until removed.
If you mean that you added it with reference to player unit it will hold that reference.
It will be the corpse or objNull if corpse was removed.
You have access to pfh ID inside it.
Do !alive _unit check and remove it if you need to stop it.
can I do it inside the PFH?
You have access to pfh ID inside it.
Yes
_this call CBA_fnc_removePerFrameHandler; inside will work?
No, read PFH documentation
according to the documentation of CBA not: https://cbateam.github.io/CBA_A3/docs/files/common/fnc_removePerFrameHandler-sqf.html
I've placed a smoke module, a few, and I'm wondering if it's possible to replace that data with the "billboard" code/
sorry to butt in
_thisΒ ARRAY
Β 0: _args - Parameters passed by this function.Β Same as β_argsβ above.Β <ANY>
1: _handle - A number representing the handle of the function.Β Same as β_handleβ returned by this function.Β <NUMBER>
and in MP environment, I cant use player inside the PFH, I have to pass the player as argument?
you can use player if the event is running on a client.
hmm, how is it possible? I do separate test for each line in editor debug console:
private _s = "concrete_hall";
if ( "Grass" in _s || "Soil" in _s || "Weed" in _s || "Beach" in _s ) then {true}; // 0.0029 ms
if ( "Grass" in _s || { "Soil" in _s } || { "Weed" in _s } || { "Beach" in _s } ) then {true}; // 0.0038 ms
if ( "Grass" in _s || { "Soil" in _s || { "Weed" in _s || { "Beach" in _s } } } ) then {true}; // 0.0039 ms
because you are checking for concrete_hall so it will check all
check for grass, im guessing the bottom one will be the fastest then
@unborn ether https://community.bistudio.com/wiki/getAssetDLCInfo
bottom one is the slowest obviously. as neither of the conditions are true and it has to nest into each of them
https://community.bistudio.com/wiki/getAssetDLCInfo
too late, old man
β¬ββ¬ γ( γ-γγ)
ah, I understand now, the { } only useful when condition is true asap
I set it to "concrete_hall" to check the "worst case"
if I do setUnitTrait every 0.5s it will cause server bandwidth to increase right, it will send data to the reset of the players?
afaik unit traits are shared, so yes
I added flag that (if will work as intended) will change value only if previous value was different, probably the most I can do...
is it possible to search for "EAST" for example in nearEntities? I want to find enemy that dont know about the player
There is no way to access a function (*.sqf) from addon in mission files?
I defined
missionNamespace setVariable ['TestFunction', compileFinal preprocessFileLineNumbers "fnc_test.sqf"];
But I can't call it in the mission ( "Test" call TestFunction; )
_nearEntities select { side _x == east };
@spiral fractal β
@fast harness there is
either function viewer if declared in CfgFunctions,
or you can execVM its addon path
Just updated my post
Okay.. but in this way I have to double handle the declarions (in addon and mission file) ?
in addon = globally declared, same as BIS fnc
ty; I'll give it a try via CfgFunctions
https://gist.github.com/liKe2k1/39b2c26e5ac1cab918ddb4e436a22d09
Undefined Variable: testlib_fnc_getversion
π¦
The Server has -serverMod=@testlib , the client doesnt know this mod
ah okay, so there is no way to push the function to the client ?
add the CfgFunctions to the mission! otherwise, the functions could be overridden.
CfgFunctions and file in the mission yes
okay, thanks π
you have to choose:
- server-side only function: server-side addon
- server-side & client-side: either both have the addon, or the mission defines the function in its own CfgFunctions
CfgFunctions
As far as I understand,CfgFunctionsis a member ofdescription.ext.
Does that mean that if I useCfgFunctionsI have to get back to editor and make a save each time I wish aCfgFunctionsstructure update?
CfgFunctions can be a part of an addon
That makes the situation even worse))
https://community.bistudio.com/wiki/Arma_3_Functions_Library explains it all
I mean, my experience says using CfgFunctions makes the local development extremely slow.
Hmm I didnt use the eden editor, just only for unit placements...
@quartz pebble every time you Ctrl+S or start the mission, description.ext changes are updated/loaded
Yeah, thats exactly what I mean. You can do "Start mission" only if you work on a tiny one.
But if it is a medium-to large and requires you to do a number of steps after the mission start to prepare the environment for your script run..
Then exiting to editor, restarting, setting environment becomes a too much time eater.
Yep. I agree.. to setup an dev environment (build scripts, copy, restart and more) takes a lot of time
don't develop your functions and your mission at the same time π
(I know, sometimes you have to)
Heheh didn't do that π
don't develop your functions and your mission at the same time
If you work on a multiplayer mission then you don't have an other option.
I prefer the way: Just setup both projects (mission and addon) in your IDE and make some magic in Powershell π
And I work on a mission as on a mission and then when PBO builds, the build scripts separarate the SQF code onto mission and addon pbos.
Thats nice π
If you work on a multiplayer mission then you don't have an other option.
youuu do, if you know what you are doing π
I develop my MP missions in SP, then eventually debug them with friends if needed
βοΈ
I develop my MP missions in SP, t
I guess everyone does so.
By the way. I gues what BIS CfgFunctions framework does - is takes your files and runscompile preprocessFileLineNumbersorcompileFinal preprocessFileLineNumbers.
Or it also does any other useful things?
compileFinal* so it is protected
it also defines _fnc_scriptName variable(s) and meta data too
which kind of meta data?
freshly baked yesterday for your eyes only π
https://community.bistudio.com/wiki/Arma_3_Functions_Library#Meta_Variables
_fnc_scriptName: String - Function name (e.g., myTag_fnc_myFunction)
_fnc_scriptNameParent: String - Name of q function from which the current one was called (_fnc_scriptName used when not defined)
you can also make them execute before or after init, etc
it makes coffee, too
I feel that framework was designed to separate BIS devs who write code from devs who make missions.
well, it's a framework
"just take a suitable func from a lib and don't think how it works"
yep!
also, prevents a super-useful function to be lost in one single mission
also helps the community to work with a lot of stuff - I mean, tasks without the Task Framework? buh!
Sure. I totally understand why BIS implemented the framework as it is. It solves their problems.
But what I can't understand though, is why a single mission maker would use the framework for his in-mission scripts? Which problems the framework would solve for him?
Arma 3 doesn't force you to use the (new) Task Framework, since it's still possible to use the "old" functions to do exactly the same. It just makes it easier for mission makers to create/read/update/delete tasks and keep track of them
We're not about the tasks framework, we're about CfgFunctions framework.
again; not required, just extremely useful, especially to prevent people from overwriting your stuff
just extremely useful
Which way (for an MP mission)?
From a bloody programming principle perspective
especially to prevent people from overwriting your stuff
especially to prevent people from overwriting your stuff
How would they override your stuff?
My_Function = compileFinal { /* code */ };
is "fine" tooβ¦ as long as you set it for all your clients and the server π
My_Function = compile { /* code */ }; // not compileFinal'd
```can be overridden by a malicious `publicVariable`
The question is - how that malicious publicVariable happens on the server? Through a cheat?
when an exploiters runs arbitrary sqf
I can think of multiple ways to execute sqf on MP servers...
but won't go there since it's against TOS and #rules
I think if someone malicious can run an arbitrary sqf code on the server, overriding your funcs - is the last thing you must care aboutπ
nope, it blocks a lot of attackers
see https://community.bistudio.com/wiki/Variables#Multiplayer_Considerations
so why not do it correct from the start, so that it doesn't break your mission/mod...
is it possible to set whitelist in server.cfg that will only allow whitelisted UID to join?
not do it correct from the start
Making a developer return to editor and Save each time he needs to update a structure of functions - is not what I'd call "correct"π
create CfgFunctions once, start game once, modify scripts on the fly...
it would be good if it was possible to simulate dedicated server in editor
just because you don't know HOW to do it, doesn't mean it's bad by default...
and I usually write my scripts within a mission (easier to debug) and move them to a mod
trust me; restarting the game every time you make a change is worse!
create CfgFunctions once, start game once, modify scripts on the fly...
And if need to add/remove a function? That's not what can be done without exit to editor
then make a simple execVM, what can I say
1/ define your functions
2/ code your mission
ideally, not both intertwined
Ok, some ahother thoughtsπ
Assume arma can't protect against a malicious publicVariable (it is a legitimate command itself - how can arma know what's inside Β―_(γ)_/Β―)
But what if there is some code you wish to run on clients but don't wont to include into a client pbo? (say, it is secret)
make a server mod which includes the functions (so it's only loaded on the server)
however this also means it can only be executed by the server
But somehow you'll need to pass it on client to run there
if a client needs to run it; it needs to be available on the client
although you could make a function which triggers a function on the server π€
why would you transmit code through network, as it is both
1/ unsafe
2/ network-hungry
this is why it is in the bad practice list!
There are two opposite requirements: "the client needs it" and "you don't want anyone to see it"π
(and that is only for a couple of funcs - not for the tons of code)
this is bad too:
[[], { player setDamage 1; }] remoteExecCall ["spawn"];
but doable
"less bad"
got a feeling it's another L*fe developer π€
but people can see it if they do an allVariables missionNamespaceβ¦
There are two opposite requirements: "the client needs it" and "you don't want anyone to see it"π
if the client needs it, the clients needs to have access to it...
if the client shouldn't see it, either protect your pbo or find a way to have the client execute a function from the server (which in return executes it on the client / all clients)
but in the end it's Arma, a sandbox, where good programming solves 50% of security issues, and proper server configs the other 50%
Or the other way: pass the code to clients through the publicVariable, and then compileFinal on clients?
that will still show the full function on the client...
Only for those clients which know how to dump traffic or memory.
or access SQF
or access SQF
I bet they are less numerous then those who know how to dump
are you kidding? how many Debug Consoles are active out thereβ¦
if you want super code safety, it's
client β params β server
client β results β server
period
how many Debug Consoles are active out there
Define "debug console". I'm serious. I've never investigated.
which can be accessed even on MP, either when mission/server is broken or with hacks
and trust me, the amount of script kiddies out there have access to it...
https://community.bistudio.com/wiki/Arma_3_Debug_Console
Never seen this working on any public server (except on ours and for myself only). But I believe it can be enabled by cheats.
and that's the issue here
CfgFunctions makes it readable, but read-only
might be missing something here.. @quartz pebble is your aim to create code that is unreadable to others ?
Let's say I'm just thinking aloud.
well the answer would be to me anyway, yes no or i dont know
unreadable by clients, but executable by clients
so taking this another step, you want to write code for your project but you dont want others to see, copy your code ?
unreadable by clients, but executable by clients
Mikero's tools. But that's another question: use or not to use. Philosophic ratherπ
anyway, logic-wise, always consider your clients as troublesome
you can only manage the server, therefore lock it up and secure it at best
make the clients ask the server, and the server answer the clients
the server is the one and only referee of the game
and hiding code is⦠meh
Nowdays everyone tries to hide
not me... everything is open source (or not released yet)
so here is my take on this, and this goes back to 2002 when OFP started. Since then most but not all code is a copy of someone elses work, developed and taken further. There is very little today that is "unique" as in not developed from someone elses work. Prior to "Life" the openess of using others code was very acceptable and allowed speedier development for new ideas.
The coming of the Life servers in my opinion poisoned all that, as far as i am concerned life server attitude to development stinks especially as very little of it is really any life server admins work
only thing I can think of to hide from clients are passwords and hashes... and for those there are other methods (although still readable on clients when accessible)
as you can see from the reaction to that post I am not the only one that thinks this
which is why I wrote this
https://community.bistudio.com/wiki/Code_Best_Practices#Final_words
It soils your reputation and devaluates your actions once it is found out β and it always get found out. DMCA's are filled on Steam every day.
It makes people in the community get less helpful and more reluctant in giving advices. It can also prevent them to release an interesting feature!
Don't try to obfuscate your code: it is considered rude, especially since you learnt from others.
Obfuscated code only makes it harder to get, but does not make it copy-protected. If the engine can read it, it can be obtained.
Obfuscated code is also slower on compilation (and, depending on the quality of code and obfuscation, on execution too).```
I wonder if there's obfuscation tools for SQF
which is why I wrote this
This has to be added as a warning to all obfuscators
I wonder if there's obfuscation tools for SQF
oh, there are. guess the community

If the people making the obfuscators shared the opinion of that text they propably wouldnt be making obfuscators @quartz pebble
and in addition everything I release is open source for good reason. For historical evidence, take a look at an addon from many years ago called Tx_Utils and then look at one of the better known frameworks and look for systems in there that are based on that (There is a lot)... Happy to see it being used and happy it has become popular and used by so many. My repayment for many many years of fun in OFP/ARMa and by christ i get annoyed by the arrogance of those thinking they are better than anyone else and their code is so bloody special
rant over my blood curdled there for a bit
especially as very little of it is really any life server admins work
That's just false
@wraith cloud most of L*fe servers are full of stolen content. Not all of them.
either that or most of the thieves are in the L*fe community, maybe
Those that have stolen content are irrelevant modded servers that last for a month or two
can someone point me in the direction of a link to replace an action key? i dont want to do a waituntil for someone to hit a key. but i cant remember or find the url that told me how to for example execute my own script when someone opens the map.
@wraith cloud like, ANZ*S?
@exotic tinsel https://community.bistudio.com/wiki/BIS_fnc_holdKey ?
I've heard that, yeah
eh, there was something i found so that i wouldnt have to worry about the key they pressed on the key board, rather it would fire no matter what they had the action bound to.
https://community.bistudio.com/wiki/displayAddEventHandler with "KeyDown"?
got a feeling it's another L*fe developer
@exotic flax Now I understand what did you meanπ€£
Nope. Ours is another one. (Don't know if #rules) allow placing server links.
@exotic flax that still relys on knowing the key they pressed. Crap. This UI guy in the past showed me how to do it and i cant find the src. fml.
if it helps with figuring out what im talking about i would have to add the code the description file. What im trying to do is replace the action for when someone opens the map to instead run my script.
that way it doesnt matter what key they bound the map too.
https://community.bistudio.com/wiki/actionKeys
actionKeys "Map";
well, that too veteran π
he said he does not want to poll for keyPresses
can someone point me in the direction of a link to replace an action key?
weeell :p
EH it is then
although you can use that in combination with CBA settings (for custom keybinds) or the User Action keys (in combination with inputAction and/or actionKeys)
sorry @winter rose that was my bad, poor wording on my part.
(okido!)
ok so inputaction looks like it operates based on the action not the key, question is how do i fire my own script on for example reloadmagazine like the code from link below.
https://community.bistudio.com/wiki/inputAction
with out the waituntil loop
you can't.
you can check on keyPress what inputAction is pressed.
so add keyPress EH to mission display.
moduleName_keyDownEHId = findDisplay 46 displayAddEventHandler ["KeyDown", {
if (inputAction "User1" > 0) then {
// execute code
};
}];
ok so if i use that, what i can do to prevent the original action from firing, so to stop the map from opening. So that it doesnt flash on the screen when i use the code i know to close it.
you would need to override it by returning true at the end of it
perhaps explain what you want to achieve, because now we give solutions to problems you don't seem to have(?)
@winter rose got it
eg. if you want someone to not being able to open the map, remove the map from the player π€£
im gonna use the code @exotic flax thx for all the help, again.
I want to write good code. even though im new. i have a custom gui for the map that i have been working on and now its time to activate it when someone opens that map. I dont want it to be clunky and i want it to run well. I all all the validation for whether or not to open it but i needed this code you provided. thanks all.
eg. if you want someone to not being able to open the map, remove the map from the player
@exotic flax Lets say.. There are some scripts in the mission I don't want public to avoid unnecessary questions.
how is that quote related to your comment? π€
The quote does not show whom it is addressed to Β―_(γ)_/Β―
If that wasn't me - ignore my answer
the map question was LifeSnatcher's π
Then my favorite smile: Β―_(γ)_/Β―

stahp itt
No, don't eat the frog!
nom nom nom nom
Yes, my liege
ππ¨
Before I go on a wild goose chase, is it possible to have an item that when you hold it allows you to have an action in your scroll bar that you can use up?
For example, a button misc item that teleports an item in.
you can script that if you have an object of type "x" in your inventory, an action appears yes
Awesome, just making sure before I research how to do it, that it's possible.
Addaction has a condition property @spice vigil
Just Check if the Player has that given item in any inventory π
X39 when I see your avatar I read the message with that character voice π
Hello, comrades! Can anyone remind me of the command, that renders object beyond objectviewdistance?
no, it was kinda specific for one object
Thank you!
I'm having some issues wrapping my head around triggers, inits and remote execution. I've got a briefing area set up in my mission, which is enclosed in a trigger area; I want to set it up to warn players if they are leaving the area before I've finished the briefing.
My trigger is set up as a simple this trigger, with the activation condition being that any player exiting the area should trigger it. I set the OnActivation and OnDeactivation to be as follows:
[parseText "<t size='2.0'>Please do not leave the area while the briefing is in progress</t>"] remoteExec ["hint", thisTrigger];```
``` OnDeactivation
[""] remoteExec ["hint", thisTrigger];```
Testing it with a friend, though, it appears that once the server is hosted, the trigger doesn't appear to do anything? I'm pretty sure the `targets` parameter of `remoteExec` can target an object, so it should target the client of the player who leaves the trigger, correct?
is the trigger server-side only?
Not set as such, no.
try thislist instead of thistrigger - this will hint only to units in the trigger
hey guys, anyone willing to help with an addaction within the init.sqf? It works when I test it locally but not on a dedi server. Can I send someone the init.sqf for someone to look at please?
_object addAction []; or player addAction []; should work without issues in init.sqf so I guess you have an issue elsewhere, which should pop up when you check your log files or have -showScriptErrors enabled in the command line parameters
Tried again with thisList, still doesn't appear to be doing anything.
@exotic flax nothing in the rpt and no script errors. I am trying to get the mission to end at an "Officer" when you reach him, officer addAction ["End Mission", "endmissionstate.sqf"];
can I put it in the init box of the unit?
this addAction [
"End Mission",
{ [] execVM "endmissionstate.sqf"; }
];
this would be better
and please check the documentation of addAction, because you can't just call a file directly
hmm... it is possible, although IMHO a bad idea
ok cheers mate
is it possible to lock UAV so that only specific player will be able to control it?
this is the code I have:
_u = [getPos spawnflag, 340, "B_UAV_02_dynamicLoadout_F", west] call BIS_fnc_spawnVehicle;
//(_u # 0) setVehicleLock "LOCKED";
player connectTerminalToUAV (_u # 0);
_wp = group (_u # 0) addWaypoint [position player, 0];
Okay, follow up question: What would I add into the Config.cpp class to get the item to give the player the action to activate the sqf script? (anyone have an example, I've been trying to research it but, again, I'm at a loss. Haha).
Im looking to get into Arma scripting. just been roaming the wiki, it'd be nice to have someone I can go to for questions, please dm me. Thank you
You can post your questions here π€·
I guess, I just don't want to flood the chat
but 1000 people know more than 1 π
Fair enough π€·ββοΈ
I just don't want to flood the chat
But thats exactly what this channel is for π
Only experience I have with programming was when I took 2 years of learning computer science in high school(java) and very minimal c++. I've just been scrolling the wiki for probably 3 days straight trying to find guides or something to help me progress and it I haven't really gotten anywhere because I don't know where to start, I look at snippets of arma scripts and they look entirely different from what I understand, I just need a guide I guess to help me get started
Im like 3 hours deep into this 18 hour c++ course
knowing a language like c++ will probably help you understand the underlying concept of SQF. Mainly the syntax and generally how things work and why (all because of the syntax basically)
Is it a good place to start? Where do I go to progress in the future?
https://community.bistudio.com/wiki/SQF_syntax
understanding the basics IMO its most important to know that almost everything (besides "private" keyword, = sign, and brackets () [] {}) is made up of the 3 types of operators listed there
Next step is to get used to reading about all the commands when you use them https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
You just cannot know everything, so seeing/reading the wiki is most important
Yeah
@simple notch these links can also help you:
- https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
- https://community.bistudio.com/wiki/SQF_syntax
- https://community.bistudio.com/wiki/Code_Best_Practices
- https://community.bistudio.com/wiki/Debugging_Techniques
And as already told, this is the place to ask for help/guidance/confirmation π
if you played some mission that you liked or want to build something similar, you can check if it has github repo and learn from it too
Okay, so I have changed my mind a little bit. I would like to make a custom grenade (which I can do) which triggers a sqf supply drop (which I can also do). But what I can never figure out is the config. Like what would I put in the config of the grenade class to activate the sqf script? XD (Quickly Favs all of those links, haha)
maybe check ACE source code: https://github.com/acemod/ACE3/tree/master/addons/huntir
https://github.com/ArMaTeC/vscode-formatter-sqf
anyone know how to install this?
@short sparrow you can install it directly from visual studio code, no need to download it from github
go to the modules panel, look up sqf, it will be in the list
I search by 'sqf' and I can't find any sqf-formatter
Hello everyone, does anyone know the difference between playMove and swtichMove? Because Im trying to do an animation menu, en some animations plays with playMove and others with switchMove
I recall those are explained on the wikipages for those commands?
The difference between playMove and playMoveNow is that playMove adds another move to the move queue, while playMoveNow replaces the whole move queue with new move
would have been nice for cargoindexes to be a param for getIn/getOut eventhandlers
you can already see if it's a "driver", "gunner" or "cargo" seat, so if "cargo" simply do a _cargoIndex = _vehicle getCargoIndex _unit;
last time I checked, that couldn't be used for the getout event. It would always return a null as if it was too late to retrieve the value
I'll test it again
not sure about GetOut, since technically it should be empty because the unit is not in the vehicle anymore
yeah thats what I mean. I believe in the past I set a user variable for the cargo index when they got in, and then got the variable when they got out
getCargoIndex probably also won't work on GetOut since it needs to be in the vehicle to get the current index.
probably the best way to handle it is to have a GetIn EH (on vehicles), and add a GetInMan and GetOutMan EH on the unit entering (including a variable with cargoIndex, which can get updated with GetInMan for position changes) and remove the EH's on GetOutMan.
does anyone know a way to increase the imagesize in a CT_TREE, they are tiny and squashed
_Functions_CT_TREE tvAdd [[], "Primary Weapons"];
_Primarylist = "getnumber (_x >> 'type') isEqualTo 1 AND getnumber (_x >> 'scope') isEqualTo 2" configClasses (configfile >> 'CfgWeapons');
{
_text = getText(configFile >> "CfgWeapons" >> configName _x >> "displayName");
_pic = getText(configFile >> "CfgWeapons" >> configName _x >> "picture");
_Functions_CT_TREE tvAdd [[4],_text];
_Functions_CT_TREE tvsetPicture [[4,_forEachIndex],_pic];
} forEach _Primarylist;
_Functions_CT_TREE tvSort [[4], false];
I believe the image size is tied to the text size
if that's the case i might as well ditch the images lol
How would I go about making all of my player's screens fade to black? I'm using the following, but it's throwing an error:
[[0] BIS_fnc_fadeEffect] remoteExec ["BIS_fnc_spawn", player];
} forEach _allPlayers;```
[1, "WHITE", 5, 1] remoteExec ["BIS_fnc_fadeEffect", -2];
maybe something close to this
Can remoteExec be used to spawn a function?
Tried that solution, using remoteExec to call BIS_fnc_fadeEffect has no effect, possibly because it requires a spawn command.
if you call it in multiplayer (not dedicated server), using -2 will not show it to you because you are the server and client with owner id 2, you can set it to 0 and try again, but then it will be executed everywhere
... This reminds me why I always loathed netcode.
everything I code works fine in SP then I test it in MP its not working right, then I fix it and test on Dedicated server and its not working again, so I have to rewrite my code at least 3 times 
I should probably change my technique...
I'm clueless when it comes to MP scripting, so here's my question:
if I use [] remoteExec ["muh_superfunction", 2]; to run a function on the server, then I call/spawn another function in that server side function, will the called/spawned function run only on the server, or will I have to keep using remoteExec with target of 2?
I don't want that nested function to polute clients
Im looking to get into Arma scripting.
A minute of discussions.
How much it is worth investing into SQF learning, taking into account SQF will retire once the next ArmA is released?
A minute of discussions.
How much it is worth investing into SQF learning, taking into account SQF will retire once the next ArmA is released?
Equal to your amount of will to invest into coding side of this arma
I mean if you want to code for this arma, then that's the language
SQF is simple ||but extremely annoying||
@thorn saffron you remotely execute the function, so it starts and runs on remote machine, so any function it calls will be on remote machine too
How much it is worth investing into SQF learning, taking into account SQF will retire once the next ArmA is released?
It's always worth it until you're interested with SQFs in Arma 3, even after the release of the next Arma which uses another language
there is also sqs if you want to avoid sqf
but joke aside, "how much is it worth", well: no SQF = no Arma scripting, that's it
you can wait years for a release that hasn't been announced, but that's your call
this channel is about Arma scripting though, and right now it is SQF
@spiral fractal, have you read the Multiplayer Scripting wiki article?
Right, this is really confusing me
Whenever I call a function which is supposed to return a value and assign the returned value to a variable, for some reason the value ends up being the bloody code of the function itself
if you are spawning it, then yes
yes, use call
use the result inside the spawn then
I'd send a screenshot, but I can't
What do you mean?
Is there somewhere I can send a screenshot to?
if (_wantToShowCode) then
{
call LM_fnc_useSqfTags;
};
yeah kk
hEvaluateCombat = [] spawn // once fncEvaluateCombat has run, set bEvaluated to true
{
bCombat = call fncEvaluateCombat; // call fncEvaluateCombat with within the scheduler
};
ah bugger
see pinned message
[] spawn
{
call SuperFunc;
bEvaluated = true;
};
urgh Java β SQF transition, brain has issues
no, I want to get the returned value of the function
[] spawn
{
private _result = call SuperFunc;
bEvaluated = true;
// use _result here
};
That's the thing
When I define a private variable instead of changing my local one, it gives me a generic error in expression
why not show us the whole code? (if it's huge, use sqfbin.com)
if you are returning code, you are literally returning code, not calling it somewhere
I know
That is not what I'm talking about
I'm talking about the returned value of call
if you hint the handle, you will see code, but that's not a Code type
if (!(isNil "_this select 0"))
```β¦ever heard of `params`, our Lord and Saviour?
One problem at a time
It's line 52 I'm talking about
Not spawn, not anything else
That always throws a generic error in expression
And Lou just pointed the problem didn't he?
so in an eventHandler, you want to define _Combat, that is not used anywhere else
F
π
please just paste the faulty code, not the whole page too ^^"
bCombat = call fncEvaluateCombat; // call fncEvaluateCombat with within the scheduler
Right, this is the line I'm talking about
bCombat is defined elsewhere as bool
THAT line
bCombat = call fncEvaluateCombat; // call fncEvaluateCombat with within the scheduler
number in your paste
I'm really confused
Do you want all the code, or do you just want to faulty line?
Right, all the code is here
Line 48 is the line I'm talking about
bCombat = call fncEvaluateCombat; // call fncEvaluateCombat with within the scheduler
bCombat = call fncEvaluateCombat returns a code type (typeName bCombat == "CODE") according to you
what line number is bCombat assigned at, where is fncEvaluateCombat starting
bCombat is assigned right at the start
function starts at line 6
I believe it's returning code yes
That's the only way it could be a generic error correct?
fncEvaluateCombat never returns anything, thus you cannot store its result in a variable if there is no result
you are trying to store something thats not there in a variable -> error
It should, I followed the guide on the biki to a tee
How do I return something then?
Ohhh
God this language hurts my head
How do I assign the return of the function then?
bruh
don't return the leftover empty space that the assignment left around
Are you bloody serious
Or, even simpler
fncEvaluateCombat = {
if (...) then {...} else {...};
combat
}
just return the combat variable that you are setting anyway
btw, its VEEERY bad practice to set global variables without a unique prefix
Its very likely that some other script might use the combat variable too and mess up your stuff
Ok, cheers
I'm trying to select the first argument, and if it exists return true
What would be?
And as Lou said, just use params with a default value
params ["_uEnemy", objNull];
if (!isNull _uEnemy) then {...} else {_uEnemy = uSelf findNearestEnemy uSelf; ...}
exactly the same
Okay, cool
Or even better..
New:
fncEvaluateCombat = // defines fncEvaluateCombat, which evaluates if the player is in combat or not
{
params ["_uEnemy", objNull];
if (!isNull _uEnemy) then {
_uEnemy = uSelf findNearestEnemy uSelf; // find the closest enemy to the player and store them in uEnemy
};
private _uEnemy = uSelf findNearestEnemy uSelf; // find the closest enemy to the player and store them in uEnemy
private _iEnemyKnowledge = _uEnemy knowsAbout uSelf; // find out how much the enemy knows about the player from a scale of 0 to 4
private _iSelfKnowledge = uSelf knowsAbout _uEnemy; // find out how much the player knows about the enemy from a scale of 0 to 4
if ((_iEnemyKnowledge > 0) and (_iSelfKnowledge > 0)) then // if the closest enemy is alerted to the player's presence, and the player is alerted to theirs
{
hint "Warning! Entering combat!";
true;
} else {
false;
};
};
just get rid of the duplicate code.
params ["_uEnemy", objNull]; DEDMEN π
huh
params [["_uEnemy", objNull]];

no worries
every men has theese kind of problems sometimes π
he wants to be on my paddlin' list but he won't!
What does having objNull in params achieve?
@surreal peak basically:```sqf
params [
["_identifier", defaultValue, [allowed, types], [ifArrayAllowedSizes]]
];
// e.g
params [
["_unitPosition", [0,0,0], [[]], [3]],
["_unitDamage", 0, [0]],
["_lock", 0, [0, true]] // accepts numbers and booleans
];
to old timers: was Operation Flashpoint's Desert Paintball always in the game (a.k.a in the v1.00)?
Got my answer: Real Paintball arrived in 1.40 patch
is the volume value in 5 fadeMusic 0.5; based on the client's music volume slider?
Let's say a client has the slider at 30%. Does that mean '0.5' volume would be 15% for that client, e.g. that specific client's master music volume?
yes, % of the client's setting. and no, you cannot force 1 to clients
Thanks.
Does 1 not just mean it will be the max volume as defined with the client music volume slider?
you can also do 5 fadeMusic 2; to increase the volume tho.
range is 0..1 @hollow thistle?
Hey folks, I asked a similar question before, but I'm getting a bit fed up. Is there no other way to get the muzzle index besides using the SwitchWeapon action and checking the current muzzle? It is not reliable at all.
Method with SwitchWeapon here:
https://community.bistudio.com/wiki/Arma_3_Actions#SwitchWeapon
@winter rose no? you can bump the volume
wiki is not right there.
At least in editor played mission.
Might be limited in MP like playSound.
ah well, this page has not been visited in ages so maybe then - anyway, the game's experience is always right π
Variable feedback! π
maaaybe we should ask for a limitation
Lou? You think you could help me out?