#arma3_scripting
1 messages ยท Page 595 of 1
now im getting script restriction 0 after adding in the filters
REEEEEEEEE
how does that even make sense
the whole point of the filter is so you DONT get blocked out.
it's magic
Yeah, not battleye filters
something else
yeahhh imma just run without be filters cause I cant even join otherwise.
yay! Can open and close the bag now and the elements are taken care of. Just need to make the logic to add items into the bag and open bags of other players. Image attached below:
https://imgur.com/a/8qTM0ys
dont mind the titles
those are fixed already
Any way I can force a AI out a vechile, they wont get out with any waypoints I give them?
Tried that
that doesnt work?
Nope, cos I need to reference the group as the unit doesnt have a variable name
hello, guys, have anyone tried to script rotor destruction effect? I have found BIS_fnc_helicopterDamage function that is ingame, but it is using non-existant file "hsim\air_h\data\scripts\main_rotor_destruction.sqf"
Will try it
you have the group set as a variable, correct? if so that should work. It will return all units inside that group and force them out of the vehicle
Yeah I do, will load it up and test it now ๐
Yep, thanks but ive wondered if anyone dug in howto force the effect that is ingame
Saying Error group: Type Group, expected Object.
_myUnits = |#|group (team1);
{
moveOut _x;
} forEach _myUnits;
Here @uncut rapids
foreach units team1
If I fastrope the AI they get out. Even though the heli is on the ground and the games registed it
assuming team1 is a group like one of yesterdays snippets was
You would be correct
Worked!
Thankyou
But now they get straight back in after, even if they have waypoint. So will look into that
ah yeah i completely forgot to use the units comment in my code i sent LOL sorry about that one
i literally had the wiki page for the command up and forgot it still LMAO
Any clue why they might auto get back in? Im thinking about allowGetIn false;
as in the AI getting out and automatically switching back to a seat?
They all get forced out, then instantly start loading back into the heli
Even if they have a move waypoint
maybe try disembarking the team leader first?
_myUnits = units group (whateverGroup);
moveOut (leader whateverGroup);
{
if(!leader group == _x) then {
moveOut _x;
};
} forEach _myUnits;
I tried [team1] allowGetIn false; It forced one out but everyone else stayed in
Will try that ๐
maybe lock the helicopter after they disembark?
idek why they would get back in so I'm just guessing tbh
allowGetIn expects an array of units not an array of groups ๐ค
That just gave me errors expunged, I tried locking it and it didnt work
_myUnits = group (heli1);
{
moveOut _x;
} foreach units team1;
heli1 lock true;
wait so what are you trying to do
The helicopter lands, and the AI are unloaded. heli the flys away, but the AI dont listen to waypoints and auto load in when kicked out using that.
cause the script I sent would just make the group leader disembark first and then make the rest disembark
I dont think I have the group variable set, I think I have the leader and the rest just follow him. Atleast thats what the scripts hinting.
And thats why [team1] allowGetIn false; only kicked one guy out
so from what i just ran the group leader instructs them to board the vehicle as soon as they get out
Thats same issue im getting
_myUnits = units (team1);
moveOut (leader team1);
{
if(!(leader (group _x) == _x)) then {
moveOut _x;
};
} forEach _myUnits;
_myUnits allowGetIn false;
just worked for me
just if you want to allow them into vehicles again you have to do _myUnits allowGetIn true;
Brilliant, idk why he ordered them back in after
Couldn't agree more
https://prnt.sc/t1roy3
For some reason it tells me there's missing something in line 5.
this is supposed to show me when a Civilian has been killed.
addMissionEventHandler ["EntityKilled", {
params["_killed", "_killer"];
}];
if(isPlayer _killer)then{
if(_killed (side _unit) == civilian) then {
_killed_Name = "";
[[format["%1 Killed %2 ", name player,_killed_Name]]remoteExec["systemChat"]];
}
}```
that entire if statement is outside of the eventhandler code
you close the event code on line 3
so move all that in between 2 and 3
yea. }]; goes after the code you want to execute on the event
now it says Line 1 missing )
addMissionEventHandler ["EntityKilled", {
params["_killed", "_killer"];
if(isPlayer _killer)then{
if(_killed (side _unit) == civilian) then {
_killed_Name = "";
[[format["%1 Killed %2 ", name player,_killed_Name]]remoteExec["systemChat"]];
}
}
}];```
the error shows the position where the issue is
_killed (side _unit) thats wrong, though it isnt line 1
if (!(_building isKindOf "House_F") && !(_building typeOf "Land_BarGate_F") && !(_building typeOf "Land_ConcreteWall_01_l_gate_F") exitWith {hint localize "STR_ISTR_Bolt_NotNear";};
if (((nearestObject [_pos,"Land_Dome_Big_F"]) == _building || (nearestObject [_pos,_vaultHouse]) == _building) && (west countSide playableUnits < (LIFE_SETTINGS(getNumber,"minimum_cops")))) exitWith {
hint format [localize "STR_Civ_NotEnoughCops",(LIFE_SETTINGS(getNumber,"minimum_cops"))];
};
if ((typeOf _building) == _vaultHouse && (nearestObject [_pos,"Land_Dome_Big_F"]) getVariable ["locked",true]) exitWith {hint localize "STR_ISTR_Bolt_Exploit"};
if (isNil "life_boltcutter_uses") then {life_boltcutter_uses = 0;};
if(!(typeOf _building == "Land_ConcreteWall_01_l_gate_F") && !(typeOf _building == "Land_BarGate_F")) then {
_doors = FETCH_CONFIG2(getNumber,"CfgVehicles",(typeOf _building),"numberOfDoors");
_door = 0;
//Find the nearest door
for "_i" from 1 to _doors do {
_selPos = _building selectionPosition format ["Door_%1_trigger",_i];
_worldSpace = _building modelToWorld _selPos;
if (player distance _worldSpace < 2) exitWith {_door = _i;};
};
if (_door isEqualTo 0) exitWith {hint localize "STR_Cop_NotaDoor"}; //Not near a door to be broken into.
if ((_building getVariable [format ["bis_disabled_Door_%1",_door],0]) isEqualTo 0) exitWith {hint localize "STR_House_Raid_DoorUnlocked"};
} else {
_building setVariable["boltcut", true];
};
Does this look fine? It's not working properly.
try this @neon crane
addMissionEventHandler ["EntityKilled", {
params["_killed", "_killer"];
if (isPlayer _killer && {side _killed == civilian}) then {
[format["%1 Killed %2 ", name player,name _killed ]]remoteExec["systemChat"];
};
}];
aight
@warm venture define "not working properly"
Alright
so im trying to make it to where you can use boltcutters on bar gates and concrete gates
Can people in a ragdoll state not be effected by SetVelocityModelSpace?
@warm venture linter says [1,3]:error:Parenthesis "(" not closed
https://prnt.sc/t1rs3q
Okay, but this should show the players name.
What is the 1,3?
line 1 column 3
the first if statement condition has an opening ( but no closing )
https://prnt.sc/t1rs3q
Okay, but this should show the players name.
@neon crane And this shows every killed unit, not just civilians
so you want format["%1 Killed %2 ",name _killer,name _killed]?
it still says the units name, not mine 
is the unit not your player?
MP
its for my milsim, with other players
and i want to log if they killed civilians
if in MP it will always return profileName
aka the name of player, not of the unit itself
no
no, name _killer will simply return the same as profileName _killer in MP
My stuff still isnt working :/
name _killer
but only when you run the mission in multiplayer
Oh 
I'm in singleplayer eden
and please... have the wiki open on a second screen or with ALT-TAB, and read the descriptions, syntaxes and examples of the commands/functions... it will tell you everything you need to know...
Guys, If i wanted to make certain doors to be opened by Blufor only ( Police Station ). How can it be done ?
trigger
I have all my pd doors open automatically when cops get near and they are holding a keycard.
Okay. I made it like that now, that it would send 2 different messages when either a civilian or a blufor was killed. Though it just replies with Player friendly fired civilian
And Player killed the civilian Blufor
addMissionEventHandler ["EntityKilled", {
params["_killed", "_killer"];
if (isPlayer _killer && {side _killed == civilian}) then {
[format["%1 Killed the civilian %2 ", name player,name _killed ]]remoteExec["systemChat"];
};
if (isPlayer _killer && {side _killed == west}) then {
[format["%1 friendly Fired %2 ", name _killer,name _killed ]]remoteExec["systemChat"];
};
}];```
What is arma scripted in? Lua or C? @robust hollow
yes but isnt sqf lua or c?
sqf is sqf
cant find a sqf validator anywhere
for which IDE?
im just using notepad++
the first works in a fair few, the second i use in vscode, the third idk
i used the first to check ur code
3sec search on google: https://www.armaholic.com/page.php?id=8680
I don't think there isn't any IDE linting (yet)
if (isNull _building) exitWith {};
if (!(_building isKindOf "House_F") && !(_building typeOf "Land_BarGate_F") && !(_building typeOf "Land_ConcreteWall_01_l_gate_F")) exitWith {hint localize "STR_ISTR_Bolt_NotNear";};
if (((nearestObject [_pos,"Land_Dome_Big_F"]) == _building || (nearestObject [_pos,_vaultHouse]) == _building) && (west countSide playableUnits < (LIFE_SETTINGS(getNumber,"minimum_cops")))) exitWith {
hint format [localize "STR_Civ_NotEnoughCops",(LIFE_SETTINGS(getNumber,"minimum_cops"))];
};
if ((typeOf _building) == _vaultHouse && (nearestObject [_pos,"Land_Dome_Big_F"]) getVariable ["locked",true]) exitWith {hint localize "STR_ISTR_Bolt_Exploit"};
if (isNil "life_boltcutter_uses") then {life_boltcutter_uses = 0;};
if(!(typeOf _building == "Land_ConcreteWall_01_l_gate_F") && !(typeOf _building == "Land_BarGate_F")) then {
_doors = FETCH_CONFIG2(getNumber,"CfgVehicles",(typeOf _building),"numberOfDoors");
_door = 0;
//Find the nearest door
for "_i" from 1 to _doors do {
_selPos = _building selectionPosition format ["Door_%1_trigger",_i];
_worldSpace = _building modelToWorld _selPos;
if (player distance _worldSpace < 2) exitWith {_door = _i;};
};
if (_door isEqualTo 0) exitWith {hint localize "STR_Cop_NotaDoor"}; //Not near a door to be broken into.
if ((_building getVariable [format ["bis_disabled_Door_%1",_door],0]) isEqualTo 0) exitWith {hint localize "STR_House_Raid_DoorUnlocked"};
} else {
_building setVariable["boltcut", true];
};
if ((nearestObject [_pos,"Land_Dome_Big_F"]) == _building || (nearestObject [_pos,_vaultHouse]) == _building) then {
[[1,2],"STR_ISTR_Bolt_AlertFed",true,[]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
} else {
[0,"STR_ISTR_Bolt_AlertHouse",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
};
cause theres something wrong in here
although SQFvm is extremely powerful (and up-to-date)
and im not sure what
and my internet is being horrible rn so its gonna take an hour to download atom ๐
@warm venture Can this be done with an already made map ? E.g Altis
Thats what im running
programming 101: make sure your code is readable... that will make debugging a lot easier
This is all stock altis life.
[2,57]:error:can't interpret statement (missing ;?): <Variable(_building)> <Keyword(typeOf)> <String("Land_BarGate_F")>
[2,97]:error:can't interpret statement (missing ;?): <Variable(_building)> <Keyword(typeOf)> <String("Land_ConcreteWall_01_l_gate_F")>```
if you have problems with a life framework, ask questions there...
_building typeOf "Land_BarGate_F" --> typeOf _building == "Land_BarGate_F"
omg
like... 90% of that code is BS for us, and the amount of framework specific stuff is too much for us to debug for you
idk how i didnt catch that.
script errors should tell you this
client side errors?
yea
Sorry i really didn't get you. WDYM by "stock" altis life
aha i see. Thanks for your time buddy
talking about the keycard thing?
I had to make custom scripts for doing that.
its like 5 lines.
And the custom scripts were used on an already placed buildings ?
To make it clear. rn i am designing my map using Mapbuilder. i was working on the police station and i want the Blufor only ( Police ) to have the ability to interact with certain doors. Is this made using the mission or scripting the building it self before finalizing the map in TB ?
if you mean scrolling and opening I dont think its possible but maybe..
yes
I have scripts setup so it automatically opens when you get near
simply lock the door(s) by default, unless a cop gets close to it
How can that be done ?
building1 setVariable["bis_disabled_Door_1",1,true];
replace the first 1 with the door number
aha. So i should place the Police Station in the mission. Not in the map it self. ( To access and script it easily ). Right ?
in eden editor, put down the building
like the office building
then by the doors it will have a door number.
Yup exactly. I was gonna place them in Mapbuilder and then try to script them. which i think isn't possible
by mapbuilder do you mean eden
No
There is a program used for designing the map. It saves the coordinates and some info of the object you placed on your terrain. After that you export the coordinated etc. as a form of txt file to Terrain Builder
coordination *
I know how to do with eden editor thats all
You don't use any other tools ?
How do you run the linter in atom..?
if (!(_building isKindOf "House_F") && !(typeOf _building == "Land_ConcreteWall_01_l_gate_F")) exitWith {hint localize "STR_ISTR_Bolt_NotNear";};
So can anyone think of why this is giving the hint? the building is typeOf "Land_ConcreteWall_01_l_gate_F"
@robust hollow https://i.gyazo.com/dafac79cf0c1ec06cff713dd8eaee329.png
getting that with linter for whatever reason.
When i setup a slider action, similiar to a buttons action in a dialog, do I need the prefix 'on' for the event handler?
I'm trying to make it so you can bolt cut a fence gate
Its the concrete one with vertical bars. The issue is that when I try to get the cursorTarget, it usually grabs the object behind it because it goes through the bars..
@warm venture i dont use atom so cant really help you there. as far as the script goes, add log lines through the file so see what the type of building actually is and what line the script is exiting on and what conditions it isnt satisfying.
is there a way to fix that..?
try cursorObject instead
its picking up the pier behind it
even when you do it with cursorObject?
could always check if the player is within x distance of an object with that classname.
@robust hollow Epic! it works. Anyway, any idea why this doesnt work? [player,"weed"] remoteExec ["life_fnc_say3D",RANY];
trying to play a sound from a source to nearby players, and no im not using player in the script, im using an object
based on that snippet alone, no. most likely causes i can think of are a bad object, incorrect sound class, quiet sound or RANY macro not defined.
u need to play around with it a bit and see what works to isolate what doesnt.
Is there a way to make hidden selection textures / set object textures visible only for as example blufor? I mean, that only blufor can see this texture edit and opfor cant see the texture change/edit like its original.
https://community.bistudio.com/wiki/setObjectTexture
setObjectTexture has only a local effect, you could remoteExec that to west and it should work ๐
@plain current ok thank you, ill give it a try ๐. To explain for what its needed is, need to do some kind of buildings & units stealth for one faction (so for the oponent it has to be stealth in visual) and the other faction needs to see their own buildings (so they can still walk in these) and units.
[_speaker,"jailbreak"] remoteExec ["life_fnc_say3D",RANY];
still cant figure out why this isnt playing a sound for everyone
because L*fe ๐
no, life.
basically nothing works properly in arma
arma3_x64.exe works really fine for me
i never have any issues i didnt cause myself ๐
cause vaulting through doors/walls is normal eh
the geometry kinda pushes you out of doing that
all I accept are vanilla bug reports ๐
so whats the point of setting a building's doors to "locked" if it doesnt actually lock them?
just lets them be opened no problem
No
@warm venture are such enterable buildings Vanilla?
Setting the door states to closed
vanilla buildings added in editor yes.
military offices
"setting them to closed" I am assuming this is in eden yes?
I suppose closed & locked
you can report this kind of issues on the feedback tracker
with the list of concerned classnames
so is there a reason why this wouldnt be working
Nobody knows what l*fe_fnc_say3D so we can say nothing
maybe because RANY or RCLIENT are server-side variables only, IDK
is life a swear word or something
yes
you keep starring out the i
read my message from before, there arent too many things that can go wrong with that
... maybe cause i didnt have #include "..\..\script_macros.hpp" in the file where rclient is defined.
which i indirectly mentioned before ๐ฆ
I fixed it in that file
but not this one
assumed it was already in there but i guess not
bad game, bad
what doors wernt locking on the military office? they are all locked for me.
None of them locked. They were locked in editor but could just scroll and open them ingame
try the game without mods, then come back ๐
a locked door cannot be opened in-game (without scripting)
ยฏ_(ใ)_/ยฏ
@warm venture are any server side scripts running that could unlock the doors?
Or amything on the client that could be responcible for it?
Because if it works in the editor scenario, but stops working on your l*fe server, then wouldnt that mean that something in the scenario/server is disabling the lock on those doors, no?
Yet another reason why you should ask altis l*fe related questions on their special server
There's maybe someone there who knows about the quirks of the framework
I can't help but laugh every time I see l*fe
*blackjack and ladies of the night
uh oh
let's say it's in the very grey area @high marsh
whats the best ide for sqf coding/linting
cause im getting an error in atom sqf linter
C:\Users\jflee\.atom\packages\linter\lib\linter-registry.js:154 [Linter] Error running SQFlint Error: '~' is not recognized as an internal or external command,
operable program or batch file.
at ChildProcess.<anonymous> (C:\Users\jflee\.atom\packages\linter-sqf\node_modules\sb-exec\lib\index.js:56:20)
at ChildProcess.emit (events.js:194:13)
at maybeClose (internal/child_process.js:998:16)
at Socket.<anonymous> (internal/child_process.js:403:11)
at Socket.emit (events.js:194:13)
at Pipe.<anonymous> (net.js:593:12)
VSCode is nice
atom also has highlighting
here is a list of useful tools:
https://community.bistudio.com/wiki/Category:Community_Tools
yeah but I cant get the linting to work in atom @high marsh
every time I save it I get that error
ยฏ_(ใ)_/ยฏ
sublime text ^_^
so if I have a "while" loop, is the code stuck in there until its exited?
because I want to change the variable thae is being checked by the while after a certain amount of time.
the variable is checked every loop
but the loop won't exit mid-code if the variable changes
the while loop runs till it fails ๐ค
while {
// as long as this returns TRUE
a < b
} do {
// execute the following code
a = a + 1
};
so for instance
while{_pd getVariable["jailbreak", false]} do {
if(!(_pd getVariable["jailbreak"])) exitWith{};
[_speaker1, "siren", 250, 1] remoteExecCall ["life_fnc_say3D", RCLIENT];
[_speaker2, "siren", 250, 1] remoteExecCall ["life_fnc_say3D", RCLIENT];
uisleep 5.2;
};
I want this to run, but I want to change "jailbreak" to false after 5 minutes or 120seconds
varspace getVariable name
name: String
Anything or Nothing if the variable doesn't exist
it works for what im trying to do so im keeping it
๐คฆโโ๏ธ
if it aint broke dont fix it.
then why does it work as intended?
it's broken because it obviously doesn't work ๐ค
yes it does? @exotic flax
Dude. You come here to get help, get told what you did wrong, and now state "I don't want any help"
it works just fine.
Either you ask for help and accept it, or leave.
Your code is wrong.
And the if/exitWith is useless.
yep already removed that
lol
if (player getVariable "restrained") exitWith {hint localize "STR_NOTF_isrestrained";}; this is part of L*fE and works fine. Its literally how all of the variables are checked in this framework.
...
Yes because that code is correct
and its different than yours
Yours is wrong and useless.
That snippet you posted is neither (might be useless, but can't say without context)
if (!(_unit getVariable ["Escorting",false])) exitWith {}; //He's not being Escorted.
ok
so this whole time yall were talking about the part I didnt have questions about
well your question was already answered
exitWithdoes NOT work within awhile/doloopgetVariableeither needs a string (name of var) or array (name of var AND default)
thank you. @exotic flax
but if we let you have your mistakes, you'll someday come back with the issues caused by that and waste more time
already told you that before though...
then what would be ideal way of exiting the while after 5 minutes
in a different script..
because it wont work in this one
because its stuck in the while until its not true anymore.
right?
just seems like a lot of work
you can add another boolean flag
like ```sqf
mustCheck = true;
while { mustCheck && { stuff getVariable ["stuff", false] } } do {
};
// and somewhere else
mustCheck = false;
if it was easy everyone could do it ๐คฃ
exitWithdoes NOT work within awhile/doloop
oh ._.
?
wont exit within while {true} do { } loop
yeah we already crossed that line about 10m ago
sqf is easy, especially due to the ammount of documentation and support โค๏ธ
Not without its quirks, though
_blah = 0 spawn {
while{blahblah} do {
};
};
terminate _blah;
maybe?
This is only my personal opinion, but you usually want to avoid having a ton of while-loops
its..probably fact
In my entire inventory code, there is not a single while-loop. I just despise them having worked in an unthreaded environment once
how do you handle changes in inventory then? Handlers?
Sqf, though, is "threaded"
The scheduler will run each task at it's time
But this doesnt mean that you should fill the scheduler with while-checks
would be so much more convenient having everything in one file..
Handlers and actions @high marsh
Handlers are mostly for selecting elements, actions are responsible for updates
I'm not sure exactly how handlers work with SQF and their engine functions. But I'm sure it's still running waiting to catch
@ebon citrus whats the best way to safe server perfomance in scripts? Like you do?
Less is more
would be so much more convenient having everything in one file..
That is just bad programming...
No
@high marsh probably engine-side instead of scheduler
Atleast i hope so
Handlers could also be implemented in a trigger-style
But I'm sure it's still running waiting to catch
no
how then
As in, an action happens and all registered handlers get called
event happens, eventhandler gets executed
since spawn is run async it seems and while is sync
and while is sync
no
while is a loop, spawn is not
they are completely different things
Spawn creates a task in the scheduler
The scheduler will run that task once it gets to it
so im basically stuck doing [] remoteExec["l*fe_fnc_pdJailbreakTimer"];
From my experience, a while loop will be run once inside the scheduler each time the scheduler returns to the task, as long as the condition is true
That's...
Seems excessive
exactly my point
would be so much more convenient having everything in one file..
@warm venture
What is fn_pdJailbreakTimer.sqf?
the new file I have to make to cancel the while.
No...
thats..what yall said
You dont need to make a whole new function to set one variable ๐
depends on the context, and how often you need that function ๐ค
It looks like not often
private _pd = missionNamespace getVariable "kavpd";
_speaker1 = missionNamespace getVariable "pdSpeaker";
_speaker2 = missionNamespace getVariable "pdSpeaker2";
_pd setVariable["jailbreak", true];
while{_pd getVariable["jailbreak", false]} do {
[_speaker1, "siren", 250, 1] remoteExecCall ["l*fe_fnc_say3D", RCLIENT];
[_speaker2, "siren", 250, 1] remoteExecCall ["l*fe_fnc_say3D", RCLIENT];
uisleep 5.4;
};
Need it to exit the while after 5 minutes, then not let it run again for 20 minutes
Logic
Im having a hard time getting in my head this whole thing
So you want an addition to your script that involves breaking out of a jail?
This is all it needs to really do... it plays the sound file every 5.4 seconds until the variable is no longer true
then it locks the doors
or needs to
while{_pd getVariable["jailbreak", false]} do {
[_speaker1, "siren", 250, 1] remoteExecCall ["life_fnc_say3D", RCLIENT];
[_speaker2, "siren", 250, 1] remoteExecCall ["life_fnc_say3D", RCLIENT];
uisleep 5.4;
};
uisleep 120;
// lock doors
thats what it really needs to do
but it doesnt work that way
I hope you are aware that this is a discussion/support channel, not a "please write my code" channel...
Because I really got the feeling we're writing the next L*fe framework, without getting paid for it ๐ค
lol..
i guess its really that difficult to answer a simple question
dont want to help - dont
dont be toxic...
if it was easy everyone could do it ๐คฃ
@exotic flax
people are here to help
not to write your code for you
and get nothing but sarcasm
i do not insinuate that you ARE, i am saying dont go there
from ppl with complexes
the problem is that you dont really know what you want and what you have
I know exactly what I want
there is a lot of context involved in Tonic's stuff that needs to be known/explained
or you need to take your script OUT of that context to make it understandable
_pd spawn {sleep 60*5; _this setVariable["jailbreak", false]}
so cause spawn is running on _pd, it makes _this reference _pd instead of the file itself
Yea
here's also an example of using params which is useful when you are calling/spawnning/executing something with multiple arguments. Take a look at example 1 on how it works in practise:
https://community.bistudio.com/wiki/params
just a side note
great
format["%1"] thats invalid
Reminds me of ACE slack
private _building = missionNamespace getVariable _buildingName; there.
or rather r/armadev reddit.
with gems like
if (!alive OpforFlgCarrier) then
{
(_ui displayCtrl 1007) ctrlSettext format ["Dropped"];
}else
{
(_ui displayCtrl 1007) ctrlSettext format ["%1",name OpforFlgCarrier];
};
or
publicVariable "timelimit","ctfscorelimit","CaptureScore","CTFicons","Icon_Distance";
if its wrong why does it work then
serious question im wondering
thats why i never changed it since last year when I made it. It worked
it doesn't work ยฏ_(ใ)_/ยฏ
so im hallucinating the doors on my building opening/closing
the format ["%1"] you posted is invalid, it doesn't work
but what you posted will fall back to default value, maybe thats what makes it work
just one part of your code being wrong and not doing anything, doesn't mean that the rest is also broken
your code can be 99% broken, but still have two lines of code that work
Doesn't mean that its "not wrong"
so is the new one better
please code with "Show Script Errors" flag in the launcher, too
please code with "Show Script Errors" flag in the launcher, too
Perhaps add that to "Introduction_to_Arma_Scripting" on the wiki in a large blinking box at the top of the page ๐ค
server errors show up in rpt
client errors also show up in rpt, but 99% of the time the client will also freak out
yeah, i've rarely had cases where the client wont start throwing gang-signs and black boxes at me
and seeing an error directly on screen makes more sense than trying to explain someone to check log files (which they sometimes also disable)
and the error message also tells you exaclty WHEN the error occured
so that gives a hint
you can connect your actions to the error easily
Perhaps add that to "Introduction_to_Arma_Scripting" on the wiki in a large blinking box at the top of the page ๐ค
well, it's on https://community.bistudio.com/wiki/Debugging_Techniques
if people read that
I also know that
An error in SQF will purely and simply halt the current script
is not true
not for all errors, for some probably
for example, an undeclared variable will throw an error but not stop the script
I am bringing the topic in #community_wiki to fix this note, for those who are interested
I've noticed that I cannot choose my custom interaction menu options when in a vehicle, but I can when on the ground.
I've defined them within config.cpp, like so
class CfgVehicles
{
class Man;
class CAManBase: Man
{
class ACE_SelfActions
{
class skipSong
{
displayName = "Skip song";
condition = "((leader (group player) == player) or !isMultiplayer) and (!(group player getVariable ['XIM_bMusicStopped', false]))";
exceptions[] = {};
statement = "[player] call XIM_fncPlayNext";
};
class stopMusic
{
displayName = "Stop music";
condition = "((leader (group player) == player) or !isMultiplayer) and (!(group player getVariable ['XIM_bMusicStopped', false]))";
exceptions[] = {};
statement = "[] call XIM_fncStopMusic";
};
class startMusic
{
displayName = "Start music";
condition = "((leader (group player) == player) or !isMultiplayer) and (group player getVariable ['XIM_bMusicStopped', false])";
exceptions[] = {};
statement = "[] call XIM_fncStartMusic";
};
};
};
};
This is using ACE's interaction menu framework
```cpp if you want ๐
cheers
whats the difference between setVariable ["bis_disabled_Door_1", 1, true]; and setVariable ["locked", true, true];
the first hides the action, the second is a life var i think
does onPlayerKilled.sqf execute globally, locally to where the player is local or on server?
locally
actually
is there any way to make a variable on a player accessible from other players when it is set via myVar = "value";
i know setVariable, but the problem is, that the value cannot be changed wtih the simple way anymore (myVar = "new Value";)
thats why i m asking
player addEventHandler ["Killed", {_this call life_fnc_onPlayerKilled}];
and yes, you can make public variables
it adds the eventhandler to the player
so i think its local to the player on player side..
@slender schooner publicVariable if you want
the problem i m facing is, that i want to be able to access a players hunger and thirst in Life, and all the code used to change it is written with the simple form
Lou, can you say is onPlayerKilled.sqf is local to server or player or global?
local to the killed unit iirc
hunger and thirst should all be a local variable on server
if you make those variables public, you might face a lot of network congestion
depending on how often you update them
@warm venture the more you learn, the more you are prone toโฆ "not be wrong" ^^
ask questions and learn, yeah
yea, i figured that out also, guess i ll try to make a callback function that gives the asking admin the needed info 
always best
public variables are something that gets fired at players whenever they update(?)
and it also means that anyone can edit those values
publicVariable needs reinitialisation on each change
and i suspect that they then overwrite EVERY players hunger/thirst
so its a hivemind hunger/thirst system
would be funny tho, you drink, everyones thirst goes up
youre always best off using the player-objects namespace for that kind of stuff on server
and update it to client when necessary
yea
like if you have a food-meter, update the position of that meter/animation when it crosses a threshold
no need to update it constantly
ofcourse
server will keep track of when it needs to be updated
can we add locality of scripts to the event scripts page?
@ebon citrus sure thing! I thought about that last month. all we need isโฆ data ๐
yeah, i guessed so much
i can try to start documenting them when i get back from lapland
i think life checks constantly every second if you crossed a certain threshold and then if you do, updates the values
wasteful
as i said, i think
uiSleep 1;
is, basically a 1 second sleep, no?
but with the difference that it also work when you dont focus on the game, no?
@winter rose initPlayerServer.sqf is executed server side and requires remote execution. Is there an alternative to detect a player-login, or will i just have to write my own script to detect player-spawn. Basically i want to add an EH on server-side to the player when they are loaded (controlling a unit)
so is there an alternative/workaround to initPlayerServer.sqf that doesnt involve remoteExec?
perfect
stahp ninja'ing meeeh ๐
just what i was looking for
that moment when you want to click the link, and someone sends a message, so you instead click the emote
you may click the emote as well if you'd like ๐
@ebon citrus note that you won't have the player unit, since it's on connection
yep (or the player disconnects)
yeah, that one aswell
need to garbage-collect
almost forgot about that one and wouldve had a memory-leak
a tiny rare one, but unfortunately one nonetheless
although wouldn't an EH attached to a player be required to be on the client?
@modern adder I think in a vehicle, you get the vehicles self actions instead of the Man's.
might need some edge-case logic still, but the main stuff is easy
then jsut check if the locality is server
MPKilled, if it works, does just what i need it to
MPHit is also great, as i can manage health server-side
fill me in with objections, please
but MPKilled is what im eyeballing for now
btw, what's up with not being able to open backpacks of dead units?
i know it can be done through the default arma 3 inventory
but as it stands, i need to add that option to each killed unit with a backpack as an action
and when/if the backpack is removed, remove the action on all clients
pain...
it's because the unit itself doesn't have any inventory when dead, however there is a placeholder item placed "under" the body which gets accessed
really? ๐ค I thought bodies became "crates"
im sure they do
because they have primary weapons etc.
you cant set a primary weapon for a vehicle*
can you?
idk, but the item blops in their hands nicely
same with backpacks
in Zeus I always see the dead body and a placeholder "crate" which has an inventory (could be primary weapon only though, although I always thought its the full inventory)
and i need to handle the unit as a unit and not as vehicle inventory
it's primary
it gets dropped into a simulated weapon holder
you can pick up the weapon and add it back to the unit's inventory aswell
if you set it as the unit's primary, it will float in the air if the unit is ragdolled
although using getLoadout on a dead unit still works ๐ค
I hate that function ๐คฃ
Hmm, ok. How would I add the interaction to the vehicle as well then?
I mean since it's always in the same order you can nit pick what you want
also add self interact for car
or maybe there's something wrong with your condition?
@high marsh which is an amazing feature of getLoadout
but some of the nesting is weird
and i wish sqf had hashmaps/dictionaries
@modern adder do the options show up, but can't execute them, or do they simply don't show up?
the nested ones being mag lists?
the loadout array is pretty complex: https://community.bistudio.com/wiki/Unit_Loadout_Array
How dare you
I have macro's to quickly generate full loadouts ๐
Don't show at all
How do I add a self interact for the car too? What would it look like in a config.cpp?
Self (Type 1 / ACE_SelfActions) Something the user would do to themselves or to their vehicle (eg. Put in ear plugs / Check mounted Static Weaponโs ammo)
although you might want to check the documentation regarding the condition and statement; since player might not be available
The simplest action is just a condition and statement. The code to these are passed [_target, _player, _actionParams]. _player is ace_player; _target is the object being interacted with; and the 3rd argument is the optional action parameters (default []).
Oh, so it's possible in the vehicle player isn't available and that's why it isn't working?
I believe the condition is triggered by the vehicle, and therefor there's no local player
if i now want to execute a function on a player and receive a callback, how would i do that?
however using _player is should return "you" as a player
i mean, yea, thats the way you do it locally, but i want to do it remotely
Of course, the function must actually return a value, else _return will just be code
Oh, I don't think you can
responseFnc = {
name player;
};
But our solution to that was to use publicvariableserver
like this, i want to execute this on a player, and get his name
You send the variable via publicvariable server, then set up a public variable event handler
Event handler will recieve the broadcasted variable
remoteExec ๐ค
I don't think remoteExec can return a value
does remoteExec give back a value to the one executing the remoteexec?
public variable also can't
does remoteExec give back a value to the one executing the remoteexec?
if you think about it, thats not possible
i tried that, but it didnt want to give me the name
Of course public variable can
you can remoteExec the value back
Of course public variable can
no it can't.
publicVariable is one way, just as remoteExec
you can do a one-way message back to original sender. With remoteExec or a PVEH
you could put something in missionNamespace (request), catch that on server, do something, put result in missionNamespace (response), catch that on client

remoteExec has remoteExecutedOwner
which has the clientID of the sender, so you can directly reply back to them
Or send it directly to the server in case there are multiple clients also doing the same thing
Arma-IPC is born ๐คฃ
via publicvariableserver
my brain is just like
right now
so, the remoteExec gives the remote player the id of the one who sent the remoteExec to them, right?
Or send it directly to the server in case there are multiple clients also doing the same thing
yes
via publicvariableserver
no. With what you said above multiple clients would overwrite eachothers variables.
but remoteExec would be completely safe
and remoteExec was built to replace that, so just use it.
Won't they all run in seperate threads?
There is only one thread
at this point, remote exec would be my safest bet, as i tried so many things before
Sorry, I meant different scopes
the public variable is one variable that is set on the server and broadcasted to every player
so, editing it, edits it for every player, ofcourse only as soon as it is broadcasted again via publicVariable
Here this is what I use
{
str [name player, diag_fps] remoteExec ["systemChat", remoteExecutedOwner];
} remoteExec ["call", otherPlayerName];
send request to a player, and he replies back by systemChat'ing the reply to my chat
and broadcasted to every player
you can use publicVariableClient, but for that you need to know which client it came from
Which you can have the client send
but why, if remoteExec has it integrated
okay, so, trying to understand this code:
on line 2 it calls the function remoteExec which calls systemchat on the person that called it on the remote player with the parameters "name player" and "diag_fps"
with the parameters "name player" and "diag_fps"
no
systemchat in this case is a function that accepts those two parameters, right?
with the parameter "[playername, 2312]"
systemchat in this case is a function that accepts those two parameters, right?
no systemChat accepts one parameter, a string
with the parameter
"[playername, 2312]"
yea, thats what i meant
oh, i see
and what is that diag_fps for then?
but isnt that useless then if systemchat only accepts one parameter?
what?
no?
the parameter is a single string
with the parameter
"[playername, 2312]"
no wait, i think i missunderstand a bit the code there
so the str in front makes it a concatenated string
it converts the array to a string
i see
without the concatenated
not at all
but, now i finally have a way to do it
remoteExec is rather simple as soon as you can get your head around it
well, i need to write a function for the displaying the info in it that it gets
it's the BE filters and CfgRemoteExec that's nice
yea
you familiar with controls and dialogs?
i hope that i can remoteExec my functions in Life just like that, without having to open an exploitable point
yea, a bit
gonna have to look closer into the remoteExec and CfgRemoteExec
it's a lot of work to make your code unexploitable with remoteExec
that's why you avoid it as much as possible
yea
well, I avoid it
tbf, i dont really care a lot about hackers
up to you
if i spot one, i ban him
then i suggest whitelisting your server
nah
you wont keep a dedicated scripter/hacker out by banning them
i mean, if you look around a bit, and with the use of my now being created admintool, i ll see if someone cheats in no time

or... you dont
i dont mean to discredit you
but youre talking about people who somehow dedicate their time to being essentially a bully
some of thema re very good at it
but that's enough of those people
but most of them are just some children that bought a 500โฌ script from some shady site, and cry when you ban them
๐คทโโ๏ธ
back to running bought scripts on random servers ๐
oof
(there is BIS_fnc_getServerVariable too)
thats also maybe a solution, but i would need something that basically instantly gives me the answer back
and cant be overwritten by another admin doing the same thing at the same time with another player
but i ll keep that in mind if i ever need it

and cant be overwritten by another admin doing the same thing at the same time with another player
remoteExec :3
TFAR uses the remoteExec scheme above to get unique ID's for players radios
is there a full proof way to prevent player and ai callouts in group chat? if so can some one point me to some info.
@still forum thank you a thousand times, i now am able to get variables from other players

finally
is possible to somehow optimize mission.sqm (playeable units)?
Optimize at what?
when i disable simulation on them - fps 60.
When enable - 30
unfortunately it doesn't seem to be working. I have this in the initPlayerLocal.sqf in a desperate attempt to turn them off. I also have in the server profile autoReport = 0; They still to happen from time to time. its odd.
player disableAI "AUTOTARGET";
0 fadeRadio 0;
enableRadio false;
enableSentences false;
dont spawn ai in until they are needed is one optimisation
https://community.bistudio.com/wiki/Mission_Optimisation Give this a read
is possible to somehow enable simulation when player loaded?
In Multiplayer?
https://community.bistudio.com/wiki/Arma_3_Dynamic_Simulation possibly (Terrano)
You meaning I'm true?
@surreal peak i tryed this, but don't changed anything
did u give my first link a read?
reading ๐
hi
how do i make the ai stay in different positions if they are in the same squad
to keep units at their spot, you can use
{ doStop _x } forEach units _myGroup;
where do i enter that
that, or "simply" doStop this in their init field, only if this is not an MP mission
where do i enter that though?
@tough abyss doubleclick to the soldier, and write in the Init line
doStop this
As Lou Montana told, if its not a MultiPlayer Mission
its a scenario mission
never to be multiplayer?
do i have to play mp?
I ask because using init fields is not a good thing for MP
Ok
if it is and only will be a single player mission, use the init field
is there a command that i can use in script to know how much is the server under "load"?
maybe diag_fps
doesn't it only print the FPS of the game? i think the server does not have any fps in it?
i mean it doesn't have anything but a console
#monitor ?
^
you can use that in scripts?
server has fps
basically my idea is to know how much the server and each client is under "pressure" so on big PvE maps i can hand-off the AI elaboration to the clients and free up the server
more pressure -> lower fps
You could take a look at how Liberation is handling that ;)
https://github.com/KillahPotatoes/KP-Liberation/blob/master/Missionframework/scripts/shared/diagnostics.sqf
It logs the FPS (and other stuff) on the server for both the server and clients
is there also a way that you know of, to know the "connection quality" of the clients? I think if the client have high ping it would make the whole server desync right?
I think if the client have high ping it would make the whole server desync right?
no
there is a server.cfg entry to auto kick on bad ping
Howdy
๐ค
@flat elbow take a look at headless clients
okay, i m back with another issue
i m feeling more and more like I AM the issue
When i try to execute
{
str [life_hunger] remoteExec ["systemChat", remoteExecutedOwner];
} remoteExec ["call", civ_1];
the RPT log shows me this error
2020/06/18, 16:54:26 Scripting command 'call' is not allowed to be remotely executed
the thing is, i actually allow everyone to use call in the cfgRemoteExec.hpp
F(call,ANYONE)
am i doing something wrong here?
so many to list!
[str life_hunger] remoteExec ["systemChat", civ_1]; // why not that?
this shows your life_hunger to the other player
the code itself works, but there is something that says that i m not allowed to use call remotely
it seems a conf issue yes
yeah something bad with CfgRemoteExec
maybe "BIS_fnc_call" works
instead of "call"
class CfgRemoteExec {
class Commands {
mode = 2; // set to 1 to whitelist only
class call { allowedTargets = 0; }
};
class Functions {
mode = 2; // set to 1 to whitelist only
class BIS_fnc_call { allowedTargets = 0; }
}
};
This should allow both
you know what
i effing hate myself now
not even morphine can help me anymore

the problem is, that i put the call allowing into the functions part
stupid question now, if i use command that isnt whitelisted in the remoteexec, but i whitelist the function, will it still work?
like, i use the "call" in a function that is actually allowed
will it work or not?
, if i use command that isnt whitelisted in the remoteexec, but i whitelist the function, will it still work?
if you remoteExec the function yes
Thanks, @still forum & @exotic flax, I had a genuine good laugh ๐
emote spam, but in a supportive way ๐
so, if it whitelist this function without whitelisting the "call"
function1 = {
{
str [life_hunger] remoteExec ["systemChat", remoteExecutedOwner];
} remoteExec ["call", test1];
};
this should work?
no, you need to whitelist the functions/commands you want to remoteExec
~~very supportive
~~
so in that example systemChat and call
i see
you are still remoteExec'ing "call" which is blocked
you can remoteExec "function1" tho
but function1 needs to exist on the target
i see i see
good to know
so i basically have to open a security hole on that point

if you make your own script function, and whitelist that, no
And embed it in a mod
thats what i was thinking about right now
well, euh......
or put in mission file ยฏ_(ใ)_/ยฏ
Own function -> in a mod -> signed
i think thats a bit too high for me tbh
Is pretty much the safest
its a bit overkill tho
yea
i know
i looked briefly over it and was amazed at how much stuff you can do, but taken aback by how much stuff you can do
yea
And if security is actually a concern
If youre whitelisted etc. It might not be worth it
If you trust your players
What are you even making?
we dont have a playerbase yet, so that would be rather useless
tanoa life
mostly to train myself in scripting
but also for the fun at working on it
i know, its quite badly written, but i just like the gamemode a lot
Not that
I mean youre taking in a lot at once, things you dont yet understand and you have to know and youll just learn bad practises
i know i know
Start with Hello World, lol.
i NEVER EVER made a hello world script
Singleplayer missions
like, never
hint format["%1 %2", "Hello", "World"];
๐คฎ
i know how hello world scripts work, but i dont want to ever make one
Arrogance
nah
Pride is one of the 7 sins, you know
My favorites are: "yes", "hello" and "ielhbefphnrjdufkkw"
Lorem ipsum is also a solid one
my favorite is "bruh"
Different generations, i guess
Hello world is usually the first few lines of code you try when first learning a new language. In usual programming, it teaches variables as well as input/output. For Arma, it was just a joke, lol
systemChat > hint
Fight me in a way which does not involve flaming ir trolling/toxicity and does not display explicit violence or gore
why should i flame you?
I said dont flame
i think the same
Anyways, im just used to using systemChat as a debug tool
*fight
To know where the code is running
Where it's entering
i prefer systemchat tho
And peint out some values along the way
If the text is too long copyToClipboard does the job
if (alive player && (player getVariable "state") isEqualTo "toxic") then {
player call BIS_fnc_๐จ ;
};
IT WORKS
thats syntax error tho
if (alive player && (player getVariable "state") isEqualTo "toxic") then {
player call (missionNamespace getVariable "BIS_fnc_๐จ");
};
you want that
if(alive player && (player getVariable "state") isEqualTo "toxic")then
{
player call (missionNamespace getVariable "BIS_fnc_๐จ");
};```
*fixed
programming languages without emoji support is soooo 2001...
@ebon citrus yea i can use HC but my idea was to leverage user's computational power and not a HC, that's where my concerns come from
๐ค ( โ๏ธ @exotic flax ) ๐ ๐จ @exotic flax
it is not 100% clear to me what happens when you handoff the AI to a client, do the server hang waiting for data to be processed by the client? how much bandwidth does it take? would ping spikes make everyone desync? if the client disconnects, what happens to the AI? etc.
do the server hang waiting for data to be processed by the client?
no
how much bandwidth does it take?
some
would ping spikes make everyone desync?
The AI would look like it lags
if the client disconnects, what happens to the AI?
moved back to server
etc.
gub.
๐ค ๐ซ โ๏ธ ๐จ ๐ ๐จ ๐จ ๐ ๐จ ๐ต
thanks for the insight dedmen, so i guess i should trash the idea of a distrubited AI?
without a way to know how well is the connection of the client, i can't prevent the AI from lagging
so i guess i should trash the idea of a distrubited AI?
huh? no. why? its good
i can't prevent the AI from lagging
yeah well... thats rare tho
Send a msg to the client, he sends the answer back -> ~Ping ๐

my idea was to weight the FPS of every client and then remove the ones that have either a high ping or are desynched or have too narrow bandwidth but for what i understood i don't have a way to know the latter part
so if for example one client starts to desync, or his ping increase, i can take the control of the AI back and distribute it to other clients
I wasn't fully kidding before, Fluffy
mmh yea i can use remotexec to see how long it takes to get the message back, but that would not tell me if someone is desynching or not
send remoteExecCall from Server, note time, wait for answer from Client, check timediff.
Desync is another topic
Desync was in OFP times a big problem tbh ๐
Yeps
i see the server desynching even when i play it now lol
But, tbf... the internet was worse back then.
โคด๏ธ
I remember playing with 800ms on 56k ๐ด
Ye you shot him and he was teleporting and you were dead ๐
but these days the spread is bigger
i can have 1000/1000 and my friend will have 12mbs
Does getDammage work if I am trying to get a unit's ACE damage?
Dual ISDN @winter rose - BUT: I had the best ping, just my downloads ๐ฆ ed hard
Or does it only work with vanilla arma?
do you remember the cars going straight out of the road and then gets teleported back in another position while you were on the turret?
Of course
still a thing
desync is not gone
you cant make it "gone"
it's jsut... better
with ebtter internet standards
but if the driver is lagging/desynced, the car will go wild
now it happens rarely to that level
better engine
better game-engine
i remember my PC on his knees when i used A2OA
although; new engine, more stuff to send around, more data used, same problems as before ๐คฃ
and it was the most powerful PC money can buy back then
less data in relation
IF all players would have better internet, which isn't the case
If you have a decent spec'd server and don't rape the network with setvar/pubvar/remexec, desync is quite rare even with +150 players
well for the ping my idea is to send a remotexec setvar command to the clients that will contain the current tick and the remotexec will set on the player a variable as an array with 1st element the time it received and 2nd element the time it's wrinting the info and then the server will get that info and subtract the two to get an idea about how long it takes for the client
The biggest problem really is mod makers not caring about the network traffic or how many script threads they generate. Many do network calls every time you get in/out of vehicles and spawn a thread for every vehicle. When you have 100s of vehicles your server is gonna start lagging quite quickly. Vanilla servers can handle +100 players easily without HC.
i thought the AI was the biggest performance wreck for a server?
send a timestamp to the client from the server
That as well
when you receive the timestamp compare it to current timestamp
You could probably read the ping through rcon or memory
AI is killing CPU, and therefor server FPS
public variables are killing network traffic
i can merge the two things, as if the client is overloaded, the remotexec will take more time too, maybe
ie if i spawn it, i can also see how busy the scheduler is
You could try pubVar'ing the serverTime and compare compare the sent time to the arrival time, then you only need to send stuff 1-way instead of 2
yes but that would introduce another issue, that i have to send the pubvar to all the players at the same time
which i think is a bandwidth spike
You could use publicVariableClient for sending to individual client or publicVariableServer for sending to server, you could also use setVariable or remoteExec, i just used pubVar as an example
what will backpack _object return if _object has no backpack?
answer: empty string
also
i figured out my backpack issue
i dont need to delete the action when i can just add this to the condition field ((backpack _originalTarget) !='')
and with this, i dont even need to detect when the unit dies: ((backpack _originalTarget) !='') && (!alive _originalTarget)
so no need for event handlers or remoteExec

here's the whole script to add the "open backpack" action back to a unit. Just call it in the unit's init-field:
params["_unit"];
_classname = backpack _unit;
_backpackName = getText(configFile >> (_classname call Nca_fnc_getConfig) >> _className >> "displayName");
_unit addAction
[
format ["Open %1",_backpackName], // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
_caller action ["gear", unitBackpack _target];
},
nil, // arguments
1.5, // priority
true, // showWindow
false, //hideonuse
"", // shortcut
"((backpack _originalTarget) !='') && (!alive _originalTarget)", // condition
2.95, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];```
@still forum anything you think could be improved?
nu
use private _var
no, good practice.
never done it if i dont need to init a variable before use in another namespace
isnt _ basically private?
not exaclty, you can still overwrite variables from upper scope.
accidentally?





