#arma3_scripting
1 messages ยท Page 597 of 1
there is a shutdown-command for rcon, if i recall correctly
if nothing essential needs to occur at shutdown, you could just aswell just terminate the task
Yeah but what can you do for countdown announcements and such?
rcon
and automatically terminating the task
that's down to the linux distro
I want it automatic tho
yes
make a script that does it automatically every 4 hours
take a pick
there are like more ways than grains of sand in sahara
right well
would probably need a linux script to auto restart every 4 hours
then a separate script on the arma server to do the announcement
or use rcon
like..battlewarden?
cause I also want an icon on the hud
rcon
that says how long until restart
I can do that part
ask there questions related to gui
my point is I need some kind of global var that updates every minute
that I can reference
Returns time elapsed since mission started (in seconds). The value is different on each client. If you need unified time, use serverTime.
alright so this must be in seconds
yes
and minutes by 60 to get hours
which distro of linux do you have?
Ubuntu
so
you have cron/crontab
just make a loop with a sleep..?
ok, pseudo-script:
-terminate process if exists
-start process
-schedule THIS task to rerun in 4 hours
so it probably needs to point to a .sh file
would be cool if I could just run a command
woo god it
do note, this is an arma 3 scripting channel. Not an ubuntu support-forum ๐
I want to save the player's team color so that they will have the same team color when respawning. I don't know much about scripting, how would I do this?
The colours via assignTeam correct?
Yes
https://community.bistudio.com/wiki/assignedTeam will get you the current team assigned
It says it works globally but doesn't in testing
so you can do use onPlayerkilled.sqf and onPlayerRespawn.sqf to get it, apply it to a variable via setVariable and getVariable and assign via https://community.bistudio.com/wiki/assignTeam
it will, the wiki doesn't usually lie ๐
Sometimes it does ๐

