#arma3_scripting
1 messages ยท Page 644 of 1
What would the command for that be? at a glance I was thinking some combination of getPos and setPos - an offset
setPos
that sounds like alot more work compared to hiding and showing two objects
setPos is for setting object position in the worldspace
trust me, it's not a lot mroe work
it's a lot LESS work
as well as a lot less headache
I mean in my case I can have both my objects placed how I want in the editor and just hide one when the game starts and then show it again when the hold action is complete
[obj1,true] remoteExec ["hideObjectGlobal",2];
[obj2,false] remoteExec ["hideObjectGlobal",2];```
in your action
looks solid to me
unless the documentation for hideobjectglobal is literally incorrect this should work perfectly
the wiki is correct. that snippet will send the hideobjectglobal command to the server for execution.
cool
you will have to make your own logic to flip it, though
if you want to "close" the gate
i would still advice just moving the object
own logic ๐คท
[obj1,!isObjectHidden obj1] remoteExec ["hideObjectGlobal",2];
[obj2,!isObjectHidden obj2] remoteExec ["hideObjectGlobal",2];
not sure it really matters much either way
well, youre working with 2 objects isntead of one
youre also remote-execing
working with 2 objects instead of one will always be a lot more work for the user and the engine
imagine if you had to pay 100% extra for a carton of milk
what i would do is either just move or if i want to feel extra fancy, lerp the gate-object between the 2 positions
to be noted, lerp will always come with some performance overhead, but you wont ever even have this option if you work with just toggling 2 objects
as far as big deals go, this isnt one. "a lot more work" is relative to what the person already knows. in this case theyre more comfortable using 2 objects because thats what they know and understand. im not saying your method is wrong or worse or anything, just the end result isnt worth the effort for one small thing imo.
Is there any documentation or something I can read as a reference to predict/calculate an unguided bomb path/impact point?
you could look up "projectile motion with quadratic drag" on google.
for example:
https://www.atiner.gr/journals/sciences/2014-1-2-2-Chudinov.pdf
and check out this for drag values:
https://community.bistudio.com/wiki/CfgAmmo_Config_Reference
I'm not sure how accurate it'll be
Mmm thanks. I hope I can understand it
IIRC there was a discussion about exactly this on the forums a few years ago. I think someone was trying to create a ccip system. Don't remember how it worked out though.
https://forums.bohemia.net/forums/topic/204453-calculating-the-distance-a-bomb-would-travel/
I think this is the closest topic but not happening at all
Hey there, as I reached the limitation of my physic knowledge, I require some help from you :/ I currently work on some Commander that is capable to manage all given Units etc. So far, quite satisfying, but for more than a week now, I struggle with a problem. My current goal is to the last AI sup...
so far as i've come to understand, the best way to make sure a bomb guides in to a target is to guide the bomb in yourself... or rely on arma to do it. These systems are not interchangeable
from a handledamage EH i am getting some returned values for damage done to a particulare part of for example 9.93263e-006. Can someopne explain this value to me and how can i manipulate the value to return a true value that i can read, eg 0.0000456 for example
I don't understand. do you want to know what 9.93263e-006 means or you want to know where it comes from?
i wantr to be able to read the value in a more easily understood format, i know where it comes from i created the line to output it
ok,
you can try the toFixed command
/ah ok thx
@ebon citrus whats your steam workshop link? I want to see some of the stuff you do. Got any finished stuff on it?
ah gotcha even better with that command as can return it to a defined number of decimal points thx a lot
Is there elseif in sqf? or would I do else if?
I don't see elseif on the wiki so I'd assume else if but it doesn't seem to work
not in basegame no
what is an alternative?
ok thanks
or (DON'T HURT ME PLEASE) use a switch
I guess you mean this switch:
#define switch(x) private __switch__ = x; call
#define case(x) if (x == __switch__) exitWith
switch(_something) {
case(_case) {
};
};
๐
no worky, call called on nil no?
or call never executing
that call on swithc not
ah
see see
it call code, all good all good walk past
that's awfully wonderful, me likes ๐
yeah, I already use it! :D
too bad you can't have returns from it like a normal switch!
I mean I could rewrite it like #define switch(x,y) private __switch__ = x; y = call but that's weird!
you can do a do, while loop (do we evne have that? a bottom control while loop) and use breakWith?
we do?
I dunno, do we?
I think you're confusing that with sqc! ๐
@queen cargo will be so happy to see this! ๐
SQC:
do {
diag_log(position(player));
} while (BOOL);
do diag_log(position(player)); while (BOOL);
still, even if we did you couldn't do it without having something like: endswitch 
๐
we don't
unless you added it

I don't think it is possible
sqf works using operators
it doesn't have "operator lookahead"
do _code while _code
I don't see why thats a problem :U
not possible
cuz syntax
never seen that anywhere before
if then is also possible
tho
do unary + while binary
if then -> if
= do while possible
no, if then -> then
if creates a temporary, then executes
do, while
do creates a temporary, while executes
I mean if _codn -> IF + IF then, no?
I didn't say that I want to do anything :U
howdy doody lads, quick question regarding the string that parses the given text for BIS_fnc_establishingShot
How exactly, would one introduce a line break in it?
Previous ways of doing so don't work anymore, specifically for this one function, sinc 24/03/2014 when an update changed how establishingShot worked in order to make it more consistent to campaign formatting. But the issue with this is, it's seemingly broke the way one could introduce a linebreak. No more fancy <br/> or |. endl, linebreak, or any other manner of text/string ways of breaking text seperately from this string seem to work. ( defining the string earlier via _string = etc etc etc. Also tried forcing results from composeText into a string via str (compose text ["line 1" + lineBreak + "line2"]) ).
Most of the ways I've tried result in bad returns or just no line break and I'm nearin my wits end on this one. Would appreciate a bit of help with this.
try maybe \n
No can do
didnt work
lemme double check just to make sure, tested this about an hour ago then went out to grab some groceries
https://i.imgur.com/pGQ5rro.png still no worky
because you're doing it wrong
Lemme try that real quick
Still a no on that one chief.
Thanks for correcting me on that though, had a feeling I messed somethin up for the composeText bit somewhere
it should've worked,
you're doing something else wrong then
show me what line1 and line 2 are
I mean show me the whole script
_string = str (composeText [text "Operation: Consequences of Power", lineBreak, text "By: SkytechCEO"]);
[[21808.4,6142.45,0], _string, 300, 300, 45, 1, [], 0, true , 10] spawn BIS_fnc_establishingShot;```
Here ya go
This should ROUGHLY be accurate and how you do it Unless I'm being an idiot
no need for the texts either
and
where I have _string in the spawning of establishingShot
IT ONLY accepts a string
_string = composeText ["Operation: Consequences of Power", lineBreak, "By: SkytechCEO"]);
[[21808.4,6142.45,0], _string, 300, 300, 45, 1, [], 0, true , 10] spawn BIS_fnc_establishingShot;
no text at all
there fixed
when you use str it removes the lineBreak
hold on I figured out what you're doing wrong
yea I was about to say,
format ["Operation: Consequences of Power%1By: SkytechCEO", toString [10]]
this will work for you
or you could write it like:
_string = ["Operation: Consequences of Power", "By: SkytechCEO"] joinString toString [10]
Here's the issue.
still no work
I wish I thought about format before though
I'm kinda surprised I didn't.

