#arma3_scripting
1 messages · Page 599 of 1
and then i jsut pass a known static argument as a string in an array
for now testing purposes
params["_name","_unit"];
private _return = -1;
{
if ((((_unit actionParams _x) select 2) select 0) == _name) exitWith{_return = _x};
}forEach (actionIDs _unit);
_return;```
and it works
the title changes according to the backpack name, so i cant use that
but i dont need to
although, this doesnt account for mods yet
you could have actions with no arguments
need to make a check for that
params["_name","_unit"];
private _return = -1;
{
private _args = (_unit actionParams _x) select 2;
if (count _args > 0 && _args isEqualType []) then {
if ((_args select 0) == _name) exitWith {_return = _x};
};
}forEach (actionIDs _unit);
_return;```
we I need a "Random script generator"
is there a way to detect if music is currently being played? I want to have triggers that will start ambient music periodically but only if action music from another encounter is not still playing
afaik not...
although you could try getMusicPlayedTime (returns elapsed time of current music track), or use addMusicEventHandler for a more fancy way to keep track of start/stop
i was looking at getMusicPlayedTime; ill test to see what it returns when no music is playing. If it returns nil I can probably use that.
okay i see, using getMusicPlayedTime when no music is playing always returns 0
that wouldn't be an issue, since music is always overridden when starting an new track, so if it's 0 and a new one starts, the "old" one never plays anyway
i see what you mean. I don't plan on having a script continously checking if the time is zero; overidding tracks is the opposite of what i want to do.
I have triggers that start combat music when the players enter combat zones, so i'm also gonna have ambient music triggers at the edges of these zones so that when the players leave, ambient music will play - but only if the combat music isnt still playing
if (getMusicPlayedTime == 0) {
playMusic "SomeMusic";
}
This will simply check if something is playing, if not, start something.
If, for some reason, 2 triggers are triggered at the same time, only the one which is later (within a second) will play.
interesting, ill look into it
i do this all the time
jsut couple it to the musicStop EH
when the music stops, start a track
i usually have a random list of tracks i paly from
more often i wait around for a random ammount of time before i start the next track
so that there's a bit of calm
i wont share my golden ratio of wait-random though
And sorry about that
i just have a personal grudge with while-loops
while (player knowsAbout "while") do {
player setDamage 1;
};
[player] spawn {
params["_unit"]
while (_unit knowsAbout "while") do {
_unit setDamage ((getDammage _unit)+0.01);
sleep 0.1;
};
};
@exotic flax extra painful and slow
needs to be re-executed every time the unit starts to know about "while"
[player] spawn {
params["_unit"];
while {true} do {
if (_unit knowsAbout "while") then {
_unit setDamage ((getDammage _unit)+0.01);
};
sleep 0.1;
};
};```
better version
and syntax-error fix
okay new issue, i have a task that for some reason auto completes itself as soon as it's assigned? I un-synced all triggers that affect it besides the one that creates the task, yet after a second the task shows up as completed instead of in progress
im using the eden task modules to create task and set task states, but for some reason it just instantly completes itself as soon as it's assigned, and yes it isn't being created in the completed state
JEEZ i'm dumb. so if you have a task with a parent task, completing the parent automatically complete it's child tasks
logical?
also, #arma3_editor for 3den related questions
i'm sensitive to 3den
my skin will wilt and boil if exposed to 3den
ew
oh i didn't realize they were from 3den
surprisingly useful then
can i ask why you dislike it?
i dont so much dislike them
but if you want to get something done in a reasonable manner, just script it
3den is at best a debugging tool for me
i try not to use the modules though
they spell mostly problems
Well, that's coming from me
They spell problems unless you know how to EXACTLY use them
Hey y'all I am currently trying to load a loadout export through .sqf via a dialog prompt
I am trying to define the _unit as the person currently in the dialog
Morning all...
quick thought...
i have this in my initPlayerLocal.sqf
// Respawn player body clean up
player addEventHandler ["Respawn", {_this spawn fnc_Del_Corpse;}];// Delete Player's old dead body
fnc_Del_Corpse = {_unit = _this select 1; deleteVehicle _unit;};
i think this has been stopping this from working
onPlayerKilled.sqf:
player setVariable ["Saved_Loadout",getUnitLoadout player];onPlayerRespawn.sqf:
player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
i had a thought, and changed the function call to this
// Respawn player body clean up
player addEventHandler ["Respawn", {_this spawn fnc_Del_Corpse;}];sleep 10;
// Delete Player's old dead body
fnc_Del_Corpse = {_unit = _this select 1; deleteVehicle _unit;};
Now it works perfectly..... i assume because the 'old player' is now not instantly deleted giving no time to grab the loadout??
Is there a way to create markers that show pictures when hovering over them like the ones in the tacops campaigns do?
@distant wave shouldnt double post.
@bronze temple it the script is running on the client (i assume it is) could you just use player?
@topaz fiber Yes, presumably the added "Respawn" event is firing and the spawn inside is completing before onPlayerRespawn.sqf has a chance to get the loadout. An alternative would be to set the variable to the missionnamespace instead.
@knotty mantle i believe tacops uses https://community.bistudio.com/wiki/BIS_fnc_missionSelector
I am making it for a server
The player variable in the sqf works however will that work in MP?
it depends what your dialog does exactly. does the player open it, select a loadout and then it should apply?
@robust hollow https://streamable.com/7s7ngw
Essentially what I am doing is trying to let the player select a preset loadout through dialog options
Thanks Connor 👍
yea, i think player should work for that purpose.
Alright poggers
Thanks
Sorry another question but can I test if a player has a certain amount of one item in their inventory?
Like I want to create a trader that uses bottlecaps in players inventories
yea, something like this perhaps _n = {_x == "bottlecap"} count items player;. not sure if items is the right command.
😡 the respawn with gear is still not having any effect on my dedicated server. Using the same scripts as what works on another mission with the same mods. So frustrating. I guess it would be best to test in vanilla and build mods in and keep testing?
It’s not like it’s complicated. 🤷🏼♂️
Hey everyone, I'm using BIS_fnc_ambientAnim in multiplayer for my mission, but I am having issues with it playing the animation, it only plays it once then stops, is there a way to get it to play all the time like it does in SP?
@topaz fiber that's not how functions work
If you want a detailed rundown and guide on how to define and use functions, let me know
Im more than happy to help someone get started with them
@ebon citrus very kind of you to offer, will take you up on that for sure
my issue is i try to learn through google and testing and understanding. Its when it does work then doesnt that i get confused lol
np
I have a setup where a "shop list" is being populated with items from a config file that resides inside a mission PBO. Can this config file situate in the server and is there a way for the players to access it? If yes then what would be the best approach?
yes, player's "can" access it but only their local copy
so if you mean that can players copy it? Yes
can players make changes to it? Not unless they are running malicious software
do the changes matter? only locally
so when you say "access" what kind of access do you mean?
I think read-only access where a "shop list" gets populated from a config file that resided in the server instead of a config file that resides in the mission PBO
Point being that when I start to have 10+ different missions that are basically using the same config file it's becoming tedious to make changes to each of the config files inside the different mission files. I'd think it'd be a lot easier if there was only one config file that multiple missions use and I could only modify this one file when needed
server could load it at init, and transfer it into a variable thats transferred to all players
as every player needs it, a simple publicVariable should be sufficient?
that's how I do it
this sounds like solving a leaking pipe with a crowbar, but sure
you could do that
but this begs the question, why are you editing 10+different missions at the same time 😅
not a serious question
a rhetoric one
but yeah, totally could
just be careful when transporting large variables over the network
hmm, I need to take a look into that I guess Ded.
But I myself was thinking that I could somehow point to the file that resides in the server from the client's side so that the client could just "fetch" the file or rather the contents of the file 🤷🏼♀️
mhm
Yeah you kinda could.. but that would probably be more work and less efficient
if the file is not inside the mission-file, then it wont get moved anywhere or "fetched"
da-da
you can remoteExec to server, let it loadFile, remoteExec the contents back
so it's better to define your stuff in the mission-file
this sort of "fetching" is sort of difficult aswell
because it could open up a security issue
that's why you should have everything the client needs in the mission-file if you are not using a mod
well not if you do it right. CfgFunctions serverside, hardcoded filepath.
yes, but "doing it right" is far more work
But again if all clients need the same file, might aswell just publicVariable it from server, much easier
account for JIP
publicVariable'd file will be available at least during the whole duration of a mission? So it's not single-use so to say?
you set a variable, and the variable won't magically disappear by itself
are public variables JIP-compatible?
is there any scripting possibility of making the AI stop turning, even if i'm specifying them not to move at all? This is what i'm currently using but it doesn't seem to work, they just freeze their movement, but not their rotation:
this disableAI "PATH";this setUnitPos "MIDDLE";
ignore the unitpost part
publicVariables are added to the jip queue yes
do you need the AI to jsut be there
@ebon citrus yep
basically make them stop making rotating every time they hear gunfire
because they're actually trying to track the enemy
disable these parts of the ai too
"TARGET" - stop the unit to watch the assigned target / group commander may not assign targets
"AUTOTARGET" - prevent the unit from assigning a target independently and watching unknown objects / no automatic target selection```
and instead of "path" disable "MOVE" - disable the AI's movement / do not move
as detailed in the ntoes by Katu:
MOVE: disabling this will stop units from turning and moving. Units will still change stance and fire at the enemy if the enemy happens to walk right in front of the barrel. Unit will watch enemies that are in their line of sight, but won't turn their bodies to face the enemy, only their head. Works for grouped units as well. Good for staging units and holding them completely still. Movement can't be controlled by a script either, you have to re-enable movement for that. Unit will still be able to aim within his cone of fire.```
@tough abyss
To be able to publicVariable a file from the server I need to have it in the server as a function(?) How does the function need to be declared so that it is found from the server? Do I just declare it inside the mission file in description.ext under CfgFunctions? Then publicVariable it from initServer.sqf for example?
make your own serverside mod pbo with CfgFunctions?
if you just do it right from initServer.sqf then you don't need a seperate function
you can define it in mission aswell, but that's excessive
oh yeah, this is one thing i wanted to ask
anyone fancy running a short script to create an RscTree to see if you're getting the same bug I am?
and I already answered that
you did? Oh and it's on the biki now Variables broadcast with publicVariable during a mission will be available to JIP clients with the value they held at the time.
silly me
sorry, i didnt notice your comment due to the ping
my bad
Has always been on wiki
@ionic orchid post the code
i've just kinda figured out what it is, lemme roll back to the example for you
ok
private _ctrlTree = _disp ctrlCreate ["RscTree", 0];
_ctrlTree ctrlSetPosition [-0.0117,0.0639,0.1877,0.9268];
_ctrlTree ctrlCommit 0.0;
_ctrlTree tvAdd [[], "Category A"];
_ctrlTree tvAdd [[0], "Text 1"];
_ctrlTree tvAdd [[0], "Text 2"];
_ctrlTree tvAdd [[0], "Text 3"];
_ctrlTree tvAdd [[0], "Text 4"];
_ctrlTree tvSetTooltip [[0], "Category A"];
_ctrlTree tvSetTooltip [[0,0], "Text 1"];
_ctrlTree tvSetTooltip [[0,1], "Text 2"];
_ctrlTree tvSetTooltip [[0,2], "Text 3"];
_ctrlTree tvSetTooltip [[0,3], "Text 4"];
_ctrlTree ctrlCommit 0.0;
tvExpandAll _ctrlTree;```
Try to click between the 'xt' on Text 1 and 2, it should be blocked by something
it turns out that it's the scrollbar - if you don't give the RscTree enough elements for it to show it, it doesn't init properly
so it just hangs out there, invisible and blocking clicks
thanks reproed
cheers
in the meantime, my workaround is to fill it with empty entries for force the scrollbar, wait a frame, then clear and add my data
not great, but it works
you are right about invisible scrollbar that shouldnt be there. Fix incoming
awesome, thanks man
does anyone know a way to find the most recently completed task?
hmm. think i may know. nvm
i need a way to identify the player (in MP) closest to an object. I've tried ```sqf
position nearEntities [["allPlayers"], 50] select 0];
but i'm guessing "allPlayers" or "player" is not a valid entity type
I know i can do "man" but need to find player specifically
also ignore the last "]", i took it out of a larger code
Use select isplayer _x with it.
(getpos player) nearEntities [["man"], 50] select {isplayer _x}
no worries!
did they break BIS_fnc_findSafePos recently?
Not as far as I know... Use it for several mission systems without reported issues
going to try a backup and see if its me or them
Last change to BIS_fnc_findsafepos was 10/20/2017 😉
oy... yeah i just tested it with my old code and works fine. It doesn't like something about the variable i'm throwing into it
You can always check in functions_f to see whether one of the bis functions was updated btw
gotcha
i think i found the problem. when i use ```sqf
[Zap_lastTask nearEntities [["man"], 50] select {isplayer _x}];
to find the nearest player
it returns something like
[player_1]
instead of ```sqf
player_1
so when i enter that variable like so ```sqf
_victim = [Zap_lastTask nearEntities [["man"], 50] select {isplayer _x}];
SafePos2 = [_victim, 200, 300, 20, 0, 0.3, 0] call BIS_fnc_findSafePos;
not a huge concern since i don't care who it selects, so long as they are within 50m, but the brackets are causing Bis_fnc_findSafePos not to work
so the question is how i turn output of [player_1] into player_1
maybe i can throw select 0 on top of it
what's up?
think i got it, just needed another select 0
lol still doesn't work, i give up for now
for some reason Bis_fnc_findSafePos doesn't like the _victim variable created by ```sqf
_victim = [Zap_lastTask nearEntities [["man"], 50] select {isplayer _x} select 0];
i don't know why
I'm getting errors. Somewhere in line 130 of Bis_fnc_findSafePos
rpt?
Rpt?
the error message?
right, which is why i select the first output of the array
_victim = [Zap_lastTask nearEntities [["man"], 50] select {isplayer _x}];
SafePos2 = [_victim select 0, 200, 300, 20, 0, 0.3, 0] call BIS_fnc_findSafePos;
@spark rose
try that
no dice
same error
now if i try ```sqf
SafePos2 = [getPos _victim, 200, 300, 20, 0, 0.3, 0] call BIS_fnc_findSafePos;
i get an error also, saying array, expected object, location
private _victim = ((Zap_lastTask nearEntities ["CAManBase", 50]) select {isPlayer _x}) select 0;
SafePos2 = [_victim, 200, 300, 20, 0, 0.3, 0] call BIS_fnc_findSafePos;
So is using the playMusic command functionally different than playing music through a trigger? If so, what command is the trigger using, or is it some hard coded music player?
I was told that musicEventHandlers only work when using the command itself and not the trigger, but it seems slightly unintuitive
dont use triggers
😅
no, in all seriousness, i dont know how triggers execute music
i would have to dig
I was told that musicEventHandlers only work when using the command itself and not the trigger, but it seems slightly unintuitive
check this information before anything!
When I attempted added a music event handler using triggers it had no effect, so I’m inclined to think that information is right. When I get home I’m definitely testing though.
@ornate prairie works for me
@winter rose false. Music EH's do work with music player by triggers
one less issue!
where is arsenal garage defined? i cant find it 🙈
fn_garage.sqf?
yep
What do you mean by defined? The location?
yep and the cfgFunctions entry
It's just BIS_fnc_garage IIRC. Check it in functions viewer?
There he is, in functions_f_mark
so addMusicEventHandler has the following text in it's wiki: "Just like addMissionEventHandler, music EH is also attached to the mission." Does this mean the code it executes is global?
also, it says " Passed params array: 0: CfgMusic class name"
https://community.bistudio.com/wiki/addMusicEventHandler
so if i wanted to use the currently playing music as detected by the event handler, how would i call it in the code? "[_this, 0]"?
_this select 0
thank you, you are very helpful
< 3
hmmm i'm still unsure if the event handler executes code locally
Since play music is a local command, i would assume that the related event handler would be aswell
but if it isnt it would really mess things up
Music event handler, always executed on the computer where it was added.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Music_Event_Handlers
so local execute by the sounds of it
thank you
i was making a variable to detect whether music was currently playing, so that ambient music triggers would only play if other music wasn't already playing (i dont want any music to get cut off abruptly). However if it was global, i would have had a problem where one player would change the variable to think that music was playing, before other players triggered the music thus locking them out of getting music played despite only the first player actually hearing anything
i hate multiplayer scripting lol
have you heard of our Lord and Saviour https://community.bistudio.com/wiki/Multiplayer_Scripting @ornate prairie? 😄
When we want to store items in a box on init on multiplayer, do we need to use the Global versions of the addItem command?
Don't Global something in an object's init section! That's EVIL.
Oh
:(
But without Global it doesn't seem to work at all, the box remains empty
clearmagazinecargoglobal this;
clearweaponcargoglobal this;
clearitemcargoglobal this;
this addItemCargo ["ACRE_PRC152", 3];
this addItemCargo ["ACRE_PRC343", 4];
this addItemCargo ["ACRE_PRC117F", 1];
this addItemCargo ["ACE_EarPlugs", 6];
this addItemCargo ["ACE_CableTie", 12];
this addItemCargo ["ACE_EntrenchingTool", 3];
this addItemCargo ["ACE_wirecutter", 3];
this addItemCargo ["ACE_Clacker", 1];
this addItemCargo ["ACE_IR_Strobe_Item", 12];
this addItemCargo ["ACE_Flashlight_XL50", 3];
this addItemCargo ["ACE_SpraypaintGreen", 3];
this addItemCargo ["rhsusf_ANPVS_14", 3];
this addMagazineCargo ["DemoCharge_Remote_Mag", 3];
this addMagazineCargo ["SatchelCharge_Remote_Mag", 3];
Init section will run for every each players. Even JIP IIRC. So, if you global something inside the section... you know. That's a mess
You cleared globally but adding locally
because we launch the server, and then players join with in progress
which retriggers the clear but not the add cargos
So the clears just need to be non-global I assume?
Suggest to use init.sqf with isServer or initServer.sqf or such and use global variant
Okay, so on initServer.sqf, do the isServer check, and use global variants would be good?
initServer.sqf only runs on server computer so don't need to isServer
If I then pick an item from the box, and a new player joins, wouldn't that reset the contents of the box as if the item was never taken?
I'm not a multiplayer lord but this should do the trick
Alright, massive thanks. We'll do some testing with it
Don't forget to name the box to use in initServer.sqf
yeah because this isn't a thing haha
we got that far :D, just the local/global functions are a bit funky
Indeed 😉
I recall my mess before that I put createVehicle into init.sqf without isServer so everything's done 😄
have you heard of our Lord and Saviour https://community.bistudio.com/wiki/Multiplayer_Scripting? 😄
@mental wren
Can be helpful 😉
yeah I had a look at that
Multiplayer scripting is a mythical beast
Understanding it takes great patience
Accomplishing simple matters in the language of multiplayer scripting can take days, if you are kot careful
Been there, done that. Everyone learns it the hard way
if there is any way to improve the wiki on an aspect that is not (well) covered, let me know 
Lou is our ambassador to the biki
one among plenty talented peeps @ #community_wiki 😉
Hey I think I asked this before but I cant remember the answer and cant find the question, what was that fancy text showing stuff like "FOB Alpha" called again?
Uh, example?
https://community.bistudio.com/wiki/BIS_fnc_infoText
https://community.bistudio.com/wiki/BIS_fnc_typeText
https://community.bistudio.com/wiki/BIS_fnc_typeText2
https://community.bistudio.com/wiki/BIS_fnc_textTiles
https://community.bistudio.com/wiki/BIS_fnc_dynamicText
@oblique arrow pick as many as you want!
sure...
penta-ninja'd!! 😄
Thank you peeps!
Yeah its a mega-ninja
they work differently
Oki I'll be sure to read them
Hm okay
Hi, is it possible to get the position of a HitPointDamage on a body ?
hitpart?
Yes
Oh thank you
this eventhandler is very picky with locality if you use it in multiplayer
Can I avoid using this EH if I already know the _hitPartIndex ? like searching for the center position
my goal is to create a drawline3d, starting from the shooter position, to the body part which is injure
I am using the HandleDamage event handler
why not use tracers?
@compact maple https://community.bistudio.com/wiki/BIS_fnc_traceBullets
It's something that shows you the bullets in Virtual Arsenal
tracerBullets IS a static line
they are these lines:
https://i.imgur.com/QCb3Sct.png
Oh okay I see, it triggers when you shoot, in fact this is what I need, but I want to see these line on a shot that happened before
If A shoot B
I am C, and I want to see the bullet tracer of A
you can
@compact maple read the documentation
the first parameter of the array passed to the function is the unit the lines will be drawn for
so you would just call the function like so :
[A] spawn BIS_fnc_traceBullets;```
But how does the function know where the bullet should land?
The parameter is only for a guy who want to see his friend's bullet right?
the function doesn't "know" anything, it just traces the trajectory of fired bullets
thats what I tought, so it can't do what I need, thats why I used drawline3d
sure, but you only get at where the weapon's barrel is aiming, not the real hit
is it possible to get the position of a HitPointDamage on a body ?
I still don't get what you are trying to get; a hit selection is more than just one point, it can be e.g a whole leg
if you want where the bullet has hit, see the HitPart EH
The relative position of where the bullets landed in the body so I want translate it to a world pos
But yes I think I will look into hitpart eh
is there a way to cancel a reload. 'cancelAction' doesnt seem to work
worldToModel something @compact maple
reload of a unit, mind you
y I know 😄
@ebon citrus not that I know of - the "cancel action" was to cancel the "get in vehicle" animation in A2, but it still played the full animation
switchAction maybe, + a remove/add weapon
maybe i can swap the player's weapon real quick XD
yeah, i want the reload animation to paly though
i just want to override the action to make sure any magazines from the backpack are not loaded
if there is a smarter way, let me know
like something i could add to the backpack config
how does picking a backpack trigger a reload?
no no no
i explained it wrong
i meant that when you reload, the unit CAN reload magazines from a backpack of the unit
i want to avoid this
as in arma 2, you couldn't reload magazines from a backpack
oh, I see
you want the unit to use only the magazines from his vest or smth ?
precisely
as in arma 2, you couldn't reload magazines from a backpack
I thought they wanted to have this behaviour, but didn't do it 🤔
yeah I get you
but I mean I think that it doesn't work like that, even in A2
?
are you sure?
i can vividly recall having to pull magazines from my backpack into my inventory
I think you can/could reload magazines from backpack already yes
and that they considered to remove that behaviour, but it was not much more than wishful thought
I tell you what, I am firing A2OA to check
the things you make me do…
couldve been added in a later update
you dont need to
i have OA warming up already
this is arma 3
im talking about arma 2
this comment is gold:
Because ArmA is a game of INFANTRY combat an not INVENTORY combat!
…I don't even know how to use backpacks in Arma 2 😅
i had to get intimate with them recently
because i had to program the backpack behaviour into arma 3
the backpack behaviour of arma 2, that is
oooh the "Open bag" button! -.-'
buuut the magazines end on the ground
aaanyway
@ebon citrus you are correct, can't reload from backpack
(in A2OA)
here i am again, with another issue
sooo, i m currently writing a small bansystem for altis life.
The system itself is supposed to be working, but i get a "missing ;" error on it
switch (playerSide) do {
case west: {
if((_this select 12) == 1){
failMission "zb_banned";
};
};
case civilian: {
if((_this select 15) == 1){
failMission "zb_banned";
};
};
case independent: {
if((_this select 11) == 1){
failMission "zb_banned";
};
};
};
↑ this is the part that spits out the error
appearently its the first case
https://cdn.discordapp.com/attachments/478246836952629259/726859644106178560/unknown.png
any ideas on why this happens?
if-then
. . .
…I know
right....i was intending to do a exitwith there, but then decided not to....
many thanks for the help