Wait hold up I might have gone full smoothbrain
At least on local it automatically saves color if you click save load out
Now i'm confused ๐ Where do loadouts come into this ๐
I have no idea, but it seems to save the team color with that box checked
The following might work...
//note: specific to each player - written off the top of my head
player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
_unit setVariable ["JIM_Team_colour", assignedTeam _unit];
}];
player addEventHandler ["Respawn", {
params ["_unit", "_corpse"];
_unit assignTeam (player getVariable "JIM_Team_colour");
}];
//I dunno if this would work either, depends if this info is kept after the player respawns...
player addEventHandler ["Respawn", {
params ["_unit", "_corpse"];
_unit assignTeam (assignedTeam _corpse);
}];
I think my condition is wrong there, but i'm sure someone will point it out ๐
No I'm saying it is literally built into the game already
I don't need to script anything
It does it for you automatically
I'm a dumbass lmao
Right now all my files in my script (like my .sqf + .hpp files) are in the main mission directory, as a way to stream things better how can I move this to like a /functions folder or something?
This is my initPlayerLocal.sqf atm:
params ["_unit"];
if (getPlayerUID _unit in ["76561198101943969"]) then {
_unit addAction ["Admin Menu", "openDialog.sqf"];
};```
_unit addAction ["Admin Menu", "myDirectory\openDialog.sqf"];
if you feel at ease, you can also take a look at CfgFunctions @silk carbon
Hi thanks for that, the issue I have is when I do that it refuses to open the actual GUI itself
then the issue is elsewhere
Do I need something in my description.ext to also point to the folder?
your script or description.ext may refer to some other files, their references should be updated accordingly
{
control = "combo";
property = "UniqueProperty";
displayName = "Custom Combo Attribute";
description = "This combo has three values.";
expression = "_this setVariable ['%s', _value];";
defaultValue = 0;
typeName = "NUMBER";
class Values
{
class None
{
name = "Value 0";
value = 0;
};
class Info {
name = "Value 1";
value = 1;
};
class Debug {
name = "Value 2";
value = 2;
};
};
};```
anyone knows what should I use in `expression =` if I want it to change textures?
not sure how it works exactly
in a bit of a predicament
so I have it setup in a cronjob on linux to restart the server every 4 hours, then a script on the server itself to do the announcements. If I wait until its auto restarted, the messages will be synced up with the restart, but if I put in a new mission file it wont be
not #arma3_scripting, more likely #server_admins @warm venture
Hi, how can I use the "Export Function" shown from this guide? https://community.bistudio.com/wiki/Arma_3_Respawn#Loadouts_and_Roles (BI Link for Loadouts and Roles, I'm trying to figure out how to get Revo's loadout retriever script to work)
- create unit with preferred loadout
- open console (ESC once)
- copy&paste script in console
- execute script
- ...
- Open any editor (Notepad will work)
- CTRL+V to paste whatever in on your clipboard (automatically added by script)
- profit ๐
Oh you're a saint thank you my friend!
Can I execute the script on Zeus as well? @exotic flax
As in: Execute the Script on a Unit while in the Zeus Interface with help of Achilles instead of using Eden?
Well, the script (by default) takes the loadout of the player (so you), but you should be able to change that to call it on any unit.
And you should be able to execute the code with Achilles/ZEN, although that wouldn't make a lot of sense since you'll need to make configs out of them anyway; so doing that in the editor is a lot easier, faster and safer
hey @nova zinc sorry for the ping
but I noticed that some rhs vehicles have exactly what I was looking for ( referencing this message https://discordapp.com/channels/105462288051380224/105462984087728128/724747007050121277)
noticed that in the expression you (or whoever configged the humvees) used rhs_fnc_hmmwv_setDecal do you happen to know where this function is located?
?
Trying to do one of these findIf. Not sure what I am doing wrong though. Trying to activate a trigger if any of the cargos are present.
[cargo1,cargo2,cargo3] findIf {_x in thisList} == 0;
fixed it... I'm a dumb dumb. make sure your activation is set to anybody
how would one lock a player in a vehicle? Removing the get out and eject options entirely for a scripted ride?
if (player in car) then {
car lock lockstate; // lockstate can be [0,1,2,3] where 0 - unlocked, 1 - default, 2 - locked, 3 - locked player
};
For future reference you can totally stack OR operators
(cargo1 in thisList) or (cargo2 in thisList) or (cargo3 in thisList)``` would be totally fine
Referencing an array is definitely smarter for longer lists though
its still not working how I'd like. it seems to only detect one of the cargo crates, the other two don't trigger it... I bet it is something simple I'm missing
Are you testing them one after the other in the same instance? If so, could it be that the trigger is not set to be repeatable?
If not, can you narrow down which crate is being detected?
yeah i was. but even before I triggered it, the first crate I moved it returned false, it wasn't till the second one was added that it threw true. let me test with repeatable
mk so even with repeatable on or off, cargo1 is the only one that is throwing true
And this is using the findIf code?
yes [cargo1,cargo2,cargo3] findIf {_x in thisList} == 0; and I'm evaluating it on debug as I move different crates in
cargo1 is the only one that throws true
[cargo1,cargo2,cargo3] findIf {_x in (list supplyEnd)} == 0; for debug
supplyEnd is the trigger
you're absolutely 100% sure that the other crates are named correctly as in the code? Not crate2 or cargo1_2 or anything?
For ease of testing I recommend setting the trigger to hint "DETECTED" or systemChat "DETECTED" on activation, so you can be sure there's no difference between trigger and debug detection
mk I'll try that
It's probably not the issue, the debug code looks fine, but it's a good testing principle and should save a little time
mk
yup still only cargo1 pops the trigger
let me try it with or operators and see if it works. if it does, there has to be a theory problem with FindIf I'm missing
found the theory problem. Took me a minute of staring at the documentation to spot it
findIf returns the index of the element it evaluated true for - that is, the position in the array. Only cargo1 is position 0 in the array, which is what you're actually checking for
Change == 0 to != -1
is there a known issue with setUnitLoadout resetting ammo-count in magazines?
oh yeah, i see it now
NOTE: Empty or used magazines in loadouts will be refilled under specific circumstance, even if the refill argument is false. This seems to happen if amount of used magazines is 2 or more.
for cockerel's sake
ok..., i get it
i'll make my own setUnitLoadout with cardgames and professional street artists
done
what is the actual problem with this game ๐
i've had the time of my life trying to do this
How can I add the action "hideBody" to a player in a way that it is only shown/available if that player looks at a corpse? (e.g. like rearm is only awailable when you look at a vehicle/corpse/ammo crate etc.)
maybe try player addaction ["Hide Body", {hideBody body1}];
where player is you, and body1 is the corpse name
@vague geode
He's asking for more generic way. I suppose:
_player addAction ["Hide body",{
hideBody cursorObject
},nil,1.5,true,true,"","cursorObject isKindOf 'Man' and !alive cursorObject"];```
@warm hedge Indeed, I am. Thanks, I'll test that.
@warm hedge Perfect. Thanks alot.
I suppose there isn't already a localized string for "bury" or something to that effect, is there?
there is a "hide body" in-game action already, no?
@winter rose Normally? No, at least not as far as I know.
not "by default", but some classes could do
it has to do with unit trait iirc
ah no, I was mistaken - it was doable in older titles, IDK how/if one can access it again
@winter rose As I said I have never encountered it and appart form UAVHacker I have played with all unit traits already, if I am not mistaken.
BTW how can I enable vehicle in vehicle transportation because for some reason I can not load anything into the Blackfish vehicle transport, not even a quad? Do I have to add the LoadVehicle, UnloadVehicle and UnloadAllVehicles actions manually?
the vehicle transport blackfish can without doing anything
That's what I thought but stragely I can not load any vehicles in there... I even tried multiple times on different days.
and without mods and only in Eden?
@winter rose Yes, I just tried it with the Xi'an and it worked just fine...
this is a little bit of code i wrote up, thing is, the addEventHandler is broken though... any thoughts?
@unkempt sorrel plz use ```sqf (see pinned message)
@winter rose Never mind. I just missed the sweet spot. ๐
heh ^_^
params["_unit"];
_unit addAction [format["<t color='%1'>Climb Ladder!</t>","#32CD32"], {
if (isNull cursorObject) exitWith {hint "No object found to climb.";};
_obj = cursorObject;
_ai = _this select 0;
_climb = _ai action ["ladderUp", _obj, 0, 0];
_group = group _ai;
_event = _ai addEventHandler ["AnimDone", {params ["_ai"]}];
_move = _group commandMove position _obj;
params["_obj", "_ai", "_climb", "_walk"];
if ((["ladder", toLower str _obj] call BIS_fnc_inString) || (["pier", toLower str _obj] call BIS_fnc_inString)) then {
_climb;
}}];
params["_ai", "_group", "_obj", "_unit", "_move"];
if (_ai addEventHandler ["AnimDone", {params ["_ai"]}] = true) then {_move};
@unkempt sorrel โ
thank you! i literally tried for 5 min and accidently did it once and couldn't figure it out lol
getting an error in one of A3 base-scripts: Image attached below:
https://imgur.com/g31C5qf
someone is calling that function with wrong parameters
usually it would give an error of wrong parameters
so the error is not handled in this script
it does give an error of wrong parameters
the "param" wants a string, but a array was passed as arguments to that function
i see
its reporting wrong parameter passed in _this to that function
but it's not reporting where that wrong parameter was passed
jup
it usually reports where the wrong parameter was passed
yes?
they don't know
ok
so the point now is to go through all of my code and see where the wrong argument is being passed?
follow the white rabbit the rpt
no, this is patrick
and the path ends there
what I mean is, you may have another, previous bad call that calls this function with these (wrong) parameters
but there is no way to backtrace it
ArmaDebugEngine would print you a full calltrace to RPT
how is that not vanilla already?
adding an event handler to an if and then hasn't been working for me, am i just dumb? lol
i dont think you can add event-handlers to operators ๐
makes sense man, im new to coding so, learning curve xd
scripting
whatever to call it
I'm trying to change an object texture (even in eden) according to a dropdown combo menu in its attributes
I know its not complete but am I doing this right?
private ["_logo"];
_box = _this select 0;
_logo = switch (_box setObjectTextureGlobal [0, " "]) do {
case 0: { logoA };
case 1: { logoB };
case 2: { logoC };
case 3: { logoD };
default { logoA };
}; ```
no
I tried ok? 
I take that logoA..D are for selections 0..3?
yeah
they're not the exact names but thats just so I know which logo goes where
private _textures = [logoA, logoB, logoC, logoD];
for "_i" from 0 to 3 do {
_box setObjectTextureGlobal [_i, _textures select _i];
};
i cant take this ๐
for instance, there is now over 300 lines of code to determine WHAT TO PICK UP

and we haven't even gotten to actually picking up anything yet
oh @winter rose I didn't mention that this is a function called from a dropdown combo control
class SZ_custom_logo
{
control = "combo";
property = "SZ_custom_logo";
displayName = "logo";
description = "This combo has three values.";
tooltip = "N/A";
expression = "_this setVariable ['%s', _value, true]; 0 = [_this] spawn SZ_fnc_changelogo;";
defaultValue = 0;
typeName = "NUMBER";
unique = 0;
condition = "1";```
in the rare chance its actually correct
will the lines you wrote work with it?
this is like a department store that sells only ducttape
@smoky verge why is it spawned?
wouldn't "call" suffice here?
I guess so?
for some awful reason I though spawn worked in eden too?
it seems to work for the mod I'm referencing from
spawn = Adds given set of compiled instructions to the scheduler. Exactly when the code will be executed is unknown, it depends on how busy is the engine and how filled up is the scheduler.
call = Adds given set of compiled instructions to the current stack and waits for it to finish and return, provides an option to pass arguments to the executed Code.
I guess both work
don't think engine would be too busy in eden
there is no other valid excuse to use spawn unless you need to run it in scheduled environment, as far as i know
it would work, but it's extra
"unnecessary"
yeah it looks less performant than call
and it's a-sync
anything you do inside the spawned script cannot be used in the script calling it
so if you change a picture and depend on that picture having been changed, then think twice
it's a bad habit to use the scheduler when not needed
get rid of it
โค๏ธ
yeah I did thanks
so how does Lou's script recognize that LogoB happens when the dropdown selection 2 is selected?
it doesn't?
I take that logoA..D are for selections 0..3?
I meant by that
logoA โ selection0
logoB โ selection1
logoC โ selection2
logoD โ selection3
he meant how will the script know which one is selected
easiest way is to use the index of the selection
this way Lou's script works easy peasy
_box = _this select 0;
_logo = switch (_box) do {
case 0: { logoA };
case 1: { logoB };
case 2: { logoC };
case 3: { logoD };
default { logoA };
};
_box setObjectTextureGlobal [0, _logo];
^^
params
assuming logoA/etc. are strings with paths to actual files
yeah
ok...
binoculars are an "ITEM"
but they dont show up in itemCargo
bug or intentional?
does someone have a script or an idea on how to make like a 3 meter teleport for ai towards the direction their facing?
getRealDir, getRelPos and setposATL should suffice
aren't they a weapon
nope
@unkempt sorrel following script teleports the player 3 meters to the direction they are looking at (2d):
_target = player;
_pos = (_target getRelPos [3, (_target getRelDir player)]);
_target setposATL [_pos select 0,_pos select 1,_pos select 2];```
just change _target to your AI
Haha! thanks man, i appreciate it, maybe my ladder script will work after all `:D
oh okay lol
i repurposed the script
thx โค๏ธ
there
you dont need to use getreldir
i just find it to be the most reliable
@winter rose BIS_fnc_itemType returns binoculars as "item"
image attached below:
https://imgur.com/rKhPcAo
HMD is an item too
and HMD is listed in itemCargo
but binoculars are NOT listed in itemCargo
BINOCULARS ARE LISTED UNDER ``weaponCargo`

im making a bug-report
player addWeapon "Binocular"
```looks like a discrepancy
this is just inconsistent
yep, but I doubt it will be fixed - it might break plenty of backward compat' ๐ฆ
done
probably just a config-change
and if anything relies on broken code, then the code is broken and needs to be fixed aswell, no?
ok, anyways, is there any way to pull from the config if an item is binoculars?
a config-entry that dictates the slot, perhaps?
because i need to make a case JUST for binoculars ๐
check "simulation type" ๐
i wish they would change HMD and binoculars config to "weapon"
wait
HMD and binoculars are under CfgWeapons
checking the ACE arsenal script... binocs have either simulation = "Binocular" or simulation = "Weapon" && type = 4096 in their configs
is there a way to set a timer or something before it runs a script?
triggers and just spawn-sleep combo
binocs and range finder or laser designator are returned by https://community.bistudio.com/wiki/binocular HMDs by https://community.bistudio.com/wiki/hmd
so could i set a trigger for an action command to do something else after it runs?
[] spawn {
sleep 10;
[] call yourScript;
};```
this runs "yourScript" after 10 seconds, give or take
trigger can be set to delay triggering after activation condition is true
yeah all i need is something simple like that, basically trying to get the ai to teleport at the top of a ladder onto the building so they dont break their legs `D:
use setVehiclePosition
why? is it more reliable for what im doing? ๐
it places object on surface
Killzone, HMD and binocular dont work on containers/vehicles
also, i need to get the item type in general
not just when it's in player slot
these items can also exist in inventory, such as backpacks
sorry for the intrusion but I've used @exotic flax's script
_box = _this select 0; _logo = switch (_box) do { case 0: { logoA }; case 1: { logoB }; case 2: { logoC }; case 3: { logoD }; default { logoA }; }; _box setObjectTextureGlobal [0, _logo];
of course with file paths to the paas instead of LOGOA,B, etc..
I can see the drop down menu in attributes
but the texture doesn't change neither in eden or ingame
@smoky verge use codeblocks
i was trying to point out they are classified as different inventory items @ebon citrus
@smoky verge what?
it doesnt change the fact that the binocular is classed as an "item", yet acts EXACTLY like a "Weapon"
@smoky verge #arma3_gui
it is special case afaik perhaps by design or by mistake however it is too late for that
it's a config change...
sorry @nova zinc I was trying to create an attribute to change an object texture in eden with a dropdown list
similar to the rhs vehicles
it's a config change...
its not
config changes could be very dangerous
ALOT of things depend on the binocs working the way they are
and you cannot possible even know all of them
it's not changing how they work
to make everyone's lives simpler?
you mean your life, doing this VERY specific thing that you're doing
yes it is
you mean the random/custom decal system ?
yeah
ok, anyways
@unique sundial is there a reasonable way to get the specific behaviour necessary to use with a specific item?
since BIS_fnc_itemType doesnt work
@nova zinc if I understood correctly they use a control combo tied to a custom function
is that right?
currently, what i must do is first determine if an item is in the CfgWeapons, then check whether it is a binocular simulation type to determine whether it goes to the toolbelt, binocular slot or nvg slot
you can define a specific decal if you need to
or just let one be assigned randomply
the entire decal system is in place for stuff like random text on abrams barrels, etc
I've also seen the option to completely change a vehicle texture
like from desert humvee to woodland humvee
@smoky verge https://community.bistudio.com/wiki/setObjectTexture
?
that's to change the vehicle texture
I know setObjectTexture
my problem is implementing it in the combo control
can you be more precise about what you want to achieve?
you can check inventory slot the item belongs from config
coz i can't figure it out
that's not reasonable
most functions and scripts used mod wide are in rhs_main
what do you want itemType to say
if an item acts like a weapon through and through, then why does itemType say "Item"
and why is it inconsistent with HMD?
HMD is listed in itemCargo
Binoculars are not
yet both of them are items
iโm asking you if there was a itemType command what should it return for various inventory items
be consistent
whatever it says, it needs to be consistent with the commands used to manipulate it
atm, there are 3 different behaviour for "Item"
one which acts like an item, One which is listed in ItemCargo, but acts like a weapon and one which acts like a weapon and is only named an item
classifications have no purpose if they are not consistent
It's not that complicated ๐คทโโ๏ธ
_item = "some_binoc_class";
_config = configFile >> "CfgWeapons" >> _item;
if (
toLower getText(_config >> "simulation") == "binocular"
|| getNumber(_config >> "type") == 4096
) then {
hint "these are binocs";
};
iโm sure all this info can be accessed from config but you are calling it inconvenient so what should such command return to make it convenient
we're talking about Arma... Consistency does not apply here ๐คฃ
if BIS_fnc_itemType returns just whatever then the whole command is without purpose
and tbh, it has been consistent up till this point
and i wonder why
why go through all this work to then mess it up with 2 items
bis_fnc_itemType is not a command but script function you can open it up and see what it does and why it returns inconsistent result
my guess it returns type for the use with arsenal
arsenal is not THE inventory
that is not true
the arsenal is a type of inventory
and the arsenal makes a distinction between HMD, Binocs and other tools. How?
arsenal is scripted armoury
edited happy?
I guess you donโt want to have a civil conversation, suit yourself
How does the arsenal make the distinction between HMD, Binocs etc.
and is this functionality exposed to sqf?
Same kinda discussions every day basically. Not worth pouring much time into
all functions are exposed in SQF... just the commands aren't :/
and is this functionality exposed to sqf?
arsenal is scripted armoury
it is scripted.. So.. do you think its exposed to script?
how to make the distinction between different tools. Binocs, HMD, GPS, etc.
bis_fnc_itemType is not a command but script function you can open it up and see what it does and why it returns inconsistent result
look it up.
its there.
I just don't understand the problem... it is the way it is, and there are solutions available either in the code (since it's SQF), or in mods (like ACE which does the same thing)
the problem is that i need to reliably and reproducibly produce the item-type based on its behaviour
did you see the script I posted? that is working 100%
in that case does ACE Arsenal not work ๐คทโโ๏ธ
time for Nca_fnc_itemType
it wont work in my use case, which is
to reliably and reproducibly produce the item-type based on its behaviour```
the answer seems to be "No"
so i'll just do it myself
something about sending a child to a task
how does arma AI know to differentiate an enemy from a friednly? especially if both look the same. anyone know a bit more about that?
side
no, i mean do they just magically know which side it belongs to after some time? or do they instantly know? etc
what affects that knowledge etc
I think at a certain range they have some doubts
but up close you could be their genetic clone with their same gear and they would still shoot at you
Hello all, I was looking around to see if it's possible to make patches which have dynamic text on them. For example I found this:
https://forums.bohemia.net/forums/topic/160703-attachto-object-to-backpack/
If there's anything similar out there that works (specifically on chest-rigs or uniforms), it'd be highly appreciated to get some examples that I can look at in terms of their code and texture setup
@winter rose I've tried the script you made and it didn't seem to help
the drop down menu works pretty fine but it doesn't actually change logos
without giving me any error in eden or packing
@mental wren you could use setObjectTexture on quite a few things including backpacks. The post you linked to is not a good solution
Hmhm, but then how would I be able to generate the text texture?
I basically want to use it for name tag patches which go on a velcro spot on most of our vests
so get player name -> generate the texture -> put onto vest
you canโt generate text, the only feature available is number plates for vehicles that can do that. you can have images that you can use as textures with writing on them
@exotic flax Hey sorry for pinging you again but I tried what you did (went in-game and executed the script as player via Debug Console) but when I tried CTRL+C, I got no result and nothing copied to clipboard.
Could you maybe help me again please?
[
["_object",player,[objNull]],
["_class","REPLACE",[""]],
["_displayName","REPLACE",[""]],
["_icon","\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",[""]],
["_role","Default",[""]],
["_conditionShow","true",[""]]
];
private _indent = " ";
private _class = format ["class %1",_class];
private _displayName = format ["displayName = ""%1"";",_displayName];
private _icon = format ["icon = ""%1"";",_icon];
private _role = format ["role = ""%1"";",_role];
private _conditionShow = format ["show = ""%1"";",_conditionShow];
private _uniformClass = format ["uniformClass = ""%1"";",uniform _object];
private _backpack = format ["backpack = ""%1"";",backpack _object];
private _export = _class + endl + "{" + endl + _indent + _displayName + endl + _indent + _icon + endl + _indent + _role + endl + _indent + _conditionShow + endl + _indent + _uniformClass + endl + _indent + _backpack + endl;
private _weapons = weapons _object;
private _primWeaponItems = primaryWeaponItems _object;
private _secWeaponItems = secondaryWeaponItems _object;
private _assignedItems = assigneditems _object;
// From BIS_fnc_exportLoadout START
private _fnc_addArray =
{
params ["_name","_array"];
_export = _export + format [_indent + "%1[] = {",_name];
{
if (_foreachindex > 0) then {_export = _export + ",";};
_export = _export + format ["""%1""",_x];
} foreach _array;
_export = _export + "};" + endl;
};
["weapons",_weapons + ["Throw","Put"]] call _fnc_addArray;
["magazines",magazines _object] call _fnc_addArray;
["items",items _object] call _fnc_addArray;
["linkedItems",[vest _object,headgear _object,goggles _object] + _assignedItems - _weapons + _primWeaponItems + _secWeaponItems] call _fnc_addArray;
// From BIS_fnc_exportLoadout END
_export = _export + "};" + endl + "// Visit https://community.bistudio.com/wiki/Arma_3_Respawn for detailed information";
copyToClipboard _export;
_export```
See the 2nd last line, it will automatically put the export to the clipboard (and the last line as output).
So either paste it directly to a file (without CTRL+C), or select the console output and CTRL+C that before pasting it in a file.
Well, I did that. I put the script above into Debug Console and did a Local Exec while playing as the unit with the loadout - it returned nothing.
am i reading this wrong or does this have a purpose:
[
["_object",player,[objNull]],
["_class","REPLACE",[""]],
["_displayName","REPLACE",[""]],
["_icon","\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",[""]],
["_role","Default",[""]],
["_conditionShow","true",[""]]
];```
The script is from https://community.bistudio.com/wiki/Arma_3_Respawn @ebon citrus
Ahhh... Make sure you remove the comments (parts with //) because the console doesn't like them
@ebon citrus that's on purpose
I'm sure he C&P-ed the correct code
@exotic flax I could kiss you right now, it finally put something out!
{
displayName = ""REPLACE"";
icon = ""\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"";
role = ""Default"";
show = ""true"";
uniformClass = ""U_O_R_Gorka_01_camo_F"";
backpack = ""B_ViperLightHarness_oli_F"";
weapons[] = {""arifle_AK12_lush_F"",""hgun_Rook40_F"",""Binocular"",""Throw"",""Put""};
magazines[] = {""16Rnd_9x21_Mag"",""16Rnd_9x21_Mag"",""SmokeShell"",""SmokeShell"",""SmokeShellGreen"",""SmokeShellBlue"",""HandGrenade"",""HandGrenade"",""Chemlight_green"",""Chemlight_green"",""Chemlight_blue"",""Chemlight_blue"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_Tracer_F""};
items[] = {""FirstAidKit"",""FirstAidKit"",""H_Booniehat_taiga""};
linkedItems[] = {""V_CarrierRigKBT_01_light_Olive_F"",""H_HelmetAggressor_cover_taiga_F"",""G_Tactical_Black"",""ItemMap"",""ItemCompass"",""ItemWatch"",""ItemRadio"",""ItemGPS"",""O_NVGoggles_grn_F"",""muzzle_snds_B_lush_F"",""acc_pointer_IR"",""optic_Arco_AK_lush_F"","""","""","""","""",""""};
};
// Visit https://community.bistudio.com/wiki/Arma_3_Respawn for detailed information"```
:D
OK now let's see if this loadout works with my description.ext...
Huh, still doesn't work... let me try this again.
Does anyone know how to change locality of an occupied vehicle from a client to a server? I know to use setGroupOwner (and setOwner), but no combination seems to work correctly. The most direct solution, setGroupOwner the crew, both crew and vehicle end up on the server - but the driver dismounts and has no gear. Doing a direct setOwner on the vehicle before or after the setGroupOwner doesn't change that.
if you C&P manually you'll need to replace the "" (double quotes) to " (single quote), otherwise it should work automatically
@hazy trail vehicle needs to be empty
Also sorry if that looks ugly, I don't know how to copy-paste code into Discord
pastebin and sqfbin are a thing you can use
Thats not the whole code is it? there isn't more than 20 lines there
or use:
```sqf
// your code
```
Let me try again, and paste the full description.ext
for long code, pastebin is prefered
Understood.
makes it easier to read and doesnt spam the chat
Yeah, completely understandable.
https://pastebin.com/zDTQeBtB - Link to my description.ext, Error in Line 23
error?
The Loadout still works perfectly fine and I can use it, but I'm confused what causes it
Yes, is there any way to copy the full error Arma 3 pastes on my screen?
"Error Type String, expected number"
so, im trying to figure out the createVehicle commmand, can someone explain it to me? i am trying to create a red chemlight so i can attach it to an AI
im struggling to figure out how to code it, yet i have seen examples.
did you also read the wiki: https://community.bistudio.com/wiki/createVehicle ?
yea.
its my first time dabbling with code really, what really ended up happening was me getting confused, (whats ah1w????)
i just need to know how to make a chemlight spawn, where to type the command, and how to attach the dang thing to an AI
...might be a bit much..
well... "just need to know" is not really how it works when learning how to program a (new) language ๐
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting is a decent read to learn the basics about the language (must-reads and useful links at the bottom are a part of it as well)
okay
I certainly remember that I could detect car horn with some Fired event handler... is it not the case any more? Or I might be wrong. ๐ค
What about this makes it only run once?
[] spawn {
waitUntil {inputAction "User20" > 0};
ThisCar say3D ["horn1", 300, 1];
};
I removed the horn from the car, and bound Custom 20 to Left Click so it's like using the horn. However, while it works, it only works once. Is it something I did?
it isnt a loop
What can I change to make it loop then? I'm not exactly a coding person, as much as I should be.
Honestly, I'm stitching together stuff I find on the wiki, so I don't even really know what some of this means.
here is one option. you may want to add an exit condition in place of true.
[] spawn {
while {true} do {
waitUntil {inputAction "User20" > 0};
ThisCar say3D ["horn1", 300, 1];
waitUntil {inputAction "User20" == 0};
};
};
Thank you kindly. I'll be just a second to try that.
another option that doesnt involve a loop is a key press event handler. This example uses key up, but im not sure if the input action is returned to 0 by the time keyup executes so keydown may be a better option as long as you prevent it spamming the sound.
(findDisplay 46) displayAddEventHandler ["KeyUp",{
if (inputAction "User20" > 0) then {
ThisCar say3D ["horn1", 300, 1];
};
false
}];
The second one doesn't seem to work, but the first one does. Sadly, it's
spamable, but it's not that bad I guess.
could add a sleep after the say3D line for the duration of the horn
Would that just look like:
[] spawn {
while {true} do {
waitUntil {inputAction "User20" > 0};
ThisCar say3D ["horn1", 300, 1];
sleep;
waitUntil {inputAction "User20" == 0};
};
};
?
sleep <seconds>;
Right.
Doesn't seem to work, or I did it wrong.
Alright, what I screwed up was putting it above the waitUntil. I moved it under it and it works fine. You're a broski, BTW.
@robust hollow Would it be possible to make it so only the driver can do this? I found something that I think does that, but I'm not certain.
(driver (vehicle player)) isEqualTo player
Would using this help me with that?
yes it would
Would the waitUntil be changed to:
waitUntil (driver (vehicle player)) isEqualTo player AND {inputAction "User20" > 0};
?
waitUntil {(driver (vehicle player)) isEqualTo player AND inputAction "User20" > 0};
I should include it in the curly braces? That must be where I went wrong.
you may also want to be checking if the unit is in a vehicle though. because they can be the driver of themself when they are on foot
All this is in the init of the vehicle, so that shouldn't be a problem, right?
no, the code doesnt execute "on the vehicle", it executes when the vehicle is created
so it would be almost the same as executing from the init.sqf for example
How would I check if they're in it too?
you could do waitUntil {driver ThisCar isequalto player && inputAction "User20" > 0};
I have it as
waitUntil {(driver ThisCar) isEqualTo player AND inputAction "User20" > 0};
and it seems to work fine. Thank you kindly, again.
I know this is something super simple and I'm just not seeing it. (even if it is "you can't")
I have a UserAction that needs to execute an animateSource and turretLock statements.
I thought I could do them both in like an array or something without having to make a new file and spawn it in
know how to do it?
@bold kiln you can separate two statements with ;
Hi all, maybe what I'm asking for is a bit complicated, but, is there any way to block to pick up clothes from a dead body when looting?
Only to take access to the backpack, vest and main inventory.
Something like the Tarkov looting system.
I hoped it was only about Warlordsโฆ
Ace cargo attaches cargo box to vehicle with negative vertical offset, so it is in fact under the terrain
Although it can be attached with positive offset too. But what if it flips over...
What's the best way to detect when player uses car horn? Fired and FiredMan event handlers don't work. Currently investigating solutions with detecting mouse button presses on display... ๐ฆ
"Fired" EH on the vehicle itself doesn't work?
"Fired" EH on the vehicle itself doesn't work?
No
Hello. How can I pass a param in addMissionEventHandler ?
Make it global is a common way
a = "blabla";
//Add a Draw3D EH on the player, start from the victim, to the shooter's position
private _id = addMissionEventHandler ["Draw3D", {
hint a;
}];
so this can work ?
Yes
Thank you
you can force one to a unit
in vanilla
@light badge yes there is
if you dont wish to re-write the whole inventory, then just add an EH on the uniform slot to detect when it's being dragged
or similar magic
I use the curator events to spot a Zeus placing a vehicle. I then want to initialize that vehicle, but I want to do with server code. I tried telling ARMA to setOwner the vehicle, which is quick, but the turrets only move over later, preventing me from changing them - unless I modify my code to remoteExec wherever the turret might be. I don't want to do that. As a workaround, I deleted the unit that the Zeus placed and had the server create a new one in its place.
The twist here is that ARMA will delete the old one and the new one if I create the new one too quickly.
I put in a sleep 0.1 to at least cause a round trip through the script scheduler, but if the server is loaded down, that short sleep isn't enough and the vehicle will again be deleted. Does anyone know what's happening here? Is there something that I can wait for to know when the coast is clear?
On a hunch, I put in a waitUntil { isNull _vehicle } before moving on to position the replacement at the exact same posASL, vectorDir and vectorUp. That seems to do the trick. No losses of replacement vehicles, even when the server is heavily loaded.
A different hunch, which I thought more reasonable, was that I was reusing a variable in the deletion process. So I deleteVehicle _vehicle, where _vehicle is not local, then immediately _vehicle = _replacement, then carry on using _vehicle. But avoiding an overwrite of _vehicle didn't affect the outcome at all; I always lost the replacement vehicle.
is there a way to force a unit to walk a certain direction for a few feet? my move commands dont work since the ai is on top of a building so it just paths off every time unless i doStop him
So I have the following:
https://pastebin.com/sk642aT2
It works for listen and SP. wondering if it would work on dedicated too when called into the init.sqf
is suicideBomber a variable name for a unit in the mission?
nope
https://community.bistudio.com/wiki/knowsAbout
Multiplayer: who must be local, while target can be remote.
allUnits returns all units, not just those which are local
allUnits is also wuite a hefty list to be iterating over in a while-loop-kinda
well, you have a sleep 1; there
i could change it to look at a unit's side.
just want to make it so my suicide bomber players can actually get in range to do something without getting gunned down
but get gunned down if they get too close so they would be suspicious
ok, make it captive
and if it gets too close, set captive to false
just check the distance between target and the player
i want it for any enemy unit. main idea is to commit war crimes but I don't want them running rampant through enemy bases. so thats why I felt I needed to do a full unit check for distance
oh is knowsAbout the only issue?
yeah, and the logic
the logic works
although not really delicate and efficient
but it does the joob
knowsAbout does not work in mp in this way
yeah I'm still learning to getting my coding more efficient
if you run this code on the server, then yeah, but then you cant use "player"
since all AI is local on the server
"maybe"
How can I set CfgWeapons "dispersion" variable to 0 for all weapons (even if changing weapons after mission initialization) in the Eden editor?
you cant change configs in-game
How can I disable bullet spread then?
if you want to change the config, then you need to write a config-replacement mod
will this work? https://i.imgur.com/NP0NZnD.png
@eternal ferry You can change the weapon sway and recoil effect on a player by player basis. If you turn them both off, you get very predictable rounds.
already in my init
this setCustomAimCoef 0;
this setUnitRecoilCoefficient 0;
this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}];
So you want lasers? ๐
In your Fired handler, set the bullet velocity to something very high.
You can alter the velocity any way you want. The projectile is yours to do with as you like.
It needs to be unmodified or the charts are meaningless
The starting premise was dropping the dispersion. Do that with your FiredMan event.
How may I ask?
You want to avoid rounds fanning out, right? So set their velocity (very carefully) such that they always follow the direction that th ebarrel is pointing.
The technique may be too crude for what you're after.
that's what im worried about
If you're trying to come up with tables, can't you statistically remove the dispersion?
its a random value
yeah
thats what i've been doing
but its still inaccurate and much more time consuming
This is not a player-accessible feature, right? This is just for your table building process?
it is a feature that uses a variable to randomize the spread, im trying to set it to 0 so I only need to shoot and record once
I'm referring to https://community.bistudio.com/wiki/Weapons_settings#CfgWeapons
Understood, but if you're the only one using it to record values, then you can put together a quick mod that sets the dispersion of all weapon types that you're using. Or wherever it can be injected into the config.
Then you do your recordings and you're done. Toss the mod.
that's what nica recommended but I've got no experience making mods.
I was asking if it can be modified with scripts
Take a look at "LAMBS Supression" mod. It's about as tiny as they come, and it only fiddles with a couple config entries. Right up your alley.
Yeah, I understand, but the most interesting config stuff just isn't accessible.
"This is a small mod which alters Arma AI Brain config settings to create an AI more susceptible to suppression and stress."
This is where I pointlessly observe that a mission should simply be a mod so that we get full access to everything. Unfortunately, description.ext gives us very limited access.
how does that mod have anything to do with what im talking about?
You can crack open that mod (it's a PBO, so you just unpack it and look it over) and use it as a template to set dispersions the way you want them.
But its for AI, wont it need significant changes to use it on a player unit?
It modifies a config entry. You don't care which entries he's modifying. You modify the entries that you want.
ah, i see
Remember that the config is just a big table of data. It's the dumping ground for all the static data that the programs, missions and mods draw on.
I wonder if I could just use the equations the internal mechanics use, omitting the dispersion of course. I could then autofill and calculate the values for any weapon.
You mean, duplicate the ballistics calculations?
They're undoubtedly highly protected
I doubt you could duplicate them.
Your best bet is to do that mod to get the dispersion to zero, then record what actually happens. When they change the engine (unlikely at this point, but possible), you'll be all set to record everything all over again.
I would think that a statistical solution would work best. Write scripts that will spawn up the units and weapons that you need, freeze them into a firing position, have them fire a crap ton of rounds, record them all and then save and process the data.
You shouldn't have to do much manually.
You could also ask on the forums if anyone has already set all this up. There are some folks who look very hard at ARMA's ballistics. Bohemia recently modified the sights on some weapons because they were off a fraction. Somebody picked up on that. Either experimentally or just by being very observant.
If I have an array of players and I am checking a variable on each of their objects for true/false would this be the best way?
waitUntil { { if !(_x getVariable ["readyStatus", false]) exitWith { false }; } forEach _list; true };```
no
because it would jsut always exit with the first run
youre always returning true
Shouldn't the exitWith cause the true to never be run?
ah
waitUntil { { private _return = true; if !(_x getVariable ["readyStatus", false]) exitWith { _return = false; }; } forEach _list; _return };```
nope
_return is out of scope
if you really want to do it this way:
waitUntil {
private _return = false;
{
if !(_x getVariable ["readyStatus", false]) exitWith { _return = true; };
} forEach _list;
_return
};```
so as soon as readyStatus of one unit is "false" the waituntil will exit
or if you want it the other way around
waitUntil {
private _return = false;
{
if (_x getVariable ["readyStatus", false]) exitWith { _return = true; };
} forEach _list;
_return
};```
oh i misplaced my return
this a little better? still striving for that dedicated server usage
yeah
that would make the unit not be shot at until they are closer than 20 to a blufor unit
you might also want to consider distance2d
that way units in towers would act the same way
"perimeter guards"
hmmm fair point
i guess the next question is will the unit be reset to captive if they respawn or do I need to write a new code in there to reset it?
better safe than sorry
Hi, I want to execute a function when a player disconnect from server. I tried to use addMissionEventHandler ["HandleDisconnect" ... ] but it seems that doesn't work properly (its never called), any idea? Thanks
server side or client side @short sparrow
Sever side, I realize that the problem was that I cannot use the command "execVM" inside the eventHanddler. I need to call a script from the event and this script may take a few seconds to finish (it writes to a database )
typeOf returns "" on some terrain objects although they clearly have class name, benches for instance. What should I do about it?
I need to get the class name of the object.
"Land_Bench_02_F"
But if I create it with createVehicle, typeOf returns proper class name
works for me
Where did you find this bench on the map?
how are you getting the object?
cursorObject
you said that it works for you, I thought you have found one on the map already
let me find it
i used one that i spawned in through the editor
ah ok, but that's the point, spawning it works well
fopund one
give me a second
Maybe what I am doing makes no sense, because the game couldn't have obviously been released for 7 years with this error?
what do you want?
I want to get class name of the object... because i have a list of objects I greatly care about, because I want my bots to sit on them ๐
So there is a match between class name and offset to place the bot
I can do it with model of course, I can still get model with getModelInfo
mmmh
๐ค but if it's indeed broken, I might have lots of problems in other places of my code. I initially thought that I get "" only for objects like trees. Didn't care much to check it.
mmmh
always test code
here's a picture of what i tried. The issue is with typeOf instead of the method of retrieving the object:
https://i.imgur.com/JsVZdUZ.jpg
Well no it's not such a big issue, I cared mostly about houses before, and they all have typeof ๐ค
I believe terrain objects are handled different from editor/script placed objects, since the model exists, but not the class reference.
mmmh
they might be baked into the terrain
houses are not since they need simulation
optimization measure?
houses are not since they need simulation
also electric poles because they need it too
yes seems to be the case
well, not all objects are available in 3den (scope stuff), so therefor can't be accessed from scripts, but can still exist when placed directly in the terrain
or just have the models "baked" in the terrain
garbage bin can be destroyed, but typeof is ""
I think it has same sim type as fence
no type == no config.cpp entry
You can still place it with createSimpleObject
how does it get to cfgVehicles without config.cpp entry?
?
๐ค
Well, the bench is clearly in cfgVehicles config class. You say that it doesn't have a config.cpp entry. How does it get there then?
Also I created the bench with createVehicle, not createSimpleObject.
Maybe you just didn't aim properly?
while{true}do
{
hintsilent str [getModelInfo cursorObject, typeOf cursorObject];
};
*edited
I checked with near objects command. The bench from map returned "" type, the bench I placed manually returned proper type.
exec this and check the hintbox
updated and shamelessly stolen the example from https://community.bistudio.com/wiki/cursorObject
Well it's not the case obviously... since I got the object list with near objects command.
Description:
Returns the config class name of given object or "" if object does not have a config class.
I can clearly see this class name in cfgVehicles in config viewer in game.
We are talking about "Land_Bench_02_F" .
Yes, you mentioned that before.
Some objects on the map don't have classes. I thought it was mainly things that land conform like walls but I guess benches as well? How I got around that was I got the modelInfo of the object, trimmed the .p3d off the end of the model name using BIS_fnc_trimString and added a "land_" prefix to it. Then I check if that isClass in cfgVehicles. I think most of the model names are the same as the classname minus the land_ prefix.
What returns getModelInfo cursorObject ?
It gives good model info, that's what I'm currently going to use as workaround
So the issue is?
The remaining issue is that it's not convenient at all and the wiki information doesn't make sense
Yes thanks @frail ledge , my case is easier, I am going to post-process the existing class name list I have and replace class names with model paths ๐
The wiki information makes perfect sense... It says Find objects (Units, Vehicles, Dead, Map Objects) in a sphere with given radius so things without a class in CfgVehicles are returned...
I meant that the wiki page for typeOf doesn't make sense. If it returns "" doesn't mean that there is no config entry.
It means anything and we don't know what exactly.
it means that the object isn't placed with a config entry
If the bench was placed as a map object it wouldn't have the land class...
but I agree that it's not very clear what the difference is
Ok, so bench I can place myself has only one thing in common with the object already on the map, and this common thing is model path. Then it makes sense.
Basically... normally, tbh, that only applies to trees, bushes and some small props... I guess benches - especially with a Land_ class I would have expected it to show in typeOf myself
If it aint Land_ you're generally on your own ๐
if placed outside game, you won't be able to work with it ๐
if placed outside game, you won't be able to work with it ๐
Either I really must go sleep now or you said something very strange ๐
Just don't expect typeOf to work with your cactus plant ๐
hint typeOf "Cactus";
// return: OUCH!
alright back to this boy now that I've done further debugging...https://pastebin.com/p2tBvz8M
when a player does not select the suicide bomber kit, it throws an error stating suicideBomber is undefined obviously. How could I go about doing a check at start efficiently to bypass all of the code if someone does not select that kit?
if !(isNull suicideBomber) then { ... };``` is what immediately springs to mind
hmmmmmm interesting. I'll have to add isNull to the thinktank up stairs. i'll try it out.
you have a foundational issue with your code
is it precedent that the user may switch to the "suicideBomber" mid mission?
or they may choose to not select it at all so object never spawns
is the object a player slot?
yup, just a unit that has playable check marked and the var suicideBomber. if AI is turned off, it will never be created
will you have to account for JIP?
unfortunately yes, because this playerbase loves to click continue and rush into the mission before everyone is ready.
or connected
ughhh, ok
make a public array
and add "suicide-bombers" to that array
through whatever means you prefer
then check if player is in said array
not exactly elegant
but it works
assuming you dont have to account for security all that much
nah its a pw protected server that is only used for ops
yeah, just do that
you can just have an action on an object that lets the players pick the suicide-bomber option
this action would add the players to the suicide bombers array
good to know but its only going to be a potential of one person selecting that suicide bomber slot
then switch the array for a variable
or keep it an array
i dont care
make a condition on the addaction which checks that the suicidebombers list is empty
that way, give or take(some lag) only one player can be a suicide-bomber
or idk
add it to the init of the object that it sets itself as the suicideBomber
and in init set some empty helipad as suicideBomber
so as soon as the player connects, the helipad is no longer the suicideBomber, but the player-objec
and then your condition fills
oh thats an interesting perspective... that just might work
also
make sure the script is only running on the server
stop adding pebbles on this house of cards, btw
lol i guess that happens when you are learning. its like I have an idea with a very small amount of knowledge on how to execute then I keep reading, add some, read some more change some etc etc etc. at least its a good learning experience
it's good
but dont expect it to work out well like that
at some point youre better off starting all over again
yeah I might have to... the idea I had is that I have a unit that has a bomber load out that is playable and I want him to be captive unless he enters the near range of an enemy unit. it seemed like a simple idea, but now that I'm running into things like JIP and servers and stuff its messing the original idea up
everything gets more complicated when you add in JIP and multiplayer
but it's very simple if you know what to do
your script is a good start
but you need to make a decission
do you want it to run server-side or client-side?
server-side would be better since as I get further into this stuff I bet its going to be more important since I'm making multiplayer scenarios
uhhh...
ok, well youre in luck
you know that init field?
in the editor
for units and objects
yuppers
ok
supposedly, it runs every time someone connects
for all objects
which have it, that is
ok, now name a dummy-object as "suicideBomber"
and then add to your unit's init field suicideBomber=this
supposedly, that should make it so that the init-field overrides the object-variable
maybe
and that's it
now just make sure that your script runs ONLY on the server
a simple isServer is good enough
i understand all of that and will try it, but its kind of like putting a Band-Aid on it don't ya think? it will get me through this one time, but I need to learn how to do this right in the future.
yes
but i cant help with that
if you cant ask the right questions, i cant help you
nor do I expect you too lol, you've been as helpful as you can
honestly, i haven't
i'm just tired
i've been trying my best to teach myself all night
your bandaid works perfectly btw
if (!isNil "suicideBomber" && {!isNull suicideBomber}) then {...} @fair drum
Is there any way to save data beyond mission/server restart? (E.g. player scores for a rank system. I don't have access to the server's startup parameters so just adding -ranking=<filename> is not possible)
if you know when restart is supposed to happen, you can save data to profileNamespace (and use saveProfileNamespace to save it to file) @vague geode
@winter rose The question is can I save it to a server file to avoid manipulation?
it would save it to server's profile
@winter rose So I just need to let the server execute the saveProfileNamespace command and it will autometically save the servers profileNamespace but how do I load it again?
profileNameSpace getvariable ...
as long as the setVariable/getVariable/saveProfileNamespace are executed on the server
What I mean to ask was whether the server autometically loads the saved data into its profileNamespace again on restart...
yes it automatically loads the selected profile's variables/values into profileNamespace when it starts up
same as how a client does
you just have to get them and re apply them manually obviously
e.g```sqf
private _health = damage player_1;
profileNamespace setVariable ["player1_health", _health];
saveProfileNamespace; // not to be used too frequently (file operation)
/// Server restart
private _player1Damage = profileNamespace getVariable ["player1_health", 0];
player_1 setDamage _player1Damage;
@winter rose So what you are saying it that it does autometically load the saved data into the server's profileNamespace again, right? So I can just profileNamespace setVariable ["var", value]; //server restarted// profileNamespace getVariable "var";?
Just want to pop in to say thanks to everyone thatโs helped me over the last few week with my (countless?) questions.
I put together a mission last night front to back with everything Iโve learned and it went really well
@vague geode yes, that is correct
as long as you do a saveProfileNamespace before the server restarts so it writes the variables to a file so it can load them when it starts back up
@vague geode yes. what @robust hollow said โ
gg @topaz fiber, never hesitate! ๐
I mean, itโs classic cheese, start at downed heli, destroy the AA to call in CAS
But the guys I play with are kinda new and easily pleased ๐คฃ
is there an alternative to knowsAbout? can't use it for my MP game cause of its locality
what do you want to do, what is the use case?
is there a way to put videos inside arma 3?
yes, .ogv files i think
({(_x knowsAbout unit > 1.4)} count allUnits == 0)
unit is a player controlled unit with a var. but as far as I know, I can't use it like this in a MP setting
I have another question: There is this "surrender" action where the unit puts its hands behind its back and is unable to do anything. 1. is it possible to allow it to move? 2. is there a way to check whether or not a player is currently surrendering to e.g. take him/her captive?
how would one go about doing that if you dont mind explaning it to me?@robust hollow
There's no walking surrendering animation in vanilla Arma
@stable juniper you convert your video to the ogv file type, put it in a pbo, then play it on a rscvideo ui control
@fair drum not like this no.
is it AI checking or only players knowsAbout?
you could do a server-side
[west, east, resistance] findIf { _x knowsAbout unit > 1.4 } == -1
AI is checking a player unit yes
then server-side for AI check
what is making this server side vs the original. I know yours does a lot less calculations that way and I need to start doing that
yours could work server-side too
AI groups are usually on the server (or headless client)
so doing a side-wide check does this
also [west, east, resistance] findIf { _x knowsAbout unit > 1.4 } may not be completely correct, his own side may of course know him
how do I go about throwing all units of a side into an array for a findIf command?
i'm just doing a [arrayofallsideunits] findIf {_x distance2d unit < value} == -1
private _westUnits = allUnits select { side _x == west };
ahhhh gotcha
private _result = allUnits findIf {
side group _x in [east, west]
&& { _x distance2D unit < value }
};
if (_result == -1) then {
// no enemies close to unit
};
```simplified
_geek waaar!_
2000 characters is the limit I think?
params["_unit"];
_unit addAction [format["<t color='%1'>Climb Ladder!</t>","#32CD32"],
{
// ensure cursor object is valid
if (isNull cursorObject) exitWith {hint "No object found to climb.";};
// initialize variables
_object = cursorObject;
_ai = _this select 0;
// check if cursor is on ladder or pier
if ((["ladder", toLower str _object] call BIS_fnc_inString) || (["pier", toLower str _object] call BIS_fnc_inString) || (["building", toLower str _object] call BIS_fnc_inString)) then
{
// make ai climb ladder
_ai action ["ladderUp", _object, 0, 0];
// add event trigger for ladder loop
_ai addEventHandler ["AnimStateChanged",
{
params["_unit", "_anim"];
if (["ladder", toLower str _anim] call BIS_fnc_inString) then
{
// add additional event trigger for finished ladder climb
_unit addEventHandler["AnimStateChanged",
{
params["_unit", "_anim"];
if (["dnon", toLower str _anim] call BIS_fnc_inString) then
{
hint "walking foward";
// walk forward
_pos = (_unit getRelPos [-2, (getDir _unit)]);
_unit setVehiclePosition [[_pos select 0,_pos select 1,(_pos select 2)+200], [], 0, "CAN_COLLIDE"];
doStop _unit;
_unit removeAllEventHandlers "AnimStateChanged";
}
}];
}
}];
};
}];```
i finally got that ladder script to work
just gotta work on descent now lol
BIS_fnc_inString is case insensitive by default so you could remove all those tolowers if you wanted.
For ACE3, any idea how to apply ace_medical_statemachine_fatalInjuriesPlayer - cardiac arrest only to specific units rather than blanket change it for everyone in the addon setting?
Tried _this setVariable ["ace_medical_statemachine_fatalInjuriesPlayer",1,true]; but to no avail.
@robust hollow i think my friend said that the toLower part doesn't make it case sensitive and compiles all that data from the string
the toLower part doesn't make it case sensitive
technically correct, though by defaultBIS_fnc_inStringdoes toLower for you, which is why you shouldnt need to do it yourself here.
also in some cases you shouldnt need str either. things like str _object is correct, turning the readable object return into a string for comparison, but others like str _anim is unnecessary as _anim is most likely already a string.
Not major issues, and hardly even minor issues. Just very very small things that can give you the slightest bit better performance ๐
@final marlin tried true instead of 1?
@robust hollow thanks man! ill take that into account, it's my very first script, and i only did it cause my ai could never climb a ladder lol
plus a lot of it was my friend so i never got the chance to really create a script from the ground up yet :D
Does any body know a script for Connecting or synchronizing the Camera Module to a Monitor so It live feeds I am quite new to the Scripting and want to look into it but I just couldn't find a script for it?
Not sure if the Camera Module is suited for that, although you can use camCreate to create a (virtual) camera and have the output rendered on an object (like a laptop or TV screen) with setObjectTexture
Could you give me the full script if its possible?
I have one available but is useless when not used in the same context as I do...
You'll be able to find several examples on the wiki, the forums and elsewhere on the internet.
do note that this Discord is for helping others, not writing/building stuff for free...
Okay, thanks anyways.
params["_v","_t","_tex"];
_n = (getArray (configfile >> "cfgVehicles" >> typeOf _v >> "hiddenSelections")) find _t;
_v setObjectTextureGlobal [_n, format['\mod\data\%1.paa',_tex] ];
can anyone help me understand what this exactly does?
I'm trying to repurpose it but whatever I do it doesn't seem to work
_v = object (like a vehicle)
_t = original texture path/name
_tex = custom texture name
yeah I imagined that part
this sqf is called from a function which is called from a config attribute
still not sure if it does what I expect
pretty sure it changes a texture but not sure according to what
and it will replace the original texture with the custom texture, based on the index of the found hiddenSelections
and where would this index be?
and how does it decide which texture to pick out of it?
if you remember this is about that dropdown menu I've been talking about lately
so if the object has:
hiddenSelections[] = {'textureA.paa', 'textureB.paa', 'textureC.paa'};
and you call:
[VehicleClass, 'textureB', 'myCustomTexture'] call MY_fnc_someFunction;
Than textureB will be replaced with myCustomTexture
oh this is interesting
from the caller it uses something similar to that 2nd line you used
expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
maybe I don't need to modify anything else and instead I need to fill the hiddenselection index wherever that is
ahhh... crap... hiddenSelections (used in the script) will take the name of the selection, instead of the texture itself, so 'camo1' is correct
as long as 'camo1' exists of course
camo1 exists but hiddenselectionsTextures[] = {""}; is empty
should I just dump all the paths of all the textures I'd want to use?
but by doing so how will I know which one I need to use
[_this,'camo1',_value] call SZ_fnc_changeFlag
This should work, since it will simply set the texture of 'camo1' to _value
or better said '\mod\data\value.paa'
so I have to somehow tie each of the values to a texture?
expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
defaultValue=0;
typeName="STRING";
class Values
{
class logoA {
name = "logoA";
value = "logoA";
};
class logoB {
name = "logoB";
value = "logoB";
};
class logoC {
name = "logoC";
value = "logoC";
};
could I just put the path in each value =
the value of those items is the name of the file, which must be in \mod\data\ (so change that in the function file to the correct location of your assets)
I somehow understand the sense
I'll make some tests
@exotic flax so the script seems to work fine but the textures don't show up
@short fossil
https://community.bistudio.com/wiki/Camera_Tutorial is a good place to start with cameras
it doesn't give me a texture not found error
nor pboproject gives me any error
in that case the paths to the textures are most likely incorrect
if they were incorrect pboproject wouldn't be able to pack
I know because they were before I tried again
but pboproject doesn't check if scripts are working correctly ๐
only hint I'm getting is a rvmat not found when I place the object for the first time
error that doesn't show up if I use the texture normally without this script
maybe the path in the function
not sure if I've done that part right
add the following line at the bottom of your function file:
systemChat format["_t: %1 - _n: %2, _tex: %3, _result: %4", _t, _n, _tex, format['\mod\data\%1.paa',_tex]]; // and set correct path in format as well
and check the results
_result should point to the correct file
where would it show up?
in chat
I guess I have to start the mission for that
you can replace systemChat with diag_log to dump it in the RPT instead
can I make the AI shut up while still allowing sideRadio to work?
(enableRadio shuts the AI up, but also the sideRadio command)
so the systemChat doesn't pop up so I must guess the function is not being played at all
@barren spire maybe https://community.bistudio.com/wiki/disableConversation ?
Don't know where you put that but chat doesn't exist in the first frame. You'll need to suspend or use hint
like a sleep 5; ?
That will do. Only 0.1 or so will do though
oh got it
Guys, is there a reason a script would work once then not? I have a kinda standard save loadout of death on player killed and then empty gear and load from saved loadout in playerrespawn. Works first time then second time I respawn I get the basic loadout of the unit. Not what I set in the editor
Or what I had when I died. ๐คท๐ผโโ๏ธ
maybe because you reference the unit object itself
when you respawn, you become another "object"
How did you do actually?
Hmm. Itโs from a script I see used in a lot of tutorials etc
player setVariable ["Saved_Loadout",getUnitLoadout player];
if it doesn't use event handlers, it is probably the issue yes
Where did you put it? An event script?
first onPlayerKilled.sqf
second onPlayerRespawn.sqf
@exotic flax the chat doesn't show up even with the sleep
I'm almost completely sure the function is not being called
and I'm not sure why
~~maybe I'll just have to use
expression = "[_this,'camo1',_value] call SZ_fnc_changeFlag"
instead of
expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
```~~
nevermind still doesnt
Hmm. Probably because I'm not really familiar with how those event scripts work, I don't see the issue (in my brain) right now...
ha, neither do i. Whats worse is i sware i copied them from another mission where it works
This is not something to solve the issue though those โremoveโ scripts in onPlayerRespawn.sqf are not necessary, since setUnitLoadout will replace everything in this context
i did think that, i was just trying to fix it, i started with just the setUnitLoadout
whats really meting my brain is that it works the first time i respawn and then not again
is respawning through the menu different to actualy being killed?
sometimes I see the game acts differently when you hit respawn in the menu and when you get killed by an enemy
could it be that?
lmao
Check the mission settings regarding respawns, since it might be possible that no scripts are called at all
expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
why wouldn't this work
if I read it correctly when the starting value is not logoA then the _value will be the one in the function, which takes the value from the bottom list
checks out
sorry @still forum
didn't want to clog the chat by reposting the whole thing
here is the control combo
class SZ_custom_flag
{
control = "combo";
property = "SZ_custom_flag";
displayName = "logo";
description = "This combo has 3 values.";
tooltip = "Choose the logo to use on the box";
expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
defaultValue=0;
typeName="STRING";
class Values
{
class logoA {
name = "logoA";
value = "logoA";
};
class logoB {
name = "logoB";
value = "logoB";
};
class logoC {
name = "logoC";
value = "logoC";
};
and this is the function that I'm 90% sure it doesn't call for some reason
params["_v","_t","_tex"];
_n = (getArray (configfile >> "cfgVehicles" >> typeOf _v >> "hiddenSelections")) find _t;
_v setObjectTextureGlobal [_n, format['\box\data\logo\%1.paa ',_tex] ];
sleep 2;
systemChat format["_t: %1 - _n: %2, _tex: %3, _result: %4", _t, _n, _tex, format['\box\data\logo\%1.paa',_tex]];
I'm 90% sure it doesn't call
add logging
thats what the bottom systemChat does thanks to Grezvany
but it doesn't show up
and there are no errors
so I'll just guess its not being called
oh forgot to specify
the second part is actually an sqf called by a function
can I not just call the sqf instead of the function?
maybe because you reference the unit object itself
when you respawn, you become another "object"
@winter rose could you explain this a little? Thanks
when you spawn, you are a unit (unitA)
you die, you transfer from unitA (corpse) to unitB (new unit)
values set with setVariable may not transfer
@still forum was trying to understand why it wasn't being called
I'm trying to simply call the sqf ingame from the console
@winter rose thatโs really interesting. Thanks.
I would prefer it to be โwill notโ instead of โmay notโ
May not adds too much confusion โบ๏ธ
I am not sure how it behaves actually :p
See https://community.bistudio.com/wiki/Event_Scripts#onPlayerRespawn.sqf
params [
"_newUnit",
"_oldUnit",
"_respawn",
"_respawnDelay"
];
so you could getVariable from old unit to save to new unit
So that explains why it works once? ๐ค
again, not really sure
what I would do is:
_newUnit setUnitLoadout getUnitLoadout _oldUnit;
```This would make the unit respawn with the loadout at the time of death (if that's what you want?)
Yeah. Just for the player to respawn with exactly the same as what they had when they died
that should do the trick
I was not sure if you wanted them to always respawn with the same loadout, defined at the beginning
@exotic flax ran the systemChat manually and the paths match
I don't understand what you mean by "call the sqf" 
I just executed the sqf from the console to see if the path used matches with the one that shows up
this stuff
systemChat format["_t: %1 - _n: %2, _tex: %3, _result: %4", _t, _n, _tex, format['\box\data\logo\%1.paa',_tex]];
so the clear problem is that the espression doesn't call the function for some reason
and I'm clueless on why
again, not really sure
what I would do is:
_newUnit setUnitLoadout getUnitLoadout _oldUnit; ```This would make the unit respawn with the loadout at the time of death (if that's what you want?)
@winter rose as simple as putting that in the onPlayerRespawn.sqf?
I can blame you for my ex leaving me๐ญ
perhaps, I travelled a lot
expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
if I understand correctly this line would need to be costantly active during eden wouldn't it?
because it will need to constantly check if _value is not logoA
maybe thats what I'm doing wrong?
but again
its a config so it shouldn't need anything to be activated
https://community.bohemia.net/wiki/Arma_3:_Event_Handlers:_Eden_Editor#AttributesChanged3DEN have a look at this, is this what you wanted?
Could put it on an event handler?
not sure it could help
how would it know I'm choosing which selection
this single line has been driving me insane for 3 days
I've seen this happen so I know its possible
just don't understand why it works for rhs and not for me
you didn't pay the SQF tax

I'm new to this conversation, is there a reason for checking if the value is not LogoA?
well if the value is not logoA(the default one) it means the user has selected another one
and will use the texture assigned to the new value
It will also be called if you had changed it to logo b and want to go back to logo a no?
I havent made it but judging by the fact the rhs one works I'd say yes
still can't get it to work tho
Short question, do I have the Mandela effect for thinking there is an sqf eventhandler for reload start and reload end for units? I was looking at the wiki and I swear that existed, or rather the reload start eh was introduced at some point.
Damn...
shortened to the possible causes and I think the problem is this part
if(_value != 'logoA')then
don't see anything wrong though
Arma can't play mp3's
any others?
I think it uses ogv
Might be a bit of a question but can someone possibly provide me with a script that can play a random ogv when player dies?
oh right
dang it
killed eventhandler
selectRandom
playSound
can't write full script now but these are the pieces
look them up in the biki to understand how to mix them
sure but i might be back in an hour
Any ideas how to set trigger's refresh interval to a different value if it's attached to an object?
is there a way to modify the positions of bones on an object via scripting?
damn, was hoping to make something more dynamic
if (alive player AND !(player getVariable ["ACE_isUnconscious", false])) then
{
_sounds = ["sound1","sound2","sound3"];
playSound (_sounds select ([0,(count _sounds)-1] call BIS_fnc_randomInt))
};
That Script good?
(_sounds select ([0,(count _sounds)-1] call BIS_fnc_randomInt))