was really hoping I was gonna be able to find a work around without facing that fact full on
hint format ["Operation: Consequences of Power%1By: SkytechCEO", toString [10]]
There's a work around for hints
Yeah :/
I know it USED to support some structured text commands
At least before that update to it
@gray hull this works
format ["Operation: Consequences of Power\nBy: SkytechCEO"]
Dunno. 2.00 or dev or no idea.. maybe not. probably not intentional if it ever worked before#
I can guarantee it doesn't work 2.00 since that's what I'm doing now.
I've also tested it ages back and it seemed to work, but uh. Since I don't exactly have a 2013 build of Arma lying around, can't exactly test it right now.
https://forums.bohemia.net/forums/topic/157261-text-formatting-within-bis_fnc_establishingshot/ Is a useful start for how it might've worked around then. (This was my first stop on the journey of figuring out why there was an issue with this)
ok, but what I told you should work (at least in the hint)
but if it doesn't I have no other clues
Yeah, that's my plan.
The issue is, this seems to be different from hint
still no work at all
belated response, but good idea @ripe sapphire thankyou
Hey quick question, if i run continuous conditions and corresponding tasks, is it better to use a loop e.g. while {true} or an fsm?
doesn't make much difference, but while (or waitUntil) is better
thanks ๐ wasnt sure for years and always wanted to know ^^
kk i guess the most impact is the frequency of checking the condition so it makes sense ๐
btw if you have too many conditions to check, don't create multiple "threads" (using multiple spawns or execVMs)
instead put them under 1 spawn to give way to other scripts in the scheduler!
but if you want different delays for each it won't work like that
okay thank you :))
[
UAV,
"Hack UAV",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"(_this distance _target < 10) && ([_this, 'B_UavTerminal'] call BIS_fnc_hasItem) && (rank _this != "PRIVATE")",
"(_caller distance _target < 10) && ([_caller, 'B_UavTerminal'] call BIS_fnc_hasItem) && (rank _caller != "PRIVATE")",
{},
{},
{
UAV engineOn true;
rec = [] spawn MypathA;
},
{},
[],
15,
0,
true,
false
] call BIS_fnc_holdActionAdd;
I've got that as a hold action on a unit but when the mission starts in mentions an error about a missing closing square bracket in the line
"(_this distance _target < 10) && ([_this, 'B_UavTerminal'] call BIS_fnc_hasItem) && (rank _this != "PRIVATE")",
syntax highlighting shows a quote issue ^
yes, the code highlight already tells you
"this string is "broken"."
also, you can use Code instead of String @cerulean cloak
I don't see it. Where is it?
" inside a "-defined string
(rank _this != "PRIVATE")",
use single quotes like others
Ah...
"PRIVATE" -> 'PRIVATE'
Thanks
those two arguments need to be string according to wiki
Picard facepalm seems appropriate
I was stuck with addAction ๐
fnc_code2string = {
private _str = _this;
_str select [1, count str - 2]
};
{ systemChat "this works like a charm"; } call fnc_code2string```
there ya go
the trigger object thisTrigger has no function to return thisList from it correct? I'm currently writing a script where it would be good to have both items available, the triggerObj and the thisList array. I could add the array as another requirement in params but I was hoping I could avoid that and access it via the triggerObj but I guess that's not possible?
or in other terms, not sure if there is a way to access thisList from outside the trigger to make use of it. In C# one would say a getter of the triggerObj to get that array
um, what?
first of all, there's list _trigger
second of all, I'm sure you're doing things wrong
so list _trigger will give me the same list as thisList ? Then that's all I was looking for.
Thanks
@hollow lantern https://community.bistudio.com/wiki/list
shouldn't it be private _str = str _this?
doesn't accept code
also:
count str - 2
๐
always gives you 2! (str -2 == "-2")
we know what he was going for ๐
yeah, I'm just messing around! ๐
hi guys, how do i make screen flash for a second for the player?
do i use ppeffectcreate? or is there another way
In what way flash?
context is player is taking a picture so screen flashes for a second
@ripe sapphire You should maybe careful there, as it may trigger someone vulnerable to epilleptic seizures, if you do include, would ensure to have warning text at the start of the media
personally dont think a flash is worth it tbh, just a snap sound would be enough
Dude its literally just one single flash not something crazy like 12 flashes in a row lol
Its not that easy to trigger photosensitive epilepsy anyways
@little raptor late response but I figured out a well, rather dirty and quick workaround for my issue earlier
I hard coded my lines into the function itself
@ripe sapphire create a dialog with a fade-parameter
that's the size of the entire screen
also, use fade to have a "flash". Dont use fade to "flicker"
even if your fade is quarter of a second, it still makes a big difference
Is there a way to exec a command on all units in a faction? I want to make a trigger which if triggered executes enableAI "PATH" on all Opfor units.
some combination of forEach and side?
If i sync every unit to the trigger does forEach syncedObjects this; work?
Error in expression, provided Code expected string, array
btw there is a new script command that turns code to string, without the outer {}
I don't know what its name was
2.02?
Hello so i have this script for deleting entity's when players are 1km away however it does not appear to be working. I am very new to all this so learning still thru trial and error and help is appreciated ๐
[{
params [
["_entities", [], [[]]],
["_playableUnits", playableUnits, [[]]]
];
private _entity = _entities deleteAt 0;
private _entity_obj = if (_entity isEqualType grpNull) then {
leader _entity
} else {
_entity
};
if (_playableUnits inAreaArray [getPosWorld _entity_obj, 1000, 1000] isEqualTo []) then {
_entity call CBA_fnc_deleteEntity;
} else {
_entities pushBack _entity;
};
if !(_entities isEqualTo []) exitWith {
_this call btc_fnc_deleteEntities;
};
}, _this, 1] call CBA_fnc_waitAndExecute;
what is btc_fnc_deleteEntities?
(it deletes bitcoins)
i mean if it's a recursive call back to this then it's your initial input, code looks ok to me(except it could be done better)
๐ค
Hi all im trying to add the drag body ability to my mp mission. Ive found the code online but ive no idea where to put it?
The codes:
null = allUnits execVM "H8_dragBody.sqf";
[uNIT1,UNIT2,UNIT3] spawn H8_addDrag;
Is that all the code you have or did you find some more? Because this is not going to work without the H8_dragBody.sqf and fn_addDrag.sqf files.
thats all i found atm
So you have no files named H8_dragBody.sqf and fn_addDrag.sqf?
maybe there is a readme with it?
Alright.
Step 1: Click Reveal hidden contents and copy the code it reveals.
Step 2: Create a file called H8_dragBody.sqf in your mission root folder.
Step 3: Paste the code from Step 1 into that file.
Step 4: According to the post, all you need to do to set it up is paste null = allUnits execVM "H8_dragBody.sqf; into a file called init.sqf (create it if you don't have it already).
[Unit1, Unit2, ...] spawn H8_addDrag; is, according to the post, used to add units that were spawned mid-mission to the system.
The post was last updated in 2014, so no guarantees.
ty ill give it a try
query on comref https://community.bistudio.com/wiki/resources
anyone have any examples of a resource for this
nope, but also teammember was never fully implemented afaik
I believe it's array of [string, string]
ah nope, mb
https://community.bistudio.com/wiki/addResources
[resource1, resource2, ...]
well yeah but cannot return any value from a default vanilla unit and no examples of addresources either
["Legs"]; is a resource
["potatoes"] might be too
according to
teamMember _agent deleteResources ["Legs"];
so we could remove thge arms legs and hands and rename the unit bob, put him in the middle of the sea and have some fun, is this where arma milsim has gotten these days ๐
team members are implemented, but they're a bit confusing.
afaik, currently they're used to "store" agents:
agents
to get the actual agent unit (object), you must use the agent command
and deleteTeam takes a teamMemberโฆ
I believe it was planned to be much more, but got abandoned in the middle
why is SQF such a pain...
Error parsenumber: Type Number, expected Bool,String
I might have a number which needs to be a number... breaks when it's a number...
i don't see anything wrong with it? ๐ it wouldn't make sense to make an overload for parseNumber which takes a number and returns the same number
How do i make a text appear on screen? caused by a trigger?
ty
is there a way to build variable names with arguments?
Like
prefix = "test";
hint damage (prefix + "_01");
so prefix_01 would be a variable of an object?
getVariable seems to be it yeah
and if the variable is an object in the mission file I'd use missionNamespace getVariable (prefix + suffix) for example?
had an aneurysm writing that lol
ye my god, the example is literally what I need
for "_i" from 0 to 5 do {
_car = missionNamespace getVariable ("car" + str _i);
_car setDamage 0;
};
thanks a bunch

Previous method did not appear to be waterproof after all, now I have [this] execVM "speedBoost.sqf"; in the init field of 2 units. This will give them a new action in the sqf file:
_speedBoost_action = _runner addAction["Stim Boost", "boost_activated = true", "", 1.5, false, true, "", ""]; where "_runner" is _this select 0
Now once again my problem is the fact that anyone with the execVM in their init is able to activate this action upon each other. What I want is that all those with the execVM can only use the addAction that has been placed on themselves.
put the execvm in initPlayerLocal.sqf instead
editor init fields execute for everyone, so everyone would see everyone else's action
Wouldn't it be heavier this way though, as the action is meant to only work for certain units
no, just add variable names to those certain units and a condition in the script to only execute if you are one of those units
If the execVM was in initPlayerLocal.sqf, I'd guess that there would need to be a parameter/condition within the addAction itself
no? something like this
params ["_player"];
if (str _player in ["u1","u2"]) then {[_player] execVM "speedBoost.sqf"};
action would only add to those two units, and you only need to edit one file if you want to change it, rather than on multiple units
I'll try that next, still pretty much an amateur in Arma scripting
Public Service Announcement:
The wiki is handling big changes about commands and functions categories - the changes are mostly about standardisation (e.g Scripting Commands Arma 3 โ Arma 3: Scripting Commands)
During this time, categories may (will) be incomplete (see for example:
https://community.bistudio.com/wiki?title=Category:Scripting_Commands_Arma_3&redirect=no
vs
https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands)
Don't worry, nothing is lost, the search bar still exists. If you end up on an almost empty category, click "what links here" (bottom left of the screen) and there will be a link to the "old" category.
If you find any other discrepancies, please let us know in #community_wiki. Thank you!
Hello everyone im a inexperienced mission maker for Arma 3. Looking to get some help. Currently making a SP mission in Eden, want a video I made to be played from the player immediatly after the mission starts. If possible the briefing would be even better to have the video. Any help would be wonderful. Thank you all.
Hello all,
I currently run a small but solid milsim unit and was in process of overhauling my training base again.
I want to have it so the basic's uniform and field kit is on a scroll wheel instead of having to go into the arsenal.
Any help would be much appreciated
Regards
Braid ๐ค
Have a look at:
https://community.bistudio.com/wiki/addAction
https://community.bistudio.com/wiki/setUnitLoadout
^ especially setUnitLoadout example 1
@tough abyss
, {hint "RED"}];
Just out of interest what am I looking at here?
player addAction ["<t color='#FF0000'>Phase 1 Uniform</t>", {hint "RED"}];
This is on the end of this
hint just shows a small hint in the top right corner
if you dont know a command you can just look up its wiki page
also with addAction have a look at example 5
Yeah seen, so if I write up something and test it. If it doesn't work would you mind taking a quick look at it?
You can just post it here
Yeah roger cheers ๐
mmh it could, but it'd propably be easier to just use a getUnitLoadout and setUnitLoadout combo
I'm just gonna test it before hand ๐
as in make an ai somewhere with simulation and damage disabled, and give that the loadout you want the people to have
call that ai something like _loadoutbase
true that works too
and load that with setUnitLoadout
I've just never done it before
_unit setUnitLoadout (configFile >> "EmptyLoadout");
I saw that but wouldn't know how to make a config ๐ฌ
Read before doubt, BIKI is always your friend ๐
๐ Yeah now looking through the forums I realise this lmao
Any ideas, I couldn't find the full example on the BIKI?
The examples are listed below ๐
you are missing a 'this' @tough abyss
also, shouldn't setUnitLoadout not be part of the add action?
ah also
use if (isLocal this) then { your code };
This is an init field which is executed globally and JIP
So ppl will repeatedly get these action added if a player joins
Yeah I got the 'this'
this addAction setUnitLoadout ??
Ah, sorry mate this is my first time looking into all this ๐
Everyone starts from nothing
Hey, new to scripting (the wiki has been a big help) but I'm looking to add a script for individual player respawn tickets. I am sure I read somewhere that it is possible.
you could've found that with a simple googling:
arma 3 add respawn tickets
Ok. I use that one for global tickets. How do I translate that to individual players so I can add to when a an objective is taken by that player. Simply reading the wiki is easy, but interpolation is not really my strength.
@Leopard20 no need to be rude
#makingyourselfpopular
No really trying to be popular just asking a question.
the answer to your question is on the page you were given a link to
hint: for the individual players, choose the appropriate respawn template
hint2 description.ext file is where it lives
Ah right got it now, missed it first time round. Thanks, appreciated :)
๐ welcome
reminder: all scripting commands are still accessible here: https://community.bistudio.com/wiki/Category:Scripting_Commands
It's not like the wiki has no search...
yeah well, people panic quickly when their bookmarks don't work ๐
let's not panick everyone! 
you could just add: this page is under maintenance at the top! ๐
nah ๐ I like mayhem ๐

who gave him his Nitro back?! ๐
hey guys what is up
how do you adjust volume of vanilla music that is played through playMusic?
ex.
playMusic "OM_Intro";
see fadeMusic on the wiki ๐
thanks lou! it wasnt mentioned in the playmusic wiki, so i was confused
is it possible to apply db + 10 on the volume of vanilla tracks?
nothing above user setting!
PS: fadeMusic link added.
thanks for the help!
IIRC you can do something like 0 fadeMusic 2 to make it louder.
At least it was working at some point.
My roof
Apologies for a mundane question, but if I want to trigger an event, such that, when player open a crate's inventory, it will be closed immediately, what trigger could I use for that ?
none, you use event handlers
though technically, https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#ContainerOpened
apologies, I should be specific that, in the case that I use containter opened, which piece of code could I use in order to trigger the inventory to be closed ?
as in, per my understanding, containeropened could be use to activate something, in the event that the container is opened
do you want to prevent container usage, or close the interface after some point?
my intention is to prevent container usage indeed
then use InventoryOpened, check that the _box corresponds to the wanted one, and return true
I will give it a go ! Many thanks for your advice !
if you just want to prevent usage, wouldnt disabling simulation on the crate be easier?
Indeed, however, my intention is to prevent usage in a certain condition and having it enabled in a certain condition
so my first thought was, having some kind of code to immediately close the container inventory in InventoryOpened condition when I want to prevent container usage
@tough abyss
then use InventoryOpened, check that the _box corresponds to the wanted one, and return true
player addEventHandler ["InventoryOpened", {
params ["_unit", "_container"];
_container == MY_container
}]
prevents opening the inventory on MY_container for player
please use syntax highlighting for your codes (see the pinned messages)
Apologies, I would be quite honest that I am abit new to the arma 3 scripting world, hence, my structure was something goes along of
If ( condition to prevent usage ) then
playerWeaponCase addEventHandler ["ContainerOpened",
{
Something
};
true;
]
no, that's wrong
Indeed, apologies, I accidentally pressed enter while trying to do ctrl enter ๐
the way event handlers work is that you add them, and when the engine detects the event, the code fires
now can you see what the problem would be if you did that?
by best guess the weapon case itself can not open the container, hence code will never be fired
also, containerOpened can't prevent opening the inventory
well no not that.
- you add the EH to a UNIT:
- as I said, the code fires when the inventory opens. this is the code:
params ["_unit", "_container"];
_container == playerWeaponCase
so I use it in the event handler like this:
player addEventHandler ["InventoryOpened", {
params ["_unit", "_container"];
_container == playerWeaponCase
}]
and this is what runs by the event handler when you open the inventory
If you're confused why there's no true at the end, remember that _container == playerWeaponCase is a "condition" (a boolean), and it returns true/false when it evaluates
ohhhhhhhh
hmmmm
Many thanks for your advice, I do admit that, I am still having a bit of a trouble understanding params at the moment
params is simple
when you have an array, params assigns the elements of the array to the variable names you provide:
for example:
[1, 2, 3] params ["_a", "_b", "_c"];
it creates the 3 "private" variables: _a, _b and _c
and _a is 1, _b is 2 and _c is 3
if you use params without any array before it (like that previous code), it takes _this as the array
so the previous code could also be written as:
_this params ["_unit", "_container"];
(_this is a "magic" variable created by the engine)
That indeed makes alot more sense.
I think I would need a few moment to absorb all of that, as I'm indeed practicing with arma 3 scripting only recently.
But thank you so so much @little raptor for taking your time explaining it to me ๐
np
@little raptor I'm so sorry for the inconvenience, indeed your code works as intended, However, I do admit that I still do not fully understands how this part:
_container == playerWeaponCase
managed to disable opening inventory.
Hence, in the case that I want to trigger opening the inventory again, what approach should I use ? And if possible, would you mind explaining the logic behind this
_container == playerWeaponCase
being able to disable the inventory ?
@tough abyss
well, the event handler says that I should return "true" at the end to disable the inventory right?
so that means if I use anything that gives me a "true", it works
you asked you wanted to disable the inventory for a certain box, so I use the == operator to compare _container and playerWeaponCase and see if the two match:
https://community.bistudio.com/wiki/a_%3D%3D_b
if you look at the command, it says it returns a "boolean". aka true/false
so the command checks the condition:
_container == playerWeaponCase
and
if they're the same -> returns true (inventory disables)
if not the same -> returns false (doesn't affect the inventory)
of course, you could've written it as:
if (_container == playerWeaponCase) then {
true
} else {
false
}
but that's redundant
because if you look at the if command:
https://community.bistudio.com/wiki/if
it also takes a boolean as the condition (if boolean then)
so you just give it a boolean to give you boolean! ๐ (a boolean can only have two values, so you can manipulate it without an if)
Ohhhhhhhh
now that makes alot of sense
Many thanks for your help ๐ I'll take abit to absorb it into my head ๐
ok! ๐
Currently making a SP mission in Eden, want a video I made to be played from the player or screen possibly immediatly once the mission starts as a sort of briefing. Any help would be wonderful. Thank you
from the player
how?! ๐
so you want it to be played from like a monitor object or on the user's screen?
Im inexperienced at coding arma 3... So i suppose a monitor object. Yknow how you can put a custom texture on those monitor objects? Would it be possible to play a video on those?
Apologies for asking again :/ But indeed, now that I understand the
_container == playerWeaponCase
is used to compare when those two are a match or not, and at true, inventory is dissabled.
However, the part that is still troubles me is that, which part in this:
player addEventHandler ["InventoryOpened", {
params ["_unit", "_container"];
_container == playerWeaponCase
}]
is the code that decides, at true, inventory is disabled ? Since param assigns variables to _this, but what in _this decides the inventory is dissabled ?
Maybe you know a few ways to play videos in arma 3 if so id love to know bc im really unaware
I think I confused you with that _this! ๐
_this is a magic variable
it's already available
params is simply assigning what _this (an array) contains to new variables
so it is defining _unit and _container for you
naturally you can name them whatever you want:
params ["_dude", "_box"];
because they're just variable names
if you're still too new to this, and you still don't understand, you can start from:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
@tough abyss
see
https://community.bistudio.com/wiki/setObjectTextureGlobal
(not 100% sure it works)
https://community.bistudio.com/wiki/BIS_fnc_playVideo
for playing videos fullscreen
In this case, if I understand correctly;
this:
player addEventHandler ["InventoryOpened", {
true;
}]
would also dissable the inventory ?
just as an example ofc !
ohhhhh
so right now, I am having the dissable code running in an if statement
when I switch the condition to else
the dissable code still functions
@little raptor should I put a code in the else statement to override this ?
player addEventHandler ["InventoryOpened", {
params ["_unit", "_container"];
_container == playerWeaponCase
}]
not sure what you mean
you can post the whole code
Right now, my structure is like this:
if (StoponKill == true) then
{
player addEventHandler ["InventoryOpened", {
params ["_unit", "_container"];
_container == playerWeaponCase
}];
}
else
{
Something other random code
}];
My Intention is, when the else condition is triggered, the inventory for playerWeaponCase is openable again.
@little raptor well ok ill take a look. Thank you
Hmmm ok so... I take my mp4 (will probs have to convert to ogv but no biggie. And i basically use this cmd in the init for the mission?
The function is called or spawned again with another video, for example "\a3\missions_f_exp\video\exp_m04_v02.ogv"["\a3\missions_f_exp\video\exp_m04_v02.ogv"] call BIS_fnc_playVideo;
@tough abyss
there's also this you could look at:
https://www.armaholic.com/page.php?id=29895
no not init
maybe initPlayerLocal or something
it depends on what you need
this is completely wrong
for one thing, it will throw an error
Oh wow wonderful find Leopard. That's for sure what im looking for. With that Armaholic Mod I can just upload my briefing video on yt and then i can cast it basiclaly to a screen.
Thanks so much
Yea i can easily follow these directions. Nice
@tough abyss first you should understand the variable types:
https://community.bistudio.com/wiki/Data_Types
especially read arrays, code
because I'm sure you don't know what [ ] and { } are
Many thanks ! In that case, I'll take more time researching into it
@tough abyss please report back if you get that working, I never could
err... no? it uses video files located in your mission/mod with BIS_fnc_playVideo, but with a splash screen style of the platform you choose. nothing to do with streaming from websites to in game (which wouldnt be possible without an extension, if at all).
either 2n*2n or 2n*1n (so 512px by 512px, or 1024px by 512px)
which is required for in-game textures anyway
check an existing texture
You can check the source files
getObjectTextures _infostand, follow the file path in the arma files and open the image
although just checked it for you and it's square (default is 256x256)
is there a way to respawn vehicls with AI crew and init? i am wanting to use AI as CAS and im needing to simply spawn them and have them re spawn with a certain init field applied
@lean anchor try https://community.bistudio.com/wiki/BIS_fnc_spawnVehicle or createVehicle and https://community.bistudio.com/wiki/createVehicleCrew
not sure on respawn besides scripting it completely though
the Vehicle Respawn module has an Expression field which I believe can be used to target the respawned vehicle for code
you should also be able to use the Respawn event handler (note: you will need to re-add the EH as part of the code executed by the EH)
does onEachFrame have a big performance effect?
depends what you do in it
eg:
onEachFrame {} unnoticeable
onEachFrame {allMissionObjects ""} very noticeable
makes sense
Are some ofp commands the same with todays arma?
Most of
Hi
Does a disabled simulation object has significantly bigger performance impact compared to simple objects?
Damn you beat me to it
Basically Simple Objects have better performance, according to the pic
Thank you
Thank you also for the tldr xd
are displayEventHandlers persistent after the display is closed, or do you have to add them each time the display is opened ?
Another question does having a lot of game logics bad for performance?
add them each time it opens. same for controls on a display.
how many is a lot, @ripe sapphire ?
I've got between 60 and 100 depending on which map, i store data on them
On mine 10 maybe lol
But this wiki https://community.bistudio.com/wiki/BIS_fnc_ambientAnim
Last comment says be careful when using it in MP, as it creates game logics
So i was wondering why
following advice is accepted at own risk
I wouldnt worry about it too much
unless you're making hundreds
yes, you need to use createunit, which is sent across the network, so making lots of them during runtime, at the same time, will generate a lot of traffic
there's no createunitlocal.. I make mine before the mission is proper running, are you able to do that?
I see, so its just a matter of high network traffic and not about the framerate right
Yes, my gamelogics are all eden placed, i use them just for getposโs, tho i use a lot of them for a lot of things so i asked if that would be a problem to performance
yeah, moslty... lots of traffic will cause stutters, but tbh, they come with the territory in this game if you're spawning stuff during runtim
oh, they are edenplaced? well that's ok then
they are generated outside of runtime
Nice thank you
Another question, is it possible to disable eden placed modules, and activate them after a trigger?
I want to activate a tracers module after a trigger
Tried doing enablesimulation false and then set to true but that doesnt seem to work (tracers wont fire at all)
Have you tried syncing the trigger and the module?
afaik no
a module is a function, and it executes when the module initializes
enabling it doesn't mean the function will execute
I see
cant you just sync the trigger to the module? or does that not work for tracers?
How do i find out what functions the module calls?
check the source code
function
open the module in config viewer and find its function
but you're better off creating the module manually with createVehicle
if what ansin11 and Pi123263 said doesn't work
Yeah i havent tried this
I'm not a mission maker so I have no idea what they're talking about! ๐
Wait you can create modules with createvehicle???
๐ฎ
I think iโll just go with that, as i can just do that in an sqf instead of making triggers again
does it? I create those after mission start without a problem ๐คทโโ๏ธ
iirc yes.
or maybe it was the high command module?
or maybe both?
I don't remember which one it was
So i find the module classname in config editor and then createvehicle it right?
How do i adjust the module parameters in this way?
setVariable
because even I get confused by all the information posted in this channel ๐คฃ
@ripe sapphire yeah I was right.
use the alternative syntax of createUnit
guys.. is there a way of getting a linefeed into a setMarkerText?
i've tried formatting a /n and a \n
i can never remeber wich it is
can markers even me multiline? cant remember if I've ever seen one
i never have
*be
Is there any way to get any information about the "spotted enemy"-markers on the map (e.g. vehicle type, position etc.)?
Never mind, found it.
That's the whole point of modules - do be used in the editor. The Create Task / Set Task State modules for example, what would be the point of making them if you can't easily set them up in the editor? At least those two work with triggers and I'm sure most or at least many others do too.
I dont think I've had a module that didnt work with triggers? I havent used them all with triggers yet though
I know, but i dont like using many triggers
Triggers are loops that check for a condition
(Some of) the ORBAT modules might not play with triggers, dunno.
So they will affect performance
Which module are you trying to use?
.
@oblique arrow
@ripe sapphire 
Tracers module
https://community.bistudio.com/wiki/BIS_fnc_moduleTracers
That's the function used by the module, so you might be able to just use that function directly (with a (dummy) object) via script instead of having to spawn the module.
yes, thank you
so I have this
but for some reason, it will place me in a parachute and all AIs running it on a listen server, but any other player, it will not place the player in a parachute and they fall to their death. I don't think i have any locality issues on this one, could I get a check?
Is it possible that contrary to the Community Wiki createMarker does only accept two elements because I tried to use all four in multiplayer but it said it only expects two.
I thought we had version 2.01.146752 already but I just checked and it's only 2.00.146773 so that explains it.
.01 is dev branch @vague geode
stable = straight, dev branch = not straight
.00/.02 = stable
Is there a way to get the position of a unit in a players group from the unit itself (whether the unit is number 1 or number 4)?
this is the classic method:
params ["_unit"];
_varName = vehicleVarName _unit;
_unit setVehicleVarName "";
_str = str _unit;
_unit setVehicleVarName _varName;
parseNumber (_str select [(_str find ":") + 1]);
but it might also be possible to use (units _unit find _unit)+1
I've never tried it so I don't know
Ok, thanks.
Hi everybody.
I created a mod who have most animation.
On my config.cpp I have an init who execute my : trico.sqf
my trico.sqf change the animation of the object like this :
_feu animate ["red",1,true];
sleep 30;
ect ...
My animation will be remoteExec the same time on everyClient ?
@stable badger
https://community.bistudio.com/wiki/Initialization_Order
Object Init Event Handlers are calledFor:AllEnv:Unscheduled
it executes for everyone when you create the object
but the code will be unscheduled
sleep 30;
thus your code must be spawned
my code is execVM from the object ๐
if the code is long, it's better to convert it to a function
for speed
no just a while trop like that :
_feu = _this select 0;
while {true} do
{
_feu animate ["bas",0,true];
sleep 25;
_feu animate ["bas",1,true];
_feu animate ["mid",0,true];
sleep 5;
_feu animate ["mid",1,true];
_feu animate ["haut",0,true];
sleep 30;
_feu animate ["haut",1,true];
};
change the condition to while {alive _feu}
the command has global effect
so it must only be executed on the server
so at the top, put this:
if !isServer exitWith {};
So if i'm on editor i can't see the animation ?
I mean it is executing for everyone.
but the command has Global effect
so you're executing duplicate commands
in other words, you're wasting the network bandwidth
and slowing down the game
when a command has global effect, only one computer must execute it
do Land_Runway_PAPI have a specific need for code to work or how does the engine handles them? I have created them on Malden on the Pegasus Island but they don't seem to work on the Airfield no matter what.
Did a createVehicle first, then switched to a 3DEN collection for easier use in the editor and placed them via 3DEN then. Still no luck.
The official placed PAPI of the big runway on Malden is 143m away from the threshold, despite DTA stating a requirement of 1000ft (304m) but neither of those distances work to get it to life.
It either always shows a red-on-red or white-on-white light. No matter what, the red-on-white never occurs.
any way to get the muzzle name of a modded vehicle without directly asking the makers?
trying to follow a scripted bombing tutorial but I need the muzzle name for the RHS Mig-29's bombs
try sitting in the vehicle, select the bombs and use currentMuzzle player in debug ๐คท
Thanks, will try
Is there anyone that is good with EOS system I added a custom faction and the units spawn but the tanks have an issue they will shoot at me but wonโt move around. I have files and the error log to show but is a lot of info to post was wondering if I may DM anyone with info to assist.
I spent over 10 hours now fixing the errors but canโt get the tanks to work
you can post logs on pastebin or some other text host
Oh okay I should have thought of that Iโll do that and post again soon thank you Lou
hi whats the best way to get the exact range between a player and a missile hit ?
I tried something like this, but it dose not work only returning 1000000000m
AM_debug = 0;
player addEventHandler ["Fired",{
_projectile = _this select 6;
systemchat str _projectile;
AM_debug = 0;
_track = [_projectile] spawn {
params ["_projectile"];
while {_projectile distance player > AM_debug} do {
AM_debug = _projectile distance player;
sleep 3;
};
copyToClipboard str (AM_debug toFixed 10);
systemchat str format ["Range: %1 m!", AM_debug toFixed 10];
true
}
}];
Because the projectile dies
And gets sent to Brazil
You need to get the position where the missile hits by recording where it was at when it was last alive
can you maybe provide me an example i cant get it to work
Does anyone have an easy way to detect if a grenade has been thrown into a trigger area, not IN a area but into.
I want to trigger when a player throws a RHS incendiary grenade into an area.
I found this post https://forums.bohemia.net/forums/topic/223546-detect-grenades-with-trigger/?do=findComment&comment=3360960 but had no joy
Basically I've put down some weed plants and when the player drops an incendiary grenade in that area I was going to trigger some smoke and fire modules and then after a few seconds setdamage 1 the plants
Well, you could try to use the "FiredNear" Event Handler to check if someone threw a grenade in a certain area.
Although the script (by pierremgi) in that forum post is doing exactly what you want; it will check if a grenade is inside the area and you could even check if it's on the ground and not moving.
I tried that script but as soon as the mission starts the trigger shows as activated
I assume because it's set to true
no
I'm not at the luxury of milling around arma today. Sorry
but you can make a while-loop which checks the missiles "alive" state
and if it's alive, records the last known position
simply getpos
once the loop is exited, the missile is no longer alive and the last position is the position you want
so jstu change your while loop to:
while {alive _projectile} do {
AM_debug = _projectile distance player;
};```
I'd use waituntil instead so it isnt updating more than once per frame
a quick test showed while updating the var ~150 times per frame, which some may say is excessive.
it would depend on fps i guess, but still waituntil or a short sleep is advisable.
cant use waituntil
because once the missile is "dead" it doesnt have a position anymore
you can slow down the checks by introducing sleep
to the loop
waitUntil {
_alive = alive _projectile;
if _alive then {AM_debug = _projectile distance player};
!_alive
};```
i see
not as nice to look at but would update more frequently than while with sleep
you could make it a draw eventhandler too
it can be run in unscheduled environment since it isnt all that intensive task
true, and now you mention that, if using cba you could use the each frame handler.
yea, the cba thing is the same thing but on eachFrame instead of draw, and it handles deleting "events" for you.
i gave "draw" as just one example
came off the top of my head for having worked with UI more
_localOffset: ARRAY The model space position offset that projectile should be homing towards to
can i get an explanation of this so I know how to use it?
is this the projectile heading?
BIS_fnc_EXP_camp_guidedProjectile
this is how it is used in the function
private _targetPos = if !(_localOffset isEqualTo [0.0, 0.0, 0.0]) then {AGLToASL (_target modelToWorldVisual _localOffset)} else {getPosASLVisual _target};
so you would use it if you want the projectile to aim for a position relative to the position of the target
Anyone have any pro tips for silently checking if a file exists on a dedicated server?
I've been using this:
params ['_path'];
private _exists = if (hasInterface) then {
private ["_ctrl", "_fileExists"];
disableSerialization;
_ctrl = findDisplay 0 ctrlCreate ["RscHTML", -1];
_ctrl htmlLoad _path;
_fileExists = ctrlHTMLLoaded _ctrl;
ctrlDelete _ctrl;
_fileExists
} else {
!((loadFile _path) isEqualTo "")
};
_exists
Which I could have sworn worked on the server, but threw a message in the rpt and that was it. But now it's actually causing the server to kick back to the mission select screen when run on PreInit and I find myself questioning if I ever tested it after I wrote it like 4 months ago and if it ever worked.
wait for next update and you will have https://community.bistudio.com/wiki/fileExists
if possible, executing in postinit works fine
Unfortunately I need it for PreInit as well, trying to make easy mission scripts where folders can just be deleted and the system detects that on its own.
Is there a scripting method to force AI to take cover (or alternatively go prone)?
@chilly wigeon make a variable and check if the variable is flipped
*flag
If youre talking like addons
Oh wait, mission 
My bad, didnt notice that
@vague geode you can force the prone action, if that's what you mean
You can also set the AI behaviour mode
Whether it's calm or otherwise
You can also write your own FMS for the AI
To make it do what you want
@ebon citrus Thanks, I'll see what I can do.
The only two solutions are:
- use the dev branch (or wait for the next stable) to get the
fileExistscommand - create your own extension for handling file IO (not recommended; could be dangerous in MP, especially with write access)
can just use loadFile but it'll throw errors
that was the issue. during preinit, using loadfile on a missing file skips the mission
@still forum
Which I could have sworn worked on the server, but threw a message in the rpt and that was it. But now it's actually causing the server to kick back to the mission select screen
not sure why it happens but the OP says it does
oof
yeah i hate that error in log == fail mission
My server has that stuff disabled because its too annoying ๐
Could you tell me real quick how I would do that?
e.g setUnitPos
is there a way to make AI ignore the formation?
basically setting the formation to none
โฆwhat would that be?
it would be the same as the AI not being in a group
but when they are in a group I can do stuff easier in eden
the AI move in a group to make path generation faster.
what you ask means each AI will have its own path generation, thus slowing down the game
but if you still want to do that despite what I said, you can either give them individual move orders, or put them in different groups
Here is a picture of my AI
1 sec
I want them in a group for ease of access of behaviors and other things
but I don't want them in a V formation when not moving
or is it impossible
I get all of these handy options
and the option to write a script to all
that's not possible
especially if all you want to rely on is the eden editor
which is related to this channel #arma3_editor
but if you want to script it, you can give units move orders
look at these for example:
https://community.bistudio.com/wiki/doMove
https://community.bistudio.com/wiki/doStop
thanks
anyone else get script errors when using RHS united states vehicles? something in their FCS script is undefined
which one?
and how?
it seems to be with the main cannon. let me see if i can get a screen
wonder if its gonna be in the .rpt, let me look
it has to do with the variable _toSelect
dunno
I just tested a couple of tanks, bradleys, strykers. no errors
if there's an error report it on their discord feedback tracker
12:16:55 unable to get word:'laserdesignator' in protocol:'radioprotocoleng'
12:16:55 Error in expression < = [_v] call rhs_fnc_ammoIndexing;
_v selectWeaponTurret [(_magazines # 0),[0]>
12:16:55 Error position: <selectWeaponTurret [(_magazines # 0),[0]>
12:16:55 Error Type Any, expected String
12:16:55 File \rhsusf\addons\rhsusf_c_heavyweapons\functions\rhs_firedFCS.sqf [RHS_fnc_firedFCS]..., line 28
12:16:57 Error in expression <Turret [_w,[0]];
_v selectWeaponTurret [_toSelect,[0]];
};
private _readdFCS = >
12:16:57 Error position: <_toSelect,[0]];
};
private _readdFCS = >
12:16:57 Error Undefined variable in expression: _toselect
12:16:57 File \rhsusf\addons\rhsusf_c_heavyweapons\functions\rhs_firedFCS.sqf [RHS_fnc_firedFCS]..., line 37
๐คท post it on their feedback tracker
Thanks.
Is there a way I can change the combat mode for a single unit without affecting the rest of the group (by scripting)?
https://community.bistudio.com/wiki/setUnitCombatMode not yet, but soon
@vague geode
Ok, I'll wait...
Go ahead...
let me dig it up
not in the mood to type!
ungrouping the unit, applying, then regrouping?
yeah
_units = groupSelectedUnits player; // just some array of units
_originalGrp = group (_units#0);
_sideUnits = side _originalGrp;
_tempGrp = createGroup _sideUnits;
_units joinSilent _tempGrp;
_tempGrp setCombatMode _desiredCombatMode; //e.g "RED"
_units joinSilent _originalGrp;
deleteGroup _tempGrp;
you also need to save the team (assignedTeam), then re apply it
also, the unit will forget its last command when it joins back!
so it just follows the leader
what should I add //here// call BIS_fnc_removeRespawnPosition; to refer to a synced module
or it doesn't work like that
the code is stored in a trigger
I'm talking just in general, I'm using this code as an example
I think I didn't ask my question correctly, i'll try again
How should I refer to an "object" which is synced to a trigger
basically to replace this or objectName
try the synchronIzedObjects command
will do
ty
so just to clarify, this is how it should look like: synchronizedObjects call BIS_fnc_removeRespawnPosition;?
because this example confused me so much _objects = synchronizedObjects _logic;
and what do the underscores mean _genericKeyword ?
and also what is 1 in this case [west, 1] call BIS_fnc_removeRespawnPosition;
It is called "id" but what does it do?
learn some SQF first:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
that's the article I got it from
when you use that command it gives you the ID
_id = ([west, [0,0,0]] call BIS_fnc_addRespawnPosition) select 1;
which you then use with the remove command:
[west, _id] call BIS_fnc_removeRespawnPosition;
but again, explaining this is pointless since you don't know any SQF
That isn't an easy task and I don't plan on being a very active with eden editor, especially now when I have many other tasks to spend my time in. I try to find the things I need in the internet and that way I learn with practice. But in general, you're right.
are they both supposed to be in one trigger? I don't understand where the _id... one is supposed to be
or should it be in the respawn module
@slow isle this guide is a good for starters:
https://www.armaholic.com/page.php?id=20465
you can learn some SQF in a day (if you already know some programming)
here is the layout I have going https://media.discordapp.net/attachments/714773557628108831/797558529388052500/unknown.png
thanks I might do it in the future. I'm currently learning C#
both of what?
ID is just a number. when you execute that command it returns it
Return Value:
Array - format [target,id] (used in BIS_fnc_removeRespawnPosition)
id is the 2nd element in the array, hence theselect 1
I would guess this is supposed to be in the trigger (deactivation) [west, _id] call BIS_fnc_removeRespawnPosition; and this in _id = ([west, [0,0,0]] call BIS_fnc_addRespawnPosition) select 1; init.sqf? Or where should I search for the id? in the trigger or?
I can't really explain this without you knowing some SQF (and what you say makes no sense)
when you use the trigger as a respawn, the game simply uses its position ([<target>,<position>] call BIS_fnc_addRespawnPosition; )
there's no way to know the ID unless you save it yourself (which means you'll have to execute the command yourself, which means you should know some SQF to be able to do it)
and SQF is really simple. like I said, it only takes you a couple of days to learn if you've done some programming before
Let me clear things out. I'm trying to do this: https://media.discordapp.net/attachments/714773557628108831/797565174910812180/unknown.png?width=559&height=683
I'm using the respawn module from the menu and synced it with this trigger.
What I don't understand currently is where _id = ([west, [0,0,0]] call BIS_fnc_addRespawnPosition) select 1; should be pasted and how we would access _id when it has no "name" to my understanding (or is _id a placeholder for the ID name?).
Did I make my question clear
I fully understand why we need the ID but I don't understand what we should place the code in to get it from. I don't understand in which gameObject/module it should be in. For example placing the code in a random unit (i think) wouldn't give us the ID, hence I am asking where I should place it.
Didn't read the full conversation.
_id is a local variable. When you call BIS_fnc_addRespawnPosition, it returns a number, and that number is saved in _id because you wrote _id = ...;.
Small problem: because _id starts with an _, it's a local variable, so you need to use something like RespawnWestID instead. Then you can access RespawnWestID in any code that comes after.
If you want to use BIS_fnc_addRespawnPosition, you don't use the module. Instead, you place the code with BIS_fnc_addRespawnPosition in initServer.sqf and that does the job.
couldn't we just call the respawn with it's variable name? example: respawnPosName call BIS_fnc_removeRespawnPosition;
https://community.bistudio.com/wiki/BIS_fnc_removeRespawnPosition
The documentation says no to that.
This is how my respawn & trigger look https://media.discordapp.net/attachments/714773557628108831/797558529388052500/unknown.png. Can't I disable and enable the spawnpoint with a command in my trigger or do I need to use a code-written respawn point to achieve this?
this answers my question
but begs another question - Can't I "disable" the respawn instead of removing it?
for example if I disable it's simulation would it still be "existing"
I don't know that. You can just try though.
which command lets you compare data types? trying to write a check for object or group
@tidal swallow i just threw it in visual studio code with a sqf-vm server and it doesn't show its missing any semicolons
the error should tell you roughly where
Yeah the problem is that this is the error log https://pastebin.com/q1ttMGC4
oh nevermind
lmao
i forgot the ;
ffs
lmao
where do you get this application?
search it, itl be the first result
or you can download sqflint/sqfvm use them in cmd
awsome thank you
so I'm trying to pull the value for a reload rate of an artillery between shots. I'm looking through the base config for the vehicle and I'm not finding anything of value. Is there a particular value I'm looking for?
it should be a weapon or magazine information I believe
https://community.bistudio.com/wiki/setGroupId
this script only returns a empty array, any other way to get the available keyword?
"if ((configName _x) select [0, 5] == 'group') then {
diag_log ('%' + configName _x);
for '_i' from 0 to count _x - 1 do {
diag_log ('* ""' + configName (_x select _i) + '"" โ ' + getText ((_x select _i) >> 'name'));
};
}; false" configClasses (configFile >> "CfgWorlds");
you always return false, soโฆ yes, empty result it is
so... whats the point?
๐คทโโ๏ธ
have something logged in the rpt
๐
List of available keywords from config
It simply dumps all keywords in the log files (hence thediag_log), which is more useful than trying to do the same in SQF.
If you need the list in SQF just return true the moment it reaches the keyword(s) you need.
All I actually want was to just copy that array to a notepad file for later use.
anyone know how to display a player name as text on the screen?
Im going for the green text they had at the start of MW2 campaign missions that showed date location and player name
name player or profileName or profileNameSteam to grab the info
thanks chief
ACE has this feature build in, and I'm sure you can take a look on how they do it (see: https://github.com/acemod/ACE3/blob/8e7f9b6db53a279432a2372c04be311807d1193b/addons/nametags/functions/fnc_onDraw3d.sqf)
why doesn't this code in the onPlayerRespawn.sqf? this addAction["Open Arsenal", {[_this select 0, player, true] call ace_arsenal_fnc_openBox},[this]];
https://community.bistudio.com/wiki/Event_Scripts#onPlayerRespawn.sqf
Because this is an array with 4 parameters.
player addAction["Open Arsenal", {[_this select 0, player, true] call ace_arsenal_fnc_openBox},[this]]; this now works
I changed this to player
thanks
you also need to change the [this] at the end to [player]
although it works, since _newUnit is also the player
I'm trying to create a teleporter using triggers that teleports all the players that belong to a specific group "X" and is inside the trigger box/area to a different spot. My initial searching in google came down to this code:
Condition: this && (player in thisList)
On Activation: player setPos [4061 + random [-10,0,10],1434 + random [-10,0,10],1];```
This teleports all the players in the trigger box to the location. How do I modify this so that only players from the group ``Rangers (Forward Recon)`` inside the trigger zone is teleported and all others can still be in the zone?
Nvm, found the solution!
Change the condition to this:
this && player in thisList && groupId (group player) == "groupname"```
I have array of class names of (vanilla + modded) uniforms. Is there are a way to identify/select vanilla uniform from that array?
_uniforms select { getText (configfile >> "CfgWeapons" >> _x >> "author") isEqualTo "Bohemia Interactive" };
why doesn't this work? https://media.discordapp.net/attachments/714773557628108831/797802079074254889/unknown.png I get a generic expression error
I think the second this is the error but idk what with to replace it
I tried doing this but to no success enteringObject = thislist select 0 && side enteringObject != blufor
What I want to do is make this for AI units too, not only players this && playerSide != blufor for debugging
because I don't have a friend to test it with rn
https://community.bistudio.com/wiki/Magic_Variables#this_2
Because this is the (boolean) return value of the trigger's condition, it has no side.
What does the whole trigger look like?
? There is an incremental count when creating ppeffects that persist outside of the mission and even engine restarts. Is it possible to reset this, if so will it have any negative effects
Sorry for the late response but I managed to debug my trigger in a different way. Thank you!
is there a way to increase a vehicle's hitpoints with a script? If not, is it possible to allow vehicle damage but not destroy it and it remains drivable? Example: HMG shooting helicopter; Heliparts are yellow/red but don't get any more damage, hence the vehicle can't be destroyed
using HandleDamage EH yes
in the BI respawn system using template menuposition, is there any way of getting which respawn object the player chose?
i can get the respawn itself using the respawn EH and I run a script fired from that
which happens when they chose a position from the menu and click respawn
but WHICH position. is what I'm after
getPos?
Wouldn't it be simple to just find the position the player is less then idk, 5 meters from. Then you know where they spawned.
I think he means respawn position.
but you already know where those positions are, so all you really need is the position of the player and check which one is the closest ๐คทโโ๏ธ
sometimes, those positions are on amoving vehicle
if a player clicks, they get run ovrer by the vehicle
๐คฆโโ๏ธ
in that case checking on 'onPlayerRespawn' won't do much, since that gets executed after spawning anyway
yes
but you could try the same method as got getting the role and loadout from that menu:
_rList = uiNamespace getVariable (["BIS_RscRespawnControlsMap_ctrlRoleList", "BIS_RscRespawnControlsSpectate_ctrlRoleList"] select (uiNamespace getVariable ["BIS_RscRespawnControlsSpectate_shown", false]));
_rName = _rList lbText (lbCurSel _rList);
_rName = "Name of Role";
Just check if you can do the same with the positions
ooo that sounds hopeful
@finite sail
BIS_RscRespawnControlsMap_ctrlLocList
BIS_RscRespawnControlsSpectate_ctrlLocList
I believe these are the ones you need ๐
these are variables in the uinamespace?
What vector commands do I need to return objects only in the player's screen space?
use worldToScreen
and make sure the result falls within the screen area
Could something similar to this also work? (proof of concept)
_units = ASLToAGL getPosASL player nearEntities [["Man"], 20];
_unit = {player getRelDir _units == 0};
that's role, @exotic flax , not the respawn position the pl;ayer selected
why getRelDir?
getRelDir is 2D. use worldToScreen as I said
plus what you wrote will throw an error
and it doesn't even execute
I am aware, that's why I stuck the proof of concept there
I couldn't remember the syntax for using eval on an array with a boolean
got ya, thank you
ESM_spectatorUI = true;
ESM_spectatorUIEH = (call BIS_fnc_displayMission) displayAddEventHandler ["keyDown", {
if ((_this#1) in actionKeys "cameraInterface") then {
systemChat "STEP 2"; // Debug
ESM_spectatorUI = false;
};
}];```
For some reason, I can't find an ``actionKeys`` that could trigger my EH ... I'm in Spectator Slot but this is not firing when I press Backspace.
stupid question probably
I have a type name (class name). I want to find a config entry for that class name. How?
"(configName _x) == '29rnd_300BLK_STANAG_T'" configClasses configFile doesn't work
Something like configOf but with class name... ๐
I believe the Spectator has its own key binds
can they be changed at all?
If not, try to figure out another way by looking at its function:
BIS_fnc_EGSpectator
well that appears to be a mag, so you can check with:
isClass (configFile >> "cfgMagazines" >> "29rnd_300BLK_STANAG_T")
I don't know if class is a magazine, weapon, display or anything
well you'll have to do a search then
but that is extremely slow
if you know it can belong to some parent class, then you can narrow down the search
such as:
[configFile, configFile >> "cfgVehicles", configFile >> "cfgAmmo", configFile >> "cfgMagazines", configFile >> "cfgWeapons"] findIf {isClass (_x >> _className)}
this will cover over 90% of typical classes in the game
but if you want to search in the whole config, you can write a recursive function for that
and once again I warn you that it is extremely slow
for some reason this is still returning my player in the array?
player nearEntities [["Man"], 20] - [player]
that's a precedence issue
wrap the first expression in parantheses
so like _units = (player nearEntities [["Man"], 20]) - [player];?
thx Leopard20 ๐
The script I posted is for role, that's correct, it's even written in the example...
The 2 variables I posted after that *should* be the position.
I'm still fiddling with it, thank you ๐
I can imagine that the spectator view does not use IDD 46, you might want to look into that.
the other vars are returning any at the moment, so its possible im doing something wrong
but I am still going
thanks for help
Couldn't find the display the spectator is using. And when I do a findDisplay 46, is returns it so it is there
I'm specifically using a Spectator actionKey so ...
findIf appears to only work with one bool.
_units = (player nearEntities [["Man"], 20]) - [player];
_inScreenSpace = (count (worldToScreen getPos _x)) > 0;
_isClose = (player distance _x) <= 20;
_index = _units findIf {_inScreenSpace && _isClose};
_unit = _units select 0;
hint str format ["%1, %2", (count (worldToScreen getPos _unit)) > 0, (player distance _unit) <= 20];
//hint str _unit;
if ([_unit, true] call ACE_captives_fnc_canSurrender) then {
[_unit, true] call ACE_captives_fnc_setSurrendered;
}
unit will surrender (ignoring the &&) but will hint true and false so both are not actually true..
instead of redoing the math, hint inScreenSpace and isClose
hint str [_inScreenSpace, _isClose]
your code is wrong in all places
but since your code throws an error โ
I meant you should use worldToScreen with inArea
Just an educated guess, but I don't think that the display being there also means that it will fire UI Event Handlers / display your systemChat. Better find that spectator display, that's all I can suggest.
Yes maybe. I'll continue looking for the spectator Display
@agile pumice
_screenArea = [[0.5,0.5], safeZoneWAbs/2, safeZoneH/2, 0, true];
_units = ((player nearEntities [["Man"], 20]) - [player]) select {worldToScreen ASLtoAGL getPosASL _x inArea _screenArea};
and for the love of God, don't use getPos
I'd remove that stupid command if I was a dev
(I mean it is useful in some places but most people don't know what it is)
that inarea command threw a elements provided error
oh I see, elements for the screenarea
the wiki says 2D is fine
weird
https://community.bistudio.com/wiki/inArea
It should work as it is
question on BIS_fnc_randomPos function. For the parameter blacklist, areas could be: Location - location. Can I blacklist locations like "NameCity"," NameVillage"? I've tried several different variations of the array, but it throws an error of undefined variable.
_rndmRad = random [2000,2500,3000];
_blacklist = ["Airport","NameCity","NameVillage"];
//_rndmPos = [[[position player, 3000]],["water"]] call BIS_fnc_randomPos;
_rndmPos = [[[position player,_rndmRad]],["NameCity"], {isOnRoad _this}] call BIS_fnc_randomPos;
@tough abyss see the pinned messages for syntax highlighting
sqf goes directly after ```
i.e. ```sqf
no line break, no space
anyway, what you're writing is not providing a location
comment "Hi, I'm James Gastovski"
[NameCity,NameVillage]
these are not defined
that's why you get undefined var
["NameCity","NameVillage"]
the game thinks you're providing markers
with those names
https://community.bistudio.com/wiki/Location
those are location types not locations
location is a special data type in sqf
@little raptor ok, I understand. I need to get those locations first, or create an array of those locations. I have a method I've used in the past. I was hoping to use the "NameCity" within the function. I see the link "Locations Commands" at the top of the wiki.
Thanks
NP
And I'll work on my syntax highlighting skill, or lack there of....
skill?
it takes no skill:
```sqf
code
```
it was confusing the fiirst time i did it ๐
yea I corrected to that. And it didn't take. Oh well.
but its pretty simple really
I've got bigger issues as you can tell.
you were writing sqf in the next line (or maybe added spaces)
ok
how is the "Scan the Horizon" command done? Currently trying to figure out if there is a engine implemented way.
Otherwise a setFormDir with random 360 was my second thought
not implemented
use doWatch in a loop
it looks like its under the weapon config. so I have these lines I've found
configfile >> "CfgVehicles" >> "rhsusf_m109_usarmy" >> "Turrets" >> "MainTurret" //["rhs_weap_m284"]
configfile >> "CfgWeapons" >> "rhs_weap_m284" >> "reloadTime"
how would I go about combining this to pull any reload time off of any vehicle?
CfgWeapons >> (configName of the first) >> reloadTime
this is a bit more of a CBA question than just a plain arma scripting q, but
I'll ask anyway
_obj_to_owned_map = ["#CBA_HASH#",["c_15","c_6","c_0","c_2","c_62","c_10","c_39","c_42","c_36","c_40","c_17","c_29","c_28","c_43","c_41","c_44","c_11","CUSTOM_6950","CUSTOM_6805","CUSTOM_15041","c_19","c_12","c_14","c_7","c_38","c_37","c_13","c_34","c_51","c_53","c_9","c_50","c_8","c_5","c_33","c_54","c_24"],[["CUP_O_SLA","CUP_B_HIL"],["CUP_O_SLA","CUP_B_HIL"],["CUP_O_SLA","CUP_O_SLA"],["CUP_O_SLA","CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA","CUP_B_HIL"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_I_PMC_ION"],["CUP_I_PMC_ION"],["CUP_I_PMC_ION"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"]],any];
_filtered_objs = [] call ALiVE_fnc_HashCreate;
{
// Filter out all objectives with multiple groups
_cluster_id = _x;
_factions = [_obj_to_owned_map, _cluster_id] call ALiVE_fnc_HashGet;
if ((count _factions) == 1) then {
[_filtered_objs, _cluster_id, (_factions select 0)] call ALiVE_fnc_HashSet;
};
} forEach _obj_to_owned_map select 1; // Iterate over all keys
_filtered_objs```
if I paste this in my console _filtered_objs is just an empty hashmap
not 100% sure, but change the forEach to:
forEach (_obj_to_owned_map select 1); // Iterate over all keys
np
I need to get better about using the parentheses aggressively
arma order of operations is weird.
Okay so the curator/spectator display doesn't exist : https://community.bistudio.com/wiki/Arma_3:_IDD_List
open the function as I mentioned before
it does exist
just not documented
@little raptor I'm just used to indexing in an array being high priority i guess
@winter rose are you telling me to edit the cursing out?
yes
sure
use the # instead of select
wdym
it has higher priority
like array#1?
yes
weird, why does nobody use that?
because it's kinda new
ah
makes sense
@brazen lagoon https://community.bistudio.com/wiki/a_hash_b
It just has no benefit unless you need it ๐คทโโ๏ธ which 99% of the people don't
yeah but it just seems like
more logical to me for array ops to be highest priority
if you know what you want it's very useful
saves you from all those pesky parantheses
but thats probably just because I have stockholm syndrome from using c-like languages where that's the case
because myArray[0]
@brazen lagoon also, there will be actual hashmaps in v2.02
I guess I'm not understanding config manipulation as this is my first time doing it.
Some things I've tried at just pulling the classname of a vehicles weapon...
_vehicleClass = typeOf arty1;
_vehicleTurret = getText (configFile >> "CfgVehicles" >> _vehicleClass >> "Turrets" >> "MainTurret");
_vehicleTurret;
//Returns ""
_vehicleClass = typeOf arty1;
_vehicleTurret = getArray (configFile >> "CfgVehicles" >> _vehicleClass >> "Turrets" >> "MainTurret");
_vehicleTurret;
//Returns []
guess I'm just not sure which commands I need to be looking at to actually pull a value off of it
@little raptor omg you're joking
is there a hashmap wiki article I can look at?
lmao leopard's too fast for me
this is great!!
configfile >> "CfgVehicles" >> "rhsusf_m109_usarmy" >> "Turrets" >> "MainTurret" //["rhs_weap_m284"]
you mentioned yourself that it's an array
so usegetArray
also this is a complete list of config commands:
https://community.bistudio.com/wiki/Category:Command_Group:_Config
the true return of that in debug is bin\config.bin/CfgVehicles/rhsusf_m109tank_base/Turrets/MainTurret
so i think i was having an issue understanding how to pull things out of configs
so I'm going to try something and see if i get the syntax right
MainTurret is not a config entry, it's a config (sub-) class (indicated by the capital first letter). As such, you can't extract a value from it with getText or getArray, because a class has no value.
yeah I JUST figured that out. I wasn't deep enough
so in the end, I now have
_vehicleClass = typeOf arty1;
_vehicleCannon = getArray (configFile >> "CfgVehicles" >> _vehicleClass >> "Turrets" >> "MainTurret" >> "weapons") select 0;
_cannonReload = getNumber (configFile >> "CfgWeapons" >> _vehicleCannon >> "reloadTime");
_cannonReload //Returns: 6 which is the correct value
so it was my own stupidity causing blindness to seeing the stupidity
it would be better to use apply
then sort the value
how do you mean and why would it be better? faster?
no just better
_vehicleClass = typeOf arty1;
_reloadTimes = getArray (configFile >> "CfgVehicles" >> _vehicleClass >> "Turrets" >> "MainTurret" >> "weapons") apply {getNumber (configFile >> "CfgWeapons" >> _x >> "reloadTime")};
_reloadTimes pushBack 0;
_reloadTimes sort false;
_reloadTimes#0
and no errors
Is it possible to give player units more hitpoints?
hitpoints are defined by the config (and model)
it cant be scripted
Although you can script incoming damage
aynone have experience with dedmen's intercept-database able to help me resolve a few issues?
There is alt languages like sqc, in which normal array OPs work ๐คช๐คช
lol
arr[0][1] = 10 gets (_arr select 0) set [1, 10] with sqc
Sorry to ask, but is there any way for me to have a script checking if an ace interaction action has been added to object ?
to be specific, I wanted to execute a script if an ace interaction action has not been added to an object
Hey peeps I could use some help, I'd like to get the position of a marker in initServer.sqf,
I currently have _spawnPos = missionNamespace getVariable "marker_rad_1";
and then getPos _spawnPos,, but that tells me that _spawnPos isnt defined
(note the, in the getPos is intended)
if you know exactly which action should be there you should be able to retrieve it by following a similar approach as https://github.com/acemod/ACE3/blob/master/addons/interact_menu/functions/fnc_removeActionFromObject.sqf
@oblique arrow use getMarkerPos instead
so _spawnPos = getMarkerPos "marker_rad_1";
thank you
if its not something specific to RHS vehicles - note that the primary turret's config name is not always "MainTurret". It can be called differently
Im looking for a way to detect shells/bombs falling in an area and have AI respond to it.
Getsupression won't work because I also want them to respond when the bb falls hundered of meters away from them.
Practical example:
- Artillery shell hits ground
- AI start running to specific positions
i've been testing this with a variety of vehicles and it seems like at least with CUP and RHS (at least with artillery types which is what I'm writing this for), they keep the same sorting which is nice
they do, but its not mandatory to name them such - so some vehicle configs might not be compatible with whtaever you do in your script, if you hardcode it that way
You can find the turret dynamically, if mainTurret is not available
https://community.bistudio.com/wiki/targetKnowledge
if the shells are shot from an "inhabited vehicle", then this vehicle will pop up in targetKnowledge (last time target endagered unit).
I have a bit of experience with it, but not much.
well i would hope so seeing as how you're one of the devs on it lol
a few questions, 1. does it still work
Afaik it does
- I'm getting an error and I have no idea why
SQF:
_conn = dbCreateConnection "testdb";
_prep = dbPrepareQuery ["SELECT ? FROM ? WHERE ? = ?",['surname, uid','characters','uid','76561198106099573']];
_exec = _conn dbExecute _prep;
_res = dbResultToArray _exec;
Error:
_exec = _conn dbExecute _prep; _res = dbResultToArray> Error position: <dbExecute _prep; _res = dbResultToArray> Error Intercept-DB exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? WHERE ? = ?' at line 1 at SELECT ? FROM ? WHERE ? = ?```
Is that question mark thing the correct way to do it? I don't have the docs in my head right now
according to docs it was
