#arma3_scripting
1 messages ยท Page 543 of 1
yes, with ranging page-up/down
to slow down VTOL you need like 2 minutes for AI to level plane to that speed ( 15 km/h )
any way thanks for the help guys got the insert done so im off to bed
@tough abyss np! g'night then.
@astral tendon so far, from what I see in the BIS_fnc_garage function you can't choose the vehicles to be loaded
Question, if I wanted to make a object just magically motion tween to another location. Like having a VR cube move left to right. What script functions would I be looking for to accomplish this?
Guys, is it possible to make unit always run with weapon ready? I can't find any good commands for this.
And not just animated as if it was ready but really ready ๐
@outer fjord I think this will be of a help: https://community.bistudio.com/wiki/setPos
@chilly scarab have you tried just replacing a playAction with the same playMove?
Yes, playMove didn't work, probably beacuse the animation I'm trying to play is an Action and not Movement.
Well, playMove sometimes has nothing in common with movement ๐
Alright, well didn't work :I
I can see some opensource code here: https://github.com/micovery/takistan-life-revolution/blob/master/anarchyinthetk.takistan/animList.sqf
It uses your animation, with playMoveNow
["ActsPercMstpSnonWnonDnon_DancingZOZO", "reden", "playMoveNow", "Dance 4 (uninterruptable)", 2, ""],
String #24
@dull drum I thought that just magically warps the item to the position?
Isn't there framework now that allows you to mimic smooth transitions?
I didn't see that yet. But when I'm going with my scalpel to the Ryan's Zombies mode if I'm not mistaking the jumps and throws there are set with setPos. Could be mistaken.
mmm
I'm more worried I would need to call it like 3000 times to mimic a smooth transition
let me get a really quick glance there
_dir = _zombie getDir _target; _zombie setDir _dir;
I found this as well https://community.bistudio.com/wiki/setVelocityTransformation
Seems legit
Yes, RZ also uses setVelocity
fnc_RyanZombies_Velocity = compileFinal "if(local (_this select 0)) then {_this select 0 setvelocity (_this select 1)}";
someone can help me how i make ai turn global mobilisation searchlight on ?
@pallid gorge with a trigger activated on AI presence?
Does the searchlight editor object have some attribute to switch it on and off?
no
Then it probably can't be switched on by scripting?
IIRC the GM searchlights have a special weapon you can make the AI use
try sqf _searchLightGuy action ["SearchLightOn", _searchLightTurret];
(replace _searchLightGuy and _searchLightTurret with whatever you've called the AI and the searchlight)
I think you also need to use sqf _searchLight addWeaponTurret ["fakeweapon", [0]];
to make the AI actually track targets with the light
worked thanks
Can someone help me out with the r3f advance logistics the mod breaks when alive is with it, once i pick up a box it cant be dropped
hey, i can't play custom sounds on the trigger;
On activation i have : playMusic "ogg";
in my description.ext i have :
class cfgMusic
{
sound[] = {ogg};
class ogg{
name="ogg";
sound[]={\sound\ogg.ogg,1,1.0};
titles[] = { };
};
};
i get no errors, i just don't hear the sound at all, anyone got a solution?
Hey guys, I am trying to make an addon for Zeus. At the moment I am having an unsure on how to execute code on a placed game object. Can someone help me? Thanks
@earnest goblet first, save, close, and reopen the mission. CfgMusic changes don't always go through properly without reloading the mission.
Second, my standard cfgMusic (which I know works) has tracks[]= instead of the first sound[]= in yours. Try that.
Edit: also, try adding a hint or something to the trigger so you know it's firing properly.
@hallow mortar restarted the mission a bunch of times but didn't try the tracks[]= yet, I'll have to leave that for tomorrow and hope it'll work, thanks :)
@crisp cairn do you mean executing code on an object immediately after it was placed? if so, then use CuratorObjectPlaced eventhandler
Dedmen: Do exactly this to fix waitUntil
7 days later
BI: Tweaked: waitUntil will now continue looping when incorrectly returning something instead of true / false, and show a warning. We strongly recommend fixing scripts, because we intend to force exiting the loop again in 1.96.
But they want to "break" it again after 1.96
OId unmaintaned missions will care about the warning
sure

Anyone understand how to use the BIS_fnc_curatorObjectPlaced?
what would be the best way to check if a unit is under fire?
can i make a player dismount the vehicle when he enters the trigger zone?
yes
sweet, what's the command for that?
either is fine because the vehicle gets destroyed and it's not moving
so how can he enter the trigger zone?
the car gets destroyed on trigger
car setdamage 0.80;
;car setHit ["wheel_1_1_steering", 1];
car setHit ["wheel_2_1_steering", 1];
so it can be moving; I then recommend you to setVelocity the vehicle to [0,0,0] only in case of destruction thoughsetFuel to 0 (to try and avoid explosion)
anyway, the commands are:
@earnest goblet
no worries, glhf ๐
soldierOne action ["Eject", vehicle soldierOne];
i did this, changed soldierOne to the name of the character, changed vehicle to the name of the car, and got an:
Error missing ]
Hello all. I'm seeing if I could get some help with trying to get UAV feed to show up on a Rugged Monitor or any general Monitor in game. Thus far I have the (showUAVFeed true; )(_bool = shownUAVFeed; )(_UAVFeedDisplay = uiNamespace getVariable "RscAvCamera";) inserted where I believe it should go, but nothing happens.
Anyway I could get some tips or help on getting this to work?
Thanks
hey guys, trying to get some help here. I need to run this sqf either globally or on the player with variable name doghandler only...
I tried using this
[ [], {
[dogHandler] execvm "scripts\kltdog.sqf";
}] remoteExec ["BIS_fnc_spawn", 0, false];
but it didnt work..
if im running only the [dogHandler] execvm "scripts/kltdog.sqf"; globally or locally within the debug console it works.
any clues why? am I using the remotexec correctly?
Thanks.
seems like a few too many layers
ah you can't just give remoteexec a script path
i forgot
["scripts\kltdog.sqf"] remoteExec ["execVM",dogHandler];``` perhaps? I don't see why you need bis_fnc_spawn involved at all
oh thanks. but now the doghandler is set to targets witch is good however dogHandler is also a param within the script. how can I put that in aswell?
so it runs like [doghandler] execvm "blablabla.sqf";
[<leftArg>, <rightArg>] remoteExec ["binaryCommand", <target>];
["scripts\kltdog.sqf",dogHandler ] remoteExec ["execVM",dogHandler]; so something like that
The vehicle respawn module is returning the new vehicle a null object, how to fix that?
help i tildet the camera in singleplayer camera mode and now my editor is 10ยฐ sideways tilted:(
Done.
will the bot obey anyone?
wanna try?
๐
(hopefully I must say; I don't know how to unban and you never know, a bug or something ๐ )
I also don't know how to unban with the bot
I always do it manually
the bot is supposed to be able to do that, but it refuses to work anytime a user is not on the discord anymore
I'm using Arma Dialog Creator to make GUIs. How can I add a clickable button with centered text? ShortCutButton doesn't support centered text
โฆwould you mind to rephrase the issue please?
nope
can somebody help i have a prb the prb is when randoms or no admins trying to join on my Server thy get kicket because(Groupicons[true/false] can somebody tell me why and how i can fix it .
if you don't want to rephrase that then I doubt anyone will understand
besides "they get kicked" there is no really useful info in there
and what does it have to do with #arma3_scripting
soooo when Players try to connect on my Server they get kicket from the Server
becauseBattleEye .... (Groupicons[true/false])
i can send you a picture (private)
Or post the message in the BattlEye log file for the kick... removing user sensitive information. Cause if you are just posting the pic of the kick message in game in ARMA it is almost worthless for adding to a filter
That is definitely not battleye, and it is something server/script specific
need to ask whoever wrote your scripts
Oh yeah... that's not a BE dialog
I guess that's just a debug message, unrelated to the kick
yeah but when you look in the console there is Kicket by battleye๐
there is some other reason then
it could be the mp_mission
does the console say nothing else?
wait
For every BattlEye filter type there is a txt file with the filters and possibly a log file with the actual kicks that gives enough info to add a filter to stop the kick happening. Without the log file entry for the kick in the log file it is almost impossible to advise
does anybody know about kp_liberation ?
its my mission
it could be that if its to old
Can I make GUI buttons with static controls and adding eg. an "onMouseClick" event to them?
Or rather, what's the preferred way
I think onMouseClick depends on type
so might not work for non-buttons
never tried tho
How do you make buttons @still forum? The default ones are pretty odd
what you mean by odd?
just simulation type button. I don't know that UI maker tool that you use. And also never really made UI's ๐
They have this 3D animation effect and shortcut buttons don't support centered text apparently
ah yes, that might be :/
maybe you can make a invisible button without text, ontop of your background text?
that should work, tfar does that too
never heard of dynamic universal war
Has not been updated on Steam since 2014... so probably does not work well anymore
i think thats right
but when i give perople adim they can join without any prb
people
ALiVE is my go to fight against bots in a dynamic environment tbh... https://steamcommunity.com/sharedfiles/filedetails/?id=620260972
do you know kp_liberation ?
I know of it... seems like a good mod. Not my thing though... Epoch and ALiVE are my things
yeah i got this on my server
and its not so old
everything is working perfekt only that thing
I said what you need to post to have someone work out how to amend your filters
But I'm getting on the subway now so someone else will have to help... sorry!
np but thx
anyone having a good countdown timer script they would share? i need to show a countdown timer for an anti-combat-logging script i am trying to execute
would the Firerange timer suit you?
dont know how it looks so,no idea^^
Is there a way to make a script so that, upon a unit being hit, they receive a message saying they've been hit?
using eventhandlers shoudl work for that.
Could you tell me how I could do it?
I am getting a fnc/Zen_OccupyHouse.sqf not found error.
Not sure why.. or what I am doing wrong here... D:
what are you packing your pbo with?
No PBO
maybe files are not included in packed pbo
Not serializing the mission yet
well use pbo then
Just loading from editor.
Better yet, how can I return the root dir for my mission
So I don't need too use a pbo
Because I don't want to pack a pbo while editing in eden.
can I just add CfgFunctions into my descption.ext right
Do I still ned a CfgPatches
??
@sturdy cape see my note on this page:
https://community.bistudio.com/wiki/BIS_fnc_VRTimer
Is there a way to make a script so that, upon a unit being hit, they receive a message saying they've been hit?
Anybody know??
yes
Yeah trying to make an airsoft style thing
So _EHkilledIdx = player addEventHandler ["killed", {_this exec "playerKilled.sqs"}]
would work?
It's not a PBO issue.
so in pbo it broken too?
So, I had a sub-folder for all my unit missions Iw as working on.
symlink?
Something like mpmission/mysubfolder/mission.map
Like that
Right
What this does is mess up the root for the mission
Because root STARTS at mpmissions.
so my path was mpmissions/sub/mission/fnc/script.sqf
Which is gross, and will break when I move it to a pbo / onto server.
so, subfolders are bad.
D:
learning smth new every day
@still forum I'm looking for a way to make it fire when hit, and be enabled if the unit has allowDamage set to false
Says it won't work with allowDamage set to false
@winter rose thanks!
you can use damage eventhandler, to disable damage even without allowdamage
Shout out to KK blogs for helping me figure that one out.
I'm confused though, I've never scripted
Is there anybody who could write the code out for me?
I wonder what's wrong in my code. This is part of my dialog.hpp:
class Inventory_moneyOnBankAccount
{
type = 0;
idc = 2310;
x = safeZoneX + safeZoneW * 0.24739584;
y = safeZoneY + safeZoneH * 0.80740741;
w = safeZoneW * 0.2375;
h = safeZoneH * 0.02407408;
style = 0;
text = "You should not see this text";
colorBackground[] = {0.6,0.2549,0.5333,0};
colorText[] = {1,1,1,1};
font = "PuristaMedium";
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
onLoad = "_this call REV_FNC_bankAccountStatus; REV_VAR_doInventoryBankLoop = true;";
onUnLoad = "REV_VAR_doInventoryBankLoop = false;";
};
And the function:
REV_FNC_bankAccountStatus =
{
_monitorBankAccount = [] spawn
{
while {REV_VAR_doInventoryBankLoop} do {
((_this select 0) displayCtrl 2310) ctrlSetText format ["Money on bank account: %1 %2", REV_VAR_moneyOnBankAccount, REV_CONST_currency];
REV_VAR_moneyOnBankAccount = REV_VAR_moneyOnBankAccount + 250;
sleep 1;
};
};
};
The issue is that the function doesn't run. All I see is that "You should not see this text".
use CfgFunctions
it expects the function in uiNamespace
you probably only set missionNamespace
I could
Anyone uses Zen Occupy House script?
Ffs lol
@still forum I'll check it out, thanks!
Btw, is it okay to use global variables like that (eg. "REV_VAR_moneyOnBankAccount")? Or is it bad code design in SQF?
In other words, is it okay to name global vars like that and then access them from here and there
Or do I need to put more thought into the architecture
well you should plan out your tag design
but whatever works for you
think the _VAR is kinda useless though, as clearly that variable is a variable so why write that the variable is a variable
unless theres some deeper meaning to the var
ace for example does
ACE_modulename_variablename
I thought it would be good to explicitly state that it's a pure variable and not a function
Or a constant
functions usually have _fnc
Yeah, that's what I use
constant. yeah maybe.
But I'd say, add special naming to the things that rarely appear
if you add _VAR to every single variable you'll write that hundreds if not thousands of times
Well yeah lol
if you add _CONST to constants, you'll write that a couple dozen times
Or just use a macro which generates names for you, and then just make it GVAR(myVariable) and everything else happens automagically
๐
hi ppl. who knows a script wich allows me to move a building on the map how i need to. why i ask? i want https://twitter.com/i/status/1157277140963995648 this but when i place it, it always spawns to high.
it would probably need bunch of animate commands to work like that
for that platform
for others setPos perhaps
that there is an editor feature that might be a readable function somewhere in the configs
i can try this open door
but don't working why ? where problem ?
{
if (_x animationPhase "Door_1_rot" == 1) then {
_x animate ["Door_1_rot", 0];
} else {
_x animate ["Door_1_rot", 1];
};
} forEach (nearestObjects [player, ["Land_BackAlley_01_l_gate_F"], 10]);
where do you call this script?
floating point comparison maybe?
although I think arma handles this
are you sure the classname is correct?
Look up in config for the name of animation source then use animateSource
Hello how do i add another script onto a mission file
There is scripted EH for save too
Is there a way to track a specific particles position or if not, is there a way to predict or track the amount it will be moved via wind?
Specifically particles from a #particleSource I've created.
@winter rose I cannot get kbTell to work in vehicle.... works find out of a vehicle but not inside ๐ฆ bug ?
You can track position with ontimer script but not remove once itโs spawned @cosmic root
Wow I don't know how I missed that. Thank you. You're a legend.
Is there a way to pass a variable to the onTimer script?
Use global variable it will be available in script
Doesn't really work for my situation. If there's not it's no big deal.
Script doesnโt take arguments apart from those set by the engine
Ideally I want to average the positions of all the particles from a source. I guess I'll have to do some weird hacky stuff. But I think I can make it work
How many particles?
@quartz coyote might be
oh god
they break the say command and then replace it by a kbTell command that's also broken...
I don't know for sure; I will have to do some tests to confirm it though
how does one determine the right z offset for simpleObjects (without class SimpleObject definition)?
trial and error
so per model setup
Hey guys, do you know of any plans to add ACEX sitting to the Contact seats?
does createSimpleObject have any requirements on p3ds? cant get CUP/A2 vegetation to spawn ๐
Is else if a thing in sqf or not?
You have?
Do compiled functions have a namespace?
Ie. if I compile a function in mission namespace, do I have to call it with with missionNamespace do { ... } from eg. onLoad eventhandler set up for a control in dialog?
no
variables are in a namespace
if you put code into a variable, it's a variable
Yes I have elseif in intercept cba
Also instead of with do just use getVariable
Because... functions are variables.
If it is function library function it will be in ui and mission namespace, if it is handrolled function then you need to call it where you defined it
As I said, just use CfgFunctions
but do you have else if?
yes
With space?
implementation detail... uh.. no
Whatโs the difference in performance?
didn't test perf
Depends on if you use condition as bool or as code
if you use code then it lazy evals
What are the benefits of using CfgFunctions instead of manually defining/compiling functions?
The benefit is that the game takes care of everything for you
instead of you having to write the same stuff dozens of times and having to make sure you don't make a single typo
I'm having issues with kbTell inside vehicles. Sound is not heard whereas out of vehicle, sound is heard. Has someone experienced the same issue?
Can't remember how to handle the diag_log command
thank Dedmen, but i'm asking after having read that.
no idea how to help then. wiki says how you use it
can you correct me :
I set diag_log {Off kbTell [aP, "jeep", "S02v03"];};
and it logged 15:42:41 {Off kbTell [aP, "jeep", "S02v03"];}
yep. that's correct
you are telling it to log a piece of code. It will log a piece of code
okay
want something else?
do that's not what i'd like to do then
I'd like to see any error related to the execution of the command
well, for some reason, kbTell doesn't do anything when the speaker is in a vehicle... so I need to understand why
I don't think the game will help you with that
there is no "please log everything that you're doing internally somewhere in the engine right now" command
is it possible to see the script behind the command kbTell ?
since its not a function I bet not
but i'm asking anyways
there is no script behind commands
I hope i'm wrong, but BI created kbTell conversation system to replace the say command but that is also bugged....
to replace?
I don't think so
they serve different purposes
kbTell is for the whole dialog system stuff
suits you , nevertheless, both are fucked up
say command doesn't handle lip moves anymore and kbTell doesn't do anything in vehicle
great
wonder how they managed to create all the SP campaigns in the recent DLCs if their own work is fucked up
maybe it works correctly but you are just not using it correctly
or some undocumented parameters
BI uses the same script stuff that everyone else has access to. So if it works for them...
yes I know.
but I've tested it correctly and it's not working
for kbTell, it's working fine outside of vehicles
but not in
I remember some recent change about something with audio and in vehicles
don't remember what it was tho. And can't find anything on kbtell wiki page
not surprised.....
i've checked the Feedback tracker and the Forum but there is nothing related to my problem
have you tried if forceRadio works in vehicle?
I tried but couldn't make it work. Altho that's probably me being dumb. I did :
Off kbTell [aP, "jeep", "S02v03", nil, true];```
But it displayed error
so I tried
Off kbTell [aP, "jeep", "S02v03", [], true];```
but again
error
so it's just me not doing it right
what error?
it says arguments are optional so
Off kbTell [aP, "jeep", "S02v03", true];
mmmh. I though you still had to respect the order
not order > placement
Well yes. placement is also the same
optional argument is optional
optional things you either put in, or leave out
the placement for the arguments is
receiver then topicname then sentence class, then optional arguments, and last the forceRadio
forceRadio is still last
but true is then taking the index position in the argument array no ?
index doesn't matter
wiki says forceRadio (Optional): Boolean, Number or String (last value of the array)
it has to be on the end
that's it
okay okay
let's try
not working
I tried adding the Topic when unit is outside of the vehicle but it didn't change anything
I thought it was because I was using an RHS vehicle and tried with a vanilla vehicle but it wasn't that ether
overviewText = "TF-Black Home Rotation";
author="TFB Mission Team";
OnLoadName = "TF-Black Home Rotation";
OnLoadMission = "TF-Black Home Rotation";
class CfgFunctions {
class SSQN {
class deployC130 {
file = "functions";
class deployC130 { recompile = 1; };
class deployC130_addEffects { recompile = 1; };
class deployC130_removeEffects { recompile = 1; };
class deployC130_killAmbientLights { recompile = 1; };
class deployC130_giveParachute { recompile = 1; };
class deployC130_returnBackpack { recompile = 1; };
class deployC130_placeInPlane { recompile = 1; };
class deployC130_getCloudParams { recompile = 1; };
class deployC130_signalJump { recompile = 1; };
class deployC130_onEject { recompile = 1; };
class deployC130_onUnitLanded { recompile = 1; };
class deployC130_planeSyncFlag { recompile = 1; };
};
};
class R3F
{
Class R3F logistics
{
file = "R3F_LOG\init.sqf";
class R3F logistics {};
};
};
{ #include "KPCF\KPCF_functions.hpp" };
};
can someone help me with fixing this
im trying to add another script
and they arent working
If I define functions with CfgFunctions like this (included in description.ext), do I need to start the files with function name or just write the function inside it?
class CfgFunctions
{
class REV
{
class InitConstsAndVars
{
class constants {file = "constants.sqf";};
class globalVars {file = "globalvars.sqf";};
};
class InventoryFnc
{
class monitorBankAccountStatus {file = "monitorBankAccountStatus.sqf"};
};
};
};
Like this:
REV_FNC_MonitorBankAccountStatus =
{
_monitorBankAccount = [] spawn
{
with uiNamespace do {
while {REV_doInventoryBankLoop} do {
_moneyOnBankAccount = missionNamespace getVariable "REV_moneyOnBankAccount" + 250;
((_this select 0) displayCtrl 2310) ctrlSetText format ["Money on bank account: %1 %2", _moneyOnBankAccount, missionNamespace getVariable "REV_CONST_currency"];
missionNamespace setVariable ["REV_moneyOnBankAccount", (_moneyOnBankAccount + 250)];
sleep 1;
};
};
};
};
Or this:
_monitorBankAccount = [] spawn
{
with uiNamespace do {
while {REV_doInventoryBankLoop} do {
_moneyOnBankAccount = missionNamespace getVariable "REV_moneyOnBankAccount" + 250;
((_this select 0) displayCtrl 2310) ctrlSetText format ["Money on bank account: %1 %2", _moneyOnBankAccount, missionNamespace getVariable "REV_CONST_currency"];
missionNamespace setVariable ["REV_moneyOnBankAccount", (_moneyOnBankAccount + 250)];
sleep 1;
};
};
};
The second one, just the function.
@topaz forum
```cpp
class pinkRabbit {
fluffiness = 1.54;
}```
โโโ
class pinkRabbit {
fluffiness = 1.54;
}```
@quartz coyote no issue on my side
; after class definition is a must
ssssssh don't ruin it ๐
@winter rose
im still a bit new to scripting so do i just add that in, all im trying to do is add another script onto my mission file
onto the mission itself and hope it works
hello hi have a mod that i have permission to edit wondering if i could pay someone to do some 3dmodeling and put in back into game
was told to ask here
@hushed mirage nope, post your ad in #creators_recruiting and be sure to be able to present this permission you mentioned
Does anybody have an update for ryanzombies resurrection that enables compatibility with ACE3?
Does anyone know an immediately obvious reason why I couldn't use triggerActivated (in relation to a repeatable trigger) as a visibility condition in BIS_fnc_holdActionAdd?
I ask because I have done so, and the action isn't appearing
we need a mission making language
write the mission, compile, play in a3
because sqf is way too shitโข
is it possible to select everything with a $x in its name
i.e i would like to run script on every helipad*
without rewriting bash in arma
so for these actions here, https://community.bistudio.com/wiki/inputAction/actions, is it possible for me to trigger one of them? What im trying to do is have vtolVectoringCancel action ran whenever someone enters a vtol and I tried looking for something of the sorts but couldnt find anything
@waxen tendon find
Waypoint activations/script only run on the machine the waypoint is local to correct?
@edgy dune https://community.bistudio.com/wiki/action
https://community.bistudio.com/wiki/Arma_3_Actions#VTOLVectoring
Also probably a good idea to use a GetIn eventhandler.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetIn
@crude needle yea I was gonna use the getin EH, but I didnt know how to execute an action. I thought the action command just returns the state of an action lol. Thanks
Thought the same thing when I initially saw it.
I was looking for something like doaction or forceaction
Variable 'test_currentdisplay' does not support serialization and should not be stored in the mission namespace.
how does one solve this again? tried adding disableSerialization in all relevant scopes, but didnt help ๐
strange thing here,i need some help.i am trying to add a script execution to the pause manu of arma and it will lock input to the dialog in which you are when adding the EH ```sqf
TZRN_EscapeCheckEH = (findDisplay 49) displayAddEventHandler ["KeyDown",
{
_key = _this select 1;
if(_key == 0x01) then {
call tzrn_fnc_escapecheck;
};
true
}];
"TZR-Client Keydown added (ESC)" remoteExec ["diag_log",2];
no idea why this happens,keydown eh will also not be added,it seems
did that for display 46 as well,just sayin
alternative would be ```sqf
//check if pause menu is open
while {alive player} do {
_display = (findDisplay 49);
waituntil {(findDisplay 49)};
if (!isnull _display) then {
[_display] call tzrn_fnc_onEscape;
};
sleep 0.2;
};```but i want to avoid having more whiles than necessary
@sturdy cape why not just use the 'onPauseScript" command then run whatever you need? https://community.bistudio.com/wiki/Description.ext#onPauseScript
i want it to be addon side
(findDisplay 46) displayAddEventHandler ["KeyDown","
if ((_this select 1)==1) then {
player sidechat 'Esc key pressed!';
[] spawn {
waituntil {!isnull (finddisplay 49)};
hintsilent 'display 49'
}
}
"];
that what you looking for?
@sturdy cape use "OnGameInterrupt" scripted event handler https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/ScriptedEventHandlers
uh nice thanks
@tough abyss that did the trick,much love man
is onGameInterrupt called always when abort menu is triggered, or is there any other occassion?
Just when that menu opens
Hey I have a question:
I want to insert the content from another file (.sqf, .txt....doesn't matter) into a script.
What I want to do is that I have a BIS_fnc_selectRandom and the Array for the randomization is safed in a seperate file (reason for that is that I need this array in many different scripts)
I know that #include is technically used for that but this does not seem to work in .sqf scripts (at least my testing didn't work)
!issuewarning @hushed mirage crossposting (this is your second warning....)
Done.
@ivory lake setVariable > with namespace do
@spring stone yes #include is the way, and yes it works
BIS_fnc_selectRandom No.
selectRandom <--
yeah - I just suggested do if more needs to be done in it
I already told that Ezcoo tho ยฏ_(ใ)_/ยฏ
@spring stone too can preprocessFile then compile it then call it if all it contains is array
Anyone know how to replicate the linearConversion to another coding language?
Or you can store array in parsingNamespace or even as mission config property, there many ways to skin a cat
@storm sierra look for lerp function in other languages
Is it possible to add an event handler to a cruise missile so when it detonates , certain code runs on the detonate pos?
facepalm myself, thanks @tough abyss xD
how can i disable "kill me" from chat
what
what?
What mission/server are you playing @dim kernel
I put 'player setVariable ["something", "anything"]' on my code and that "something" is alive even after respawn. That is what I wanted but why? Isn't variable destroyed when object is gone?
infiSTAR is one addon that adds the kill me functionality
and afaik you can only remove that functionality by modifying the code in A3AH.sqf
didn't expect that. Thanks for answering.
@dim kernel why disable, you canโt control your suicidal urges? ๐
To be fair, iirc with infiSTAR it will suicide you if you type that anywhere in a chat message ๐
So... "Thank God he didn't kill me!"... Boom, dead ๐คฃ
But to disable it you have to remove those lines or modify the string check in A3AH.sqf rather than via a config variable
Thatโs just bad design, and people pay money for it?
people pay for shittier things ยฏ_(ใ)_/ยฏ
Life. 
wait, IRL, or the mod server ๐
I guess those that canโt, pay
@restive leaf you talking about the infistar a3 normal/exile version?
Vanilla version. Don't do Exile
Is there any Information on reliably RemoteExec to someone even tho they tabbed out?
Without nopause ofc
so far, none I know
Ok ty
I am looking for any tips on locality for waypoints. For example, when a group is transferred to a client or HC, and a script is executed on WP completion, where does it run and what constraints are there on it.
I asked this over on Reddit and got no replies, so I figured I'd try here.
Any easy way to change the role on the respawn screen from "Default" to anything else?
https://www.reddit.com/r/armadev/comments/cku3am/respawn_screen_role/
there is some info on respanw configuration on the wiki.
there is also an event handler you can add to the object
Yeah, I tried class CfgRoles and it just errored out. Probably because I'm pulling loadouts from the player's locally saved loadouts
What are you using?
Oh I thought you meant you were using cfgRoles config
Yeah, no. Which is probably why I'm running into issues.
I suspect so. I'm still somewhat a novice at this.
actually did you give me the right thing?
that script seems to be to do with respawn loadouts
Yes
ok
I'm trying to set the role while still letting people use their own saved loadouts.
anyone know how you can have "Type bool, excpected bool"
The error only accurs when on a dedicated server
if a command that returns bools receives nil it will return bool typed nil
ah thank you!
Hi everyone!
I'm looking for some insight on thread-safe communication within ArmA.
I have some critical region where separate threads access shared data which is both read and written by each thread.
My initial approach was to use a MutEx lock, so that if a thread is within the critical region, all the other threads are locked out.
It looked like:
waitUntil{isNil "lock"};
lock = true;
// < insert critical region here >
lock = nil // lock = false
But then I realized that this kind of lock is completely wrong, as it stops multiple threads the first time, but when they are able to exit the waitUntil block, there's no stopping.
Eventually, my lock became:
while {!isNil "lock"} do { uiSleep 0.05 };
lock= true;
// < insert critical region here >
lock= nil;
But I'm still super skeptical about this. Any advice?
TL;DR: How do you make a part of your code run by only one thread at a time?
about how you did, with a public variable if you cannot afford to use a private var
Not really viable to have a private var shared between two threads, or is it? ๐ฎ
With a prefix, ideally
No not possible; well you could pass an array reference, or an object (but it may be a bit overkill)
What I meant is that each thread would have its own private var, which is not what I'm after ๐
And my aim is that if I have ten threads starting simultaneously, I want the threads to go through some section only one at a time. This is critical for processing requests ๐
AROMA_ThreadLock = false;```
:woot:
it is the simplest, a global flag
So it would be as I described above?
waitUntil { not isNil "var" && { var } };```yeah
as I said, I don't think waitUntil will work ๐ฆ
Why not?
because it's blocking at the beginning of the code
but after that
when var becomes nil
several threads at the same time may read it and exit
and resume execution together
the while I used is aimed to prevent that
so that the condition is checked "twice"
you can set a sleep at the beginning of the waitUntil if you want
as soon as it evaluates to true, it will quit the block I'm afraid
but maybe it's the same
I don't really know at this point with SQF ๐
well, that's the point
just that the scheduler shouldn't make them all trigger at once; make tests to be sure (and/or use unscheduled)
I don't know much more, given I am about to sleep ๐
Good luck!
o7
@real mango you have probably been misinformed. There is no "at the same time" in SQF, everything runs either unscheduled or scheduled. When unscheduled code runs everybody waits, scheduled code time shares. What you can run into is that a spawned script can suspend in the middle of execution while another script starts executing, and there is no way of telling when suspension will happen or if it will happen. For this exact reason nothing you proposed is going to work.
reference missionNamespace? might work but probably not.
Hey all, So i'm starting to get into scripting for missions and i'm looking for a good guide or video series to get my toes wet with the syntax (My background is mainly in C, Java, and Python) anyone have recommendations?
@hasty violet where is init file called from?
@real mango https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/master/addons/core/script_macros.hpp#L96
But that isn't 100% safe either.
@real mango here is a variant that should be safe.
waitUntil {
private _hasLock = false;
isNil {
if (!MUTEX_isLocked) then {
MUTEX_isLocked = true;
_hasLock = true;
}
};
_hasLock
};
<code>
MUTEX_isLocked = false; //No need to make this part safe
@cloud drift can't think of literally any "good" guide to scripting. The barely acceptable video guides are so out of date that they are basically useless and teach you wrong stuff.
Yep
you shall not suspend in postInit
@tough abyss As long as there is a scheduler (and thus preemption) there is going to be concurrency. Even if two threads never run at the same time (means little to no parallelism), it does not mean that there is not going to be concurrency.
Imagine two threads (T1 and T2) running the same script that just read a global variable into a private one, increase it and store it back:
// my_var is global and has value 0
private _var = my_var;
_var = _var + 1;
my_var = _var;
There can be instances where these two threads cause a very unexpected result. Why? Because the order of execution may be very different from what you expect.
A naรฏve (or optimistic) person may think that execution looks like:
T1 reads my_var = 0
T1 changes _var = 1
T1 writes my_var = 1
T2 reads my_var = 1
T2 changes _var = 2
T2 writes my_var = 2
But this is only one of the main different ways this can be run:
T1 reads my_var = 0
T2 reads my_var = 0
T2 changes _var = 1
T2 writes my_var = 1
T1 changes _var = 1
T1 writes my_var = 1
Which is clearly a wrong result ๐
@still forum I'll give it a shot, I hope you're right ๐
I'll write some tests with hundreds of threads to check the results of all these different approaches, will let you know.
This might be some interesting (advanced) stuff for the wiki btw ๐
@still forum ouch. Any decent resources with good documentation on the basic syntax atleast? I know i cant dec a for loop
for(User user : userList){
}
in sqf, but i cant say i know the correct syntax for an iterative loop through a collection.
I just dont want to bog down the channel with stupid questions like that xD
This might be some interesting (advanced) stuff for the wiki btw
not really
Bookmark this page https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
@still forum
Sweet, thanks will do. Sorry if i drop stupid questions every now and again. .sqf syntax is weird.
Side note, how do you return variables. I've been looking through code and i'm not seeing any return statements.
the value that's left on the stack will be returned
1 //put 1 on stack
; //End of statement clears stack
_var = //2. take value from stack and move into _var, stack is now empty (SQF bug)
1; //1. put 1 on stack
1 // put 1 on stack
; //last end of statement in script block is ignored (Don't ask...)
So. 1 was left on stack at the end, 1 get's returned.
Wow thats funky, but it makes sense lol
Last question for the night. Any IDE's that have an SQF syntax filter. Using brackets atm and it's nasty for this language =p
Visual Studio Code with SQF plugin is fine
sweet. I'll grab that thanks
@real mango Not sure why I deserved such long pointless reply. I told you the reason your result can be unexpected but you clearly not ready for realities of SQF.
Thaaat's not the way to help him.
@real mango the (in)famous scheduler cycles through all running scripts and give them each some time to execute; so it can "pause" your script, as you may already know, to let other scripts run too.
The thing is that you can't know for sure that your script will not stop right after the lock check. So your script arrives to the waitUntil / while / whatever, there is no lock so let's enter the code, then BAM, script gets paused and another one is running, the other one does the same, enters the code, does its stuff, gets paused, back to the first one, and the first one is still allowed to do its code. This is why you cannot make a "thread safe" thing in scheduled SQF
This is why you cannot make a "thread safe" thing in SQF uh.. I just did tho. Posted above...
I think you could, however, put all this in an unscheduled code with isNil
which is what i did...
let me finish!!1!1!! ๐
He is a programmer. I'm quite sure he understands how this stuff works mixed up Roamn and Scrub Sauce
Edited, not in scheduled* SQF
This is why you cannot make a "thread safe" thing in scheduled SQF I still did tho...
isNil is unscheduled
yes, the 34 lines of code are unscheduled
the rest is "thread safe" scheduled script with a mutex
wait, you would put your code outside of isNil? Isn't there a chance that the scheduler pauses between waitUntil statements?
no
it cannot exit the first waitUntil while another script has already passed it and hasn't reset the isLocked variable
I mean between private, isNil and the result
isNil is unscheduled
nothing can interrupt it
if _hasLock is true, noone else can obtain the lock anymore.
well yeah, everything happens in isNil. My bad, my brain
BIS_fnc_spawnOrdered
Might aswell just use call then..
he steals our ideas!
So KK back @ BI or what?
Thanks for the many responses!
Let the code speak for us, I'll try to come up with a decent test suite to test Dedmen snippet and see if anything goes wrong ๐
Sorry if I'm a bit lengthy in my question/responses, I thought 9 lines weren't that much ^^
Might aswell just use call then..
not the same innit if you run in unscheduled and need a bunch of spawned scripts but executed in order
Spawn one and do calls inside
what if you need to spawn from different scripts?
Then the queue thingy function kinda makes sense.
hello party ppl. i have a question regarding headless clients. wich ip adress i need to write in the serfer cfg? on the turtorial said: headlessClients[] = { "xxx.xxx.xxx.xxx", Note however, that you need to replace โxxx.xxx.xxx.xxxโ with the actual IP address of your headless client!
my stupid question: from were i get the IP adress from that headless client?
try 127.0.0.1 also #headless_client
does someone know how to script the chemical detector added by contact?
@modest temple https://community.bistudio.com/wiki/Arma_3_CBRN
There's not much to script. Just a variable one can set to change the displayed value.
hehe, ninja'd ๐
๐
I've spent some time at the #arma3_ai it's dark and cold there, So I've returned with some strange questions.
I need a visual effect on one of my AIs. The setParticleClass thing effects locally. As many many other things that I apply via remoteExec if I need them to be seen or applied on multiply of machines. So the question: is there any good snippet or way to wrap the code to the function or .sqf that will execute everything inside a parameter set to be applied with remoteExec?
Like take all this code and apply each command through remote. Or even apply through remote if it is needed.
second definitely no.
first.. I think.. no? Can't really imagine what you need
To avoid bothering about the locality.
And just go "ok I need this set of script commands to effect everywhere" without setting remoteExec for each of them
Will it give a remote context to everything inside?
I have no idea what do you mean by remote context
Give me a sec
Like
CUS_fnc_name = {_this select 1 lightAttachObject [_this select 0, [0, 0, 0]];}
[_this, _lightsrc] remoteExec ["CUS_fnc_name", -2, true]
Will the lightAttachObject work on all machines except server?
If i'll run it within remoteExeced function?
If the targets have function in CUS_fnc_name global then yes.
I have no experience with lights. It is possible that you might need to create the light locally on every client.
It goes via createVehicle which is Ag Eg
but if it wouldn't be so, just
CUS_fnc_name = {
_l1 = "#lightpoint" createVehicle getpos _this select 0;
_l1 lightAttachObject [_this select 0, [0, 0, 0]];}
[_this] remoteExec ["CUS_fnc_name", -2, true]```
could do the trick, right?
The question is basically not about the particular light creation, but about creating a functions that run everything inside as a remoteExec
There is no such thing as run everything inside remoteExec
By remote executing [<args>] remoteExec ["CUS_fnc_name", -2, true]
you tell all the clients to execute code stored in CUS_fnc_name global
with given args.
so the client "takes" code from CUS_fnc_name and executes that.
also remoteExec = spawn, remoteExecCall = call
Yeah, sleeps and waits for spawn
Now I get why fnc_RyanZombies_DoMoveLocalized = compileFinal "_this select 0 domove (_this select 1)"; is set up this way. Thanks, @hollow thistle
I will return to the darkest and slimiest AI rabbit holes
Any ideas on what i might be doing wrong on my server that prevents custom faces and voices from playing/loading. We prevent all client side mods, if that might be the reason.
@exotic tinsel could it be just the thing with locality? How and where do you run your script? Like if it runs server only nobody will see anything.
server only
In this case you need to politely ask it to apply your scripting commands on other machines for them to see the animations:
https://community.bistudio.com/wiki/remoteExec
https://community.bistudio.com/wiki/remoteExecCall
or script them locally for each client machine: initPlayerLocal.sqf
https://community.bistudio.com/wiki/Initialization_Order
I have a massive server side addon, i know how to remote exec and all that its just this issue with players custom faces and voices not working and causing arsenal issues. I have been told this is an arma bug and to wait for hotfix but i want to understand it so i can try to create a solution now. i have written alot of scripts to correct arma bugs so this is no different i just need to be pointed in the direction of the causes so i can start to formulate a solution. PLZ ANYONE point be at why arma is having this arsenal issue so i can implement a solution before arma does. half or a lil less of our 300 players are having this 'novoice' arsenal bug and that tells me its something im doing on my server.
use ace arsenal
Massive server side add on... life server?
Hey there guys. I'm doing an operation soon that may require a man to be on drugs that numb his pain and make him 3 times more damage resistant than the ordinary dude.
From my limited understanding of how Arma 3 coding (and ACE3 coding by extension) works, the following code makes it so every hit, no matter what, does 2% of the unit's health.
Unit addEventHandler ["HandleDamage", {false}];
Unit addEventHandler ["Hit", {Unit setDamage (0.02 + getDammage Unit)}];
I just want him to be more resilient to damage and near invincible to pain. Anybody have any how to go about this?
hmm
So, I have a event handler that fires when a units state is changed from X to Y.
I also have a loop that listens for when a unit dies, or is the last man in a unit.
I would like to extend the loop to ALSO switch based off a variable that can be set in the event handler.
@exotic tinsel
so i can implement a solution before arma does
It was fixed last week. So you're a little late on that.
Hey guys, I'm making addAction using ACE. I am wondering how do I execute a function/script within one?
A little more details pls
In a Mod?
In a Mission folder?
In the debug console?
addictions? what does that mean?
Not sure if ACE has addictions in medical rewrite, I suppose not. But you can overdose
it means while {ace_syringe} do {player action ["Inject"]}
@still forum no it does not because that would be stupid. You don't get addicted that quickly.
guess we'll have to wait till the user that went offline right after asking a question comes back online then
Are there any good ways to cancel an RPG reload animation while moving? (and not just set it to feed infinite or excessive ammo)
setDamage
like kill an RPG bearer? ๐
yeah ๐
joke aside, I would remove/add ammo, this might not cancel the animation but the reload would have to be replayed
else: disable running/sprinting if reloading, this way they can only slowly walk
The thing is I want to prevent soldier from stopping while reloading. I can feed ammo directly without any reloads but... it would be great to save an animation.
or setAnimationSpeedCoef to zero so they can't move while reloading, OFP style (oh the nightmares)
wait, what do you want to do?
exactly what I said - to prevent soldier for being stuck while reloading an RPG ๐
Not to stop him, but vice versa
like if move is playing just continue to run please would ya?
Are there any good ways to cancel an RPG reload animation while moving?
didn't understand that this way ^^
you would need to intercept the reload action and add the magazine by script yes
Oh. And by intercepting do you mean to catch that reload is in progress or reloadrpg animation is in progress?
I would say before that, the 'R' or 'reload from menu' action
there might be an EH somewhere for this
On a key press?
I don't know, the wiki might help you here
Ok, thanks!
Damn just read the change log : isn't that gonna cause a lot of problems ?
waitUntilย will now continue looping when incorrectly returning something instead of true / false, and show a warning. We strongly recommend fixing scripts however, because we intend to force exiting the loop again in 1.96.
That thing is a revert of what was currently ingame
pre hotfix waitUntil errors and exits
now it just throws warning and continues as normal
I see
Are there any legit ways to force open GPS for players? Like simulate rctrl+m press or something?
Sorry, I wrote that when I just woke up haha. I am looking at executing a function through an ACE Addaction. Using a SQF within a mod
@dull drum showGPS maybe?
https://community.bistudio.com/wiki/setName
In Arma 3 this can be used to set name of a person but only in single player.
So this does not work in MP?
that's what it says, yes
@winter rose it's kinda deprecated or something
@astral tendon well, yeah ๐
Even on the remoteexec?
hey i get this in my cba_settings.sqf:
ace_interact_menu_useListMenu = true;
but its overwritten by clients, how do i force the mission settings over clients?
@astral tendon it doesn't say "only local", it specifically says "it only works in single player"
@astral tendon though it might work for an AI, but definitely not for a player.
Well, no way to test that now.
if you get more info, ping me so I can update the wiki
Sure.
@dull drum then I don't know. maybe with some display magic
I wonder if there somewhere lies a secret tome on managing the existing UI via scripting ๐
atleast in arma 2 you oculd get it to work in multiplayer on a player if you had it apply very-very-post-post-init. after the player had loaded in and their identity applied
scratch that i think i'm thinking of setIdentity
@still forum so again, its something im doing on my server. what things would cause this issue, no custom faces loading and getting the error on trying to load arsenal items. error 'novoice'? please help me out mate. thats why we are all here. Im looking for understanding of why its happening so i can work backwards to find what im doing to cause the problem.
How to make a diferent lose screen when the tickets of a teams reachs zero?
depends on what you mean by different lose screen, you could make use of CfgDebriefingSections:
https://community.bistudio.com/wiki/Description.ext#CfgDebriefingSections
@exotic tinsel have you updated to hotfix? Sounds like you didnt
i update the server every day
@tough abyss any other ideas why its still happening?
Sounds like this is a server problem and not a scripting problem.
#server_admins seems to be what you are looking for @exotic tinsel
@exotic tinsel install the hotfix from today :U Come back when you double checked that you did
yes the hot fix today fixed it. thank you arma and you guys for the help.
Glad it's sorted.
put everything in mission to array?
?
It just sounded like a phD dissertation theme shortened :)
!purgeban @fast jackal 0 spambot
*fires them railguns at @fast jackal* ร_ร
how do i put everything in the entire mission to an array?
what?
I have no clue...
maybe the mission export script?
or just a forEach loop with the terms being a bunch of different objects and append that into an array
Hello, does the multiplayer dynamic groups use this function? https://community.bistudio.com/wiki/leader
"multiplayer dynamics groups" what's that?
never seen that
but yes. leader is the script command to find the group leader so that's probably used in there
Alright and if I want multiple conditions to be met to call a script is this syntax correct: if ((side player = west)(leader group player == leader player)) then
no
you need to use and or &&
also leader group player is always equal to leader player
Alright
also the first one the = is an assignment, needs to be a == comparison
if (player = leader) ?
again, equal instead of comparison
you want to see if player is the leader of his group?
Yes
Ah ok I understand the = and == now
if (side player = west) and (leader player == player) then
= /== ;)
besides that yes
i need every object in the mission; added to an array.
pushBack?
entities can work too and might be faster
too*
๐
Hopefully just running at the beginning of a mission...
yes
also why sould i not run it multiple times?
not that i will but i am curious now
as the wiki says, it's slow
Because objects created during the mission will be added. For example, if you use ACE3 and are wounded then the blood drops are mission objects too
And what Dedmen said
should be simple object now in new ace (next ace)
Is that going to be the same for all medical trash @still forum ?
Id hope it's for anything ace drops, would be nice on the pref
When I switch player unit with selectPlayer, every actions and scripts that work with previous player unit are terminated. Is there any good way to reinitialize?
How are you using selectPlayer
I create new unit on current unit's position, and execute selectPlayer and remove previous unit.
Can you not re-init via the init argument in createUnit?
Or do you have to do it when the slectUnit is done.
I think I have to do it when selectPlayer is done.
The real issue is locality is going to be pretty hard to troubleshoot.
The best way is to wrap the startup / reinit into a function that you remoteExec on the unit you are going to select into, and do it before you selectPlayer, or after you selectPlayer, and you know it is done, IE player has control, then you call that init script on the players new self.
Having a hand doPlayerInit wrapper function would make this a bit easier on you for certain tho.
I think to use selectPlayer properly, I should make whole mission to work after selectPlayer.
while loop are keep running but EH and action are completely broken when I use selectPlayer.
@still forum reference my last question, when I have multiple conditions separated with "and" these add up? they have to be all met for the script to continue?
and "or" is for one or another
Okay please don't laugh ๐ but this is the script I came up with and ofc it does not work. It's probably all fked up
waitUntil {!isNull player};
_unit = _this select 0;
if (side player == west) and (leader player == player)
then {_unit addAction ["Deploy FOB","_num = player nearEntities ['Man',15]; if(count _num >2)
then{['Deploying Platoon Rally Point',10] spawn HGF_fnc_progressBar;
sleep 10;
_fobarray = "Land_MedicalTent_01_NATO_generic_inner_F" createVehicle position player;
[west,player,FOB] call BIS_fnc_addRespawnPosition;)}
else {hint 'Need more allies nearby to deploy FOB'}","",1.5,false,true,"","_this == _target"];
_fobarray = _fobarray select 0; if (side player == east) or if (side player == independent) then addaction "Destroy FOB", deleteVehicle _fobarray; _fobarray call BIS_fnc_removeRespawnPosition;
};
replace the multiple and with &&?
no go read wiki
Try this:
waitUntil {!isNull player};
_unit = _this select 0;
if ((side player == west) and (leader player == player))
then {_unit addAction ["Deploy FOB",_num = player nearEntities ['Man',15]; if(count _num >2)
then{['Deploying Platoon Rally Point',10] spawn HGF_fnc_progressBar;
sleep 10;
_fobarray = "Land_MedicalTent_01_NATO_generic_inner_F" createVehicle position player;
[west,player,FOB] call BIS_fnc_addRespawnPosition;)}
else {hint โNeed more allies nearby to deploy FOBโ};
_fobarray = _fobarray select 0; if ((side player == east) or (side player == independent)) then {player addaction ["Destroy FOB", {deleteVehicle (_this select 0)},[_fobarray]]; _fobarray call BIS_fnc_removeRespawnPosition;
};
I just added some parenthesis and removed some syntax problems. Do read the wiki though a lot of the problems are very simple and could have been avoided.
You could see by highlight it wont work
Sorry Iโm on my phone highlight doesnโt show lol
I think I fixed the things I missed?
No
no it is not fixed
No it is FUBAR sorry
Looking at this on my computer I now have almost no clue what this supposed to do but @vague harness I'll dm you with my attempt at fixing this so we don't spam this channel with simple things.
I have this as a condition for an addaction (leader group player == leader player) but it comes back true even when the player is not a leader. I want it to work with https://community.bistudio.com/wiki/Arma_3_Dynamic_Groups
Any suggestions on why it's doing this?
leader player returns the player's group's leader
leader group player does the same
the issue is you're comparing the same value always
Ah
you're probably looking for leader group player == player
let me see if that works
No errors, but still shows true when player is not a leader
hmm
I tried groupOwner too but I am not sure how to use that one
Would it be an Issue with https://community.bistudio.com/wiki/Arma_3_Dynamic_Groups
Maybe when a player is ungrouped it still registers him as a leader
Well, every unit is always in a group
When you leave a group, you're just joining a new empty group
Alright, is it possible to be a leader of said empty group
Pretty sure, yea
yea, not quite sure myself what's going on now
I am not quite good enough in code to do this but can you use _clientID = groupOwner _someGroup; to find out which ID of clients have a group and then allow these to the addaction
hey guys, quick question. didnt arma 3 wheeled helicopter were able to taxi at some point?
umm that weird i could swear back in the day I even saw a video. like it had a break and if you release it it moved forward
maybe i m getting it confused with takeonhelicopters
but thx for the response
Hello, Im working with some old code here and I heard that code like this: waitUntil {(player getvariable "loaded") == 1}; is deprecated or was always not correct, but now it shows as an error and makes it unuseable, how could I use this in a correct way?
this is what its throwing in my client rpt
3:25:53 Error in expression <aituntil {(player getvariable "loaded") isEqualTo 1};
player allowdamage true;
[>
Error position: <isEqualTo 1};
player allowdamage true;
[>
Error Undefined behavior: waitUntil returned nil. True or false expected.
@restive leaf
Is that going to be the same for all medical trash
I hope so. Should be.
@vague harness
when I have multiple conditions separated with "and" these add up?
Yes. Just read like english.
condition1 and condition2 and condition3
Exactly like in the english language. Only happens if all conditions are true.
Also I'd really recommend to do
if cond then {
<code>
} else {
<code>
};
Instead of
if cond
then {<code>
<code>}
else {<code>
<code>};
๐ค
I have this as a condition for an addaction
(leader group player == leader player)
I already told you yesterday why that makes no sense.
groupOwner is not what you are looking for.leader player == playerlike I already told you yesterday is the right thing to do.
@vapid wadi "loaded" is not defined on the client at the moment this is executed. You need to initialize it prior to using the check
Alright, thanks Ill take a look
@vapid wadi if you update your arma to the last update it shouldn't error anymore. Just throw a warning.
No your code is not deprecated and wasn't "always not correct" either.
Use getVariable with a defaultValue
which will have the same exact result as your undefined variable
The waitUntil "fix" tried to fix some infinite loops, which you probably don't have there, you are just waiting for the variable to be defined
The fix is such a idiotic idea.
They wanted to fix infinite loops, now scripters will fix their scripts, and the same infinite loops will stay.
What's the benefit of that.
isEqualTo 1 is checking whether it's a number which is 1.
so, no a number
ok so it should be false?
how should I use the setvariable
I guess you would set it to 0
until whatever "loaded" means happens
unless 0 is also a valid value which has some meaning in which case you might want -1
can't know what to set it to without knowing what your code does
I mean should I do player setVariable ["loaded",1,false]; when im trying to set it or player setVariable ["loaded",1,true];
depends if you need it globally or not
can't know what to set it to without knowing what your code does
You wrote your code, so only you can know what you need
@vapid wadi use waituntil{player getvariable ["loaded", 0] == 1}
how performance intensive is it to repeatedly set public variables for units?
f.e. i have that in a fired EH for each unit of an 8 to 12 man group:
_unit setVariable ["IRON_EH_Fired_Time",time,true];
@spark turret https://community.bistudio.com/wiki/Code_Optimisation#Multiplayer_recommendations
potential network saturation if you do it (very) frequently, of course
aaand since it's on "fired", I suppose it is ๐
aonother thing: if i set the "public?" boolean to false, can i still call it from another script running on the same localitly?
to keep the network free
what is the reason you want to broadcast it
yes of course
there is no need to broadcast it if the usage is local
(besides potential teamswitch / local code that would use "player" var)
i dont have a reason to broadcast it publicly, other than that its used to determine if the group is in a firefight which triggers other stuff. its part of my "trenchAI" script
maybe have usage of the time variable so it would set it to true if more than say 5s passed
i thought of that too, but for that i have to use "getVariable" which i assume has the same perfomance impact as just setting a new one
fired fires on all pcs where it is added, there is no reason to broadcast it you just going to saturate network for no reason
the EH is server local only since the script runs on server and all units are server local ai too
and where do you need to know if unit is fired?
only on the server it seems
well then there is 0 reason to broadcast it
changed it to that:
if (_unit getVariable ["IRON_EH_Fired_Time",time] + 5 < time) then {
_unit setVariable ["IRON_EH_Fired_Time",time,false];
};
you dont need to set it to false, it is false unless you set it to true
i honestly doubt that the 5 second intervall check is less performance intenstive than just resetting the varibale each shot, now that broadcast spam is out the window
@spark turret As for me, it's better to keep it local and grab it by onrequest style, aka RE<->RE when it's needed. Well ofc if it's not an unconditional situation.
for that one i dont need broadcasting at all actually
but will keep in mind, i can think of at least 3 EH that overbroadcast in other scripts atm
setVariable costs essentially nothing performance wise
and getVariable a little less
it's nothing you should ever worry about
Only problem might be network spam, if you send it over network, which you don't anymore
If only the server needs it. you can also do
_unit setVariable ["IRON_EH_Fired_Time",time,2];
which will only set it locally and on the server
ah didnt know you could sort by that, cool
You still send quite a bit of networking stuff to the server, but not broadcasting to everyone should already make it good enough
@still forum ```@Grahame
Is that going to be the same for all medical trash
I hope so. Should be.
@Atlas
when I have multiple conditions separated with "and" these add up?
Yes. Just read like english.
condition1 and condition2 and condition3
Exactly like in the english language. Only happens if all conditions are true.
Also I'd really recommend to do
if cond then {
<code>
} else {
<code>
};
Instead of
if cond
then {<code>
<code>}
else {<code>
<code>};
thinking
I have this as a condition for an addaction (leader group player == leader player)
I already told you yesterday why that makes no sense.
groupOwner is not what you are looking for. leader player == player like I already told you yesterday is the right thing to do.``` Thanks, didn't quite understand but I do now. Although It works, it's wierd that leader player == player always return true even when the player is not group leader. Any idea why?
I have it in onPlayerRespawn, could that be an issue?
"even when the player is not group leader" are you sure he isn't?
how do you check that he isn't?
how many other players/ai are in players group when "the player is not the group leader" ?
I have tested with a squad leader grouped to a few subordinates and I have tested the subordinates and even 1 player alone thats is technically a group leader in a group with only himself is the way I see it as. That's the way I understand it anyways
group leader = you can give orders (or you're alone)
Another way I thought of doing it was to use groupOwner and find the id's of player who are group owners, make that into an array and then use that as a condition. Unfortunately I cannot figure out how to do just that.
groupOwner means network owner, nothing to do with in-game leader notion
Gotcha, another way I thought of was to use the role that was selected on respawn (using BI respawn) and have that as a condition. I followed this https://forums.bohemia.net/forums/topic/192840-bis-respawn-system-how-to-determine-role-after-respawn/ which ultimately ended up not working either
if the player is alone in group, he's the leader. I guess he doesn't have a group after respawn (not having a group doesn't exist, not having a group is equal to being in a group with only yourself)
I thought so too
@tough abyss โค
Hi guys, sorry for yet another question!
I'm struggling a bit with Preprocessor commands:
#define QUOTE(var1) #var1
#define SV_DEFAULT(VAR_NAME, DEFAULT)\
if (isNil #sv_setting_##VAR_NAME) then {\
sv_setting_##VAR_NAME = profileNamespace getVariable [QUOTE(sv_setting_##VAR_NAME), DEFAULT];\
}```
I defined a macro as this. What I would ideally want looks like:
```sqf
if (isNil "sv_settings_VAR_NAME") then {\
sv_settings_VAR_NAME = profileNamespace getVariable ["sv_settings_VAR_NAME", DEFAULT];\
}
but instead I get this:
if (isNil "sv_setting_"VAR_NAME) then {
sv_setting_VAR_NAME = profileNamespace getVariable ["sv_setting_##VAR_NAME", DEFAULT];
};
The if condition and the profileNamespace variable name have the same formatting but I was attempting two different ways.
Anyone knows how to achieve this? ๐ฆ
I'm trying to add the blood drops to be able to be seen as a marker by zeus using this code:
obj = allMissionObjects "";
systemChat str obj;
Zeus addCuratorEditableObjects [obj,true ];
It adds everything, however the blood isnt showing up.
systemChat str obj;
shows ace_drop_2.p2d
which I assume is the blood drop as im doing this in a virtual map
Not 100% sure but I don't think it's a zeus editable object ๐ฆ
It should be if it is an object
is what im trying to add as an object
I just need to find the name of it so I can use the interaction feature of ace to use on it
tracks and stuff like that also doesn't count as "object" even though it is such
also craters and bullets holes I'm pretty sure you can't add them to a zeus interface even with your approach
https://github.com/acemod/ACE3/blob/master/addons/medical_blood/functions/fnc_createBlood.sqf it seems like it is a simpleObject
then 100% not zeus interactible ๐
I should be able to use the ACE interation menu with it though?
on blood drops? I really don't know about that ๐ฎ
I think I found the classname for the blood drop, thanks for telling me about the zeus not working for simple objkectrs
@real mango you made a QUOTE macro, but then chose to not use it for isNil?
I should be able to use the ACE interation menu with it though?
no, not on simple objects
as I explained below, it was a different way to approach it, since using QUOTE wasn't working
also prefer simpler names, var1 instead of VAR_NAME
not sure if _ is allowed in there
it is allowed fortunately ๐
for now I got it to work like this ```
#define SV_SETTING_INIT(VAR_NAME, DEFAULT) sv_setting_##VAR_NAME = profileNamespace getVariable [("sv_setting_" + QUOTE(VAR_NAME)), DEFAULT]
although everyone will agree that's ugly ๐
#define QUOTE(var1) #var1
#define SV_DEFAULT(varName, DEFAULT)\
if (isNil QUOTE(sv_setting_##varName)) then {\
sv_setting_##varName= profileNamespace getVariable [QUOTE(sv_setting_##varName), DEFAULT];\
}
or
#define DOUBLES(var1,var2) var1##_##var2
#define SV_DEFAULT(varName, DEFAULT)\
if (isNil QUOTE(DOUBLES(sv_setting_,varName))) then {\
DOUBLES(sv_setting_,varName) = profileNamespace getVariable [QUOTE(DOUBLES(sv_setting_,varName)), DEFAULT];\
}
ouch, red
that's sqf highlight :u
cpp does the same ๐
QUOTE(sv_setting_##varName)
this doesn't work unfortunately
will produce "sv_setting_##varName"
not quite sure why, but above should work as workaround
i like the DOUBLES macro idea
will give it a try
looks promising
#define SV_SETTING_INIT(VAR_NAME, DEFAULT) sv_setting_##VAR_NAME = profileNamespace getVariable [QUOTE(DOUBLES(sv_setting,VAR_NAME)), DEFAULT]
works like a charm ๐
@still forum Arigatou ๐
How would I go about using either the ACE addAction OR the vanilla addAction and add that action to any object with a class name which is defined in a array
@surreal peak if you have CBA you can use initPost eventhandler with retroactive thingy set to true on a classname. Will fire eventhandler for each existing object of classname and all future ones
https://community.bistudio.com/wiki/getMissionPath <-- this nice
@still forum I want to make the code run as a zeus module script for a multiplayer Zeus server (with CBA / ACE / ETC.) Looking at what I presume to be the wiki page for the event handlers: https://github.com/CBATeam/CBA_A3/wiki/Extended-Event-Handlers-(new) , would I be able to make the code in a single script to run just once
For reference, im trying to make a zeus module that once ativated will allow you to use either ace interaction or just the normal interaction (with addAction) in order to clean blood spots
yes you can add XEH handlers via script
I figured out how to get an array of the blood spots with
_blood = allSimpleObjects [ace_drop_1,ace_drop_2,ace_drop_3,ace_drop_4];
don't have time now to google for you
kk
is there any way to do something slightly less complicated? :p
My knowledge in coding stops at around Event Handlers and Class's , since I havent studied those in school and struggled to understand them
I think I already asked before but I cant find it here but how to remove ACE interaction from a unit?
disable ACE mod... disable keybinds from interaction menu...
or is there a specific interaction you want to have removed?
everything
Looks good.
is there a function to make a player invisible inMP?
hideObjectGlobal true;
hello, comrades! I have my arma crashing when i try to createdialog or createdisplay RscDisplayOptionsVideo
Have anyone tried something simillar?
i do it like this ```sqf
[] spawn {disableserialisation; (finddisplay 46) createdisplay 'RscDisplayOptionsVideo'}
missiondisplay as parent is probably invalid
so i should change 46 to something else, right?
I am not too confident in display and stuff
Its an engine display you are not supposed to create it by script
yep, but it is the only way to force AA to player
any other setting can be configured
i am forceing ATOC so nobody can see through the trees
How do you mean
class CfgVideoOptions
{
class ATOCQuality
{
class Disabled
{
text = "$STR_A3_OPTIONS_DISABLED";
grass = 1;
oldTrees = 1;
newTrees = 1;
other = 1;
multiSampleCount = 2;
};
and also i switch AA listbox itself from control config (mean config.cpp from addon)
only thing left is to summon video dialog, so the guy with arma3.cfg
multiSampleCount=0; will get it too
What are you saying that you can hide trees with user setting?
No, you can make trees transparent like crap
Other than KK, what blogs do you guys follow?
Anyone else have some they recomend?
Asking in scripting, because I am looking for more arma scripting related blog content.
What just by choosing different video option?
@tough abyss https://imgsli.com/NDQ4Ng
Looks like ATOC should be OFF by default, the other one looks like crap