to be honest, I didn't notice it until I opened the error message picture
what's the locality of failMission
if run on server, will it fail all players?
yeah, that's what im worried about
4non's code, if run on the server, might end kick ALL players
it would end the mission for everyone I believe
assuming you want "ban system"s to run server-side, this is what i assume will happen
so you'd have to remoteexec that failmission
I wonder if you could somehow bug out arma enough to only show the end screen for certain players 
well @ebon citrus it uses playerSide, so I suppose it is run client-side
@oblique arrow you can
use endMission locally, the player gets his mission closed while the others keep playing
"you are banned"
"no i'm not"
"ok, cool, welcome in"

as @ebon citrus says,
it is best to use
https://community.bistudio.com/wiki/serverCommand server-side (obviously) with #kick or #ban instead of a client-side check @slender schooner
well, i wanted to make it a function that automatically makes you disconnect when the value is set to 1 in the database
but, i guess i could aslo look into switching this with the kick
ban lists are for that, no real need to have a ban system mission-side unless you want them to see a very custom reason
run it on the server and switch endmission with kick
i believe they want to ban from specific roles
(police, civ, medical)
as the l*fe folk do
oh
then, do as you please
basically yea
(ban != kick though)
yea i know
i want to stay away from the be bans as far as possible
and if true, kick
i want to be able to manage all that via webinterface later
also , use true instead of 1
well, i save it as 0 and 1 in the database
i want to stay away from the be bans as far as possible
Server admins cant do BE bans anyways afaik, if they can that sounds like a bug
this reminds me of a recent conversation 😄
euh, yes
yes, Lou
what i mean with be bans is, rcon bans
i just mean that if you get a return of "true/false"
you can use that variable in an if-check
i know
but this is for my eyes, to keep the code more clear
pick your poison 🤷♂️
some people say i m a madman
while Dedmen may disagree, I sometimes like to have a boolean == boolean. a list of booleans for example
but this keeps the code more, easily understandable on one glance, plus, i could later edit it, to other values aswell
by the way, if such comparison could be added to Arma… just sayin' 👀 😁
like, saying, you have ban 5, meaning, banned from x and y
it's just basic practise when you write script for arma:
(gif attached below)
https://66.media.tumblr.com/9d9ef0bbb895f0c6b4610db511b240af/tumblr_mkul4bkMua1qbz8aro6_250.gif
@winter rose isn't it in Enforce already?
true == 1; //true?
I meant more like false == true
but I don't know EnScript yet 🤷♂️
haha
well, a bit of the same - until I have an eventual alpha or beta to toy with, I am not yet going there
wait
ints and floats are separated

