#arma3_scripting
1 messages ยท Page 127 of 1
But only if you don't have anything else in the script
because that stuff will also be delayed by your sleep 30
Forgive me coding Is new to me.
....even the basics.
switch (side group player) do
{
case west: { // WEST SIDE CODE
actId = player addAction ["Teleport to Nato Base",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState b_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL b_tele);
};
}, nil, 1, true, true, "", "true", 5]; sleep 30;
player removeAction actId;
};
case east: { // EAST SIDE CODE
actId = player addAction ["Teleport CSAT Base",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, false, true, "", "true", 5]; sleep 30;
player removeAction actId;
};
default {};
};
Yes, this is correct
but if you'll have anything more added later it wont run until that sleep 30 wait passes
nothing else should be added.
One last question. Having an Issue with player dying and the AI they are commanding takes over and starts barking orders. This only happens when the player Is Incapacitated. Is there a work around such as Increasing the rank of a player In EDEN editor?
Not sure, I have little experience with AI
Thank you.
I would expect the alt syntax https://community.bistudio.com/wiki/callExtension to give a specific error code when the extension is not loaded/found.
But there is no error code for that listed on the wiki.
Seems like it would return a -1 returnCode. But that is both if the extension doesn't exist OR if it doesn't have callExtensionArgs defined. So probably not helping much
Having an Issue with a line of code. Not sure If this code only work as admin or In Eden editor but when a player trys to use it It does not work.
this addAction ["Its just a weather balloon agent Mulder", {
0 setFog [0,0,0];
}];
Says SE at the top
Only server can control the fog
So that Is why I was able to turn It off with that script In eden editor. I had two test done. One In the main server I host and the second In the eden editor local server. The script Is on a computer and when activated by a player It Is to turn off the fog.
Its a shame I was hoping to put this In the players hand In some role playing sort of way.
Use remote exec to ask the server to execute it: https://community.bistudio.com/wiki/remoteExec
{0 setFog [0,0,0]} remoteExecCall ["call", 2];
Let me give it a try.
Right to jail, right away! ๐
[0, [0, 0, 0]] remoteExec ["setFog", 2];
And even if you really wanted to use call: It is a script command, and remote execution always executes those in the unscheduled environment, so there is no need to do excess typing to use remoteExecCall instead of remoteExec.
So I should go with that one?
Both should produce the same result ๐
Thank you to both of you.
Where can we modify the stamina in the Addon settings ? My people is complaining their stamina drains way too fast and it's annoying us all ..
_plr setUnitTrait ['loadCoef',0.75];
``` i think that helps with the stamina
using mods? like ace?
Yes, I do use ACE
Thanks
Is there a way to target squads or
Have you enabled advanced fatique, if yes, there is settings for these.
well the command must be ran locally so for player group you would have: ```sqf
{ _x setUnitTrait ['loadCoef',0.75]; } foreach (units player);
glad u got it figured ๐
Thank you too gencoder! It sure is useful!
Can someone explain the error?:
There is a CfgFunctions in config.cpp -
class CfgFunctions
{
class MD
{
file = "\md\functions";
class mdf {
class initDrone {};
};
};
};
The structure of the md folder is:
md/
โโโ functions/
โโโ fn_initDrone.sqf
But I receive the error script \md\functions\fn_initDrone.sqf not found.
#arma3_config eventually, but also https://community.bistudio.com/wiki/Arma_3:_Functions_Library
can you make player run faster via script?
Its becouse in file \md
Just put md
yeah, ty
thx i'll try that
its bit funny as it plays the animations faster but I guess that's the only way?
With scripting yea that is the only way to move player faster and that player still has controle. Other way would be setvelocity but at that point you are just launching player. Its good if you want for players to have super human jump
hmm well I noticed player also heals faster, so that's bit unwanted
You can change that with EH anim when you detect that animation put player animspeed coef down and when the anim is done just put the animcoef back.
ok thx
i tried this but there are lot of walk/run animations to cover because of the stances player can take ```sqf
player addEventHandler ["AnimChanged",
{
params ["_unit", "_anim"];
// sprints
if(_anim in ["amovpercmevasraswrfldf","aadjpercmevasraswrfldf_up","aadjpercmevasraswrfldf_down"]) then
{
player setAnimSpeedCoef 10;
}
else
{
player setAnimSpeedCoef 1;
};
}];
When exactly is he supposed to be faster? When sprinting?
i was thinking all the time but I may have to limit it to sprinting anims
well I covered the three main run anims, maybe that will do... code updated ^
Do _unit setanimspeedcoef inatead player in EH
oh yeah your right , thx, that was just test code ๐
origin getPos [distance, heading]
no other getPosXXX has this alt syntax, right? or just not documented on BIKI
getRelPos comes to mind
Unless its the same thing
Hey, what can i use to view/edit SQF files ?
notepad, notepad++. vscode literaly any IDE editor.
Result: 0.0279435 ms (slow)
Code: getPos player
[3512.99,6689.22,0.00137329]
Result: 0.00170412 ms
Code: getPosATL player
[3512.99,6689.22,0.00140381]
Result: 0.00279068 ms
Code: player getPos [100,360]
[3512.99,6789.22,-3.05176e-005]
Result: 0.00216745 ms
Code: player getRelPos [100,360]
[3526.88,6590.19,0]
> Returns position that is given distance and relative direction away from original object.
slightly confused by the getRelPos returned position
what plug in do i need for notepad++ as i already have but still cant read the file properly
what do you mean cant read file properly. You mean you dont have syntax highlighting or you actually cant see anytext in sqf file ?
dont have the syntax as the websites i find to download it from look.... dodgy ๐
still cant see anything to download as it says in the quote
https://forums.bohemia.net/forums/topic/138891-arma-3-notepad-syntax-highlighting/?page=10
Second to last comment on this page. google drive files.
thanks got it
Which part?
Z is always 0
Direction is relative to object direction
Enen tho you've set the direction to 360, it will move 100m along the direction that the object is facing
Unless your object is facing north, it will affect both X and Y
x 3512 vs 3526 and y 6789 vs 6590
if one is just cardinal? offset and the other relative to the unit direction, then i can see the difference in outcome
Yeah that's why it's called rel pos ๐
How many stored variables start to affect performance in noticeable way? If AI soldier has variable set, will the variable being saved perish along the soldier when it dies?
does that include cleanup after death?
Yes
good enough
The variables are attached to the unit object. The object remains the same even when the brain (be it AI or player) is no longer present.
ah alright
what im trying to do is to change language of everyone on blufor side, and add variable for those with new language so they dont get randomised again. Is 100 ish at once max having variable like this have noticeable impact?
i know spamming variables isnt good but i have no idea when to start getting worried about performance
No. 100 vars are probably not gonna consume more than a few KBs
Variables don't cause much performance impact by themselves
The Spearhead 1944 CDLC is very performance conscious since its map and other custom features are quite extensive yet if you look at their code they add an incredible number of variables to their player and Ai units, so what I am trying to say is that they wouldn't do that if it had any performance impact since their performance budget is already very thin, they just can't afford to hurt player FPS anymore than what they already do
correct me if I'm wrong but the more global variables you have the more engine has to search thru when using them
you're wrong. Hashtable
hmm isnt there search still?
It searches yes. But doesn't take longer (on average) when there are more elements
oh ic, that's good
same for local vars?
yes
local vars depends on scope depth. Either distance to the variable, or if undefined the total depth
Which is why you always use private, otherwise it looks it up
is there a way I can get a terminal output for errors instead of loading arma eden editor and test playing
like "does the closest local var hashmap have this var" nope โ "does the one above" etc
you can always access your .rpt file yes
ah, thank you ill look into that
how to a generate new logs without start the game?
refresh or reopen the same file
confusion
if the same file is updated, how do I have so many rpt files with dates in the name?
does it generate a new report daily?
one run = one file iirc
No i beleave it generates new file everytime you open the game and i also beleve it keeps up to certian number of files and then deletes the oldest one.
it keeps ~ last 10 logs
so... it updates from opening the file, and generates a new one everytime I open the game?
Yea
i opened the latest rpt files in the fold and the time logs are the time?
nothing new is added? although I have changed some of the code
You cant
im just confused as to why updating a file would serve any proupse rather then having to generate a new one everytime
it doesnt appear to update, when I open it. can its time stamped? with yesterday?
with what do you open it?
note pad or vscode
RPT log files are a log of what the game is doing (or failing to do) when it's running, so they won't be generated when the game isn't running. So you can't generate logs without opening the game.
A new RPT file is created for every game session, starting when the game launches and ending when it's closed. During each session, that session's RPT file is updated with any new logs as they happen. If nothing happens (for example, sitting at the main menu) there's nothing to update the file with.
Depending on what you open the RPT file with, you may need to close and reopen it in order to see new changes. Notepad++ will automatically detect new changes and offer to refresh the open file; I don't know about other programs.
Thanks Nikko for the explanation kodos
is there a script command to order a AI to repair a vehicle?
Unfortunately we don't seem to have script access to some of the order types that can be given from the commanding menu, so there's no all-in-one "move to and repair". However, you can do it yourself by having the AI move to the vehicle using one of the various movement commands, and then using action to make them do the repair on it once they get there.
Hello all! My friends have been stuck on this issue for days... hopefully this will draw some more attention to it.
Summary: Trying to get unlimited ammo and the same pylons to respawn on an aircraft.
https://forums.bohemia.net/forums/topic/280836-respawn-expressions-issues/
Hello! First | The basic premise of what I am attempting to do is two-fold. A) respawn existing vehicles (of different types - i.e. some jets, some helicopters, some ground vehicles), with the same custom pylons - for the jets/helis - set by the pylon/dynamic loadout editor in 3den. This part wor...
Hey lads,
I've got an odd question, I am trying to get the unit ID of all units within a group. I am able to do this with some regular expression but for some reason when I run the operation script in a hosted server (not eden editor multiplayer), it comes out as bis_o2_749 (749 seems to change).
This is the array of units from the command units player;:
[bis_o2_749,B Alpha 1-2:2,B Alpha 1-2:3,B Alpha 1-2:4,B Alpha 1-2:5]
But when I run it on singleplayer or eden editor multiplayer, it is this:
[B Alpha 1-2:1 (Coolsurf6), B Alpha 1-2:2, B Alpha 1-2:3, B Alpha 1-2:4, B Alpha 1-2:5]
Does anyone know what might be happening? This is the code for it:
_array = units player;
_name = name player;
{
_text = str _x;
_number = _text splitString ":";
_number = _number select 1;
_number = _number splitString " ";
_number = _number select 0;
if (_text find _name != -1) then {
remoteExec systemChat format["PLAYER IS: %1", _number];
_teleportOffset = parseNumber _number;
};
systemChat format["%2 Ran Script: Number: %1, Text: %3, Tele: %4", _number, _name, _text, _teleportOffset];
} forEach _array;```
I really want to make sure this runs properly and are very close to just making a failsafe to check if the user is named "bis[...]" and use that as a teleport offset.
https://community.bistudio.com/wiki/groupId
This is the command, if that's what you look for
Also, what exactly is the goal to have number? What is the teleport offset you want/mean?
Is there a way to keep the targets from dying, but still functioning? I tried to disable damage but that keeps them from working
This is exactly what I needed. I am creating a setpos function that will take the groupID of a unit that enters a trigger and teleport them. This will have an offset based on where they are in the unitID so that they don't get teleported on top of eachother.
Pretty much want them teleported onto a pointer I put in eden editor and have them go in a line formation based on the offset I set (player 1 will be first, 2nd will be behind them X amount of meters etc)
This groupID function basically rips anything regex related, I should have figured where Arma would get the number after the : in the first place.
I've never coded or made an operation in arma 3 before, but I wanted to use this as an excuse to learn a bit about SQF and it has been going somewhat well so far
If you don't want them to overrap into each other upon a teleport, I would say that is one unreliable way to do, because the member's ID can be skipped, if the one is killed
I realise that this could mean that spots in this line will be empty, but I am on a bit of a deadline for this operation and I think the players would naturally fall fully in line.
The trigger I have planned will actually prevent death during the time and thanks to PF Advanced Revive from the DLC, during a players death, there is a few frames they are immune to damage that i can take advantage of to prevent death all together to stop this from happening.
I am quite well relying on this function to work and not have the player die, but there will be zeus available so I have a few backups. I did have a look and see there is a dedicated teleport command. Should I use that teleport command over setPos?
Although this does concern me
This is from VN_fnc_revive_handledamage, I believe it is apart of the prairie fire or western sahara dlc
those are the only two that will be enabled for this operation
VN does mean SOG
Had a feeling it was that one, I really like the revive system from these modules alot. I don't think it would work well with ACE but thankfully we are not using that for this operation.
This part, I actually would suggest to do in this way:sqf { _x setPosWorld (_pos vectorAdd [_forEachIndex * 3,0,0]); } forEach theGroup;and _forEachIndex does mean the iteration index. It won't skip and starts from 0, it adds 1 upon the iteration
I currently have this command setup to run on each client, I was worried about server race conditions if they were checking the value the server has saved might be grabbed twice if a player enters a trigger at the same time.
I am trying to get the script somewhat working just to teleport me and I can quickly share it, I might see if I can use the way you did it for the teleport as it might be more robust.
_teleportOffset = 0;
_array = units player;
_name = name player;
_groupID = groupID player;
_number = floor _groupID;
_teleportOffset = (_number - 1);
_incrementValue = 1.2 * _teleportOffset;
systemChat format["%2 Ran Script: Number: %1, Tele: %3, Offset: %4", _number, _name, _teleportOffset, _incrementValue];
_markerPos = getPos playerSlota;
_teleportLocation = [
(_markerPos select 0),
(_markerPos select 1) + _incrementValue,
(_markerPos select 2)
];
player setPos _teleportLocation;
This is my currently working local script for player teleports based on Unit ID. I realise how easy this might be to get working server sided just because relying on clients to properly run this might have issues.
I am getting "theGroup" in your context from units player. I don't know how I'd get the specific group I want (this being alpha 1-2) to run in your forEach loop.
I tested it on getEntityInfo, which returns lots of bools
the 2 version is with my optimization applied
0.00036369 ms getEntityInfo objNull
0.00025543 ms getEntityInfo2 objNull
yay, big mucho bettero...
Tbh I didn't expect a 15 element array to be that fast
0.00041743 ms getEntityInfo player
0.00034901 ms getEntityInfo2 player
With that kinda speed, I don't see the sense in adding the second syntax ๐
0.00021268 ms player getEntityInfo 2
only 50% of the time, to get one value, instead of getting all 15
Is this noticeable only within single command call? Would there be a difference in say:
1 allObjects 0 apply {alive _x}
```and
```sqf
1 allObjects 0 apply {alive2 _x}
```?
The number of allocations goes down, so it would have on average the same effect on every bool
If you need to do that for 100 of entities and you need only one property it might add up
So 2nd syntax still makes good sense
_x = [];
_x resize 2000;
_x apply {true}; 0.0547725 ms
_x apply {true2}; 0.0205002 ms
Arma Script Compiler would already do this optimization of merging all true/false's together. But it only does that in one file. So each file would still have one allocation.
But also it would do the allocation at script load time, not runtime.
So you kinda already have this optimization if you use bytecode
So within single compile? Or compileScript + sqfc only?
compileScript + sqfc built by ArmaScriptCompiler, because it has the optimizer
Can we expect to see this being optimized everywhere somehow? Sounds like noticeable performance improvement
Its just 6 ish lines of code to make this be everywhere
There is also a few other places that might make sense.
-1, or pi
Always the same value, but always allocates a new value to store it in.
But at that point the check for "is this -1" might be more expensive than what we save in the cases that it actually is -1.
And if we don't solve it via a check on every value, we have to solve it manually in every script command, which won't happen
you could perhaps allocate all floats into RAM? ๐
Well that would just be 16 gigabytes. So probably yeah
Also ran that same test on latest compiler in C++20 land
0.0179434 ms
Code:
_x = [];
_x resize 2000;
_x apply {true};
Fun fact, "nil" command is actually relatively expensive. Because it actually allocates a "Void" value.
Whereas other commands that return nil, generally return a empty value and thus don't need to allocate
Though I couldn't find a alternative nular command that also does nothing and returns nil ๐
inline assembly in x64 visual studio is not a thing.
Also that wouldn't make anything better, the optimizer already generates perfect assembly
no
A empty value would be nothing.
As I said it allocates a Void type value
No it has a pool allocator
Yes new, which then goes via a pool allocator. That doesn't matter though?
no?
So after that true/false optimization.
true is now faster than nil
true: 0.00012076
nil: 0.000125111
Ofc you could turn that around
true: 0.000120502
nil: 0.000118242
But I don't know what implications it might have to change the type of nil
via 64bit? wat?
I'm talking about the void datatype in the script engine... You don't know what you're talking about.
That is irrelevant for this
Because its a pool allocator, it allocates full pages at once
4096*?
It can use huge pages, but it likely won't so 4096.
And also, that is irrelevant because it won't need to allocate new pages in this benchmark
What are you talking about?
It allocates pages. A page is always at the page boundary. And has no padding
We aren't
Well atleast I have never seen windows change the page size at runtime
And even then, there would still not be padding and we would still hit the boundaries of that new page size
Well yes, so what?
Then the next script file executes, and it needs more values and fills up the 3KB that were remaining
well yes, that's a whole different paradigm ๐
Well yeah don't compare moddable sandbox game with system requirement of 8GB of ram to a little microchip with kilobytes of memory
What do you mean OOP features?
its all OOP.
Every instruction is a baseclass with virtual method, every script value is a inherited class with virtual method messes
I have no idea what "class controls" are, and if by "type generics" you mean templates, it does use them if appropriate.
Well that is used
I don't get what you are trying to say
You're not making sense to me
Factory Method, Composite
But why does that matter?
Future maintenance on a 25-ish old codebase of a game in its end of life phase?
SQF is not bytecode no.
And I have no idea, someone else wrote that SQF compiler 20 years ago
Arma*
The plans were implemented. Tested. Decided not to do it and all the code for it was disabled
Don't know
Every instruction is a class with virtual "execute" method.
The compiler parses the string stuff, and creates arrays of instructions.
The execution just calls Execute() in order
Yes
SimpleVM is actually that. And its like factor 10 faster
no
Enfusion doesn't use SQF
(sadly)
SimpleVM is a new SQF bytecode translator/interpreter implemented a couple months ago
Its similiar to Enfusion's VM. both run on bytecode instructions
SimpleVM doesn't support variable scopes. And probably not going to add that.
So it cannot be used everywhere
Its basically like binarized config.
Its a intermediary representation. So that gets rid of all the preprocessing and string parsing.
It is essentially bytecode. But the engine can't execute it, it translates it back into the existing represenation of instructions
When SQFC is loaded, its translated into normal code representation. And that you would then run
When you compile SQF. Yes.
Just like .cpp/.bin
.cpp needs to be preprocessed and string parsed.
.bin is a binary representation thats much easier to load
Mostly loading.
The benefit of it being mostly compiled outside of the game, when mods are packed, is that you can take much more time.
So my SQFC compiler also has a optimizer in it that can improve runtime performance by optimizing the assembly
Arma 3*
yes, improves game start/load time
As we're quickly approaching the release ofย ARMA 2 , the third installment in Bohemia Interactive's award winning series of military PC simulations, it's a good time to clarify some things about the name and also explain why using Armed Assault 2 is wrong or why Arma is not a cheesy weird name as some English-centric souls may believe!
its in profiling branch, and will be enabled by default on 2.18
yes
#arma3_scripting message there is an example of old SQF, vs SimpleVM
Arma 3*
The game is not Armed Assault
Is there a command to return explosive charge timer?
no, AFAIK
I have a question.
really would appreciate every help to get what is needed to solve my problem.
I have already found a script that I can insert into the init line of a SECRET FILE/DOCUMENT object.
So that it shows up in the "Intel added" tab when I press M/MAP.
I know how to insert text and an image there so that it can also be seen under the Intel Added tab in the Map Screen.
However, I would like that this file/Intel...firstly: that it add a task.
Secondly, it should still appear as an object in the inventory of the soldier who picked it up.
And can also be picked up again by others.
Anybody know off the top of their head what the behaviour is in this situation? I could setup a test but I'm lazy ๐
// On server
beforeRespawn = _clientPlayerObject call BIS_fnc_netID;
// On server after client respawns
afterRespawn = _clientPlayerObject call BIS_fnc_netID;
// Result of beforeRespawn == afterRespawn?
I don't know what BIS_fnc_netID does in the SP case, but they'll be different otherwise.
wait
iirc it just uses an array and assigns unique IDs to whatever you call
what's _clientPlayeObject?
What it says on the tin, a player object remoteExec'd from the client to server
The question really is if the player is considered the same object after respawn
It's not.
I think the netID changes because the player object changes? 
The old object is still hanging around as a corpse with the old netID. Unless you deleted it.
Cool suspected as much, thx for the confirm lads
The surprising part to me about respawning is that it seems to be done player-local.
Server just gets told about it afterwards.
Well the player object is local to the client
the way I see it is before the client is ready to "take over" it's handled by the server, after the handover it's all the clients responsibility
which makes sense for such a client-central object
anyway...
Any ideas for a hashable value that remains the same on the server per player but resets after the player leaves/rejoins?
leave as in disconnects, or returns to the lobby?
I'm composing the key for a hashMap based on a string and the object
both
fun criteria huh? ๐
I think you'd have to do that manually.
Ugh, but that takes work! And it's friday...
map getPlayerUID or getPlayerID to a value that's set on client state changes.
getPlayerID if you want it to work on a loopback server :P
i used this script that adds the "Intel added" thingy.
Friend allready solved the problem...get the intel added/Task Created/ File still in Inventory .... i dont know how but he did it.
data = [this,"RscAttributeDiaryRecord",["Title","Text",""]] call
bis_fnc_setServerVariable; this setvariable
["RscAttributeDiaryRecord_texture","picture.jpg"];
would like to know if there is a way to add a second picture to that file.
hi, i'm an intermediate zeus and beginning to learn the sqf scripting environment and i want to make sure that im doing this correctly. i have a carrier with an interior stored several thousand meters above it and i want the player to be teleported into it upon interacting with an object. the script works as expected in testing, but i want to make it work in multiplayer. am i missing something with remoteexec? thanks!
[exterior_door, "Enter Carrier Interior", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "_this distance _target < 7", "_caller distance _target < 7", {}, {}, {player setPos (getPos interior_door); player setPosASL (getPosASL interior_door);}, {}, [], 5, 6, false, false] remoteExec ["BIS_fnc_holdActionAdd", 0, exterior_door];
similar issue, this script with a hold action also doesnt show up in multiplayer, i think im missing something
[laptop, "Connect to Network", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{
hint "Net Connection Established";
},
{},
[],
12,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, laptop];
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
oh fancy
player setPos (getPos interior_door); player setPosASL (getPosASL interior_door);```
You don't need both of these, just use `setPosASL` and drop `setPos`
Where are laptop and exterior_door defined?
They are given as the variable name in 3DEN
And you say this isn't working in some MP situation?
Correct, the others I'm testing this with say they don't see it, but it works for me just fine
You're localhost and the code is running in initServer?
Let me double check
Oh, forgot to mention, I'm making this for a Zeus repository for a group I'm with. Sorry, still getting familiar with everything
so im trying to make a booby trap type script where when a person enters a radius of this object an apers mine that is underneath it will explode
its not designed to kill its designed to maim and freak people out mainly
is there a way i can have it that the trigger sets the health to all apers mines to 0 by using its class name?
Something like
in thisList APERSMine setHealth 0; ?
i want there to be multiple of these so i cant use "this" or give it a named variable as i want to be able to place these down as compositions if possible
Thanks! I had figured out the issue, using [this] in remoteExec rather than its variable name worked. Thanks guys! Sorry for the noob questions, I'm still learning :)
so i tried again with a new code i get no errors when making the code but i do in game
but also no explosion
_this = nearestObjects [player, ["APERSMine"], 3];
_this setDamage [1, false];
can someone point me to the best docs for interacting with an object that doesn't normally have options available. A laptop in the instances.
_mines = nearestObjects [player, ["APERSMine"], 3];
{_x setDamage [1, false]} forEach _mines;
Is there a command to add an HMD to a player such as addGoggles or addHeadgear?
There's a command akin to triggerAmmo or something that should be used instead
linkItem
It is just triggerAmmo
https://community.bistudio.com/wiki/triggerAmmo
Only thing is that the object has to be local
TYVM
It possible to format text inside of or use in BIS_fnc_typeText?
you mean like ```sqf
(format ["Text %1", 123]) call BIS_fnc_typeText
I dont know the arguments BIS_fnc_typeText takes because wiki is down
Yeah, if i do that though, it returns an error saying it got text and expected string
whats your code?
_cooldown = _unit getVariable "HD2_Eagle_cooldown_Timer";
[
[
["Eagle Supports on cooldown", "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '1' font='PuristaSemibold'>%1</t><br/>"],
["Support Item returned to caller", "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '0.7'>%1</t><br/>"],
[formatText ["Cooldown: %1", _cooldown], "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '0.7'>%1</t>", 15]
]
] spawn BIS_fnc_typeText;
Cooldown is currently 360 for testing
probably the problem is formatText if my assumption is correct that it turns string to text
I've also tried
_cooldown = _unit getVariable "HD2_Eagle_cooldown_Timer";
_cooldownText = (str _cooldown);
_text = "Cooldown: " + _cooldownText;
[
[
["Eagle Supports on cooldown", "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '1' font='PuristaSemibold'>%1</t><br/>"],
["Support Item returned to caller", "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '0.7'>%1</t><br/>"],
[_text, "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '0.7'>%1</t>", 15]
]
] spawn BIS_fnc_typeText;
``` Which instead of giving an error just hides the last line
try formatText -> format
B_soldier_AR_F
O_Soldier_AR_F
I_Soldier_AR_F
this inconsistency in BIS naming classes is killing me
boi
B_Pilot_F
O_Pilot_F
I_pilot_F
oh boy
don't let me start on czech names in config "hlavni vrtule", ...
"Turtle_F" isKindOf "Man" => true
There is generic animal class, "Turtle_F" isKindOf "Animal" is also true
isKindOf "CAManBase"
Yeah, but its such a newbie trap to select by "Man" inheritance and end up with snakes and rabbits
20yo data & dev history, I agree but what can you do but fix things (and break mods) between gamesโฆ and A4 won't be on RV
that period wasโฆ chaotic, to say the least
'member "campaign DLC"?
Muh sandbox campaign
Nobody knows, but its the same engine and toolset so should be relatively easy
So far everything is getting thouroughly documented
it seems so, at least
Hey guys, im trying to set a variable for an object, im using : _entity setVariable ["sean_alpha","sean_alpha",true]; but when using this it seems its not actually assigning the Variable, I might not be explaining it right..
_entity setVariable ["sean_alpha","sean_alpha",true];
Just gives you a variable inside _entity called "sean_alpha" filled with "sean_alpha"
If you want it to actually vary changed the second parameter in the array to whatever your variable you are reading from.
And how do you try to get is another question
Ill briefly explain what im trying to do
["sss_requestSubmitted",{
params ["_player","_entity","_data"];
if (_entity getVariable ["sss_callsign",""] != "ARTILLERY") exitWith {} ;
[player, selectRandom ["arty1","arty2","arty3"]] call CBA_fnc_globalSay;
}] call cba_fnc_addEventHandler;
This is the script im trying to create - its using Simplex Support and ive just been trying to get the variable name so it can be called for just that one module
so it plays audio for firing
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
Ahh sorry about that
Im trying to use setVariable so that _entity would be considered the item im calling
Im pretty new so Im not sure im using the right things or wording
_entity setVariable ["sss_callsign","ARTILLERY",true];
Now just make sure _entity actually contains the same entity you receive in the eventhandler
_entity setVariable ["yourVariable",0]; // <- this sets the variable and store into _entity
_entity getVariable "yourVariable" // and call the variable, and the name should be the same in order to get the certain value```
Okay I kind of get it, ill give apply this and see how it goes
No fckn way, so I get it now, so basically _entity will be binded to "variable name" using setVariable, and to call that variable i'd use _entity and the name to call it, am I getting that right?
Basically
I've spent actual 3 hours trying to look this up and you guys told me in less than 5 minutes I can't believe this, thank you guys so much
And just to confirm _entity can only hold one variable name at a time right?
no
Conceptually you can think of it as _entity having a "data"-backpack and with setVariable you tie "yourVariable" and the value together and put it in the backpack
So when you pull on "yourVariable" with getVariable the value plops out
this hopefully may help
https://community.bistudio.com/wiki/setVariable
https://community.bistudio.com/wiki/getVariable
no restrictions on the number of vars ๐
I see, however using your example mrCurry
_entity setVariable ["sss_callsign","ARTILLERY",true];
sss_callsign can only be used once? but _entity is the data base
No limit until you break your RAM, but yeah
Correct
Well, "sss_callsign" can only contain 1 value, you can read/write any number of times
but ofc you can reference arrays and hashmaps and build it as complex as you want
This is making so much more sense to me okay, thank you all very much for the information
you can also store an array with multiple values in it ๐
I am once again asking for help ๐ tried to figure it out myself but can't seem to get this one to work now
sss_requestCompleted works for artillery but doesnt for Aircraft, Variable is working just the sss_requestCompleted, not sure what im doing wrong here. hopefully this isnt a mod related question sorry if so
["sss_requestCompleted",{
params ["_player","_entity","_data"];
if (_entity getVariable ["sss_callsign",""] != "Iceman") exitWith {};
[player, selectRandom ["icemancomp1","icemancomp2","icemancomp3"]] call CBA_fnc_globalSay;
}] call cba_fnc_addEventHandler;
Is there a way to unlocazise something? So basically if I have the input "Large Avulsion" I want to get the raw text retured "STR_ACE_Medical_Damage_Avulsion_Large".
with configs yes: https://community.bistudio.com/wiki/getTextRaw
Tried that already, did not get it to work.
- read config translations
- getText them all
- compare
q
Quick question is there a way to detect witch respawn player selected in respawn menu ?
no?
why i cant open the website (also a friend cant open it when i sent him the link)
ah nvm it works now
weird
maybe a temporary cache issue; there was an update this morning
How can I get an array of map markers close to a player's position? I' tried various versions of this including nearObjects
_nearbyMarkers = nearestObjects [player, ["Marker"], 1000];
allMapMarkers select { player distance getMarkerPos _x < 1000 };
```I assume
Sorry, I meant to specify a specific type such as:
dataType="Marker";
position[]={5898.396,74.980003,20191.879};
name="NonCon_Abandoned_Village";
markerType="ELLIPSE";
type="ExileNonConstructionZone";
Wanting to find all "ExileNonConstructionZone"
like this ?
allMapMarkers select { player distance getMarkerPos _x < 1000 && markerType _x == "ExileNonConstructionZone"};
Yes, thanks. That did it.
Hello I'm trying to disable the arty computer but when I put the scprit in eden edtior in the unit it works for me but not others and running it through with zeus doesn't change it
@terse rover
enableEngineArtillery false;
should work if executed in the mission or unit init
@Anyone: Is there a way to check (in script) if
compile _some_string
``` throws an error due to incorrect syntax?
The result seems to be the compiled code no matter if the game throws a syntax error or not...
nope
"just write it right" ๐
Aight, I'm just putting in some basic hooks anyway so I'll just push the problem on the next guy then ๐ Cheers
Does anyone know how to check if there is a notepad in the player's inventory, for example.?
"yourItemClassname" in items player
why does it happen ๐ฆ
seems like the classes array part doesnt work, but i dont get why
Probably scope issues, depending on how you're calling it.
If you call that global function from other code, it can't necessarily see the _unitClasses as it's locally defined outside the function.
I notice that "name" of a unit sometimes gets cleared when a player unit dies, but othertimes it doesn't. Anyone know why?
Is there a killed event handler that I can attach to a remote unit and have the event handler run on the server?
MPKilled MP EH? It will also fire on clients, but a quick isServer check will take care of that
looks like entitykilled mission event handler was what I was looking for.
However, I'm still looking for an explanation for why "name" for dead player units is sometimes cleared and sometimes not cleared.
What is cleared and not cleared name?
concerning the value returned by the "name" command.
Some time after a player has died, the corpse's "name" is sometimes cleared to "". But other times, it's name remains the name of the player that conrolled it.
Hmm, no idea, sounds like typical MP mess. Just tested and local corpse seems to retain the name properly. Likely happens with remote units.
Unless you do something else that triggers name update
so far it seems to be only the host player's name that gets cleared when the unit he was controlling dies
Testing as player server, doesn't get cleared so far
Tried on remote player, name reverts to bot name as soon as player respawns
Oh no, not as soon
Randomly it seems
In other words name is unreliable after unit's death
Hell, it is unreliable while unit lives, I used to display icons over players with name and sometimes it ended up Error: No unit
Right now I keep last player owner on units and broadcast a hashmap with owner history and their names
No matter what I do I cannot get this addAction to close the doors on this building. Right now I'm trying to use the edit door module synced to a trigger, and have the action set a variable to true to trigger the trigger
But nothing happens
in terms of the door anyways
post code
Well originally I used it to call an sqf, but I couldn't get the door to open via animateDoor
This is the code on the object sqf call{this addaction ["Reset Markers",{{ deleteVehicle _x; }foreach (player getvariable ["hitMarkers",[]])},0,0,true,true,"","_target distance _this < 3"]; resetdoor = true;}
oh wait
I put it outside the addAction
Doesn't work anyway though
Basically all I'm trying to do is make it so when you hit a button, it closes all the doors of the building in addition to another action
I see nothing related to closing here
That just has it set resetdoor to true in an effort to trigger the trigger object which has the door module synced to it
_cqc = nearestBuilding khmark;
_door = 1;
for "_i" from 1 to 7 do
{
_cqc animateDoor ["open_door_1", 0];
_door = _door + 1;
};```This was the script I was trying to have it call originally, but again the animateDoor doesn't seem to do anything with this specific building
animateDoor doesn't work but module does?
Try animateSource, I just did on some random A3 building and it works
cursorTarget animateSource ["Door_1_sound_source", 1]
Also you need to find door animation name from config, it might not be the same as vanilla buildings
under animation source in cfg it has that name of open_door_1
and subsequent doors
Oh that worked
how would I call the script? I had it in the addAction but that deosn't seem to work
call compile preprocessFileLineNumbers "somescript.sqf"
Or lazy scheduled
0 execVM "somescript.sqf"
Or better define your script in CfgFunctions or somewhere in the script and just do call myfunction
I got it, thanks for the help @meager granite
Sa Matra. When will you release koth for reforger?
Noob question, i've disable ai target for a dude in it's init, but when i walk into a trigger with enable ai target, it doesnt seem to work. How come this is happening?
Post your code
this disableAI "TARGET" for init and Soldier1 enableAI "TARGET"; for trigger
Are you sure:
- the trigger is working for sure
- the
Soldier1is the correct variable
i have a hint that says working when i activatre the trigger
and the hint works
so the trigger is defs activating
Any Mods you have? Especially AI Mods
yes, lambs
Try without
I had the ai disabled in the editor for lambs but ill try with it not enabled in the launcher
still doesnt work
What about any other Mods
nothing that affects ai
this has worked in the past with lambs enabled
idk why its not working now
Try vanilla
gotta quickly remake it
in vanilla the ai doesnt even disable
trying enableFeature
doesnt work either
That does mean your way to script is not correct
What about disableAI "ALL"
how did you check that it doesn't work?
did you use checkAIFeature?
Yes i've used both
you mean you did systemChat str (soldier1 checkAIFeature "Target") and it returned false?
I'm saying checkAIFeature not setAIFeature
BIKI mentions about issues when using TARGET as the parameter value. Maybe it could explain something?
i havent used setAIFeatures, will give a go
didnt even think that was a command
like theres enableaifeature?
if thats what you're refering too
This post exactly is Leo's suggestion
Dev-Branch or Stable Branch of Arma 3?
stable branch
well do you actually enable it before calling systemChat?
also nvm this ๐
it's already disabled which means it was working anyway...
in your trigger code:
soldier1 enableAI "Target";
systemChat str (soldier1 checkAIFeature "Target")
so before trigger its false, on trigger its true
before trigger the ai is shooting anyway
and ai continue to shoots after trigger
Bug?
Maybe ๐ค
For playable units.... it seems that eventhandlers and variables are shared between the same unit but across respawns. I.e, when the unit respanws, it still has the same event handlers and variables attached to it that the corpse had. Am I understanding this correctly?
Yes
Its for all units I think
Engine-driven respawn re-adds all event handlers and variables to new unit (old unit\corpse also retains them)
is it that the corpse retains them, or that the corpse is a copy of the unit, and the unit retains them?
Is it possible to have configurable keybinds for use with cusome functionality defined in displayAddEventHandler "KeyDown" event handler?
Not sure what you asked
When respawn happens, new entity gets same EHs and variables that previous entity has at the moment of respawn.
whats the most efficient way to get the closest unit from an array of units to a target unit?
Does findDisplay 46 not work if you have more than one client running on the same machine?
Shouldn't be related, you're doing something wrong elsewhere
How big is the array?
private _distances = _units apply {_x distance _target};
private _closest = _units select (_distances find selectMin _distances);
```comes to mind, not sure if its faster than `sort`
I don't like sort for performance because you need to build nested arrays
GIB selectMinIndex
or findMin whatever name is better
<12 (group size)
Measure against
private _sort = _units apply {[_x distance _target, _x]}
_sort sort true;
private _closest = _sort select 0 select 1;
Bet sort would be worse ๐ค
yep it is
I am curious, if I wanted to make a helicopter for example, have a force constantly applied to it forward (like how scifi mods, them their definitely not helicopter model aircraft have addaction to "fly" forward) how would I go about it? I mean am not sure which code to use. Do I teleport them forward all the time by very small margins, or is there other way?
addForce, taking frame time into account
Depends on what you want
setVelocity each frame could also do what you want
addForce will constantly increase the velocity compared to static and instant setVelocity
Something like this I assume?
addMissionEventHandler ["EachFrame",
{
vel = velocity this;
dir = getDir this;
this setVelocity [
(vel select 0) + (sin dir * 10), (vel select 1) + (cos dir * 10), (vel select 2)
];
}];
Multiply your addition by diag_deltaTime so its more stable at different FPS
Got recommended a video recently, very much related to this: https://www.youtube.com/watch?v=yGhfUcPjXuE
DeltaTime. This video is all about that mysterious variable that oh so many game developers seem to struggle with. How to use DeltaTime correclty? I got the answers and hope this video will help to deepen your understanding about how to make frame rate independent video games.
0:00 - Intro
0:34 - Creating The Illusion of Motion
1:11 - Simple Li...
Hello, I'm trying to understand how to get information out of cfg and I'm trying to run the following, expecting to get a list of the names and their attributes. What am I doing wrong?
getArray (configfile >> "CfgWorlds" >> "Stratis" >> "Names")
empty array?
yes
ok well make sure "Stratis" is correct and it has the "Names"
your code looks fine its not that
cfgviewer is giving me the following path: configfile >> "CfgWorlds" >> "Stratis" >> "Names"
"names" seems to be a class, not array
Oh, I see. How can I access the attributes inside it? I want to get settlement positions and I see they look like this: configfile >> "CfgWorlds" >> "Stratis" >> "Names" >> "Girna" >> "position"
Example:```sqf
getArray (((configfile >> "CfgWorlds" >> "Stratis" >> "Names") select 0) >> "position")
How can I get the other attributes that aren't arrays?
private _names = configfile >> "CfgWorlds" >> "Stratis" >> "Names";
for "_i" from 0 to (count _names - 1) do
{
private _nameCfg = _names select _i;
systemchat format [">> %1", getArray (_nameCfg >> "position") ];
};```
I found the page with the getters, thank you for the help! https://community.bistudio.com/wiki/missionConfigFile
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
if (_item == "lopatka_inventar") then {........}];
How to change this handler to the opposite condition so that the script works not on the presence, but on the absence of an item in the inventory.this method does not produce results.
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
if (!(_item == "lopatka_inventar")) then {deleteVehicle ddddd}
}];
_item != "..."
I tried to register it in a separate handler, inserted it into the same one, there was no reaction.
show full code
player addEventHandler ["take", {
params ["_unit", "_container", "_item"];
if (_item == "lopatka_inventar") then {_lopata_spina = "Lopata_building" createVehicle position player;
_lopata_spina setVectorDirAndUp [[0.9,-0,-1], [0,8,1]];
_lopata_spina attachTo [player, [0.05,-0.25,0.3], "pelvis",true];
_lopata_spina setVectorDirAndUp [[0.9,-0,-1], [0,8,1]];
_lopata_spina attachTo [player, [0.05,-0.25,0.3], "pelvis",true];
if (_item != "lopatka_inventar") then {deleteVehicle _lopata_spina }
}}];
what in the name of syntax
sqf
use advanced developer tools mod by leopard
how can an item both not match and match a string?! 
this is what you have:
if (_item == "lopatka_inventar") then {
...
if (_item != "lopatka_inventar") then {
...
you can also just use else
but anyway, I think you want to do something that can't be done like that
you want to attach an item to the player when he picks up an item, and detach/remove it when he drops the item
player addEventHandler ["take", {
params ["_unit", "_container", "_item"];
if (_item == "lopatka_inventar") then {
_lopata_spina = "Lopata_building" createVehicle position player;
_lopata_spina setVectorDirAndUp [[0.9,-0,-1], [0,8,1]];
_lopata_spina attachTo [_unit, [0.05,-0.25,0.3], "pelvis",true];
_unit setVariable ["_lopata_spina", _lopata_spina];
};
}];
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
if (_item == "lopatka_inventar") then {
deleteVehicle (_unit getVariable ["_lopata_spina", objNull]);
};
}];
Everything worked, thanks for what I wanted
createDialog vs BIS_fnc_displayMission?
One creates dialogs and the other just returns a display ID
They're not really comparable because they don't do the same thing at all
Hello there, I have once again a question that could be quite easy to solve, but I can't seem to wrap my head around it.
I've used AliasCartoon's intro scripts to make a nice intro for a scenario. https://steamcommunity.com/sharedfiles/filedetails/?id=660221885
As per the video that introduced it to me, it looked like it could be used in multiplayer, as the mission the guy made to showcase it had enough slots for a whole squad.
I've exported it once it looked fine to multiplayer and put the PBO in our dedicated server.
But, on the server, it doesn't work, for some reason we're stuck on a camera facing a seagulls's cloaqua ๐
Any idea why that doesn't work ?
Sorry, i'm quite a rookie in using scripts
like what am I doing wrong. and the other thing, I have yet to get a variable to permently be displayed on screen and its been like 2 weeks
idc number?
If i'm not mistaken, the whole description.ext, init.sqf, mission.sqm and all the other files used in the mission file are also inside the pbo made when exported to multiplayer, yes ?
Everything contained in the mission folder (the one that ends in e.g. .Altis) is packed into the PBO
Alright, so the issue isn't from the server missing a file, then
Neither of them return or use IDCs.
IDCs are used to identify Controls. They are of data type Number, and a control's IDC, if it has one, is defined in its config. Commands that can use IDCs will have that mentioned in their syntax documentation. For example, displayCtrl can use an IDC to return the Control (actual data type Control) which has that IDC.
IDDs are the same but for Displays. createDialog does not use or return IDDs; it returns the Display it created directly (data type Display), not an IDD (Number). BIS_fnc_displayMission uses IDDs inside itself to get the current main Display, depending on whether we're in the Intro/Outro/Mission/Editor, and then returns that Display.
alright.... well what function do I need to return a display for a objective
You possibly need the command findDisplay, but you might need to expand more on what exactly you want to do.
I need to display this: https://pastebin.com/Mn5YVJ3C
https://community.bistudio.com/wiki/GUI_Tutorial#createDialog_vs_createDisplay_vs_cutRsc
Depending on how you want your display to behave, you can use createDisplay, createDialog, or cutRsc. You only need to provide a display reference if you want to use createDisplay; the command page shows how to do that. The other two commands don't require a parent display; the created display is independent.
holy shit. three opition for displaying something. this code is a nightmare.
There are three options because they all behave differently, and those differences can be useful depending on what you're trying to do.
this is incorrect? Weapons_Levels = createHashMapFromArray [ ["B_Soldier_F", [ // Level 1 Weapons ["arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F", "Binocular", "hgun_Pistol_01_F"], // Level 2 Weapons ["Binocular", "arifle_SPAR_01_snd_F", "arifle_SPAR_01_khk_F", "arifle_SPAR_01_blk_F", "arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F"] ]], ["B_soldier_AR_F",[ ["arifle_MX_SW_F",] ]] ];
Weapons_Levels = createHashMapFromArray [
[
"B_Soldier_F", [
// Level 1 Weapons
["arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F", "Binocular", "hgun_Pistol_01_F"],
// Level 2 Weapons
["Binocular", "arifle_SPAR_01_snd_F", "arifle_SPAR_01_khk_F", "arifle_SPAR_01_blk_F", "arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F"]
]
],
[
"B_soldier_AR_F", [
["arifle_MX_SW_F",] // the comma has nothing to do here
]
]
];
no, where did you see that
The comma tells the game to expect a next element in the array > it finds ] instead > panik
so i am looking at the docs and see sqf findDisplay 46 createDisplay "RscCredits";, so i understand it as ```sqf
private _laptop = missionNamespace getVariable ["laptop2", objNull];
if (!isNull _laptop) then {
_laptop addAction ["Hack Laptop", {
createDialog "HackingProgress";
findDisplay 1001 createDisplay "HackingProgress"
}];
};```
wait i need to delete createDialog
The left argument for createDisplay, which in the example is provided as findDisplay 46, is the parent display, within which the created display will exist.
Display 46 is the main mission display, and is the most commonly used display for in-game dialogs and stuff.
I don't know what Display 1001 is and I'm not sure if there is one in the base game. If there isn't, this will fail because it doesn't exist; if there is, it still might not work because it may be a specific display that only exists at certain times.
well I guess its more like this sqf MyUnit disableAI "AUTOTARGET";
so how would I get that to disable all friendly AI
globally for a mutliplayer server
{
[_x,"AUTOTARGET"] remoteExec ["disableAI"];
} forEach units west; // resistance, east, civilian
(note: doesn't handle units created later, that's more complicated)
disabledAI is for all AIs, not just "friendly" ones
eh,
description.ext disabledAI is different to disableAI, btw.
The description.ext parameter controls whether AI units are created for playable units that don't have a player. disableAI is for controlling AI behaviour features for existing AI units.
what's best setting for disabledAI (Description.ext)? in CTI mission
1 or 0, your call
well i dont want AI to takeover any player slots
then 1 to disable any AI thing
does anyone know on how to easily make a foreach selection random for a Hashmap? I know hashmap are already random, but when it is set initially from there the values are always in the same order if you let it run through a forEach. I basically want a random key to be selected every time it runs but I still want it to run through every entry in hashmap. To make it more easy to understand:
hashmap: ["key1","value1, "key2","value2, "key3","value3]
In forEach it might grab it like this: [ "key2","value2, "key3","value3,"key1","value1] and next time you call it, it will be grabed the exact same way. I want to make that random so that there is always a diffrent key getting grab first from foreach and not alway key2 and then 3,1 in this example.
private _shuffledKeys = keys _hashMap call BIS_fnc_arrayShuffle;
{
private _value = _hashmap get _x;
// ...
} forEach _shuffledKeys;```
Hey guys, this is the completion section of a holdAction in a composition I'm working on. The hint fires as expected, but the texture change has an error saying it is an Array rather than a String, Bool, Object, or Group. I do know what an array is but I'm confused as to why that's how it's being recognized and how I can fix it. Thanks!
{
"Net Connection Established" remoteExec ["hint"];
[_this, [0,"a3\structures_f\items\electronics\data\electronics_screens_laptop_co.paa"]] remoteExec ["setObjectTexture", 0, _this];
},
Is the code happen in holdAction and its completion?
Yes, it worked before I added the texture change just fine. Here's the full code:
[laptop, "Connect to Network", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{
"Net Connection Established" remoteExec ["hint"];
[_this, [0,"a3\structures_f\items\electronics\data\electronics_screens_laptop_co.paa"]] remoteExec ["setObjectTexture", 0, _this];
},
{},
[],
3, //set to 3 for debug
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, this];
params ["_target", "_caller", "_actionId", "_arguments"];```Completed's `_this` does have this
In action code parameters, _this never refers to the object the action is attached to. In some action condition parameters, it refers to the unit who completed the action; in other action code parameters, it contains an array of various information, including the object the action is attached to.
In all holdAction code parameters, the _this array is already parsed into a set of named variables you can use. The object the action is attached to is available as _target.
See: https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd, https://community.bistudio.com/wiki/addAction
That makes sense. Sorry for the noob question, still learning :)
Guh.
I've got two units in a helicopter, one in the pilot seat (named Copilot in the script for reasons), and one in the crew cabin. They are separate groups.
This script is supposed to scoot the copilot back to his seat, while leaving the engine running.
For some reason, though, the passenger gets out.
copilot moveout Dragonfly;
group copilot leaveVehicle Dragonfly;
copilot moveinturret [Dragonfly,[0]];
Dragonfly engineon true;
I can work around it by just forcing them back in, but I wanna know why.
Replacing the leaveVehicle with unassign/assignasturret worked once, then stopped working T_T
Is it possible to get which grenade the player currently has selected?
Are there any sources to verify that something is a bug? And a way to report it?
This is referring back to the TARGET ai feature thatโs not working as intended @warm hedge
Is it possible to tell if a player is ready to throw a grenade. I.e., they have reloaded the mag since the last throw?
#arma3_feedback_tracker and let them/us know so we/Bohemians can also try to verify
is there a straightforward way to draw a picture next to a "RscProgress" progress bar?
Using an RscPictureKeepAspect, probably
RscProgress sucks and you might as well just resize an image or a text control
I can't quite figure out how to put an image into a control. Is it set through the control's text?
never mind, figured it out
I am so sorry for all the dumb questions but I've been really having trouble creating an object with an interaction using objectsMapper. The return value of objectsGrabber has a spot for init code, so I tried throwing my code (just an interaction that teleports the player) in there to no avail. My current solution is to create a variable with the action code in it and then call that in the init code field, and the game loads without an error, but the interaction just doesn't show up. Is this just not possible? For reference, the use case is to create a bunker that, upon entry, teleports to a separate, fully-fleshed out interior, and spawning it using a script to avoid certain types of pain. Here's the relevant parts of the code:
bunkInteriorParams =
{
[bunkInterior, "Exit Bunker", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "_this distance _target < 4", "_caller distance _target < 4", {}, {}, {player setPos (getPos bunkEntrance);}, {}, [], 5, 6, false, false] remoteExec ["BIS_fnc_holdActionAdd", 0, this];
};
bunkEntranceParams =
{
[bunkEntrance, "Enter Bunker", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "_this distance _target < 7", "_caller distance _target < 7", {}, {}, {player setPos (getPos bunkInterior);}, {}, [], 3, 6, false, false] remoteExec ["BIS_fnc_holdActionAdd", 0, this];
};
["Land_Drainage_01_F",[-6.06445,0.371094,0.0391998],230.883,1,0,[21.8998,-7.76198],"bunkEntrance",bunkEntranceParams,true,false], //this is the object I am trying to put an interaction on
["Land_Wreck_Heli_02_Wreck_04_F",[1.10547,9.94531,1.27695],90,1,0,[2.50431e-006,-89.327],"bunkInterior",bunkInteriorParams,true,false], //this is the other object
I've tried a lot, but nothing seems to work. The current implementation gave me in error in the objectsMapper function itself.
Also, how can I change Object Specific properties that you can see in the editor using a script? Like how do I refer to them?
I don't know objectsMapper you mean, but are you sure those codes are called in that way? What if you try to call an obvious script, like hint does it work?
objectsMapper is BIS_fnc_objectsMapper that spawns objects using an array, formatted in the same way that BIS_fnc_objectsGrabber returns. I tried hint, with parameters, and it worked just fine.
Okay, I figured it out. I'm infurated. It was totally fine not throwing the commands into a variable, but because they have quotes in them they have to be surrounded by apostrophes.
Hmm, are you sure this is a Magic Variable you can use in that context?
Ah hmm yeah, it was just String vs Code?
Yup. I forgot the apostrophes so it interpreted the quotation areas as strings and the rest as code. Sorry for the stupid mistake
_cfg = loadConfig "mission.sqm";
_addons = getArray(_cfg >> "addons");
_cfgPatches = configFile >> "cfgPatches";
_addons append configSourceAddonList(configFile >> "CfgWorlds" >> worldName);
_dep = _addons;
while {count _dep > 0} do
{
_newDep = [];
{
_newDep insert [-1, getArray (_cfgPatches >> _x >> "requiredAddons"), true];
} forEach _dep;
_dep = _newDep - _addons;
_addons append _dep;
};
_mods = _addons apply { configSourceMod (_cfgPatches >> _x) };
(_mods arrayIntersect _mods) - [""];
Hello, i have this code which in results gives me mods needed to load a different mission with different mods everytime but i have one problem. I can fetch only mods for mission and terrain itself, but not dependencies for the mods. I have been hardcoding deps for some time but it's getting spaggetti really fast so it would be nice if someone can help me with this script to upgrade it to append dependencies for those mods as well. Thanks in advance
Do you need it for activateAddons?
I am activating it by making a preset everytime in seperate program i wrote for Discord / Arma integration
Hey guys,
I would like to get the datetime via the sunangle as input , this function right here gives you the sunangle via the time but I would like to invert it , does someone have a idea ?
private _latitude = -1 * getNumber (configFile/"CfgWorlds"/worldName/"latitude");
private _day = 360 * (dateToNumber date);
private _hour = (daytime/24) * 360;
private _sunAngle = ((12 * (cos _day) - 78) * (cos _latitude) * (cos _hour)) - (24 * (sin _latitude) * (cos _day));
parseNumber ((round _sunAngle) toFixed 0)
i only need to get the deps of required mods so it's complete for simple mission usage. So far if for example i use 3CB, i add it's deps either manually or by integrating it hardcode (which gets me to this point now)
Sorry, couldn't understand what you're doing.
following code, when used in Arma 3 Debugger (ctrl+D in Editor) results in this:
["@AS Main","@Jbad","@CUP Terrains - Core","expansion","@ace","@3CB Factions","enoch","curator","@CUP Vehicles","@Global Ops Terrains","@CBA_A3","@Enhanced Movement Rework","@The Free World Armoury","@Task Force Arrowhead Radio (BETA!!!)","@S & S","@RHSGREF","@S & S- New Wave","@RHSUSAF","mark","@Niakala","@RHSAFRF","@CUP Units","@Enhanced Movement","tank","@CUP Weapons","aow","heli","tacops","jets","orange","kart","argo"]
For a given mission, this is end result of code. It's only missing dependencies for some of mods itself. I am trying to expand this list of mods by those mods that are missing.
Shouldn't requiredAddons cover mods dependencies?
Unless you mean you want requiredAddons of requiredAddons
Exacly this, i want requredAddons of requiredAddons ๐
private _addons = (getArray(loadConfig "mission.sqm" >> "addons") + configSourceAddonList(configFile >> "CfgWorlds" >> worldName)) apply {toLower _x};
private _cfgPatches = configFile >> "cfgPatches";
private _getDeps = {
{
if(_addons pushBackUnique toLower _x >= 0) then {
_x call _getDeps;
};
} forEach getArray(_cfgPatches >> _x >> "requiredAddons");
};
{_x call _getDeps} forEach _addons;
private _mods = _addons apply { configSourceMod (_cfgPatches >> _x) };
(_mods arrayIntersect _mods) - [""];
try this, didn't test
Sure thing, seems to checkout but will test further
Im not sure if this is right place to ask, but is there any way to remove the render distance limit that dictates how far ai can engage enemies?
well its math lol
you are correct
You know the sun angle, the day and latitude and you want the hour?
Or are you asking for something impossible?
yea sun angle,day and latitude
Yeah it's just maths then :P
private _sunAngle = ((12 * (cos _day) - 78) * (cos _latitude) * (cos _hour)) - (24 * (sin _latitude) * (cos _day));
just revert it
x = y +1
y = x - 1
its se same, but some extra leters lo l
_hour = acos ((_sunAngle + (24 * sin _latitude * cos _day)) / ((12 * cos _day - 78) * cos _latitude));
damn im rusty in math
I got this out _day = ((((_sunAngle + (24 * (sin _latitude) * (cos _day))) / ((cos _latitude) * (cos _hour))) + 78) / 12) * cos _day; but thats probably wrong lol
I will give it a try , ty man
if by date you mean both day and hour, you can't get it from that equation
you have 2 unknowns and 1 eq
Apparently he knows the day
yea
_cosday = cos _day;
_cosLat = cos _latitude;
_sinLat = sin _latitude;
_hour = acos (_sunAngle + (24 * _sinLat * _cosday) / (12 *_cosday - 78) * _cosLat);
ive landed near too, so probabl jhon is right
then why do you write I got this out _day =?! 
you need the hour not the day ๐
You need more brackets :P
((((yes))))

btw out of curiosity, where did you get that equation?
I'm pretty sure that the actual equation was a lot more complicated 
sun angle is the elevation right?
sunangle goes from -24 to 90 and yea it is about the position of the sun
actually I found a easy way with linearconversion I think
weird I have something different in my textbook 
where n = day of the year (with n = 1 for January 1).

actually I showed the wrong pic. I meant this:
Does anybody know if there are any configs specific to throwable projectiles (such as hand grenades, flares, smoke), that can be used to easily identify if a projectile is one of these types?
no. you should read the config values
e.g. simulation
what about simulation?
for grenades, simulation = "shotGrenade"
Looks like shotsmokex and shotgrenade are the simulation values for grenades and smoke throwables.
Hey, will the following in a gamelogic's Init be executed for JIP?
[]spawn {
while {true} do {
call VFX_fnc_sparks;
sleep 5;
};
};
ideally this just makes sparks every 5 seconds.
should, yes
And I should NOT remoteexec the sparks because it's already "local", right?
Totally new question. I'm using eyepos to draw icons using draw3d mission event handler. However when units move, the position returned by eyepos seems to stutter a lot. Anyone know why this is and how to get around it?
eyePos is not a visual pos
you need a position in render (visual) time
you can for example do this:
_eyePos = _unit modelToWorldVisual (_unit selectionPosition ["eyeleft", 1e15]);
what does 1e15 represent exactly?
memory lod
tho it seems like it's not defined there
well you can just hack it 
_unit modelToWorldVisual (_unit worldToModel ASLtoAGL eyePos _unit);
About the grenade thing again. Do you think it is faster to look up a config value for a projectile, or just to check if the magazine it came from is "in" one of several in an array?
neither. use a hashmap
well config one should be faster but still neither is fast enough
using "mag in hashmap" the best way to check if it's in there?
didn't you mean reading some value for some projectile? e.g. checking if a projectile is a grenade?
from the event handler, it gives [ammo] and mag, figured I'd just check if the mag was one of several types.
generally speaking, you should check the ammo.
but if all you're checking is if some projectile is a grenade/smoke, I guess using config is better than hashmap because I don't think it justifies the memory consumption
_sim = getText (configOf _ammo >> "simulation");
_sim == "shotGrenade"
vs
_mag in _grenades // or _ammo in _grenades, depending which one you prefer
the difference should be less than 0.001 ms
but checking the hash should be faster than checking an array, correct?
anyway, to answer this, if you need to search in a big array, use a hashmap instead
yes
I'm looking for the best way to attach an event handler to all playable units, on each client. Suggestions?
initPlayerLocal.sqf*?
If you have the magazine, you can wait for 2.18: https://community.bistudio.com/wiki/isThrowable
isn't initPlayerLocal.sqf executed only on the client that is connecting?
Actually let me restate my problem. I want to use unitSetAnimSpeedCoef, which only has local effect, but I need it to be global, so that any player sees all players animated at the same speed.
Also, I guess I should ask if changing animation speed is known to break any other aspects of the game, such as whether certain actions (such as healing) will still perform correctly.
remoteExec setAnimSpeedCoef?
In initPlayerLocal.sqf:
waitUntil {!isNull player};
[player,_coef] remoteExec ["setAnimSpeedCoef",0,true];
// if necessary, add a Respawn EH that does the same thing for the new unit```
speaking of event handlers, on a player unit (where AI is disabled), if the player leaves the server and then reconnects and takes control of the same unit, or another player connects and takes control of that unit.... then (on other machines on the network), does the unit still have the same event handlers it had before the original player left?
depends if the unit gets deleted on disconnection or not
Do you guys know if changing the animation speed is known to break anything important in the game?
so far, nothing
beware of too much speed though, ofc ๐
i was only going to increase by 15%
Are all mission and display event handlers removed when a player disconnects from a mission, or when the mission ends or restarts?
yes
Hey guys is there any script to reduce turret rotation speed, i want to slow down turrets from ww2 vehicles because they are very unrealistic, some of them are but others are not
Not possible without a config mod
is there a command to get the current magnification or fov of the camera?
No
You can get FOV with these commands:
https://community.bistudio.com/wiki/getObjectFOV
https://community.bistudio.com/wiki/getResolution
is there a way to draw an icon using draw3D, in such a way that, the bottom of the icon is visually aligned with a position in the 3d world.
Is there a command to return if a unit (in this case the player) is currently spriting?
Is there a way to force the player unit to throw a grenade WHILE they are moving? These two cause the player to throw a grenade, but only if they are NOT moving. [player, _currentThrowable select 1] call BIS_fnc_fire; player forceWeaponFire [(_currentThrowable select 1), (_currentThrowable select 1)];
This doesn't seem to have any effect on the player:
```player fire (_currentThrowable select 1);````
_state = animationState _unit;
_action = getText(configFile >> "CfgMovesMaleSdr" >> "states" >> _state >> "actions");
_cfg = configFile >> "CfgMovesMaleSdr" >> "actions" >> _action;
_state in [
toLowerANSI getText(_cfg >> "FastF"),
toLowerANSI getText(_cfg >> "FastFR"),
toLowerANSI getText(_cfg >> "FastFL")
]
Is there any way through scripting to sort the order in which gear appears in an arsenal box?
Please tell me the command using the eventhandler "AnimChanged" so that the shovel becomes invisible behind your back.A shovel is a variable _lopata_spina.Previous codes :
player addEventHandler ["take", {
params ["_unit", "_container", "_item"];
if (_item == "lopatka_inventar") then {
_lopata_spina = "Lopata_building" createVehicle position player;
_lopata_spina setVectorDirAndUp [[0.9,-0,-1], [0,8,1]];
_lopata_spina attachTo [_unit, [0.05,-0.25,0.3], "pelvis",true];
_unit setVariable ["_lopata_spina", _lopata_spina];
};
}];
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
if (_item == "lopatka_inventar") then {
deleteVehicle (_unit getVariable ["_lopata_spina", objNull]);
};
}];```
any way to tell if a unit either AI or player is talking (either using game's built in sounds, or VON)?
In the case of the direct channel for getplayerchannel, does it rightfully only detect the channel if the listening client is in range of the talker?
Only if listener satisfies all conditions to be able to listen to the talker
so range, side, group, etc. whatever channel requires
So overcome that you can have each client script-broadcast their talking state yourself
if(getPlayerChannel player != oldchannel) then {
oldchannel = getPlayerChannel player;
player setVariable ["my_channel", oldchannel, true];
};
something like this
Wiki says it only detects the channel if the speaker is making a sound, but that doesn't seem to be the case. Or else it isn't the case when push-to-talk is used.
Is there a way to allow custom keybindings for scripted events in a mission?
yawns
When using the unitCapture command, it works fine, but I somehow can't copy anything to the clipboard when it prompts me to copy the movement data by pressing F1 or F2, my clipboard stays empty
Just in case do you do in MP?
No, Eden.
Are you sure no software else is using clipboard?
Well hard to tell though
What about Windows + V?
Clipboard is empty
Quick, and daft one, as usual
I am in group with callsign "Raven 1-1"
_unit = group player;
hint fo0mat ["%1",_unit];
returns "B Raven 1-1"
Why is this?
it just is , B for Blufor
group player //"B Raven 1-1"
groupId group player //"Raven 1-1"
The engine programmers probably wanted to include the side of the group in Group::toString because multiple groups can have the same ID as long as these groups belong to different sides.
Was trying to read ammo counts off memory with extension, good things cheaters already figured it and explained obfuscation that BIS did for it
AKA no file patching and extension whitelisting ?
Well I guess I'll have to ask for extension to get whitelisted
hey, anyone know why this wont work?
this addAction ["Teleport To: Garages", {_caller setPos getPosATL garages}];
it works when i replace _caller with the variable name for the player, but i want to make it multiplayer compatible and according to the wiki page for addAction, i should just need to add _caller to the varible to set the position of, but this doesnt seem to work
2015 >still no scripting command to get and set ammo counts for magazines
You just need to use params first:
this addAction ["Teleport To: Garages", {
params ["_target", "_caller", "_actionId", "_arguments"];
_caller setPosASL getPosASL garages;
}];
ah, got it, thanks o7
Engine limitation
No its "BIS designers didn't need it yet" limitation
Note that if you want to include extra parameters, you can to use the 3rd argument of addAction (I'm thinking about the variable garages)
this addAction ["Teleport To: Garages", {
params ["_target", "_caller", "_actionId", "_arguments"];
private _garages = _arguments select 0;
_caller setPosASL getPosASL _garages;
},
[ garages ]
];
I'm reading the docs about seats in vehicles and I see many FFV turrets, FFV cargo. What the heck is FFV?
Firing From Vehicle
that's when you can shoot from a car window for an accuracy experience near zero?
thanks @winter rose
Sa-Matra, BE will auto whitelist extensions. Or you can send BE an email with filename for extension (you need client to block it beforehand)
Important you will need to code your SQF to work without the extension
BattlEye will block whitelist extensions (appears to be random, i swear the code is buggy), but its prob happens when BE is getting DDOS.
I have a certain compound full of agents that is supposed to be seen by player and as soon as he detects it, a code will fire. I thought of placing a 200cm helper sphere slightly above it and use checkVisibility, but no matter what I try, no matter what distance, it will return 0.09[...], or 0.11[...] if close enough but never higher than 0.12, so I think it isn't very reliable. I do not see a knowsAbout variant that would work with a group or a dozen of spawned agents, so idk what to do now
yeah no idea how one can reach 1 visibility unless wiki is wrong
Thanks for details. I'll use extension on server side only probably so it should be less of an issue.
checkVisibility
that's not affected by distance, time of day, and weather
use targets + targetKnowledge or targetsQuery
e.g.:
_knownAgents = myAgents arrayIntersect (player targets [true]);
_knownAgents findIf {time - (player targetKnowledge _x select 2) < 1} >= 0
Technology just isn't there yet to set ammo counts
"read ammo counts off memory with extension" ffs BIS it's 2015
i've only ever used addMagazineAmmoCargo with crates, can you not set it for player inventories?
Cool moon
If i want to use an Entity killed event handler to do something when civilian death occurs, do you all think its more performance light to use a mission event handler "EntityKilled" and simply filter for civs or use a server-local "killed" event handler that is added to each civ when it spawns?
Wondering if its negliable but curious
EntityKilled calls for every single killed entity in the game, there can be plenty
What do you mean by server-local Killed?
Wish we had global entity events to be honest, had a need for them many times already
Global Killed, Server Local, etc.
If your civilian check if very simple, it shouldn't be that big of a deal
Otherwise you can try using MPKilled and do isServer or local check there
but you'll need to reliably add it to entities that you care about
You can also cache expensive checks into hashmaps
BE blocking whitelisted extensions is when the servers are down or under heavy load.
which also happen to be ridiculously often.
Realize BE is useless :D
I do wish we had some pre-filtered alternatives for EntityCreated/Killed, so we didn't have to spend SQF commands on doing basic type checks. Like UnitCreated, VehicleCreated.
I have it fairly optimized in EntityCreated by doing:
if!(typeOf _this in server_ehs_onEntityCreatedIgnore) then {
//if entity is some crap like #crater, add it into hashmap, otherwise proceed depending on simulation type
};
```But its still several SQF commands for each entity
Sometimes I wish entities were treated like class names for hashmaps
but then again somebody else will expect it to be entity instance hash
i guess using the arma server to relay the data would be too advanced
when HASHMAP isNil STRING will be a thing it could be turned into
if(server_ehs_onEntityCreatedIgnore isNil typeOf _this) then {
maybe isNil is slightly faster than in and there is no ! anymore
Muh microseconds
Which is already done, for the ID check at least.
k. also why not just allow servers to whitelist dlls :rolleyes:
Because it would make sense, did you think before proposing the idea ? cmon
thanks ๐
Would love a bit of help, unsure if there's a non scripted option, guessing not but I'm looking for a way to disable certain seats in the TF-373 MH-47, specifically the loadmaster and hoist operator seats
You'll need to find turret path for it though
Might be [1] and [2] from the look of it
this lockTurret [[1], true];
this lockTurret [[2], true];
It was [1] and [3] but otherwise works perfectly thank you
boop
is it possible to have group icon in player map where the group is friendly but not with enemy groups?
Only create the markers on the side that should see them.
when getting config entries, what's the property one has to look for to actually get the classname string itself?
Is it macro?
I need to separate some classnames according to a prefix criteria.
Oh
I was under the impression this was not what I would get from that command
LOL, thanks
i'm using MARTA
That system is local iirc so the same applies
i'm not 100% sure but i think something is adding default group icons
So I'm looking for a script to jam ACRE radios for players once they get within a certain range of the object set as the Jammer and the jamming stops once they exit that range or the object the jammer is added to is destroyed or deleted.
Does someone know is this script exists somewhere? / Has it laying around?
Total noob at scripting here. Im trying to have a marker that shows up when activated by trigger and i got it working by having "triggerActivated trigger_1" as the condition but how can i add more triggers that activate this condition?
More triggers, all of which are required to activate the marker trigger:
triggerActivated trigger_1 && triggerActivated trigger_2 && ...```
More triggers, any of which can activate the marker trigger alone:
```sqf
triggerActivated trigger_1 or triggerActivated trigger_2 or ...```
(you can also do some stuff with `count` and/or `findIf` to make it more compact if you have a lot of triggers)
Thank you ๐
is there a way i can detect if mouse wheel was pressed?
oh you said pressed ๐
hey is it possible to have a static turret be able to be operated normally but also make it so it is completely static, e.g, if a vehicle were to hit it, it would stay still instead of falling over
You could attach it to something
is it possible to attach it to an object already in the world? e.g on the attached image, have the turret attached to the base.
Technically yes, but it's a hassle, and the simulation rate of buildings is pretty slow so it would have unpleasant effects
attachTo doesn't require proximity in any way - it's not like glue, it's just magic. So just have a dummy invisible vehicle somewhere
alright, appreciate the help o7
no unfortunately doesn't work
@hallow mortar sorry for the extra ping but ive attached the turrets to a civvy quad bike in some other corner of the map and when in game, the turrets all turn towards a random location. is there any way to preserve the rotation?
If you used BIS_fnc_attachToRelative, rotation should be preserved and if it's not then ๐ค
If you used plain attachTo, you can setDir or setVectorDir after attaching, but the direction is now relative to the parent object so it'll need a little maths to figure out the correct direction.
got it, ill use the function instead. appreciate all the help o7
did you get it working with any of the mouse buttons? id start from that
Crows has a TFAR Jammer Zeus Module
https://steamcommunity.com/sharedfiles/filedetails/?id=2515887728
oh ACRE
You can put down a game logic instead of a quadbike, and attach it to that instead...
Less risk of anything funky happening
There's no problem inherent with using stacked user interface "keyup" or "keydown" event handlers, is there?
also, user interface and mission event handlers can safely be added during a pre-init function, correct?
How would I reference an action created by a mod? For context, I'm trying to create a script that records the names of heli passengers deploying cargo ropes. So far I have this for the event handler
player addEventHandler ["ASL_Deploy_Ropes_Action", {
params ["_vehicle", "_player"];
_pilot = currentPilot _vehicle;
if (isPlayer _player) && (currentPilot _vehicle != _player) then {[_player, _pilot] execVM "deployedRopes.sqf"};
}];
depends what kind of problem you're talking about
user interface no. mission yes
which problems regarding mission EV are there?
I mean user interface has problems, not mission
and it's obvious why. during pre init UI probably is not intiailized yet
"ASL_Deploy_Ropes_Action" is not a valid EH. What are you trying to do?
Reference an action created by the Advanced Sling Loading mod
Reference as in?
Use the actionName of this specific action
In the mod's code, that action is called "ASL_Deploy_Ropes_Action", I'm trying to figure out how I can create an event handler to detect when someone triggers that action
Well if that is the goal using addEventHandler is still wrong and not going to work
I don't know that Mod or how it works so can't say if you can anyhow
is there a script to put a handheld weapon on a tripod?
Hi everyone, i'm looking for a dedicated, experienced and motivated arma-scripter for a longterm thing.
Feel free to message me in private for more information.
Hi Sem, feel free to post a more detailed description in #creators_recruiting
I'm having a bit of difficulty with an eventhandler =/ its just not calling the function I want it to
not hinting, which leaves me to believe its not being called
Yea its because you call that local function
cant call a local function in an eventhandler?
afaik not
Is there any way to execute a script locally when a player disconnects? I'm using profile namespaces to save items for each player for simplicity and would like to save their state also when they disconnect.
Locally here mean the player who is about to disconnect will do?
Check for abort game button press perhaps?
Keep in mind player's game might crash
Might as well make it work for worst case scenario
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#Ended
Does this work for that purpose?
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#HandleDisconnect
I'd recommend this from server side
Get player unit items from there
And remoteExec, profileNamespace?
Oh I thought he was saving player items into server's profile namespace ๐ค
If it is client's profile namespace then you might as well check when player clicks leave to the lobby confirmation button
Not sure how Ended works, maybe it could fit here
Then start diag_log-ing all the things :D
How would I change this to run the WFBE_CL_FNC_OnKilled only when a player themselves dies? Now it executes every time any player dies or respawns
//--- Re-add the KEH to the client.
WFBE_PLAYERKEH = player addMPEventHandler ['MPKilled', {[_this select 0,_this select 1] Spawn WFBE_CL_FNC_OnKilled; [_this select 0,_this select 1, sideID] Spawn WFBE_CO_FNC_OnUnitKilled}];
(Note: Arma 2: OA)
Why do you need MPKilled here?
Can player leave the game and become bot and change locality somehow?
Why not? ๐ We had issues with possible cheaters (and/or bugs) with the regular version of the event handler, so I thought engine side execution would be more reliable
Killed is also engine side ๐ค
Hmm
What this EH does it makes every client and server execute this code once this unit died (player at the time of EH addition)
Where do you want this code to run in the end?
When player dies or respawns
Only player's own player unit?
Yeah
Then Killed is what you want
It will execute as long as that player unit is local when it dies
Alright, I'll try it out
Hey, guys. So I am currently aware, that if you put a soundfile in your mission folder and add a couple lines of code into the description.ext, that you can then add a this say3D ["SoundileABC",20,1]; in the 3den Editor and it plays the file locally as if I had put down a playsound module in the zeus interface.
My question now is, if it is possible to somehow execute the this say3D ["SoundileABC",20,1]; in the zeus menu without having to prepare everythigng in advance in 3den. (Because just pasting the command in the innit didn't work for me)
I know, that apparently it's possible to also just do it via making a mod and adding the soundfile to the playound option in zeus, but I'm feeling like it should be easier to just execute the say3D command on some object to achieve the same result without having to create a new mod.
Thanks, I had to revert back to Killed EH indeed ๐
If cheaters removing Killed is your issue, you can make your previous code work, just add if(_this select 0 == player) then {} check inside the EH
or local(_this select 0)
Better that than discovering you were editing the wrong file :)
Yes, but you have to force it: https://community.bistudio.com/wiki/setVelocityTransformation
Well, not really the AI pilot.
No problem to dummify the pilots... but vector math 
you could also record the fligth path, althrough Idk if it get interrupted by dying/crashing?
Guys, I am having an issue of Ai units (not on player's group) running out of ammo, moving near vehicles/container and getting stuck in a "take" action loop indefinitely. They will continuously try to resupply? (every 4 seconds or so) from said container until fired upon but will never break out of the loop on their own without a player's intervention. I am pretty sure it must be a "known issue" by now because I've seen such behavior for ages.
I guess my question is if anyone has dealt with the issue somehow or if there is a ticket for it
Q: vanilla?
Yes sir
Here is an ai stuck on said animation on his team mate's body 5 minutes into the match
They do the same on vehicles and as time goes own I've seen whole groups stuck trying to "pick up" things
I don't think I've ever seen this happen tbh
Vanilla? No mods or mission script?
Looks like something about agents logging in systemchat, so maybe some custom FSMs
Well... New question:
So you know how you can see friendly units on the Ctab in game. I'm currently in a mission using bluefor vehicles but putting opfor guys in there. These vehicles now show up on the players CTabs even though they are enemy. If anyone knows if it's possible to disable specific vehicles or units from showing up on the CTab that would be a great help! Thanks
It would by the way also be fine if the CTab would not show any friendly units at all ^^ - If that helps make the solution easier
Those agents are the dogs running around but nothing related to the regular units. No mods but some scrips but the scripts have nothing regarding that.. will do another check anyway
but the scripts have nothing regarding that
famous last words ๐
but yes please, check & if possible provide repro :)
{
_opforUnits = {getNumber (configOf _x >> "side") == 0 and _x inArea PROBLEM} count allUnits;
_indepUnits = {getNumber (configOf _x >> "side") == 2 and _x inArea PROBLEM} count allUnits;
if {(_opforUnits*6)<_indepUnits}then{_x setMarkerColor "ColorGUER"}
}forEach _areaMarkers;
I have code to turn markers for areas green when there's a lot of indfor forces in them, and i want to apply the code to multiple markers at once: but the problem (written where PROBLEM is) is i cant do _x twice because i cant specify that those _x's belong to the forEach since they're behind the counts
{
_y = _x;
}forEach _areaMarkers;
Oh I should have seen that, thanks
๐ ๐
I think if found a bug with the targets command
create a unit on side EAST
make it side ENEMY with setRating
stand in front of the said unit at the start of the match:
player in (cursorTarget targets [false, 200])
Returns "TRUE"
The if I move around and wait for a while, return to the same pos and do the same command it now returns FALSE
I have to increase the 200 to 874 for it to return TRUE... yet I am standing in front of the unit
Could that be that there is an issue at how targets measure distance the longer the match goes on? It no longer updates at some point?
No matter how far or how close I get to the unit, any value below 873 will return false... even if I am standing 5 meters in front of it...
Just something, you can easily check the side of a unit by using the side keyword.
Also this is how I do exactly that. (Edited a bit as I also have vertical height check in there)
{
private _marker = _x;
private _east = { alive _x && side _x == east && _x inArea _marker} count allUnits;
private _res = { alive _x && side _x == resistance && _x inArea _marker} count allUnits;
if ((_east * 6) < _res ) then {
_x setMarkerColor "ColorGUER";
};
} forEach _areaMarkers;
independent = resistance
Is that a Linux-based server?
Hey guys i have a quick question is there any reason to do this in a code ?
[var1,var2,var3] spawn {
[_this] call {
(_this select 0) params ["_var1","_var2","_var3"];
//rest of the code....
};
};
Is it just me or does this call seam unnecessary ?
i dont see point with the "call"
right i mean if you call from scheduled environment. its still sceduled enviormente and at that point spawn is the same as call so why do it 2 times ?
Hey guys, do you know if there is anyway to enter zeus using the debug only - on a multiplayer server?
you cant get out of scheduled with call
I have a question regarding the command menus for SLs more exactly the target menu. Is there a way to remove/block it without a loop?
spawn isn't the same as call in scheduled.
If you do spawn, it still creates a new scheduler thread, and allows the rest of the original scope to proceed without waiting for it. call is treated as inline code and will be executed in order, in the same thread. call can also return things to the parent scope because it's still in the same context.
There's no particular reason to do call as you've shown it, with the called code fully typed out exactly where it's called. You're not getting anything from call that you couldn't have got by just...doing the code normally. However, for calling functions and otherwise pre-composed code, call is very useful, even in scheduled.
It possible to make this code return an object instead of a string?
_spawnPos = "respawn_west"+(selectRandom ["1","2","3","4","5","6","7","8","9","10","11","12","13"]);
Myb like this:
private _spawnPos = "respawn_west" + (selectRandom ["1","2","3","4","5","6","7","8","9","10","11","12","13"]);
private _var = missionNamespace getVariable [_spawnPos];
if(isNil "_var") then {
missionNamespace setVariable [_spawnPos,objNull];
};
That syntax of getVariable requires you to specify a default value, and it's pretty much for the purpose of avoiding needing that isNil check.
private _var = missionNamespace getVariable [_spawnPos,objNull];```
Note that if you're trying to work with markers, those _aren't_ objects, and they have their own commands for working with them, which use strings as references.
Ah that would explain it, thanks
So I am using a slightly modified script from a youtube video to do a paradrop, that your supposed to put in the activation of a move waypoint, It worked a week ago but now it has stopped working, could anyone help me determine what the problem is?
hercD sideChat "GREEN LIGHT, GO, GO, GO!";
null = [] spawn {
{
if(((assignedVehicleRole _x)select 0) =="Cargo") then {
[_x] ordergetin false;
[_x] allowGetIn false;
unassignvehicle _x;
moveout _x;
sleep 0.3;
};
} forEach(crew herc);
};
this is all the code in the waypoint, originally by OnlineCombatBN
the modifications whre removing the remove backpack and add parachute lines from the original script, this is because I want it to eject the players with their existing backpack (as the players will already have parachutes)
Hey!
I've seen the new getEntityInfo https://community.bistudio.com/wiki/getEntityInfo . Until it comes out what is the right way to get such information? (my crude approach is to use a static configuration and a bunch of if( _vehicle isKindOf || _vehicle isKindOf ||..) etc.
You don't need the null = any more. That's not breaking it, it's just something that used to be needed but can now be removed.
If your server or client is using the Profiling branch of Arma 3, make sure it's up to date with the very latest version released yesterday. The previous version had a bug where the crew command would not work properly.
If Profiling branch is not involved, look for recent updates to any mods you're using; the stable version of the game hasn't been updated in the last week, so anything that worked before should still work.
(would just need to get canFloat for vehicles)
Windows 10 pro, hosted server
I have a position coordinate where I want a plane to fly to (facing the given direction). However, I want to spawn that plane about ~2000m away from that position. How would I go on about it? (Its more aligned with Ambient Flyby).
Basically, I want to spawn couple of planes abount 2000m away from the position I give, facing the direction I give and despawn - all scripted.
I can use BIS_fnc_ambientFlyby but I'm having trouble figuring out the startPos and endPos with the 2k distance in mind.
If its a normal North/East/South/West direction, you can do [[x - 2000],0,0] but for more advanced angle of approach, how would you code this
That was added to get information that is otherwise ungettable
So there is no right way..
ok thanks
Perhaps something like this?
params ["_targetPos", "_dir", "_distance"];
private _spawnPos = _targetPos getPos [_distance, _dir]; //TODO: Might have to fix the Z-coordinate of _spawnPos.
private _plane = /* spawn plane at _spawnPos */;
_plane setDir (_dir + 180); //Turn _plane towards _targetPos.
I fixed it with rudimetry mathematics I could think of :
x2 = (_pos select 0) + DISTANCE * cos(dir)
y2 = (_pos select 1) + DISTANCE * sin(dir)
Syntax 3 of getPos can do it for you, but yeah.
Could a 147 KB missionNamespace variable cause problems in a multiplayer environment?
If it's operating locally then it shouldn't be a big deal, but you'll definitely want to avoid sending it over the network too often
probably dumb question, got an error "error setposatl, type array expected object"
[]spawn {
sleep 5;
jposition = getPosATL jumpdes1;
jposition set [2, 1000];
_this setPosATL jposition;
sleep 0.1;
playSound3D ["A3\Sounds_F\ambient\thunder\thunder_03.wss", _this, false, getPosASL _this, 5, 1.5, 20000];
playSound3D ["A3\Sounds_F\ambient\thunder\thunder_04.wss", _this, false, getPosASL _this, 5, 1.5, 20000];
playSound3D ["A3\Sounds_F\ambient\thunder\thunder_01.wss", _this, false, getPosASL _this, 5, 1.5, 20000];
};
I have an object on the ground that is jumpdes1 = _this;
_this is the arguments passed to spawn, which contains....[] (an empty array)
got it, so I give my _this a name and use that instead
You don't have to give it a name, just pass the object you want to move into the spawn as an argument
copy
Essentially I fetch a github file
This is ran only on the server
"https://raw.githubusercontent.com/XXX",
"GET"
] call a3uf_common_fnc_request;
missionNamespace setVariable ["TFI_Arsenal_Items", _arsenalitems, true];```
Then anytime a player joins, I get the variable and compile it
```_res = missionNamespace getVariable "TFI_Arsenal_Items" select 0;
_code = compile _res;
call _code```
Our server have been dealing with random occurrences of desync that completely kill it. I was wondering if this could be the cause.
Anyone know of a mod / script simialer to fire support + that will allow you to use a module to basicslly free fire an rpg warhead?
@royal bramble That's broadcast, so yeah, it sends over the network on join and the size matters.
147KB isn't that bad though. ACRE can send 16MB+.
Is your fetch done asynchronously?
compiling of a large file shouldn't hand server for more than a second, broadcasting it either
As for general problems, I know that Arma likes to randomly drop public variables, REs and setTerrainRight for JIP
More probably with large data
More probable when player is under VPN
isplaysound3D broken for custom sounds?
I've never gotten it to work
I'm trying to play a sound, ideally say3d with global effect, and determine if that sound is done playing
Is there a way to adjust the intel item script- the BIS_fnc_initIntelObject one, to work off of doing a hold item action? IE as opposed to simply being a scroll wheel action, the activation of it is done with a hold action. IE you hold your interact on it, and the ring progress bar goes.
hmmm should i go for most backward compatibility with this library or as little developer overhead as possible?
eh fuck it, backward compat is easy enough
Hello, I'm trying to make a script that saves information from players to a hashmap stored on the server as a public variable. My expectation is that the public hashmap is accessible and modifiable from every client and when a client uses the Save Gear action, I would be able to see their entry in the hashmap on the server, but it's not happening and I don't understand why. Can anyone tell me what I'm doing wrong?
//initServer.sqf
//server makes the database hashtable
// entry keys are player UIDs and one "newProfile" entry to be used if a player entry isn't found.
// the value for each key is as follows:
// select 0: gear
// select 1: funds
//initializing database
ionProfiles = profileNamespace getVariable ["ionProfiles", nil];
if (isNil "ionProfiles") then {
hint "No ION Profiles Database detected... creating...";
ionProfiles = createHashMap;
_newProfileContents = [];
// default loadout
_newProfileContents set [0, [[],[],[],["U_I_G_Story_Protagonist_F",[]],[],[],"","",[],["ItemMap","","","","",""]]];
_newProfileContents set [1, 10000];
ionProfiles set ["newProfile", _newProfileContents];
} else {
hint "ION Profiles Database detected. Checking profile.";
ionProfiles = profileNamespace getVariable "ionProfiles";
};
publicVariable "ionProfiles";
//init.sqf
//persistence
sleep 5;
call HL_fnc_playerLoad;
player addAction [
"Save Gear",
{
call HL_fnc_playerSave;
}
];
//HL_fnc_playerSave.sqf
_UID = getPlayerUID player;
_ionProfile = [];
_gear = getUnitLoadout player;
_ionProfile set [0, _gear];
_funds = [player] call HALs_money_fnc_getFunds;
_ionProfile set [1, _funds];
ionProfiles set [_UID, _ionProfile];