#arma3_scripting
1 messages ยท Page 210 of 1
hmm, that's not something i've tested with my safezone system yet, let me see how that goes
worked perfectly fine against anti-tank missiles, but not for a tiny drone ๐
this is the logic i used, if you're curious: sqf _vehicle addEventHandler ["HandleDamage", {call { params ["_unit", "", "", "", "", "_hitIndex"]; if (!call WHF_fnc_isFriendlyFire) exitWith {}; if (_hitIndex >= 0) then {_unit getHitIndex _hitIndex} else {damage _unit} }}]; sqf // fn_isFriendlyFire.sqf params ["_unit", "", "", "_source", "", "", "_instigator"]; private _sideA = side group _unit; // with blufor default for empty vics private _sideB = side group _instigator; _sideA isEqualTo _sideB
Yeah, you prolly wont be able to stop people from doing that, but I at least want to get their name. Because the problem you have is that you dont even know who controlled the drone
Im trying to do that with UavControl right now, and it does work to some extend, but I have to use a while loop for every drone to check if someone is using it, and thats not optimal I would say
hmm, printing _instigator simply returned null the entire time, but _source appeared to contain the drone object on some calls, and using UAVControl on that briefly gave me the player unit
If you use the UAVControll inside the handle damage EH and you crash it, it did show the name? Cuz the problem I had was that since the drone died, it did not show who was conencted to it
ergh, sometimes it reported the name but usually aggressive crashes showed nothing: sqf _this addEventHandler ["HandleDamage", { params ["", "", "", "_source", "", "", "_instigator"]; if (isNull _instigator) then {_instigator = UAVControl vehicle _source # 0}; if (isNull _instigator) then {_instigator = _source}; if (isPlayer _instigator) then {[name _instigator] remoteExec ["systemChat"]}; }];
How do I do the sqf code highlight thing again?
perhaps it's because the drone dies first and the player is disconnected from it, then the wreck destroys the aircraft afterwards?
```sqf
```
[] spawn {
while {alive this} do {
_peopleConnectedToUAV = UAVControl this;
_uavSlot1Name = name (_peopleConnectedToUAV select 0);
_uavSlot1Role = _peopleConnectedToUAV select 1;
_uavSlot2Name = name (_peopleConnectedToUAV select 2);
_uavSlot2Role = _peopleConnectedToUAV select 3;
if (_uavSlot1Role != "") then {
systemChat format ["%1 is using a drone as %2", _uavSlot1Name, _uavSlot1Role];
if (_uavSlot2Role != "") then {
systemChat format ["%1 is using a drone as %2", _uavSlot2Name, _uavSlot2Role];
};
};
sleep 1;
};
};
It shows a name as soon as you enter driver or gunner, but its a while loop
:/
I assume having a ton of while loops constantly run on drones cant be healthy for a server, or its performance rather
i might have got it, if you attribute the UAV controller when they first take control of it, you can use it as a fallback for when the drone is destroyed and the controller loses connection: ```sqf
addMissionEventHandler ["PlayerViewChanged", {
params ["_unit", "", "", "", "", "_uav"];
systemChat format ["view changed, unit: %1, uav: %2", name _unit, typeOf _uav];
_uav setVariable ["TGC_uav_controller", _unit, true];
}];
_this addEventHandler ["HandleDamage", {
params ["", "", "", "_source", "", "", "_instigator"];
if (isNull _instigator) then {_instigator = UAVControl vehicle _source # 0};
if (isNull _instigator) then {_instigator = _source};
_instigator = _instigator getVariable ["TGC_uav_controller", _instigator];
if (isPlayer _instigator) then {[name _instigator] remoteExec ["systemChat"]};
}];```
i assume PlayerViewChanged is local so you should add that on all clients
the handledamage is def local, so you'd do the same too
yeah, im gonna play arround with it alittle and see how it works
hmm, sometimes it detects it correctly, other times it doesn't still...
printing source shows it sometimes thinks it's the aircraft itself that's doing the damage, rather than the drone wreck
but that's mostly when i crash into the body of the heli, hitting the rotor instead is more reliable at attributing the damage to the drone
So I made this now, and I guess this could work. If I add a killed eventhandler to it now and the drone killed itself, then I would count that as crash and save the variable in diag_log / .rtp file
if (!isNil "randomEHidk") then {
removeMissionEventHandler ["PlayerViewChanged", randomEHidk];
};
randomEHidk = addMissionEventHandler ["PlayerViewChanged", {
params ["_oldUnit", "_newUnit", "_vehicleIn", "_oldCameraOn", "_newCameraOn", "_uav"];
[_uav] spawn {
_uav = _this select 0;
if (!isNull _uav) then {
_peopleConnectedToUAV = UAVControl _uav;
_uavSlot1Name = name (_peopleConnectedToUAV select 0);
_uavSlot1Role = _peopleConnectedToUAV select 1;
_uavSlot2Name = name (_peopleConnectedToUAV select 2);
_uavSlot2Role = _peopleConnectedToUAV select 3;
if (_uavSlot1Role != "") then {
systemChat format ["%1 is using a drone as %2", _uavSlot1Name, _uavSlot1Role];
_uav setVariable ["lastRegisterdSlot1User", _uavSlot1Name, true];
if (_uavSlot2Role != "") then {
systemChat format ["%1 is using a drone as %2", _uavSlot2Name, _uavSlot2Role];
_uav setVariable ["lastRegisterdSlot2User", _uavSlot2Name, true];
};
};
};
};
}];
I was always a stranger to remoteexec, my question is how do I remote exec
mflamp1 switchLight "ON";?
Would it be smth like?
["mflamp1","ON"] remoteExec ["switchLight", 0,true];
mflamp1 without quotes
THX!
Can anyone help me with a chat.sqf file not working on trigger Activaiton? 2 files work,But the last 2 dont,Even tho the coding is right,If you want more info DM`S are open ๐
chat.sqf file ?
oh hmmm
what does the code look like exactly for the execution bit (trigger side)
like i know the stuff for it,But its just really weird how its not working for specific BIKB (Dialogue file)
In the trigger it would be blufor not present with : nul = execVM "chat (Number) .sqf";
i have tried different activation types but will not trigger 4 me
all of your scripts are the exact same execution?
whats with the null = in there
that was my follow up question
just do [] execVM " .sqf";
ya i just prefer to do it with nul in there because thats how i started off with doing it
well that is way out dated
that could possibly be part of the issue as its outdated
will i remove all nul so?
don't keep doing things just because thats the way you always did it
and put [] execVM "chat.sqf";
yep, it should work
alright ill try now
that null stuff was from way way back when the game did not work right yet: its just left over stuff no need to use it any more
Dammaged is global argument, unlike all the other damage handlers. So it has its uses.
yes i was confused by that for some time also damage and dammage are 2 diff things
wait what? colour
class Sentences
{
class 3_Q_Line_5
{
text = ""
speech[] = { "\chat\t5.ogg" };
class Arguments {};
actor = "Q";
};
class 3_WW_Line_6
{
text = ""
speech[] = { "\chat\t6.ogg" };
class Arguments {};
actor = "WW";
};
class 3_Q_Line_7
{
text = ""
speech[] = { "\chat\t7.ogg" };
class Arguments {};
actor = "Q";
};
};
class Arguments {};
class Special {};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};
class CfgSentences
{
class ConversationsAtBase
{
class 1
{
file = "1.bikb";
#include "1.bikb"
};
class 2
{
file = "2.bikb";
#include "2.bikb"
};
class 3
{
file = "3.bikb";
#include "3.bikb"
};
class 4
{
file = "4.bikb";
#include "4.bikb"
};
};
};
rgr that m8
rgr = ?
looks nice right
ya it does
you know how to do that right
nah
ok but what does rgr stand for?
should have just said that
also the trigger is BluFor Not present,And there is blufor in it
like its weird,Its the same as the other 2 that work just different words and number like t6,t7,t8 etc
so annoying
put a hint at the end of the script see if its firing at all, could be a error within the script but Arma aint tossin anything about it
are the WW and Q correct
hint as in hint "(Put words wanted to be said here)";
ye
"ok its getting to here" remoteExec ["hint", 0];
ah see I typically just do hint "whatever i want"
alright so where do u want me to put it again?
at the end
its on the zargabad map,Could that be a problem by chance?
just inside the scope
im not good at this stuff ur saying no clue what the scope is eh
inside the last };
startWithConsonant[] = {europe, university "hint hi how are ya"}; like that
Do not do that
ok
ill try that two secs
That's config, not SQF script. You can't put SQF code like hint in there, except as expressions in config attributes.
w8 kikko is here we are saved
kikko is the guy with N id assume
yes hes the best ever
hes like the best guy for anything Arma
and could the map Zargabad be a problem?
The map shouldn't be an issue
and there is others as well but i think hes the best
Give me a second, I don't use the Sentences system often so I'm just reading through it and seeing what's up
Factually, I am not
i remember trying to this same thing on a spearhead 1944 DLC map,But wouldnt work even for the first one so ya
Nah Nikko stinks ๐
lol hahahahahaah lol
so is N like a bohemia coder or what?
Can you lay out for me how your code is set up in terms of files?
- what is in the "chat.sqf" files you're executing?
- where is your
class Sentences ...config placed? - where is your
class CfgSentences ...config placed?
No. People employed by BI have green names.
thats a vet collour yes hes great
class CfgSentences
{
class ConversationsAtBase
{
class 1
{
file = "1.bikb";
#include "1.bikb"
};
class 2
{
file = "2.bikb";
#include "2.bikb"
};
class 3
{
file = "3.bikb";
#include "3.bikb"
};
class 4
{
file = "4.bikb";
#include "4.bikb"
};
};
};
Description.ext scotty colour plz?
meaning a vet of the game like really good guy
["4", "ConversationsAtBase"] call bis_fnc_kbtell; this is a chat4.sqf file
Kikko can show you how to do that
perfect
For config formatting, put this at the start:
```cpp
and this at the end
```
For SQF code, replace cpp with sqf
so at the start put the cpp? and ... at the end
It's ` not .
swap class CfgSentences with ccp?
On my keyboard it's in the top left, but I dunno what shape yours is so it could be anywhere.
just copy what he put there
No, just wrap it in those end pieces. This is purely for making the Discord formatting.
sorry i dont know what ur on about?
!sqf
```sqf
// your code here
hint "good!";
```
โ turns into โ
// your code here
hint "good!";
you see now ?
honestly nah,This is confusing me
copy what nikko put there
can you not just do the code and add ur twist to it
I'm not trying to change the code (yet), I'm trying to show you how to make it look pretty in Discord to make it easier to read
yes for the collour
woohoo yes ๐
Remember, it's sqf for SQF code, and cpp for config
so i put sqf instead of cpp when im trying to show the code?
shit didnt mean to do that
dont do what I do sometimes by accident and put a space after the sqf part lol
yes like cpp for the description.ext code
ok so what do i do now with that error?
If it's SQF code, like with commands and stuff, that goes in an Editor field or an SQF file, you use sqf to tell Discord that's the language it needs to highlight for.
If it's config (has class and stuff, goes in description.ext), use cpp to tell Discord to think of it as C++ (it's not C++ but the syntax is close enough to work)
Okay, so this is in description.ext. I assume all those .bikb files exist, in the same folder as description.ext (NOT in a subfolder) and contain the class Sentences ... you previously posted?
ya
ill send it all onto you if you want
its all in the same mission folder
nothing seperate
You said 2 instances work and 2 don't. Which are which?
so i have 4 bikb,4 chat.sqf,And a description.ext,Chat1.sqf and 2 work,3 and 4 dont
oh nice
Can I see the exact contents of 3.bikb or 4.bikb, and the contents of chat3.sqf or chat4.sqf, please?
Also the attributes of whichever trigger is supposed to execute them
why is there no ( .ext ) at the end of the Description.ext
Because they have "show file extensions" turned off in File Explorer. I'd recommend turning it on, but we can see from the file type column that that's not the problem here.
i cant colour it
ccc class Sentences
{
class 3_Q_Line_5
{
text = ""
speech[] = { "\chat\t5.ogg" };
class Arguments {};
actor = "Q";
};
class 3_N_Line_6
{
text = ""
speech[] = { "\chat\t6.ogg" };
class Arguments {};
actor = "N";
};
class 3_Q_Line_7
{
text = ""
speech[] = { "\chat\t7.ogg" };
class Arguments {};
actor = "Q";
};
};
class Arguments {};
class Special {};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};...
the three symbols black out and cant do it,Weird
You must use ```cpp at the start and ``` at the end. You can't use ... instead.
They will appear a darker grey once Discord detects them, it's showing you it's detected them and will use code formatting. Like how it previews the italics if you type _text_.
nah.Wont work,Blacks out and it skips a line instead of texting
๐
You've just got a space between the first ``` and cpp. Remove that space and you'll be good.
Except for that being SQF, so use sqf. cpp is for config.
??
just like Guardian was saying ๐
Oh, hang on. Add a line break after sqf and before the actual code
press Shift+Enter
I always forget
oh man so close ๐
sqf
{insert code here}
after you type the sqf part hit Shift+Enter to make a new line then past your code
that works too lol
Well anyway, I don't see anything specifically wrong with what's posted so far. It all looks roughly right. The next thing to check would be the triggers themselves.
,,, ๐
so sqf is for what? cpp is for?
As I said a moment ago, SQF is for SQF code - executable code that you're putting in Editor code fields and in .sqf files
sqf is for sqf and cpp is for like config stuff
CPP is for config, with class and such, which you're putting in description.ext
right,Thanks
the triggers are right tho,Its Blufor - not present,Kill all of the enemys in the area = [] execVM "chat3.sqf";
and the next one chat4.sqf ofc
no = sign
This isn't a criticism of you, more of a tip for troubleshooting: "it's right" isn't a substitute for the actual configuration. If everything was right, we wouldn't be troubleshooting :P
If you have that = in the actual code execution field, remove it.
What you had before was null = [] execVM ...
What that did was take the Script Handle, returned by execVM, and save it to a variable called null. The = sign is used for assigning values to variables. Doing this used to be necessary due to a bug in the Editor, but it's been fixed for years. So you don't need null, and you don't need = either because you're no longer assigning a value to any variable.
Doing null = [] execVM ... wouldn't actually break your script, it's just pointless. But having a lone = hanging out there would break it, because that's not valid syntax and it would confuse the game.
in the onActiveation of the trigger put
"Kill all of the enemys in the area" remoteExec ["hint", 0];
[] execVM "chat3.sqf";
so [] execVM "chat2.sqf"; e.g.
Yes, exactly
There are more efficient ways of doing this, but we'll stick with this now, at least until we get it working like this, because it will work.
then remove the hint
If you try that and it still doesn't work, the next thing to check is whether the trigger is actually activating. Use a systemChat "trigger activated!" or something in its On Activation field to prove it. If the trigger activates but your script doesn't run, then the problem is with your script; if the trigger doesn't activate, then the problem is with the trigger.
i think he should have blufor presant maybe
but if blurfor is present in the trigger it will just complete the task as the start of the mission no?
task what task you said nothing about a task ?
Let's just take this step by step. Ideally, the steps I'm suggesting.
alright so the code came up from N,So ya i think its the script but u said it was right so?
well it does look correct to me
so tell more about the trigger how big is it and are blufor in the trigger at start of mission
Oh I see a potential problem. It's a classic too
They just said the trigger successfully activates, so that's not the issue
copy
so its a custom size,Fits the people i want in it and yes their in in at the start of the mission
copy that
In your .bikb files the text attribute is missing a ; at the end
he said in the .bikb files
Yes, there should be a ; after the closing quote
It's possible the game might be able to recover from it in some cases, but going without it is not how it's supposed to be done. It's wrong. There can be consequences. You should fix it.
ill try that now
thats because the script gets so far and the game says oh no no way ๐
Possibly not the right spot for this, but does anyone know of a way to stop players from loading in prone when at altitude?
depends on how hight you want them i think
so it says the path file - 3.bikb,Line 4: Config End of line encountered after Captain,Roadblock clear,Moving to next objective; (Words i have in there@```
Does that need to get reset if you want them to then jump out of a plane and freefall at that same altitude? Or is it just slap it in the init and make it wait then reset anyways?
are they in the plane or flying object?
Well that's a little suspicious.
Can I see the actual exact words you have in there? (just for that line) You might have odd characters that are breaking it.
and the game just quit when the trigger was completed
maybe you can use ```sqf
_player playMove "Stand";
class 3_Q_Line_5
{
text = "Capatin,Roadblock clear,Moving to next objective;
speech[] = { "\chat\t5.ogg" };
class Arguments {};
actor = "Q";
};```
Okay, well, missing "
oh fuck,Let me try again ๐
They're standing in the cargobay of the plane, not seated in the plane, and the plane is stationary on a floating piece of pier
standing but are they in the object? like a seat for example
Hold on, I'll screenshot it
Just standing, not in a seat or anything. Idea is to open up the back when they're ready and jump out to skydive
so the plane is floting on the water ? like
The plane is on a concrete pier piece floating 8km in the air
ahhh ok
Yes, you will need to change the unit's freefall altitude back if you want it to start freefalling again. It's a permanent change to the unit's properties, not a one-time override.
ya,Still not working even when corrected
8 m should not put you into freefall mode
That's true, but they said 8km, which is a little bit higher
oh shit ok lol my bad lol ๐
Look I appreciate you're trying to help, but the first step to having a helpful response is actually reading what the other person wrote
yes yes thx for giving me hell i like it ๐ it only makes me better ๐
Can you zip your mission folder and send it to me by DM? You can strip out the audio files if you like. I need to see this in its actual state, not piece-by-piece.
Does this look obviously wrong to anyone? Arma hasn't thrown a flag just from putting it into the init so far, about to test but wanted another set of eyes
[this, 8000] spawn {
params ["_unit", "_altitude"];
_unit setUnitFreeFallHeight _altitude;
waitUntil { time > 1};
_unit setUnitFreeFallHeight -1;
};
how do ZIP it? i have never done that b4
right click on it
Rightclick on the folder > send to > compressed folder
Unless you're on Windows 11 and they've hidden it somewhere else, because Microsoft's decided they hate the context menu this time around. It might be in the Share tab at the top when you have the folder selected.
ya nah i got it gimme a sec
Nevermind, worked perfectly ๐ ๐
Excellent!
nice
Thanks fellas for reminding me of setUnitFreeFallHeight ๐
was Nikko i didnt do any thing but get in the way ๐
Actually it was El'Rabito
oh oops
right so i have the folder how to send it?
rightclick on my name > message > drag the zip onto the message field > send
i dont have nitro
If it's big enough to need Nitro to send it, you should remove the audio files first
ya i took em out
the hell is in your mission
right click on Nikko's name then click on message
oh shit w8 what
You'll notice this doesn't show the size of what's in those folders
Songs are chonky and I don't need them. Take them out
2 secs
and there might be a long delay between some tasks,Just wait like about 20-40 seconds for some,But its 3 minutes for the start so
hes not going to run the mission hes going to look at the files
oh,Well if he wants too,There you go
Thanks. I'll look at this. It might take a minute so stay cool.
lol back in Arma 3 Alpha i had this guy came in my server and he put all of us way up at like 30,000 m and we were stuck in freefall mode
thats terrifying
i had to kick him and restart the server
yes
we even hit the ground and did not die but stayed in freefall mode
it was bad lol
i didnt have battle eye on so now i always do ๐
is multiplayer good with arma 3?
hell yeah if you script correctly
i played it once but i think it was just friends pissing about with zeus
well i dont use zeus i make my own missions from scrach
i think i made like 1000 missions by now
you know after playing for 10,000 hrs you want to make your own missions ๐
w8 letme see brb
make that 10,080 hrs woohoo ๐
lol
as a matter of fact i was just talking about the very 1st mission i made in Arma 3 last night in Gen Chat
it was fun
well i really started way back in OFP that was fun to but Arma is way way way better
i was talking to this 1 guy he has 23,000 hrs in Arma 3 i was like wow Awsome ๐
but tbh my missions would be lame with out guys like Nikko and others
them guys are Awsome and thx all you Awsome guys for helping me make my missions so Awsome ๐
So, I do have one small question about my script; I've added comments to each line to explain what I thought. however I am trying to get a object (like a statue) to "face" the players without leaning the object. However; I believe I messed something up since Arma is complaining about line 65 (which is the following part)
private _azimuth = _fgt getDir _nearestplayer;
I'm still kinda learning how to work with distance and arrays so any help would be great! this is suppose to loop which is already set up because my audio effect works as intended, just this block/section is where I am super stuck lol
if (count _players >0) then{ // Counts how many players are in the
// Check for Nearest Player
private _nearestPlayer = objNull; // Variable nearestPlayer now represents Empty
private _nearestDistance = 3001; // Variable nearestDistance now represents Max Distance of 3001 Meters
if (_nearestPlayer != fgt) then{ // Variable nearestPlayer is checked to make sure its not FGT
private _nearestPlayer = player distance fgt; // Variable _nearestPlayer now represents players distance from fgt
if (_nearestPlayer <_nearestDistance) then{ // if the nearestPlayer is less than the nearestDistance
private _azimuth = _fgt getDir _nearestplayer; // gets the direction of nearest player
_fgt setDir _azimuth; // sets the fgt to "face" the nearest player
};
};
};
if needed; I can copy/paste the whole Loop part of .sqf file lol
what do u mean by without leaning the object ?
private _nearestPlayer = player distance fgt; // Variable _nearestPlayer now represents players distance from fgt```
Why do you do this?
Since you've done this, after that point _nearestPlayer contains a number (the distance). You cannot use getDir on a number.
rotating like making it like upside down or something stupid lol
So this is the part im still learning about Arma, when it says
private (whateverhere) = [x,y,z]
I'd assume its kind of limited to what I can give a name to. Again I'm coming from UE5 so a lot of this is kinda different to me so I did that as like a see what y'all say, cause like I said, I'm just trying to learn about it and some of the wiki's are confusing lol.
true that
I kinda thought you could "Change" the variable after using it for one thing if that makes sense?
but again; that logic now saying it out loud is kinda stupid lol
private is used to prevent variables from conflicting across different scopes. See https://community.bistudio.com/wiki/Variables#Scopes
Your usage of private is fine, what's not fine is changing the variable to be something else and then using it as if it still contained the original thing.
You can change variables to contain different things after defining them, there's no technical limitation on it, but you then have to remember that and treat them appropriately.
i just say in my head what i want to happed and then i make the script while im saying it in my head ๐
of course; so my question about that part is; could the private variable be called whatever? like private dingdong = [x,y,z]
Well, private is used only for local scope variables, not global scope variables (global variables are inherently incompatible with the concept of a private variable), so it must start with a _. But otherwise yes.
well everything in this .sqf (those goes for 99% of all my .sqf's) wont talk to one another so private is fine
-# I think?
esample of local scope var's
private ["_fgt","_azimuth","_more","_here","_lol"];
``` ๐
Yes. In fact, the majority of the time you define a local variable in any script, you're going to want it to be private. It's almost always the right choice.
(Actually, most of the time it won't cause a problem if it isn't, but it's better to be safe and there's no downside to doing so)
to answer this; thats kinda what I was trying to do with the _azimuth and the
_fgt setDir _azimuth;
part
ok, I think I understand, so I should rename the
private _nearestPlayer = _player distance _fgt;
Also does the player and fgt need the _ too? cause rn they dont
Really depends what you're doing.
You might want to reference the global variable fgt if it's an object's Editor variable name. On the other hand, if you've dynamically acquired a reference to it within this script, it's probably better to keep it as a local variable so you don't conflict with other scripts. (If you do use global vars, it's recommended to give them a more unique prefix to avoid collisions with other scripts and mods.)
player isn't a variable, it's a command that returns the player object on the current machine. So that one really really depends. If you need the return from that command...you have to use that command.
with out the underscore: its a global variable frt
ok so I should make sure fgt doesnt have the underscore as it is a object in the editor itself correct?
If fgt is the variable name you've given the object in the Editor. Editor variable names are global variables, but you can also get references to Editor-placed objects by other means, so that isn't the only possible way to refer to them.
I am always pretty anal about assigning private to my variables but also realistically in most cases doesn't matter. Only event it will really matter is if you call code with a variable of the same name then all of a sudden you're dealing with a really unfortunate to find bug. I tend to be anal about it because for me there really is not any reason not to use it. Except for maybe on frame event handlers where you want to save performance, even then though that is where syntax 2 of private comes in clutch
yeah the objects variable name in the editor is fgt
this may help some
//Server Run
if (!isServer) exitWith {};
//private local var
private ["_mrk","_vtype"];
//_mrk
_mrk = selectRandom ["Sub0","Sub1","Sub2","Sub3","Sub4"];
//SDV is a global var
_vtype = "O_SDV_01_F";
SDV = createVehicle [_vtype, (getMarkerPos _mrk), [], 0, "NONE"];
SDV setDir 180;
//Submarine is global var
Submarine = "Submarine_01_F" createVehicle position SDV;
Submarine attachTo [SDV, [4.45, 0, 1]];
Submarine setDir 180;
so... meaning I should do the private for my variable? (sorry im kinda getting confused with the yes or no lol)
Apologies yapped a bit lol. TLDR is that realistically kinda rare you'll run into an issue if you don't but I always would since it's easy and will save you from potentially pain in the butt to find bugs later ๐
NikkoJT is correct in everything he's been saying
Here is some more information though on how private works if helps #arma3_scripting message
I tend to generally use that syntax 99% of the time. If there is a bunch and performance is a concern, I'll tend to toss them in a private list like so:
private ["_var1", "_var2", "_var3", "_etc"];
That mechanic doesn't actually depend on private. All local variables are destroyed on leaving an if scope if they were initially defined inside it.
gotcha; well I mean the audio works so I'll just keep using what I got anyway (at the start of the entire .sqf I have private _fgt = fgt; anyway so either way you guys mention works lol)
I know, more just demonstrating how it affects scope.
does its cause confusion a bit? maybe but I'll get that sorted (kinda rushing with this script a little bc the op im doing is this Saturday and this part is taking a lot longer than i thought)
I get the setDir script, but there isnt a way (as far as I am aware) to allow the script to automatically find the closest player no?
Also another reason why I was saying private doesn't really matter- although I tend to always use it out of best practice and readability
private does matter imho
like Nikko said if you don't use private then some mods and scripts could get corn fused ๐
I mean just varies on what you are using it for. If you had a bunch of Draw3D running on every frame, you wouldn't want to impact performance by using private a bunch
oh yeah i agree with that yes
You could probably do something with this https://community.bistudio.com/wiki/BIS_fnc_sortBy
I dont want it to "look at the leader" lol I would like the object to rotate toward the closest player but I'll have to ask again later as I gotta disappear for a few hours lol
copy that m8
ok, I have returned lol, so I found a thing called "nearestObject" is that a outdated way of locating a player closest to an object?
I have no idea what or why is outdated. You want the player object, among of any players?
There is no command to do it automatically. Several commands combined will achieve it
Referring to this, I am looking to make my object turn toward the closest player. I saw the "nearestObject" and was curious about it
I've been looking on exactly what allows me to achieve the goal im trying to get to. I am just a little stuck lol.
nearestObject is max 50m so it'd not normally useful for that.
yeah I read more into it and saw that literally seconds after sending that message. I was like well crap that aint gonna work lol
nearestObjects can do it, although it's a bit expensive because it'll sort the lot. Otherwise you first get a list of players and then find the closest one of those.
yeah nah I need a distance of 3k meters lol
There is actually no good way to do this in SQF but there are several bad ways.
oh shoot? alright; so what is a "good" way of doing it? I've only used .sqf files so I have no idea what other ways there are... well besides functions but I have no idea how them things work XD
let alone create one
I mean there really should be a command that'll find the nearest of an array of objects, but there isn't.
You can use this thing if you're not picky about performance: https://community.bistudio.com/wiki/BIS_fnc_nearestPosition
ah yeah, I gotta take performance into account as I host the server and play on the same computer (local host)
Fastest current method is this monstrosity:
private _distances = _objects apply { _x distance _pos };
_objects select (_distances find selectMin _distances);
Didn't thought of that find usage
so if I understand correctly;
distances = 3000m
_objects = the object im wanting the 3k to start at(?)
_x = player
No
distance is a command to get the distance between
_objects is the objects to find
_pos is the position of the object
In this case _objects would be allPlayers or similar.
While _pos would be your "object" or the ATL position of it.
If you only care about closest in 2d then use distance2d instead.
playableUnits is probably better than allPlayers unless you want it to look at corpses.
You can prefilter down to players within 3km or not. Whether that's optimal depends on your mission.
If that 3km matters then it's probably best to prefilter.
I don't think that makes the process significantly faster tho
It does if there's one player in radius and 99 out.
playableUnits inAreaArray [_pos, 3000, 3000]; anyway
ok so it would be this right?
private _distance2d = playableUnits apply { _x distance _fgt };
playableUnits select (_distance2d find selectMin _distance2d};
yeah I'll use playable units (I dont want my object focusing on a dead corpse lol.
Why you write _distance2d?
assuming off of this
I dont need 3d, just 2d
No that is not he mean
oh gotcha
distance and distance2d are the commands inside the apply.
_distances is just a variable name.
oooohhhh
_distances or _distance2d or _distanvekdodkshsocodjjwkdokvjdjkvk make no difference
Just your readability and preference
ok I gotchu, again, just trying to understand hence why I'm askin and showing my thought proccess lol
No need to clarify that. Everyone is here for that purpos
private _nearPlayers = playableUnits inAreaArray [_fgt, 3000, 3000];
private _distances = _nearPlayers apply { _x distance2d _fgt };
private _nearestPlayer = _nearPlayers select (_distances find selectMin _distances};
If it's possible that there are no near players then you should handle that case.
Can be done neatly with call/exitwith like this:
private _nearestPlayer = call {
private _nearPlayers = playableUnits inAreaArray [_fgt, 3000, 3000];
if (_nearPlayers isEqualTo []) exitWith {objNull};
private _distances = _nearPlayers apply { _x distance2d _fgt };
_nearPlayers select (_distances find selectMin _distances};
};
yes which I had the
if (count _players >0) then{ ...
so it would bypass the script I have... or well in this case, the one you guys are helping me with
sorry for the late reply lol
earlier you said that there isnt a "clean" or whatever way of doing it in a .sqf... I assume this would work in a not performance safe manner?
if so that is fine
It's not terrible, written like that.
It should just be a lot better.
The apply part is pretty fast because of simpleVM.
what does simpleVM mean?
It's a thing Dedmen wrote that optimises some short loops.
gotcha
So if you can rewrite an algorithm from one larger loop to two short ones it's often much faster.
oh so I shouldn't wrap everything into one loop? (give me a moment and I'll show what I currently got)
The more obvious way to do nearest-object is something like this, but it's very slow because there's no way (at not least not that I've figured) to use simpleVM with it:
private _nearObject = objNull;
private _nearDist = 1e6;
{
private _dist = _pos distance _x;
if (_dist < _nearDist) then {
_nearObject = _x;
_nearDist = _dist;
};
} forEach _objects;
Note that for what you're doing it's probably not a concern anyway.
you gotta know how often your code is being executed.
base line 10 seconds but it has a random +20 so its a 10-20 seconds... I plan to raise it later once I get it working to like 30-50 seconds
so this here I dont have to worry about as I have that If then bit right?
assuming your logic is correct, sure. It's just organisation.
additionally; here my probably very incomplete and nonsense script lol
while {alive fgt} do {
private _randomSound = selectRandom _sounds;
private _players = playableUnits;
// hint format ["Voltage Tower playing: %1.ogg", _randomSound];
playSound3D [
getMissionPath format ["audio\%1.ogg", _randomSound],
fgt,
false,
getPosASL fgt,
5,
1,
3000
];
private _nearPlayers = playableUnits inAreaArray [_fgt, 3000, 3000];
if (count _players >0) then{ // Counts how many players are in the
// Check for Nearest Player
private _distances = _nearPlayers apply { _x distance2d _fgt };
private _nearestPlayer = _nearPlayers select (_distance find selectMin _distance);
private _azimuth = _fgt getDir _nearestPlayer
_fgt setDir _azimuth;
};
sleep (10 + random 20); // waits 30โ50 seconds before next play
};
yeah that's no good, you need to move the nearPlayers calc before the check.
wait I just realized
Otherwise _nearPlayers could be empty even if _players isn't, and then bad things happen
yeah I was about to say... should I move all the private variables to where the private _randomSound is? so its at the start of the script
Nah, keep them local where you can.
Style thing really, but if you keep the scope of a variable as small as possible then it makes it easier to read.
I mean, if its a "preferance" thing; I'd like to keep all the private variables stuff at the top so its easier for me to find them like how I got the private randomsound and players
but if that'll cause issues I'll move them as I need if that makes sense?
Well, a lot of those vars can't have a legitimate value unless there are nearby players.
yeah so I should keep all those where they are but move the _nearPlayers before the if (count) check correct?
Editing the code one sec so you can see what I'm talking about
something of that sort? (maybe? lol)
yes
sweet; now I just gotta figure out the whole _fgt setDir _azimuth; part
holy shit: i just made a Bad Ass Script where the Enemy select a random player from all the player group: and Attack you like Mad Dogs: WoW i stumbled on to something cool ๐ lol the "ghost" in the Mach. ๐
i got the idea from Lou hes Awsome
talk about a all out Rush lol wow
no disableing anything just good fun scripting ๐
the enemy attack so fast and hard: i can hardly kill a 6 enemy group ๐
of corse you can ajust the amount of Enemy in the group in the Params
holy shit them Enemy are Bas Ass mama jammers lol ๐ also what's really cool is the script keeps checking to see how many players are alive so they get included in the random player check
i even went in a house and tried to hide and they came in the house and Attacked me like mad dogs ๐
and they were nade-ing and shooting the hole time Wow
the script is only 22 lines
if you don't count the spaces and the comment out lines
the 1 time i got close to 2 objectives and both enemy groups from both objectives Attacked me also: holy moly that was intense.
the Attack player script: gets exec-ed from the enemy group script:
i had to fall back like 6 times just to live tho it all ๐
i was like Runnnn lol ๐
God i love Arma 3 woohoo
i cant w8 to host that missions and see how people deal with that ๐
max amount of respawns is 30 on a 10 player mission
but you can change that in the params also ๐
//Params
class Params
{
class Respawn
{//0
title = "Respawn";
values[] = { 0,10,11,15,20,30 };
texts[] =
{
"infinite Respawns",
"10 Total Respawns",
"Team Respawn",
"15 Total Respawns",
"20 Total Respawns",
"30 Total Respawns"
};
default= 30;
code = "";
};
};
i like Team Respawn the Best: cuz when you die you go into Spectating mode till the last player dies and then we all respawn ๐
its more like real to me: you can only view blufor side when your dead:
but you better turn the Ai off so you dont have to w8 for they to die ๐
but sometimes you may want that so well you know
also i have this smooth Transition when you die from black schreen to spectating mode: and also on respawn: its cool i like it-------------------------------------------------------------------
funnily enough i remember someone a while ago trying to solve race conditions
i'm having an error that ive been stuck on for the past 4 hours, i need some help as im not good with scripting.
when a trigger is activated for a healthbar script for wbks, this shows up.
to explain the process, what im doing is
Spawn smasher with createunit, and give it the variable name of "IA"
Then a sleep goes off, where the full healthbar script is initiated. so far, it's not working and anytime i try to make it work, it either just stays static and doesn't progress/go down and doesn't go away once the boss is dead, I know the script works because the exact same one works with someone else, as i just copied it from them.
trigger activation/conditions run in unscheduled environment, basically meaning your scripts are expected to run in a single frame, so they forbid sleeping inside them - you need to spawn your healthbar part in scheduled environment so it's allowed to run in the background, e.g. ```sqf
_unit = _group createUnit [...];
_unit spawn {
// in this block, _this = _unit
// (but you can keep using your IA variable too)
sleep 2;
systemChat format ["%1 has spawned!", name _this];
};
sqf
if(isServer) then {
a2 = createGroup east;
"WBK_SpecialZombie_Smasher_Acid_3" createUnit [position a1, a2, "IA = this"];
};
IA spawn {
sleep 2;
systemChat format ["%1 has spawned!", IA _this];
};
[IA,""WBK_SynthHP"","Iradiated abomination] spawn {
if (isServer) exitWith {};
params ["_unit","_param","_name"];
_TB_Health_PIC = findDisplay 46 ctrlCreate ["RscPictureKeepAspect", 20004];
_TB_Health_PIC ctrlSetPosition [0.319531 * safezoneW + safezoneX, 0.00500001 * safezoneH + safezoneY,0.0360937 * safezoneW,0.066 * safezoneH];
_TB_Health_PIC ctrlSetTextColor [1, 0.05, 0, 0.8];
_TB_Health_PIC ctrlSetText "\a3\ui_f\data\IGUI\Cfg\Revive\overlayIcons\f100_ca.paa";
_TB_Health_PIC ctrlCommit 0;
_ctrlBackground_Health = findDisplay 46 ctrlCreate ["RscBackground", 20001];
_ctrlBackground_Health ctrlSetPosition [0.355625 * safezoneW + safezoneX, 0.016 * safezoneH + safezoneY, 0.299062 * safezoneW, 0.044 * safezoneH];
_ctrlBackground_Health ctrlSetBackgroundColor [0.2, 0.2, 0.2, 0.3];
_ctrlBackground_Health ctrlEnable false;
_ctrlBackground_Health ctrlCommit 0;
_TB_Health_bar = findDisplay 46 ctrlCreate ["RscProgress", 20002];
_TB_Health_bar ctrlSetPosition [0.360781 * safezoneW + safezoneX, 0.027 * safezoneH + safezoneY, 0.28875 * safezoneW, 0.022 * safezoneH];
_TB_Health_bar ctrlSetTextColor [1, 0.15, 0, 0.8];
_TB_Health_bar progressSetPosition 1;
_TB_Health_bar ctrlCommit 0;
_TB_Health_HUD = findDisplay 46 ctrlCreate ["RscStructuredText", 20003];
_TB_Health_HUD ctrlSetPosition [0.402031 * safezoneW + safezoneX, 0.0245 * safezoneH + safezoneY, 0.211406 * safezoneW, 0.025 * safezoneH];
_TB_Health_HUD ctrlCommit 0;
_TB_Health_HUD ctrlSetStructuredText parseText format["<t color='#F7E8E8' align='center' size='1.1' font = 'PuristaMedium'>%1</t>",_name];
_actFr = [{
_array = _this select 0;
_mutant = _array select 0;
_param = _array select 1;
_hud = _array select 2;
_paramInitial = _array select 3;
_WBK_TB_paramHealthBarToShow = (_mutant getVariable _param) / _paramInitial;
if !(alive _mutant) exitWith {_hud progressSetPosition 0;};
_hud progressSetPosition _WBK_TB_paramHealthBarToShow;
}, 0.1, [_unit, _param,_TB_Health_bar, _unit getVariable _param]] call CBA_fnc_addPerFrameHandler;
waitUntil {!alive _unit};
_TB_Health_PIC ctrlSetTextColor [1, 1, 1, 1];
_TB_Health_bar progressSetPosition 0;
[_actFr] call CBA_fnc_removePerFrameHandler;
{
_ctrl = (findDisplay 46) displayCtrl _x;
_ctrl ctrlSetFade 1;
_ctrl ctrlCommit 6;
} forEach [20001,20002,20003,20004];
uiSleep 8;
ctrlDelete ((findDisplay 46) displayCtrl 20001);
ctrlDelete ((findDisplay 46) displayCtrl 20002);
ctrlDelete ((findDisplay 46) displayCtrl 20003);
ctrlDelete ((findDisplay 46) displayCtrl 20004);
};```
so something like this?
IA _this is a syntax error and the quotes are unclosed around the boss name, but otherwise ye you've got the idea
note that two separate spawn blocks will run at the same time, so sleeping in one block doesn't hold up other blocks
if you want the delay to apply to the healthbar part, you need to sleep inside that block specifically, e.g. sqf [IA, "WBK_SynthHP", "Irradiated Abomination"] spawn { sleep 2; ... };
@odd kraken and it might help if you collour the text to m8
```sqf
// your code here
```
that white text heart's my eye's lol ๐
copy and past that then remove all the \\
and this is going to help how..?
so you can see collour text
and the collurd text will do what exactly
i gotcha, fair enough
thats a roger m8
most times if people see that white code they say omg ouch ๐
took me some time to get it right also but you will get it right soon
[] spawn
{
if (isServer) then
{
a2 = createGroup east;
"WBK_SpecialZombie_Smasher_Acid_3" createUnit [position a1, a2, "IA = this"];
};
waitUntil {!isNull IA};
sleep 1;
waitUntil { !isNull findDisplay 46 };
_para_HPBar1 = findDisplay 46 ctrlCreate ["RscProgress", -1];
_para_HPBar1 ctrlSetPosition [0.2 * safezoneW + safezoneX, 0.05 * safezoneH + safezoneY, 0.6* safezoneW, 0.011* safezoneH];
_para_HPBar1 progressSetPosition 1;
_para_HPBar1 ctrlSetTextColor [0.1,0.1,0.1,0.8];
_para_HPBar1 ctrlShow true;
_para_HPBar1 ctrlCommit 0;
_para_HPBar2 = findDisplay 46 ctrlCreate ["RscProgress", -1];
_para_HPBar2 ctrlSetPosition [0.2 * safezoneW + safezoneX, 0.05 * safezoneH + safezoneY, 0.6* safezoneW, 0.011* safezoneH];
_para_HPBar2 progressSetPosition 1;
_para_HPBar2 ctrlSetTextColor [0,1,0,0.9];
_para_HPBar2 ctrlShow true;
_para_HPBar2 ctrlCommit 0;
_para_Name = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
_para_Name ctrlSetPosition [0.45 * safezoneW + safezoneX, 0.02 * safezoneH + safezoneY, 0.1* safezoneW, 0.09 * safezoneH];
_para_Name ctrlSetTextColor [1, 0, 0, 1];
_para_Name ctrlSetFont "puristaMedium";
_para_Name ctrlSetStructuredText parseText format ["<t align='center' size='1.3' shadow='2'> ????? </t>"];
_para_Name ctrlShow true;
_para_Name ctrlCommit 0;
_para_maxHP = IA getVariable ["WBK_SynthHP", 0];
while {true} do
{
_para_currentHP = IA getVariable ["WBK_SynthHP", 0];
_para_progress = linearConversion [0, _para_maxHP, _para_currentHP, 0, 1, true];
_para_HPBar2 progressSetPosition _para_progress;
if (damage IA >= 1) then
{
IA setVariable ["WBK_SynthHP", 0];
_para_HPBar2 progressSetPosition 0;
ctrlDelete _para_HPBar1;
ctrlDelete _para_HPBar2;
ctrlDelete _para_Name;
break;
};
sleep 0.01;
playMusic "SoldatsMusicSong93";
};
};
So a really talented scripter made this,(i only added the play music part) but this seems to not work in a dedicated server, any reason for this?
waitUntil { !isNull findDisplay 46 };
there are no displays on a dedicated server
oh, what would work then?
What are you trying to achieve (or more importantly, where are you running this)?
it spawns a smasher from webknights zombies and creatures mod, where a a boss health bar get put up on the screen
and im running this on a host havoc server in a innit of a hold action, which worked in eden, but not in mp
hay @odd kraken you got the text collour woohoo good job m8
How are you executing the script? If it's from a hold action then you need to remoteExec it
otherwise the code wrapped in isServerwill not execute as the holdAction code only runs on the client who activated the action
how would i remote exec it?
help delivered ใ( ยบ _ ยบใ)
โค๏ธ
Not sure if this is the best chat to ask this on, but looking for someone to help me put together a server with mods? Willing to pay if we can agree on a price. Ive tried to do it on my own but im not super experienced and have had to alter the name of every single mod for it to work, on top of that my internet isn't super fast so uploading the modpack has taken days ๐
Why not just rent one from many service provides (like HostHavoc for example)? Also #arma3_questions
Yeah I have done that much. And the server works vanilla. Im just having trouble loading all the mods, troubleshooting them, and finding all the ones that need files renamed so the server can read them.
Haha alright thanks
Honestly I know I could finish it with time but I already have a tight schedule and just looking for a more experienced hand to quicken things up
Hello All: Can i do this: or How would i do this:
SDV setCenterOfMass selectRandom [ "[[2,0,-1], 12]", "[[-2,0,-1], 12]" ];
without the quotes
oh really nice
actually```sqf
SDV setCenterOfMass [[selectRandom [2, -2],0,-1], 12];
hello script chat
does anyone have examples of the cadet popup code being executed on spawning into a multiplayer mission
I got this workin! thank you all for the help! I just had to remove the private _azimuth = _fgt getDir nearestPlayer and _fgt setDir _azimuth and just put fgt setDir (_fgt getDir _nearestPlayer); and it all works like a charm!!!
You had a typo there. nearestPlayer is missing the underscore.
Earlier version was missing a semicolon.
what do you mean cadet popup?
HintC I believe
@obtuse depot about the spawning into a MP mission: i Guess the placement of the HintC: would be the bees Knees: on that ๐
// MP mission
// most likely in the initPlayerLocal.sqf
if (!isServer && isNull player) then
{
waitUntil { not isNull player };
"Your message" remoteExec ["hintC", 0]; // 0 means all clients
};
//or
//=============================================================
"Your message" remoteExec ["hintC", 0]; // 0 means all clients
//or
//==============================================================
//Displaying a hint to a specific group of players:
// Assuming 'USMC' is the name of a specific group
{
"Your message for the group" remoteExec ["hintC", _x];
} forEach units USMC;
//can use:===================================================
"Your message for the group" remoteExec ["hintC", USMC];
Is there a way to temporarily hide the vanilla heal action?
I could handleHeal and just make it do nothing but i dont want the players to be confused
Remove FAK from the inventory that is. I don't believe there is a way other than that
huh... that's a bummer
Speaking of, removing Engine-defined actions would be a niche idea
Oh wait, one thing. Try showHUD if it is acceptable to hide all actions
still want them to be able to interact with other stuff ๐ but yeah as you said it really would be nice to be able to remove, or at the very least hide engine defined actions
thank u original gangster I plan on putting this into a mod when itโs holidays to tell ppl to touch grass
Send queue update commands to the server and have the server do the actual updates.
That's pretty sad to go out of your way to do that
Which 3den attribute and which value do I apply to AI units to disable their Wake-Up Dynamic Simulation attribute via SQF?
According to https://community.bistudio.com/wiki/Eden_Editor:_Setting_Attributes#Attributes I've tried several attribute types so far with the following snippet:
{
private _isPlayable = (_x get3DENAttribute "ControlMP") select 0;
if !(_isPlayable) then {
_x set3DENAttribute ["addToDynSimGrid", 1];
};
} foreach (all3DENEntities select 1);
ignoreByDynSimulGrid is the attribute I see in my mission.sqm file on a unit I manually uncheck that attribute on, but applying that via SQF doesn't seem to have an effect.
:( u hurt my feelings
Oh. select 1 is iterating over the groups...
Got it to work:
{
{
private _isPlayable = (_x get3DENAttribute "ControlMP") select 0;
if !(_isPlayable) then {
_x set3DENAttribute ["addToDynSimGrid", 1];
};
} forEach (units _x);
} foreach (all3DENEntities select 1);
I'd say: it really depends on the meaning you put in it ๐
i just want to wish ppl a happy holidays and this is how im treated ๐
diabolical...
well โ "go touch grass" can also be seen as a diss, that may be how Dart saw it
if it's "enjoy your holidays, don't forget to touch grass", you do you and I think it's wholesome!
This is about their mod causing CTDs for people, and then telling people to go touch grass when people got annoyed because its a holiday
yyyyyyeah, don't CTD people ๐ (on purpose)
was a dumb binarize error bc temp folder needed to be cleaned lmao
holy copium
Oh yeah, addon builder claims to clear the temp folder but doesn't.
so removing that line is enough?
check if hasInterface and put waitUntil + all UI stuff in there
Thanks, i need to read about dedicated server stuff
As far as I can tell, you could just change the first then to exitWith and it'd probably work.
That'd break localhost though, so better to add if (!hasInterface) exitWith {}; afterwards.
Everything except the createUnit looks like client-only stuff.
ended up with a silly 500mb rpt EOF error
Does anyone know how you can color items in a treeview? Eden does it for the entity lists, but using parseText with <t color='blabla'> doesn't work
I want to add a hold action for an object that only shows up for the Zeus, how can I do that? I know the hold action part but i do not know how to check if the unit that is looking has the right Variable Name
You asking about Abstract 's WBK?
what situation would cause a server to not pass (isServer) ? several scripts that use an If(IsServer) don't go through in this particular server
You sure it is the only about isServer? Or any other commands?
unsure, the script was supposed to add an eventHandler that was within isServer condition, i had to swap to true, now another script that also uses that is not running, as if whatever is inside isServer doesn't go through
it was a switch case in the thing i mentioned but still nvm i just checked it is a ifelse
which event type?
ok, correction:
it is an isServer within an eventHandler, which makes me think it will always be false, so changing subject, what causes it to be true?
XEH Hitpart
The server adding the event too would be the only reason for it to be true inside the handler.
It is a config based event XEH event handler ?
The eventhandler is added using CBA's Extended event handler
I changed it from this
to this:
nothing within (isServer) was going through, which i may believe is because it is within an eventHandler, but the main issue our unit was having was that it worked in other servers from groups we played with, what made our server be different?
and now we're having issues with a couple more scripts doing that
and the main issue is the (isServer) not going through, i wanted to figure out what causes it, it's just our server, other servers, hosted, singeplayer, all of them work, just our main server doesn't
Long time since I used XEH, but I don't see why the event handler wouldn't be added on all machines including the server.
This probably still applies from BIKI
The event will not fire if the shooter is not local, even if the target itself is local.
So if you, a non-hosting player, shoots, the event will only trigger on your machine, so isServer is false.
The server is being hosted using faster (dedicated essentially)
Yeah, so all machines have the HitPart event handler would be my guess. But only run on the machine local to the shooter. So it would fail for human players on a dedicated server, but work fine SP/Editor.
i would have to check but it works on other units servers, i assume them to be dedicated aswell
I would recommend restarting your logic with the assumption that isServer is not the problem.
Maybe something like filepatching causing your server not to be running the code you think it's running.
What's your goal here? I recognize that code (the people who wrote it didn't understand it) and have spent my own time fixing it for my own group
getting to understand why (isServer) statements don't work on our server, even tho it works on others
this is just one example
The new or old one 
Either way the new one has some left over variables from the old method if that is what you refer to
Or is that not the tank one
fuuuuuuck
schizo posted for no reason then GG
Not sure why they didnt have me remake the other one when I did the tank tbh
Because they don't know what's bad
I've told them the exact issues with lots of their stuff, which still has not been fixed. I gave up
I've just been rewriting the scripts for their stuff in our unit mod
fair enough
so there is this animation where unit is redirecting vehicles to side road
Acts_ShowingTheRightWay_in
Acts_ShowingTheRightWay_loop
Acts_ShowingTheRightWay_out
is there an opposite animation to redirect to other side ?
Yeah, from CBA wiki:
The same limitations of the usual event handlers added via the addEventHandler scripting command regarding locality also apply to Extended Event Handlers.
Now if you only cared about this code working for enemies shooting at players then it might appear to work on a server that wasn't using headless clients.
No
All animations that are accessible in Animations Viewer are the all animations available in game
Which means, you know, you can't find the left variant
Unless you use Marshall animations and call it a day
I got error in this, its simple trigger to delete some mission objects
deltrg = createTrigger ["EmptyDetector", uberPos, true];
deltrg setTriggerArea [50, 50, 0, false, 30];
deltrg setTriggerActivation ["NONE", "NONE", false]; //<- here
deltrg setTriggerStatements ["triggerActivated wintrg or triggerActivated failtrg or triggerActivated failtrg2",
"
deleteVehicle failtrg;
deleteVehicle failtrg2;
deleteVehicle wintrg;
deleteVehicle hvtbuilding;
deleteVehicleCrew hvtveh;
deleteVehicle hvtveh;
", ""];
deltrg setTriggerTimeout [60, 60, 60, false];
wtf ?
Why on earth would you use a trigger for that
waitUntil
{
sleep 0.5;
triggerActivated wintrg or
triggerActivated failtrg or
triggerActivated failtrg2
};
deleteVehicle failtrg;
deleteVehicle failtrg2;
deleteVehicle wintrg;
deleteVehicle hvtbuilding;
deleteVehicleCrew hvtveh;
deleteVehicle hvtveh;
i tested and its not deleting the objects ... ๐
I just put what your code at the end of the mission script
0 spawn
{
sleep 60;
deleteVehicle failtrg;
deleteVehicle failtrg2;
deleteVehicle wintrg;
deleteVehicle hvtbuilding;
deleteVehicleCrew hvtveh;
deleteVehicle hvtveh;
};
You could also put that code into the activation field of wintrg failtrg and failtrg2
and call it a day
this is the first I did but I need some time between completing mission objective and deleting the objects because I don't want everything to disappear immediately in the players face
see above
@cosmic lichen Its working! That's really clever to add spawn into win trigger statements, thank you.
Looking at the input actions (https://community.bistudio.com/wiki/inputAction/actions) does checking SetTeamRed (Left Ctrl+F1) work even when not commander (or most importantly, when in curator interface)?
Is this a scripting question or in-game control question?
is there any way to make this command to work in MP (respawn = 5)? Or any way to spawn switch-able units? Its working fine only with units spawned in editor.
addSwitchableUnit _unit;
edit: if somebody wonders selectPlayer is the holy grail ๐ค
Scripting.
I'm trying to check if Ctrl+F1 is pressed which runs an entirely different script while in curator interface and I'm curious if SetTeamRed would function just the same for input action validation in this context
So you say inputAction "SetTeamRed" is the command in question?
Yes
It worked pretty fine to me
what will happen if two players switch simultaneously to same unit with selectPlayer command? ๐ซฃ
nothing happens simultaneously
one is always first
2nd one will probably fail silently
what's the command to make a vehicle a medical tent/vehicle? can't seem to be able to find it
i.e so you get the "treat at" option
ah, gotcha
However, that's easy to script
yeah i figure i'd just have to make a custom action that does the same thing, easy enough, i was just hoping for an engine solution (without needing to change the config)
I am having a issue that the below code, when deployed in a zeus environment/multiplayer, the "custom action" is being trigerred when i am not looking at scp173. Eg. if i dont look at it, but the other player does, the custom action is still being activate when it shouldnt.
anyone know why? i dont think i need to put a remote exec but it is not working.
My quick hint check also seem working by properly returning the names of the player that is looking at scp173.
spawn {
....
_scp173View = false;
if (time - _lastTeleportTime > _teleportCooldown) then {
private _menInRange = (_scp173 nearEntities [["Man", "LandVehicle", "Air", "Ship"], 100]) select {side _x in [east, west]};
private _viewers = _menInRange select {
!(worldToScreen ASLToAGL getPosASL _scp173 isEqualTo [])
};
_scp173View = (count _viewers > 0);
if (_scp173View) then {
private _viewerNames = _viewers apply {name _x};
hint format ["SCP-173 is being watched by:\n%1", _viewerNames joinString "\n"];
};
if (!_scp173View && {count _menInRange > 0}) then { "Custom action"};
-
On a given machine, viewers are all those in range, if the local player is looking. So if A, B, C are close, then it will be [A, B, C] if the local player is looking, otherwise none, []. On a dedicated server I would imagine none.
-
The only way for a custom action to trigger is there are people close, and the local player is not looking.
-
For the dedicated server machine it would pretty much trigger all the time anyone is close.
-
For a, possibly, hosting player-machine, the custom action would only trigger if looking away and someone is close.
But basically this: _viewers = _menInRange select {!(worldToScreen ASLToAGL getPosASL _scp173 isEqualTo []) does not do what you expect it to. It is all nearby, if player is looking at it, otherwise none.
how can i change it that it is not just local player looking (aka me) but any player looking.
bc i though in the _meninrange select, i thought it would only select people that is also looking at it. and not just me
Well, it is not clear whether your use of nearEntities is meant to only apply to players or not. worldToScreen is meaningless for an AI, or unmanned vehicle.
worldToScreen cannot go look at some other players screen, or an "AI's screen".
ohhhh, i didnt know that worldtoScreen cannot go look at other players screen. so that why
is there a command that does it? or it dont exist in arma?
I don't believe there is a command like that. There is aimedAtTarget, but that is only for aiming. There are lineIntersect commands, but they just check whether there is an unobstructed line.
If you only need it to work for players the current scheme is fine. You could run the script on all machines and have
private _isClose = (vehicle player) distance _scp173 < 100;
private _entityOnScreen = !(worldToScreen ASLToAGL getPosASL _scp173 isEqualTo[]);
if (_isClose && !_entityOnScreen) then {
// Trigger custom action appropriately here in MP
};
sorry, i am confused, how is _entityonscreen different from the original code?
Wont it still not work?
when i dont look at it*
Ah, I saw you want not looking at it, editing.
maybe i am getting confused but i think "player" do not work in multiplayer no?
I am a bit loss on why your code would work compared to the original. Your code seems to be focus if player (inthis case, in multiplayer, i dont think it work. But assuming it does, it would likely be me only) is within 100M and i dont see scp, then do "action".
If i want any players to be looking, your code dont seems to work.
Maybe i am understanding something wrong.
I see you want no-one at all is viewing when close. That is a tough cookie over a multiplayer connection.
yes, i want if no one at all is looking at scp in multiplayer within 100 meter, then scp can trigger the action
it best if it also incorporate ai but atleast the players
Well for AI you have to come up with some way of "seeing" that is not screenToWorld, because AI don't have a screen.
How often do you want to trigger? Because the only feasibly way would be to transmit each players _entityOnScreen on the server to perform a global check there.
i would want the check to be at each second.
less than that , it would kill frames. so at least 1 second up to maybe 5 second at most
So you could toggle player setVariable ["IS_SCP_ON_SCREEN", _entityOnScreen, true] all the time (or optimize whether closer than 100m or not).
what ever is easier
Then the server would do the check across all players based on that info.
No you can do a worldToScreen every frame if you want without noticing it. The problem is the network traffic is reliable, so it might cause trouble if sent too much.
i never deal with setting variable and custom check on other player's side.
I solely did some general remooteExec per the BIS website. how would you do to deploy that?
I cant really visualite how to code it
So something like this would run on all player machines:
if (hasInterface) then {
[_scp173] spawn {
params ["_entity"];
while {true} {
sleep 0.5;
private _isClose = (vehicle player) distance _entity < 100;
private _prevValue = player getVariable ["IS_SCP_ON_SCREEN", false];
private _isOnScreen = !(worldToScreen ASLToAGL getPosASL _entity isEqualTo[]);
private _shouldUpdate = (not _isClose && _prevValue) || (_isClose && (_prevValue != _isOnScreen));
if (_shouldUpdate) then {
private _newValue = if (not _isClose) then { false } else { _isOnScreen };
player setVariable ["SCP173_ON_SCREEN", _newValue, true];
};
};
};
};
This would update twice a second if the player is looking or not. To optimize network traffic we only send if status changed AND we are close. If we leave we set it to false.
The server would do something like this:
if (isServer) then {
[_scp173] spawn {
params ["_entity"];
while {true} {
sleep 0.5;
private _closePlayers = allPlayers select {vehicle _x distance _entity < 100};
private _NumWatching = _closePlayers count {_x getVariable ["IS_SCP_ON_SCREEN", false]};
if (count _closePlayers > 0 && _NumWatching == 0) then {
// Handle custom action
};
}
};
};
Given that we could sometimes hang Arma by deleting a unit immediately after someone selected out of it, I'd recommend avoiding that :P
You would of course need to add the teleport timeout et cetera too.
So basically on each player we store in the player-objects variable space in IS_SCP_ON_SCREEN whether or not the entity is close and on their screen. The server regularly checks for close players and reads these entries to know if the remote player is looking or not.
ok i have a good idea now. just curious but isnt _scp173 undefined on the server side. My old code used to be code tied to a specifc created scp173. Would you code still work if i am placing multiple scp173?
Well I don't know where you got _scp173 from in your original script.
Well it would work fine, you would need to spawn both handling scripts multiple times and use unique name for the setVariable name.
So:
[_scp173, "IS_SCP_NUM_1_ON_SCREEN"] spawn {
params ["_entity", "_varName"];
//.......
private _prevValue = player getVariable [_varName, false];
// ......
player setVariable [_varName, _newValue, true];
//.....
And similar for the server handler.
Also, let says that the scp173 is killed and i want to kill the player's side check. how would i go from sending a info from server to player to stop it. given a constant running of the code on player side will slow them down.
Then you would spawn with:
[_scp173_1, "IS_SCP_NUM_1_ON_SCREEN"] spawn // ....
[_scp173_2, "IS_SCP_NUM_2_ON_SCREEN"] spawn // ....
[_scp173_3, "IS_SCP_NUM_3_ON_SCREEN"] spawn // ....
Well you could change the true condition to alive _entity. The script would quit the loop when that is no longer true.
it is that simple lol? i thought it was some complicated code haha. ok i think i have a good understanding now.
Thank you so much Muzzle!
You're welcome
Also if you get it working, you may want to try changing player setVariable [_varName, _newValue, true]; to player setVariable [_varName, _newValue, [2, clientOwner]]; to avoid having the server forward the data to all other clients, since they don't need to act on it.
So instead of 20 clients updating, forcing the server to send 20*19 updates out to the other clients, it just receives those 20 updates only.
Thanks for the answers earlier. I am going to experiment with server-side updates. I'm not aware of any way to enforce locking in SQF, so mutating shared state seems particularly brittle.
pushBack is atomic so a queue would do well enough
hello all: can i remoteExec this on the server some how ```sqf
[] spawn SFA_fnc_INS_ChopperHoldFinish;
this gets (run or spawned) from within the 1st chopper script
[] remoteExec [ "SFA_fnc_INS_ChopperHoldFinish", 2 ];
@hushed turtle hmmm it does not seem to work correctly
Error position: <โSFA_fnc_INS_ChopperFinishโ, 2];
both works
oh ok i'll try it
Indeed they were, I was typing on phone and I didn't notice them being different ๐
woohoo it works Awsome thx all ๐
thx so much guys i mean really happy now woohoo @granite sky @cosmic lichen @hushed turtle
all you guys just made me the happy-est guy in the World ๐
What would be the best way to remove values from that array without reassignment , since I'm passing the reference in to child functions
I'm really trying to avoid just making it a global variable for sanity reasons
deleteAt modifies the original array instead of returning a copy
Great thanks.
morning chaps ๐
I have a variable in the main scope of my script. If I import it into a while loop further down, I understand the variable is privated in the loop
does that mean the value is or isn't changed in the main scope?
How do i get the variable name of a group? Like the group is called ei_0 but it returns Alpha 2-2. I want to do something like ((str ei_0) splitString "_""")#0 != "ei";
not great to rely on that, but indeed most likely str _theGroup (not recommended)
Not sure what you mean by importing a variable into a loop, there is no need (or mechanism) for that. You can just use existing variables in loops (see _a in the example below). You can also define new private variables in loops; the scope of such variables is tied to the loop and they become undefined after the loop (see _b in the example below).
Run the following code (e.g. through the debug console in the Editor) and observe its output:
private _a = 0;
systemChat format ["Starting with _a = %1", _a];
while {_a < 3} do {
private _b = 42;
_a = _a + 1;
systemChat format ["_a = %1 and _b = %2", _a, _b];
};
systemChat format ["Finished with _a = %1 and _b = %2", _a, _b];
systemChat format ["isNil _a: %1", isNil "_a"];
systemChat format ["isNil _b: %1", isNil "_b"];
I misunderstood my own code ๐
the variable is privated in bottom scope, then I attempted to use it in a spawn snippet that was inside a loop, because I've only been doing this for 20 years and still learning ๐
rather than messing around with importing, I just converted it to a global
I was using (misusing) this https://community.bistudio.com/wiki/import
global variable is "visible" in loop and everywhere actually ...
spawn always creates a new scope. To access data from the surrounding code, you have to pass it in as an argument.
private _a = 0;
private _b = 3;
while {_a < 3} do {
_a = _a + 1;
_b = _b - 1;
[_a] spawn { //Provide _a as an argument to the spawned code.
params ["_a"]; //Could also use a different variable name instead of "_a".
systemChat format ["_a = %1 and _b = %2", _a, _b]; //_b is undefined here.
};
};
systemChat format ["Finished with _a = %1 and _b = %2", _a, _b];
```Example 3 on https://community.bistudio.com/wiki/spawn illustrates this too.
Good day. I'm trying to understand - one of the UIs I use in mission created with createDialog does not prevent players from using VoN, however all the rest are 
Is it a known issue? We really struggle with need to close UI in order to say something.
UPD: I see that non-blocking display has idd = -1 in its description, but all the others have assigned values, is that what makes all the difference?
Offtop:
IDD_EDIT_BRIEFING // TODO: Has to be checked by Pete! 138
Did Pete check it? ๐
he never did :p
Did i write anything wrong bc my music wont play?
["CUP_A2OA_Iron_Mountain", 60] remoteExec ["playMusic", 0];
It thinks the string is left side argument, but playMusic has them both on right
Use array in array like [[]]
ty, works now
What is the name of the variable that stores the object quality settings?
There isn't one, by default.
You can use https://community.bistudio.com/wiki/getVideoOptions to get the data you need and then save it in a variable yourself, if you like.
Sounds like a question a cheater would ask 
And by looking at his linked steam account, I am pretty sure that's the reason.
Edit: Yup banned for Cheating in Arma 3 on the Infistar Antihack 
There's still no quality of objects there, I need to disable extreme graphics settings on the server (all)
That command does return object quality settings:
["objQualityName", "VeryHigh"],
Most client video settings cannot be force-set. They have performance and accessibility implications, so it's up to users to pick the one that works for them.
setTerrainGrid, setViewDistance, and setObjectViewDistance are about all that can be changed by script.
private _videoOptions = getVideoOptions;
private _objQuality = _videoOptions select 3;
private _hasViolations = (
_objQuality in ["Ultra", "Extreme"] ||
);
smt like this ?
No. getVideoOptions returns a Hashmap, not an Array. You can't use select on it because the contents aren't stored in order. You need to use get.
Thanks
@hallow mortar Can I lock Heli flight model to standart only for all clients ?
Not through scripting. This is controlled by the server config forceRotorLibSimulation parameter. https://community.bistudio.com/wiki/Arma_3:_Server_Config_File
Yes, but the player can still go to the settings and set the model to advanced mode, or will it not work?
The documentation says that parameter enforces the setting. If you think it's not enforced, you can easily test it yourself.
How hard is it to port over a2 vehicles
for reference, how hard is diamond?
10 of course, according to Mohs'
real answer: It involves quite a bit of work, knowledge of the arma engine and the assorted tools
theres some guides on the forum
On dedicated server with headless clients. Does server spread workload automatically by changing locality of AI units or does this has to be scripted?
Hey hey, I was wondering if anybody knew how to do a script that adds a visual health bar, sorta like a boss healthbar from like a souls game into Arma 3, I know SCP - Darkwoods did make a boss healthbar, I was just wondering if anybody knew how to recreate it?
It has to be scripted.
What makes you use "private" in spawned code? It literally makes nothing except for making the code harder to read.
Also that last private _newValue = if (not _isClose) then { false } else { _isOnScreen };... Well, it just means _isClose AND _isOnScreen, why make it that complicated
In addition to what @willow hound says and to save you a sh-ton of headache if you decide to do it:
- Your headless client should be spawning the groups and units it will control
- Spawning them on server and later transferring to HC is a pain and naked men
I think private affects code readability exactly zero point zero zero percent. But it does prevent overwriting variables in outer scope when code gets moved around and shift scopes. This wasn't for me, and 98% of my personal scripting doesn't live in spawn, so my habits mostly adapted to general callable code.
As for the second point, you are right _isClose && _isOnScreen is equivalent expression. This was code on a saturday evening that I didn't personally need, so I didn't spend time simplifying it. The logic merely followed my imperative train of thought at the time in which the condition was basically whether to "reset" to false-and-away state. (Edit: actually I had this unnecessary notion initially that I wanted to skip the screen check if the player was far away, and didn't clean up the conditions after opting not to)
But yeah you could remove _shouldUpdate too and simplify it all to:
_isObserver = _isClose && _isOnScreen;
if (_isObserver != _prevValue) then {
player setVariable ["SCP173_ON_SCREEN", _isObserver, [2, clientOwner]];
};
Cross posting from #arma3_config - How can I extract the CfgVehicles class hierarchy from in game like that of Arma 2 in Wiki? https://community.bistudio.com/wiki/Arma_2:_CfgVehicles
What makes you use "private" in spawned code? It literally makes nothing except for making the code harder to read.
- Consistency
- No need to think if you always make all local variables private
- No risk of breaking things by copy-pasting or by refactoring the code (e.g. by removing
spawn) - Easy to see where variables are declared for the first time: I see
private, I know that there is a new variable (not a reassigned one) and I know for sure what its scope is
private essentially becomes the "I want to declare a new (local) variable" keyword (like const / let in TypeScript / JavaScript or var / val in Scala), and life is simplified.
Yeah, I always use private just because it's easy to see where I'm declaring my variables. I wish there was some keyword for globals too.
I just write them with prefixes like FOO_SystemName_myGlobalVar
In a decade of sqf I can only remember a single time where I set multiple private variables in my top level function, and then accessed (read) them in further down in called functions. And this required care on my side but was safe for callers because my top level declared them private. But zero times have I ever wanted to write such dynamically scoped variable further down. And private ensures that never actually happens, even by accident.
To add, I declare private ["_foo","_bar",...] right above loops (for/while/forEach) if they are used there.
Not sure it actually improves things, but I โจ believe โจ it does no harm to reuse varaibles instead of re-declaring them 
I tag all if my global vars, but that doesn't help me to see where I'm declaring them. Hovewer I have /*new*/ comment at start of each line where I'm declaring global var in all my sqf scripts, which helps me to see that.
Well according to BIKI it is equivalent except worse performing ๐
I didn't measure myself though, and doesn't really matter
Why not write them in a single block at the top of the file with default values for declaration?
That way you will see exactly what global vars are used here and what to expect from them
I do have them at the same file. Well, at least most of them
I assume you preProcess your files so assuming you don't need a variable named global you COULD (not saying you should) do this:
#define global
global TAG_myGlobalVar = 42;
That's actually good idea
Generally for global var I just search for "TAG_var =" ๐
imho
//Private and Global are different
Private _variables = whateveriwant;
// Global variable
someVar
//Global means the variable is in the global scope.
//Such as mission variables, variables on an object, etc.
//Private is only for local variables,
//i.e. variables that start with an underscore
//Variables that begin with an underscore are local variables,
//meaning they are only defined in that scope
someVar = 1; // global variable
_someVar = 1; // local variable
//All local variables have to start with an underscore
//For example:
params ["someVar"]; // Error: invalid local variable name
//hint is local, meaning A hint would only be displayed on the machine where it was run
``` ๐
why does this not work, it just prints 'any'
p1 addEventHandler ["hitPart",
{
params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect", "_instigator"];
systemChat format ["projectile type: %1", _projectile];
}];
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart says:
This EH returns array of sub-arrays [[...],[...], ... [...]]. Each sub-array contains data for the part that was hit as usually multiple parts are hit at the same time (see HitPart_Sample). The structure of each sub-array is listed below.
Or are you using https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart_2 (Projectile EH)?
No im using the first one and only want to know which type of _projectile/_ammo hit the _target
Looks like you need to do (_this select 0) params... to get the first hit part
Looks like less than 3 parts got hit, so that would explain why third element in _this wasn't defined.
@cptnnick I pretty much said the same thing in the other channel. That's funny lol
So using this should work,right?
Im trying do differentiate between the different ammo types meaning: bulletbase,grenadebase,rocketbase etc.
Yeah, _this in this context is an array of arrays, but you only need first subarray - I doubt ammo is gonna be different between hit parts
rgr, i will try it later, thank you
hay guys: Everything is working so Great: thx so much: all you great guys: You know who you Are: Woohoo: to many to Name
i freeking love this Arma 3 ๐
i just completed a mission i made where you must attack this HQ and kill all there and Download info form a LabTop on the location of the fuelDepo: (that spawns at Random Locations) and there's Tanks there and MG trucks and Ememy: and ofcorse you must expload the fuel ๐ for mission win ๐
huge explotion on the fuel and smoke and fire Woohoo ๐
Will this work as a file path for cfgfunctions: โScripts & Functions\AIโ
Will Arma take the spaces and & symbol for file paths?
perhaps; try and see
I would recommend using Functions like everyone else
oh and thx @ Lou for helping me with this ```sqf
SDV setCenterOfMass [[selectRandom [2, -1], 0, -1], 100];
im feeling very thankful today ๐
you might be woundering whats the big Deal with Setting the mass on a littel old SDV: ๐ ```sqf
//Submarine attachTo SDV
Submarine = "Submarine_01_F" createVehicle position SDV;
Submarine attachTo [SDV, [4.45, 0, 1]];
Submarine setDir 180;
WooHoo
Is there specific reason that hitpart eh fires regardless if damage is turned off and hit eh not?
i'm not sure it might be a paradox ๐
Would be nice if hit eh would also fire
Would really want to know why if someone with more knowledge can answer please
i have some knowledge just not about hitparts: i was just jokeing in the last post m8
All fine i didn't mean you
copy that m8
maybe you could try ```sqf
addMissionEventHandler
addMissionEventHandler ["hitPart",
You need it to fire even when damage is off(I assume allowDamage false) ?
hit can also fail to fire if the target has damage enabled, but the hit does very little damage.
I think they happen at different points in the hit process and monitor different events. hit apparently has a threshold for damage being done, while hitPart occurs earlier, before it's decided whether damage is being done.
But this is all engine code within Arma's horrifyingly complex and inconsistent damage system, so you'd probably need a dev to give a complete answer.
I just wanted to know why ๐
so i was right it is a paradox ๐
paradox is a statement or situation that seems self-contradictory or opposed to common sense, yet may prove to be true ๐
Well I can make the following speculations for why:
- Note the description for
allowDamagesays it does not transfer when unit moves locality despite being a global command. - Combined with
isDamageAllowedwhich states that for non-local objects the results is alwaysfalse
The following is of course all speculation based on reasoning of the data that is visible to us from the engine. We might conclude that possible allowDamage is only known properly on the machine the object is local to which is why other machines just getfalse. Now let us look at event handlers: "Hit"requires the object is local and will not fire ifallowDamageis false, which make sense from a damage perspective since only the machine local to the object knowsallowDamageis false or not."HitPart"only works on the shooter. If you ever played on severly lagging server you know the shooter's view takes priority. Other game engines might have the server "rollback in time" so see where the hit is. But here the shooter is authoritative in what he hits. But assuming again above the shooter might not have accurate information on whether allowDamage is true or not for the target. So it just runs always.
There is also the argument that if someone is interested in the data in "HitPart" they may have other reasons than damage, so not running the handler here breaks that.
- The major disagreement with my hypothesis is that
"MPHit", from BIKI at least, does distribute the event handler and also incldues the note aboutallowDamagebeing a deciding factor. But that would seem to imply non-local machines do have accurate info aboutallowDamageso why wouldisDamageAllowedreturn false for those? And why wouldn'tallowDamagenot then follow an object that changes locality?
Anyway, that was it for my speculative Ted Talk.
so i was right it is a paradox ๐ ๐
lol just having fun ๐
ok Awsome people i can't w8 to get back from Golfing: to learn more stuff Woohoo: see you m8s
Does BIS_fnc_curatorHint allow structured text to be passed?
the wiki page says nothing about it, so ๐ฎ perhaps
hey guys do groups go null if every unit gets deleted or removed from the group? don't wanna run into a reference error? I'm new to arma 3 but I assume so
The group can be auto-deleted when empty, but the exact timing is not guaranteed. Unless a script actually does deleteGroup on it, there's an element of "when the engine feels like it"
Will group var be undefined or grpNull?
^^ Yeah what can I do to check it during runtime? Oh and one more thing I'm gonna use groups as a keys in a hashMap but it is an unsupported type. The wiki gives a workaround by using hashValue group to create a key. Group value won't ever be changed during runtime as any side effect? ( i don't know how it responds to deleting and adding units) I'm assuming it keeps the same reference value the entire time unless it ever gets destroyed
If all units from the group are deleted, the group is simply empty (not grpNull). Also, from https://community.bistudio.com/wiki/deleteGroup:
In Arma 3 when the last unit leaves a group, the group gets automatically deleted. Manually deleting all units from a group, however, does not automatically delete the empty group.
Gotcha makes sense
the wiki say it uses netId for group hashValue, this is automatic unique identifer from the engine I don't need to worry about it changing ever?
and thanks for your help guys ๐
When the group is deleted, the variable value should become grpNull. You can test this by running the following code (e.g. in the debug console in the Editor):
private _g = createGroup blufor;
deleteGroup _g;
systemChat format ["isNull _g: %1", isNull _g];
not sure but iirc groups have a deleted event handler which you can use to remove the group from the hashmap just to be safe
In function is
CONTROLHINT ctrlsetstructuredtext parsetext _text;
so yes, you can use structured text.
https://community.bistudio.com/wiki/ctrlSetStructuredText
that's smart didn't think about that thank you
Quick question how would i detect explosion on a object ?
explosion event handler?
thanks that is it.
you could make a progress bar with https://community.bistudio.com/wiki/ctrlCreate
I've been messing around with [testBoat, 60] spawn BIS_fnc_unitCapture; since boats in Arma 3 can't seem to drive in a straight line near land masses.
It seems to record location data and the playback function works okay with some caveats; Some animations from the boat aren't included (water jets) and there is no engine noise since I guess it's technically off.
Any ideas on how get it to make some noise so it at leasts sounds convincing enough that it is actually driving?
. . . turn the engine on? ^^
but otherwise you cannot manipulate e.g engine RPM by script.
Wouldn't that just make an engine idle sound? Since the boat is driving the RPMs should be rather high.
that's about it yeah
I guess I could do a say3d since I think that follows the sound source. Then record the sounds it makes when I record with BIS_fnc_unitCapture.
(by mouth)
("VROOHOOOOOHOOOOOOOOM")
extra immersive! ๐ซก
@little raptor
I am trying to loop an animation in the way you suggested a couple of weeks ago. The issue I am having with the EH method is that it fires multiple times (even though the wiki says it shouldn't for AnimDone). This means that the animation starts over rapidly, making it look jittery/glitchy.
testUnit addEventHandler ["AnimDone", {
params ["_unit", "_anim"];
systemChat "mainFired";
[_unit, _anim] spawn {
params ["_unit", "_anim"];
sleep 5;
if (alive _unit && _anim == "HubSittingChairUA_move1") then {
systemChat "animationfired";
[_unit, "HubSittingChairUA_move1"] remoteExec ["switchMove", 0];
[_unit, "HubSittingChairUA_move1"] remoteExec ["playMoveNow", 0];
};
};
}];
I fires more than the screenshot. Possibly up to 20 times.
The double remoteExec is probably wrong because it doesn't guarantee execution order. Those commands aren't documented well enough for me to say what's actually correct.
All sorts of waffle about "good practice" and things that may or may not work. No actual description of how the animation system works.
it doesn't guarantee execution order
it does, iirc?
remoteExecCall does. remoteExec just puts them in the scheduler queue. IIRC they usually run in reverse order.
Oh, I guess these are commands so they should get remoteExecCall behaviour. Kinda hard to prove either way.
remoteExec is supposed to have guaranteed execution order live. The remoteExec JIP queue, however, may not be in order
I'm guessing that knowledge of the animation system is not commonplace and is made worse by the passage of time. Maybe it's a situation of there is only one or two people knowledgeable at Bohemia on it anymore.
I shouldn't expect scripted combatBehaviour or behaviour values to stay if I don't disable the FSM right?
idk what the AI does if its disabled, will they even shoot or move? Do they just act normally according to whatever their behaviour is set to?
IIRC "AUTOCOMBAT" handles all the safe/aware/combat switching so you can just disable that and otherwise they'll act normally for their behaviour.
im trying to but forgot how to do it in script
disableAI
the bohemia wiki is a maze of links that aren't connected well imo
thats what i was looking for
yeah I have seen this page before and couldn't find it purposely looking for it
๐คท
yeah it's too spaghetti sometimes
The search requires you to remember what it starts with, at least.
Could do with a semi-modern search that can handle partials.
fair, but also searching for "disable" is not so far fetched here ๐
but yeah, MediaWikiโฆ
Please refrain from crossposting anyways
inheritsFrom is a command to parent(s), getArray should return all children of the class
Can someone please remind me, its driving me nuts and google with its new AI search is making it hard to find the actual answer.
What is the command to print into the console to log stuff? I cannot for the life of me remember.
diag_log?
thanks, it was driving me nuts, that is it.
ok a few tips:
-
instead of remoteExec, a. add the EH to where the unit is local, or b. add it everywhere and do early return using
if (!local _unit), or c. handle its locality change; all are better options than remoteExec. I'd say adding it everywhere is the safest option but if you know locality won't change you can just add it to the local computer. -
no need for switchMove+playMoveNow; just use the 2nd switchMove syntax, which is also less jittery if you set the blend factor to 0:
_unit switchMove ["HubSittingChairUA_move1", 0, 0, false];
// or its remoteExec form, but not needed if you do tip # 1
[_unit, ["HubSittingChairUA_move1", 0, 0, false]] remoteExec ["switchMove", 0];
- instead of "AnimDone" EH, use "AnimStateChanged". "AnimDone" was a bit buggy last I checked it.
So it just becomes:
testUnit addEventHandler ["AnimStateChanged", {
params ["_unit", "_anim"];
systemChat "mainFired";
if (alive _unit && _anim != "HubSittingChairUA_move1") then {
_unit switchMove ["HubSittingChairUA_move1", 0, 0, false];
};
}];
// start the anim
testUnit switchMove ["HubSittingChairUA_move1", 0, 0, false];
- you can use
_unit disableAI "ANIM"which will prevent them from changing animation so often. (but the EH will take care of it anyway)
you can make it into a function and reuse it:
(I also added it to biki)
// TAG_fnc_loopAnim
params ["_unit", "_anim"];
// remove old EH
_unit removeEventHandler ["AnimStateChanged", _unit getVariable ["TAG_AnimStateChangedEH", -1]];
private _EH = -1;
// if anim is empty, just stop looping
if (_anim != "") then
{
_EH = _unit addEventHandler ["AnimStateChanged", {
params ["_unit", "_anim"];
systemChat "mainFired";
private _loopedAnim = _unit getVariable ["TAG_LoopedAnim", ""];
if (alive _unit && _anim != _loopedAnim) then {
_unit switchMove [_loopedAnim, 0, 0, false];
};
}];
};
_unit setVariable ["TAG_AnimStateChangedEH", _EH];
_unit setVariable ["TAG_LoopedAnim", _anim];
// start the anim
_unit switchMove [_anim, 0, 0, false];
// start looping
[testUnit, "HubSittingChairUA_move1"] call TAG_fnc_loopAnim;
// stop looping
[testUnit, ""] call TAG_fnc_loopAnim;
you also can use OOS to generate SQF code @agile pumice
it is also a C-stylish lang
however, still in ALPHA ๐
but looking forward to reach BETA state soon
thats not really what I meant haha
I have a C# library that I want to run in arma3
not that I want to turn my sqf code into C#
c# doesnt work with call extension does it?
think I answered my own question
How can I determine if curator has switched vision mode to nightvision / thermal? inputAction "curatorNightvision" > 0 does not work neither nightVision and cameraVisionMode
yes c# work
Have you tried to check the vision mode of the curator camera?
inputAction is for detecting whether the key is currently being pressed. It will only return true for a brief moment while the player is pressing the button to switch.
I tried currentVisionMode curatorCamera and it returns 0 even when its nightmision
I'm using waitUntil {inputAction ... - it works for other functions like control group set, camera position set etc.
Just flashlight and nightvision
Try using a User Action Event Handler instead
Yea thats what I was thinking - keydown even handler. But its strange that these inputactions are not being recognized
User Action event handlers and KeyDown event handlers aren't the same thing
Ah yes ๐ - User Action event handler works fine, KeyDown does not. But got it working in the end though.
anyway to create waypoints without adding it to a group? can only find the way of creating waypoints by addWaypoint, I don't see something like a generic createWaypoint
I'd like to define some waypoints in advance (like a group of move commands together could be thought of as a custom route) and then add them to potentially multiple different groups at different times depending on other logic
No, but you could predefine the waypoint data - position, type etc - and store it in a variable for later use
thats what i figured i would have to do
would have been great if the link I shared was a little more elaborate
Gday all,
how can i force a player controlled vehicle in a position with scriptiing until the rest of the script has run then "release" the vehicle at the end of the script?
Remove fuel and add back later.
https://community.bistudio.com/wiki/setFuel
You could also attach the vehicle to something
attach idea is brilliant
["Aligning vehicle with repair bay"] remoteExec ["hint", (driver _veh)];
_veh setPos (getpos _nHeliPad);
_veh attachTo [_nHeliPad,[0,0,0]];
//Detach
detach _nHeliPad;
Something like this?
Sry, dont now how to do the sqf coding is discord
nothing about params or anything lol
```sqf
```
Thanks for the tips, Leopard! I played around with your function for quite a bit tonight; however, I was not able to get your function to work as it is written on the BIKI. The unit will play the animation that you pass to it when you call the function; however, it will not loop. It only plays it once.
So I started modifying your function to see what would happen. I found a couple of interesting things:
- Some animations will loop with your function while others won't. The sitting animation you have listed on the BIKI won't loop, but I tried some others, like a push-up and vehicle repair animation that do loop.
- That sitting animation, you have on the BIKI will loop if you change the EH from
AnimStateChangedtoAnimDone, as well as change your if conditon fromalive _unit && _anim != _loopedAnimtoalive _unit. Though there is an awkward moment where the unit stands after the animation plays and abruptly sits again mid-standing animation. I was able to fix this by reverting to the first syntax ofswitchMove.
After messing around with the function, I switched over to tackling the jittery issue I have with my current script. I used a locality check like you suggested, but it did not fix the jitter. My current thinking is that since AnimDone "Triggered for all animation states in a sequence.", what is happening is that because the EH fires multiple times, my switchMove within the EH gets run just as many times as well. Thus causing the jitter at the beginning of the animation loop.
After further testing, the jitter seems to be caused by my adding a sleep in between the animations. The length of the jitter is directly proportional to the length of the sleep. Is there a way I can add a pause between the animation loop without sleep? Some of these animations are quite short so they look weird if you dont add a little break in between them.
are you still trying to make AI sit on that beach chair? ๐ฎ
Hahaha, yes! I think I'm about 20 hours deep at this point. I really should move on, but when I get frustrated, I tend to dig my heels in. But I'm still learning other things with it. I picked up a better understanding of variables and functions by messing with Leopard's function, so it's not all wasted time.
oh well I've always try to set up animations but I always give up, just wait and see its results on dedi when you get everything working on editor lmao
even for simple commands or functions
I hear that. I'm nearing completion of the major mechanics in the mission and I'm not looking forward to seeing what breaks when I test it on the dedicated server!
๐
Probably broadly correct, depending on what you want it to do, but don't use setPos getPos. Those commands are slow and do not use the same altitude format as each other. Instead, use a matched pair of setPosASL / getPosASL or setPosATL / getPosATL.
Also, attachTo will automatically move the attached object anyway, so you don't need to manually change its position first at all
yea i figured that out, it now uses BIS_fnc_attachToRelative.
My problem rn is detaching the heli from the pad when the script is finished
Well, detach _heli
If your script is a repair script then it must have a reference to the helicopter to work with, so it's as simple as making detach the last thing it does
Whats params got todo with callExtension
i think i figured out why it wasn't working
I was setting the detach command in the wrong place
Same result with one backslash
```sqf
//I only used one backslash
```
๐
I want to know how to accept params in the dll class
arma callExtension, you give it a string, it returns a string
its up to you to code it to parse the string
I'm trying to process html files with the xml document approach shown here http://www.codeproject.com/Articles/587458/GettingplusOnlyplusTheplusTextplusDisplayedplusOnp (method 3)
and im processing the input string like so: http://pastebin.com/raw/vvrSAwzd
but its just returning an empty string
sorry for not being more elaborate ๐
I need to apply settings for some mods on the server, I tried in init.sqf, I tried in the server mod, but they don't apply, can you tell me where to enter these settings or what to do?
Example of settings:
hatg_setting_building = true;
hatg_setting_complex_detection = true;
hatg_setting_cooldown = 10;
hatg_setting_debug = false;
We don't know what are they. Is that a particular something for a particular Mod?
Specifically, these lines are the settings of the Hide Among The Grass mod.
Which tells you that instructions?
not too sure with how to handle that in the string builder
I set up the mod in arma, through the add-ons settings, and then exported them.
But I dont know how to apply them to the server, the methods I have tried do not work.
Have a read of this article https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System
thanx
oh nice @stable dune
so then like this then Woohoo ๐
```sqf
// Copy text on all this and remove all the ( back slashes = \ ) and your code goes here
```
thx m8: lol i need help so i can help ๐
```cpp
// and for Description.ext type code or settings code
// Copy text on all this and remove all the ( back slashes = \ ) and your code goes here
```

you can also do diff colors like this
- private _scotty = _this select 0;
- private _scotty2 = _this select 1;
+ params ["_scotty", "_scotty2"];
Guess your got a promotion. Congratz, Corporal.
is there a way to increase the spacing for a group of units in a formation? IE follow the wedge pattern but increase the distance between each unit
nope iirc
with a mod, but for all groups, not just one.
cause it would override the spacing config for that formation i presume? (i have no modding experience only know the basic)
what if you made a custom formation then
i assume thats possible
Hey folks, bit of a queer one for you. I have this setup for which a player can enter into a trigger, and by looking through their camera (Or coming out of their camera) objects in a specified layer are revealed to them. As you can see, this work in singleplayer (First clip) but when running on a dedicated server, the 'Jumpscare' sfx works but the objects are not revealed. Everything I've read points to this working, and I'm rather confused. Any help is greatly appreciated!
[Working through stuff on the debug menu, the player is given the value of "ghostCabin" in their "ghostLocation" variable, as intended. I believe therefore it may be something to do with the code in which I unhide the objects, in initPlayerLocal
There are a lot of layers here. Figure out whether the code at the end is running first.
Do you mean the 'Optics Switch' event handler? And yes, I'm terrible for writing spaghetti ๐
EH -> camON -> showGhostObjs
stick a couple of diag_logs in showGhostObjs and it should be clear where it's breaking.
I don't really get what you're trying to do with this trigger though. It's a global trigger that's using player but it's broadcasting the vars for some reason?
It looks like it should still "work" but I don't generally work with triggers.
oh wait, getmissionLayerEntities says it's server exec?
Not sure why it would be, but that would certainly do it.
sorry new to scripting, what is the easiest way to make it so that the "hold action" results in these 3 light generators to turn on?
Have you used hold actions before?
nope
There aren't really easy or hard options here. Hold actions are just hard :P
usually didnt wander into setting up RP stuff besides some light scripting
pain.
Enjoy the parameter list: https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
This is probably the thing for switching the lights: https://community.bistudio.com/wiki/switchLight
It's local effect so I guess you'd need to remoteExec the thing.
how do you send an AI radio message through script? things they say like "Moving to position" that's part of the base game when you command the AI to do something. I'm looking to trigger that audio with a script
I'm looking at CfgRadio and the Conversations system but unsure atm
seems to be the way to go, I'll test it a bit to see if they want to behave or not
Would also need to JIP secure it if necessary. And then there is the question of whether light are also subject to streaming and then if so whether light state is remembered across (un)loads.