this could be it!
this one's going to be real hard to get used to foreach(auto k, auto a: mapa) // prints: 'mapa[jan] = 1', 'mapa[feb] = 2', 'mapa[mar] = 3' { Print("mapa[" + k + "] = " + a); }
foreach at the start
no no, I will deal with it all right 😄
yeah, but this is pretty much c# syntax
exactly
i could get used to this
Java is for (String stuff : stringArray)
how would i go about getting ai to leave a vehicle after being dropped off, then start a patrol whilst the vehicle drives away?
and JS, I don't remember exactly (there is a foreach but that creates a new scope so I avoid it - the other one)
I am aware of that but will the ai dismount the vehicle before they arrive and try to do there waypoints?
what is wrong here? if ( time < _timeCalcPos ) then { _timeCalcPos = time + 120; _c = count units _unit; _i = (units _unit) find _unit; _iDir == 0 then _dir = (_i*360/_c); _iDir != 0 then _dir = [(_iDir - 1)*45 - 60 + _i*120/_c]; _posMove = [(_pos select 0) + _dist*(sin _dir), (_pos select 1) + _dist*(cos _dir)]; waitUntil {sleep 5 ; scriptDone _handle}; };
it keep telling me missing ;
Array.forEach((item, index) => {});
what does it say?
_iDir == 0 then _dir = (_i*360/_c);
_iDir != 0 then _dir = [(_iDir - 1)*45 - 60 + _i*120/_c]```
this
unless im missing something
so the whole thing is wrong?
I said "the other one" @exotic flax 😄
is that meant to be an alternate syntax for if-statement?
syntax
if (_iDir == 0) then {_dir = (_i*360/_c)};```
it should order the AI to go to spec. direction
if im not entirely mistaken
ill try it out nica. thx 4 help
change the other one too
k
this one _iDir != 0 then _dir = [(_iDir - 1)*45 - 60 + _i*120/_c];
(and check that _c is not 0)
Lou, is there some hidden syntax?
can you make an if-statement without if?
also, if _dir is not privated in an outside scope, then it wont exist outside the if-statement
Any _local variables you declare within the body of an if/then statement (ie between the curly braces) are local to that 'if' statement, and are destroyed at the end of the statement. If you know you want to use the variable outside the 'if' statement, make sure your declare it before the 'if' statement.```
eventhandlers, do they have a(n) (notable) impact on client performance?
Lou, is there some hidden syntax?
can you make an if-statement withoutif?
wait, what?
_iDir != 0 then _dir = [(_iDir - 1)*45 - 60 + _i*120/_c];
this looks really wrong to me
an if-statement needs… an if
only the array select boolean can do otherwise
and then the missing curly brackets
thus the code is not actually being executed
well, it's being errored
yep - always code with show script errors
i paly with show script errors
so that i can complain to people about their mistakes
we don't even have ternary in SQF
// WRONG
_iDir != 0 then _dir = [(_iDir - 1)*45 - 60 + _i*120/_c];
// RIGHT
if (_iDir != 0 && _c != 0) then { _dir = (_iDir - 1)*45 - 60 + _i*120/_c; };
i play with show script errors
of course, who would remove that flag 😄
its an old crcti script from DVD (der verrückte Doktor) crcti. back in the day he made the best cti´s.
yea part is sqs
ah yes: sqs was
// sqs
? alive player : hint "alive"
? not alive player : hint "dead"
// sqf
if (alive player) then {
hint "alive";
} else {
hint "dead";
};
🤮
fixed* - it's even worse than what originally posted


? is if and : is then
no else 😄
Arma 1 iirc
to be honest, i like sqf for what cool stuff you can do, but what annoys me a lot, is the incompetence of the error reporter
and OFP
https://community.bistudio.com/wiki/SQS_syntax
prepare your radiotherapy
the error reporter is far better than many
TheRE iS a MisSInG ; sOmEWheRe
to be honest, i like sqf for what cool stuff you can do, but what annoys me a lot, is the incompetence of the error reporter
use arma debug engine to see local variables and call stack on script errors
VS c++ compiler errors are like hieroglyphs
while the problem was a missing "then"
@austere silo
AFAIR sqf got introduced in Arma 1, and if/else in OFP:R 1.85?
I may be wrong about SQF, I still wonder
well iam a really noob in scripting but DVD made it like this back in the day
A line beginning with a semicolon (;) is considered a comment and ignored by the game engine.
NOOOOOOOOO!
how did anyone use this ever?
lol
i have a hard time leaving the ; out when i write Python
now imagine using it for comments
@ebon citrus
; that is a comment, yep
? alive player : hint "harr harr!! you fell into my trap"
@ not alive player
~3
hint "you dead"
😅
Montana is the man
i allways comment with //
dang, I got SQS flashbacks
or /**/
#, /**/, ''', """, // and ///
SQS = one line = one statement
loops? HAHA
#loop1
hint "you are alive"
? alive player : goto "loop1"
hint "you are dead"
i can feel getting sqf flashbacks in the future
when everyone will be writing in Enscript
don't vomit on your keyboard plz
i dont know man, my vscode sqf extension says, this aint no comment
https://prnt.sc/t81t4p
back in my day, we had one scheduler, and we had to share that scheduler with all mod
@slender schooner in SQS, it is 😉
no semicolon either
nothing of value missed
so your parser may be scared 😄
if you live your entire life ignorant of sqs, you didnt miss anything
and, this with the goto reminds me a lot of batch
if/then/else introduced in OFP:R v1.85 had to be one-lined 🦇

…yyyep.
wait a second there buddy
so you basically had a whole function that was an if, and had to be in ONE SINGLE LINE?
imagine making nested if's
mind you, average resolution was 1024×768 back then
brb, gotto go buy some 24k wide monitors
making a simple nested if would be equal to the fellowship of the ring
@slender schooner
either one line or split in multiple sqs, or using goto
ouch....
Show some respect to your elders that had to make fancy missions back then!!1! 👴 😂 😅
imagine in the future, people will write code with 3d-ladder/blueprints style code in AR and we will be explaining them that back in our day, we wrote code in letters on a 2d monitor that couldn't display ALL THE CODE at once
oh, hi lmao. how may we help you today?
to be honest, coding will probably stay like this
its working!!! Thx a lot Nica and Montana
probably not
i mean, there is no more efficient way than writing it
it wont be gone
my brain is melting, idk why attachTo makes ai pretty much unusable 😦
well
but the current coding in the future is like punchcards are for us
the basically have an object attached to their body
what are you tryign to do LMAO?
how old are yall?
so they maybe see themselves trapped in an object?
old enough to have seen 911 on the telly
lol
i will NEVER provide such intimate information about myself
@unkempt sorrel what are you doing?
also COPS?

…harr harr
we wanted to objectify women, but there aren't any 😢
OOF
i know
it's a Greek island for a reason
i downloaded a women's mod, but isKindOf "Man" revealed the truth
lol
https://community.bistudio.com/wiki/getShotParents
nothing beats having write permission on the wiki and writing examples 😄
😆
lmao
as my question went under before If i use eventhandlers on players, does this have any real influence of the performance of said players?
depends mostly on what you set in the EH code
like, for example, the firednear eventhandler, does this affect them?
but the handler itself is no problem?
nope
i see
it's like...
you could add a 100, it shouldn't be a big deal
the problem is, i look at such things as while true loops
0.000000000000000000000000000000001% of the performance demand of the common l*fe script
accurate
i mean, its basically what it does, no?
yea, but how does it trigger?
it has to check constantly if something happened or not, no?
no matter if you define any EH's or not, the engine will go there
so adding one that is empty doesnt change anything
when the game iterates through its tasks, it will raise a flag on certain conditions
kind-of
it will do this no matter if there are EH's or not
no loopås needed 😉
i dont have the specifics
but having done software and recently game-development
i can say nobody would loop a check for these things
as the engine needs to handle the matter anyways
and if it does, it just raises a flag
what you need to know, is no
EH's dont matter
an -event- -handler-
is basically a subscription to an event. you say:
- hey engine: whenever someone "FiredMan", run this script
- ok buddy
so the game stops to execute the code before it moves on
bascially
if you need a return: call. otherwise: spawn
especially if the task is time intensive

all while-loops are simps

now, this begs the question
@winter rose are trigger activation fields a "waituntil" or a while?
or some other method
it's an if run every 0.5s iirc
so more triggers: more time spent evaluating
unscheduled too

unscheduled is tight
basically:
call: "when your mom calls you with your full name"
spawn: "when your mom goes out shopping and leaves a list of tasks on the table"
trigger: "when your dad keeps asking you to come and look at something"
@ebon citrus im attaching an ai to a plane, but the problem is he doesn't like to use his laser when attached, but with setPos it uses it, but is super unreliable
is this that UAV thing again?
yeah i eventually got it to work, hideobject works with the ir laser, only problem now is just transporting the ai
i believe the laser gets hidden at some distance
yeah but, its like 2km so its not that bad if i fly 1.5k
🤷♂️
nobody has tested
let Lou know about your experiments
if there is anything to update
or if you find a bug
yes sir :D
https://steamcommunity.com/sharedfiles/filedetails/?id=925018569 <<<<< (MOD LINK FOR WALKABLE SURFACES)
i think i found my answer
what?
Is anyone here good with relative positions?
kinda
this guy is:
https://community.bistudio.com/wiki/getRelPos
I'm trying to spawn objects relative to a house but inbetween getting the coordinates and spawning things in, things end up offset
it does all the complicated math for you
Specifically when the objects are rotated along the Y and Z axis
I don't think I can post pictures here
_theHouse modelToWorldWorld [-5, 1, 0.25]; // don't laugh at the name
Ok here's how it looks when grabbing the objects
that aswell
how are they grabbed, and how are they spawned?
_house worldToModel getPosATL _x;
[_x, _house] call BIS_fnc_vectorDirAndUpRelative;
This is how I get the relative position and dirAndUp
_obj setVectorDirAndUp [_house vectorModelToWorld _dir, _house vectorModelToWorld _up];
_absPos = _house modelToWorld _pos;
_objPos = (_absPos vectorDiff (_house vectorModelToWorld (_up vectorMultiply (vectorMagnitude (boundingCenter _obj)))));
_objPos set [2, _absPos#2];
_obj setPosATL _objPos;```
That's the code for placing the objects
_x is each object in the house
[_x, _house] call BIS_fnc_vectorDirAndUpRelative; this does nothing
_house worldToModel getPosATL _x; this does nothing
As for what I expect, I expect the second picture to look like the first, but it's offset
I just took that out of the larger script, it's what I use to get and save the position and rotation
when you take stuff out of script, you need to explain it
i would really appreciate to see the whole sequence
but i can see that you dont want to share that
Well I said that's how I get the position and rotation
I just write it down and paste it into another script for debugging, so the whole script isn't relevant
position: Array - world position, format PositionAGL or Position2D
If you want the whole source code, it can be found on https://github.com/Tinter/Tinter-Furniture
yeah, sec

i do not have the time nor the mental capacity to debug your entire srouce-code for you
sorry
I never asked you to
youre giving too little information for me to be of help
maybe Lou will be able to help you
I posted the information that I thought was relevant
for me atleast, you need to make it a little bit easier to digest
what i see is a lot of irrelevant code that does nothing and an issue that is not properly explained/the steps to reproduce
but that is just me
someone with more experience might be able to look at your code and know immediately
Anyone familiar with the current LFC script?
I keep getting undefined description error in _x in the one .sqf
@drifting copper ^
Yeah that one
i dont think one .sqf is included in that script
Anyone familiar with the current LFC script?
I keep getting undefined description error in _x in the one .sqf
@drifting copper
Sorry that is my bad in describing the issue. error is in feedInit.sqf
in case _x is an object, maybe
str _x
str _x
also, some people coming from other languages think format ["%1", _x] is the way to display strings
people just don't look at the stuff enough before starting to write code.
You see format MUCH less often than str, and they see format can turn stuff into string, so thats what they use
but dont know str
i mean str is pretty much a common method in most languages
or something similar
anyways, which line?
not possible
I also can not seem to get the eventHandler to view the screens. Such a nice script that I had in a mission before
can you show the error-message?
http://prntscr.com/t83wln sorry for the low res
how do i attatch an ir strobe to ai so i dont friendly fire them in the a-10?
i'm using ace but how would i make it so they have an attatched ir strobe?
Are you attaching in editor or Zeus?
editor
https://steamcommunity.com/workshop/filedetails/?id=623475643 use this. It adds additional CBA functions
i have that
I do not know what it means sadly
it means that base is not defined anywhere and therefore cannot be used
@drifting copper https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
it's a good read for people starting out with arma 3 sqf
How do i make it so when the AI is caught in an ambush they dismount and return fire
Because they just stay in the vehicles and dont get out
mods? @silver mauve
Anyone knows which eventHandler is fired when Zeus gets into a Unit via remote control?
tryed to find kexwords UAV, remote, control, curator ... not really anything matching ..
maybe mission handlers ...
"PlayerViewChanged"
thx
sorry, didn't help ¯_(ツ)_/¯
did not work. That weird because i thought Zeus remote control is also just an UAV of some form.
@delicate maple attach a user interface EH to display 312(curator display)
onLoad should suffice
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/ScriptedEventHandlers#Events
"curatorUnitAssigned" maybe
i dont think that works, lou
would have to test
but you can always attach an EH to the curator display and check when it loads
yep - I am not Zeus-experienced
and then do soemthing
me neither
i've many times had intentions of re-writing a zeus-module
like, the entire zeus-module
it has some flaws
I used this time to add another, smaller Table of Contents to https://community.bistudio.com/wiki/Arma_3:_Event_Handlers ^^
If anyone has some experience with relative positions and orientations, please contact me, because I think at this point my problem is with some technicality of vectorDirAndUp or positions above ground that I'm missing
meep meep
I think I have something ready for you
if I find it through my files, I get it here
the mini menu yes
it's new, i hate it
it takes me 0.01s longer to sort through the page
😠
yeah, sure
im going to download the entire biki
and make my own biki
been there, done that
@delicate maple when looking at ZEN (a well known Zeus mod) isn't there a EH or script which gets called when accessing a remote unit. However, they have their own EH's around Zeus and Remote units.
see https://forums.bohemia.net/forums/topic/229631-beta-arma-comref-offline-wiki/
and @exotic flax has something cooking, too 👀
still cleaning up the mess Lou made with the wiki exports :P
btw, what's the license for the biki content?
@ebon citrus https://community.bistudio.com/wiki/Meta:General_disclaimer 😉
as often as I want
which is, so far, not needed until next patch
@exotic flax don't be sore, it's ok, you will win the next one I promise 😛
the day I get bored of doing it, I'll give the source to other peeps - unless I abruptly die, we're safe 😉
this setObjectTexture [20, "vtx_UH60/Data/Exterior/Markings/Num_3_ca.paa"];
If I use the above should it handle the start of the filepath automatically or do I need to work out the start and enter it myself?
Answer= If there is no drive letter it starts in the mission folder.
describe your links
on that link, you would have gotten to a screenshot sharing page where my error message screenshot was hosted
object the warning?
on that link, you would have gotten to a screenshot sharing page where my error message screenshot was hosted
wasn't written down next to the link when you posted it.
7. When posting a link, please include a description/context to what is content,
place it within the appropriate channel else it might be deleted.
also wouldn't have changed anything on the crossposting.
Also this is #arma3_scripting, config errors are offtopic here, and if you just want to crosspost to here to complain that your code has config errors, that can also be classified as spam per #rules
so.. just don't do all that please.
is there a way to make cars glow like vr suits do? i have a race track made with VR blocks and i'd really like to keep up the tron aesthetic
make an .rvmat with the values you need and apply it with setObjectMaterial
the glowing would be a full layer thing though, more like vr entities rather than vr suits where only specific areas glow
anyone know how to play an animation like Acts_hubTalk_salute1
works with switchMove without a smooth transition obv but i was wondering how i'd go about making it a smooth transition between anims
playMoveNow
How do I check if a certain string is in an array
(“string” in _Array)
Is there a script to trigger a reload animation without the reload occuring?
if("Blah" in ["Blah","Bleeeh","Bl"]) then {
};
@copper needle
Much appreciated
i did it!
@winter rose i managed to do it
i took my car...
and i... and i drove circles around arma 3
i drove donuts on it's lawn
crashed right through it's window
i backed out of that stuff and drove away
and i claim no legal liability
but i can now reload a weapon ONLY from inventories of my choosing

is there a way to get a mod-prefix in script?
never mind
is there a script function to get all magazines that fit a weapon?
never mind, i made my own function with card-games and street performers
magazinewells
No. magazineWells is newer tech for magazine selection
ok...
but theyre all listed in "magazines"
or is this some legacy thing?
modders left these in because...
it was trouble to remove them?
magazinewells is a good idea
attached below is a video showcasing the script functionality:
https://streamable.com/0ooe77
no more reloading from backpack and those god-awful animations are back
have at ye arma
i'll also throw this video of summy funny RPG behaviour:
https://streamable.com/hv5bcv
this seems more akin to loading a recoilless musket than an rpg XD
modders left these in because...
backward compatibility @ebon citrus
so a mod referring to this would not break after magazine wells introduction
(and noice on the "don't reload from backpack" thing 👍)
about player:
a player's unit is always local to the (human) player's machine
a dedicated server doesn't have a player unit (isNull player returns true)
to know if a certain unit is a player, use isPlayer
Does this mean if I execute a command on the console using player but then press server exec, it will see player as null?
as objNull presumably
player simply returns objNull on a dedicated server as no "player" unit is selected there (unless someone toyed with selectPlayer server-side)
@slate cypress ^
if you want a current, local player reference to be used on the server, see remoteExec
[player, 0.5] remoteExec ["setDamage", 2];
What about global exec? I heard that it runs code on every client individually.
Does this mean player will be something different on every client or will it be the same as the person who ran the code?
https://community.bistudio.com/wiki/Multiplayer_Scripting#Locality is a decent read about the topic (although could get an update to make it easier to understand)
already working on trying to understand it myself and then writing it down to be used on the wiki
Thanks
but if I can make it clearer, yes, tell me
you are (only?) the second person to report an issue reading this specific part, so I suppose it can be better
IMHO the difference between local/global arguments and effects (and execution, like addCuratorAddons) is often not understood and could be explained better with some examples (like using remoteExec or using EH's similar to CBA using 'eventNamespace')
Especially because it also requires to know WHERE a script is executed (player, server, HC, etc.)
https://community.bistudio.com/wiki/Multiplayer_Scripting#Code_examples
examples are here?
wow... I've been on that page a thousands times... and never noticed it 
and I'm reading a lot of stuff on the wiki, compared to most people in this channel 😛
…I cannot argue with that 😄
will surfaceTexture be added to public release?
Hi, is there a quick way to add altitude to a ATL position ?
@bright stirrup Most likely yes
@compact maple getPosATL player vectorAdd [0,0,10]
Thank youuuuuuuu
I'm starting to be very sure that there is a bug with relative positions and orientations
relDirAndUp = ([axe_1, house1, false] call BIS_fnc_vectorDirAndUpRelative);
relPos = (house1 worldToModel getPosWorld axe_1);
axe_2 setVectorDirAndUp [(house2 vectorModelToWorld relDirAndUp#0), (house2 vectorModelToWorld relDirAndUp#1)];
axe_2 setPosWorld (house2 modelToWorld relPos);```
Given two houses, house1 and house2, of the same type and an object axe_1 that is rotated around the X and/or Y axis, an object of the same type, axe_2 will almost but not exactly get the same relative position to house2 as axe_1 has to house1
how do you set their pos btw?
I have a mission, but I can't upload it
the command used
I have placed it in eden
no, I mean, how do you spawn and place the new ones
They're both spawned in eden
And named
And the one named axe_1 is rotated
Here's a link to a mission with the objects and code for the bug to occur
Well I suppose the right thing to do is to submit a ticket to the feedback tracker
wait until you are really sure there is an issue with commands, and not simply a code error
What do you mean?
well, if you say "the command doesn't work as expected" and it comes from a user error, it doesn't help anyone
Well I've been sitting with this for a while and I don't see how this could be a user error
tbf.. I've also noticed some issues with PositionASL, where the results aren't always perfect...
I will concede that I don't know exactly where in that chain of commands that it goes wrong, I suppose I'll see if I can isolate it
as far as I can tell it's because it still takes in account the terrain (height, slope, etc.) when placing objects, especially when used in combination with commands which don't calculate in ASL specifically.
setPosASL is setPosASL, no matter the terrain
what the issue might be, though, is getPosATL in a house - the ground below may be wavy, we don't know
But I use neither of those commands, I use setPosWorld
And it is also relative to the house, so the ground shouldn't factor into it at all
but if the house is turned due to the terrain, the relative objects are also turned
or not... which will than cause issues
is there a script function to get all magazines that fit a weapon?
cba has one, I think cba_common_compatibleMagazines
@exotic flax The vectors for orientation are also turned relative to the house, so it shouldn't be the house rotation influence it in the wrong way
When using say3D and playing a sound file through the console in a dedicated server, is the standard file directory the location of the pbo?
So if I place a .wav file with the pbo, I can simply just use the name of the file rather than doing some kind of directory?
say3D requires the sound file to be configured in CfgSounds
and then you need to reference the classname instead of the filename anyway
@slate cypress playsound3d (amd maybe2d) is the only sound script that can use direct paths to file without cfgSound, btw
PLEASE DONT CHANGE THIS
My reload script relies on it

Nope, only playsound3d
Thank you @ebon citrus @exotic flax
But use playsound3d sparingly






