#arma3_scripting
1 messages ยท Page 164 of 1
Anyone able to help with this as i have no idea what's going on, everything was working fine before Arma updated now it doesn't...
we have a spawner that we use to get our vehicles and supplies, using one visible marker to indicate the spawner area, and one invisible marker to set the direction the vehicle will face when spawned, but after the arma update i can no longer make any changes to the spawners, it just locked me out from pressing the "ok" button, but if i remove the code from the item init field it works again.
the code clearly works because its working as intended on the server, but we need to be able to make changes to it and i cant for the life of me figure out why its not letting me do anything, below is the code from the init field and the error given, any help would be beyond appriciated:
private _posASL = getPosASL Car_1 vectorAdd ((getPosASL Car_2 vectorDiff getPosASL Car_1) vectorMultiply 0.5); _posASL set [2,_posASL # 2 + 7.4]; { if (_x != _this) then {deleteVehicle _x}; } forEach nearestObjects [ASLToAGL _posASL,["Car", "Armored"],5]; _this setPosASL _posASL; _this setDir (Car_1 getDir Car_2);
Either Car 1 or 2 (or both) are not defined
Especially in Eden
thats the thing, they are both named correctly, these are direct copy and paste from the ones we have on the server which work perfectly fine, just cant edit them
thats what im not getting
As I said, not in Eden
Variable names in Eden are not created until you actually run the mission
In the first place what are you trying to do
basically i need to be able to add and remove or change things for our unit as we develop, the list function is no issue, its just the previously mentioned init field which is causing the issue since the update, therefor blocking me from making any changes.
it clearly works when the mission is running but as mentioned when it comes to needing to change something in the editor i cant do anything because it thinks its wrong, it wasnt even giving me an error before, had to use 3den enhanced just to get the error to even show
long story short, we need to make it so the spawner accepts the init code again, because i have no idea why its stopped working all of a sudden
And where is the reason why you need to run in Eden
if i run the mission they spawn perfectly fine, everything works, but i make changes to them in eden, they are save in compositions so i just change them as needed
they are save in compositions so i just change them as needed
Not sure what this does mean
we palce our spawners in on our mission files through saved compositions for our unit so everything is there and up to date
the problem is just the init field is telling me its wrong when it clearly isnt, so im not able to change anything in the spawners because of that code, i just dont know what wrong with it
And I still don't know why you're running that script in Eden
its the only way i could get an error code to show up, before that there was nothing being displayed, the code is being ran through a module
Well
It is simply because you're running a code that you don't really supposed to run in the environment
thats the thing, we have always been using that code, for well over a year, its literatlly just the game update that it started to break, i just have no idea why, without these spawners working we cant change any of our assets
I'm pretty sure it never worked that way
Unless you have a Mod that assign such variable name
Maybe Eden Enhanced? (tho I doubt it)
(Which I made my own for my internal use)
it deffinatly works because the spawners are recognising it, if i run the mission and try spawn something in at the spawner then it works no issue, but in the editor if i try to change something i get no errors and just locks the "OK" button, i can spam it all i want but wont accept it
it just locked me out from pressing the "ok" button
maybe actually showing the window that doesn't work as you expect it to can help
literatlly this, just locks the button from being pressed
So you're twisting the issue all the time? You wanted to run this code in this chunk of environment but not in Debug Console in Eden Editor?
the only reason it was in the debug was because thats the only way i can get the error code to display, and even then i have to use 3den enhanced to get it to show up, only reason why that was done.
but the code is ran through the module as show above
How do we supposed to help if we have no exact issue/error
thats exactly the issue, i have no clue what the problem even is because it wont give me any error code, nothing at all, all i know is that since the update the spawners now reject the code that clearly does work because its on the server, its just now stopping me from changing anything in the module
Maybe new CBA or/and arma update broke something on SSS (i assumme that is Simplex Support Services mod), and their last update is Updated 7 Feb .
Have you tried something else than your code there?
just make sure that it works.
correct we are using SSS, my script knowledge is kinda limited, this is the code we have been using for well over a year now with no issues till the update came, so not really sure what else i would put there to achieve the same goal?
all that realistically is needed is to tell it to face a specific direction (hench the invisible marker "Car_2"), and to delete anything on the spawn area if something new is spawned in
You can set the background color somewhere, if you set that to transparent, it should be transparent.
I have transparent test UI's, so it does work.
may require non-default rvmat for UserTexture object iirc 
or maybe i'm misremembering stuff
P.S. yeah, it was the other way around. The problem i've misremembered was solved by switching to UserTexture object ๐คฃ
So the bug then, is that dialog returns true, even when no dialog is open?
Looks like that: #arma3_scripting message
Mh I think there is no way to check which dialog the "dialog" is.
Its a user dialog, but
yeah i looked into that, got help in the ace discord. #976224730422063214 message
it looks like the "ca" part in the wiki (https://community.bistudio.com/wiki/Procedural_Textures) at texType is not correct. it is not "ca" as default.
A hashmap is two arrays. That's it.
tho in the end i set it as "sky" as the object this is applied on is going across the horizon
There might be a engine bug there. But I need more information to figure that out.
Is there a way to find all open displays? To find what the "dialog" is?
How can you pass 3den entities into a function?
[[1538e25b580# 442157: memorypoint1.p3dLand_MemoryPoint1,1536893e080# 442163: memorypoint1.p3dLand_MemoryPoint1,1536cdf6b00# 442169: memorypoint1.p3dLand_MemoryPoint1]] call BTH_fnc_function; Of course won't work
Give them variable names like any other object
E.g. you can select them and use get3denSelected "object"#0
pass 3den entities to do what?
Do you actually select them?
I know that it does work
the eden entities are created by a function and output as an array of entities. Inputing that array (which is the exact array I posted in my example) simply doesn't work
Is that snippet the code you actually put in Debug?
they don't really convert back from strings 
You shouldn't convert your array to a string as artemoz said
Example would be the output of debug console, which is a string
I'm not converting anything
You're not. The game does it automatically when you display it in debug console output (output is a string)
that output is just proof the function is receiving the array as it should
wot
So is this, yes or no
No that's just a literal array of entities as an example
I'm trying to pass an array of eden entities into a function that sorts them in a particular way (for a start, anyway)
Do you mean that's a psuedo code to tell the idea
get3denSelected command etc can fetch Eden object(s)
I am trying to use an array produced by a function that generates eden entities (it uses the selected as input)
and array is passed to the second function how? Copy/paste the debug output to the code field? Saved to variable and taken from there?
it's a variable
ListOfThings = call BTH_fnc_GenerateThings;
// returns [[entities],[entities],[entities]]
[(ListOfThings select 0),true] call BTH_fnc_ProcessElements;
Yes
okay. And how does "sorts them in a particular way" happen afterwards? Some kind of _x setPos* [...]? or _x set3DENAttribute ["Position", [...]];?
right now it just pairs one item with the next, and then pairs the second item with third, third with the fourth, etc
that's just what it does so far, though
so where do you encounter a problem?
here's the test function I was using:
BTH_fnc_pairElements = {
private _array = _this;
private _processedArray = [];
copyToClipboard str _array;
if ((count _array) < 2) exitWith { _processedArray };
for "_i" from 0 to ((count _array) - 2) do {
_processedArray pushBack [_array select _i, _array select (_i + 1)];
};
_processedArray
};
this is obviously just the sorting part
the entities appear in the clipboard but the output of this function is just empty
And what do you actually pass into this fnc
this
the boolean is for a later thing but BTH_fnc_ProcessElements is essentially just BTH_fnc_PairElements
and what are the actual outputs (clipboard and debug console result string) of the actual code you've pasted here? ๐ฟ
[]
the exitWith always returns empty array []
Yes thats it. The first or second one is the user dialog. Thank you. Somehow I didn't find that one.
First one would be options menu which is probably not open.
so if dialog == true, the first should be the dialog.
@solid gale you could try what allDisplays prints while dialog==true
is it possible to
If you have to ask then no.
You can only set the capacity to nine with an addon and then do some fiddeling with lock. GL getting that to work on dedi with JIP.
I can't seem to create eden entities for objects accurately. I believe I was told this function could do it:
fnc_getPitchBankYawAccurate = {
_v = _this select 0;
_y = vectorDir _v;
_z = vectorUp _v;
_x = _y vectorCrossProduct _z;
_ay = -asin(_z#0);
_az = _y#0 atan2 _x#0;
_ax = _z#1 atan2 _z#2;
[_ax, _az, _ay] apply {rad _x};
[_ax, _ay, _az]
};
And I thought I tested it but apparently I didn't. It even returns the rotation values in radians which means it can't be right
I definitely remember it working. I don't understand how/why it would work
What does this have to do with creating entities?
I have no idea what you're talking about
That function is supposed to take an object and create eden entity rotations for and eden object
yeah I did ask about it lol
That's the context anyway
Well it does "create" rotations so idk what's the problem
They're in radians, yes, but you can skip that and get the result in degrees
that appears to work
I need to figure out the origin offset eden creates and it's done
nevermind there is still a lot of misalignment. I need 100% accuracy
Misalignment in what? Rotation or positioning?
Are you using getPosWorld/setPosWorld?
positioning is because the origin point in eden entities is different than their models as far as I can tell.
Rotation is the biggest issue
and getPosWorld
no set pos commands ofc
How are you applying the rotations anyway?
BTH_fnc_placeLineBetweenPointsEden = {
params ["_o1", "_o2", "_model"];
private _p1 = getPosWorld _o1;
private _p2 = getPosWorld _o2;
private _dir = _p1 vectorFromTo _p2;
private _up = vectorNormalized ([_dir#1, _dir#0 * -1, 0] vectorCrossProduct _dir);
private _line = createVehicle [_model, [0,0,0]];
private _bb = boundingBoxReal _line;
private _size = (_bb#1 vectorDiff _bb#0)#1;
private _center = (_p1 vectorAdd _p2) vectorMultiply 0.5;
private _scale = (_p1 vectorDistance _p2) / _size;
_line setVectorDirAndUp [_dir, _up];
_line setPosWorld (_center vectorAdd (_up vectorMultiply (_bb#0#2 * _scale)));
_line setObjectScale _scale;
_line3den = objNull;
collect3DENHistory {
private _pitchBankYaw = [_line] call BTH_fnc_getPitchBankYawAccurate;
copyToClipboard str _pitchBankYaw;
private _3denpos = ASLtoATL getPosWorld _line;
_line3den = create3DENEntity ["Object",_model,[0,0,0]];
set3DENAttributes [
[[_line3den], "Rotation", _pitchBankYaw],
[[_line3den], "Position", _3denpos],
[[_line3den], "ENH_objectScaling",_scale]
];
};
//deleteVehicle _line;
_line3den
};
this is how
it doesn't matter what order since the rotation and position values are just properties of the entity
eden objects use ATL or AGL
This code returns x z y rotations
afaik 3den needs x y z
I already fixed it
BTH_fnc_getPitchBankYawAccurate = {
_v = _this select 0;
_y = vectorDir _v;
_z = vectorUp _v;
_x1 = _y vectorCrossProduct _z;
_ay = -asin(_z#0);
_az = _y#0 atan2 _x1#0;
_ax = _z#1 atan2 _z#2;
[_ax, _ay, _az]
};
For 3den I think you need getPosATL
Because it measures the height from the land contact not model center
yes I know
private _3denpos = ASLtoATL getPosWorld _line; that's what this is supposed to do
it's a requirement to retrieve the position from the non-eden object
private _3denpos = getPosATL _line;?
Yes
I'm certain I tried that. I know I didn't have it weird for no reason. Let me test
Looks about the same
Screenshot?
The eden entity is the one that is not aligned. The screenshots with only one wire is showing the eden entity
It almost looks like it's JUST a position issue but the rotation seems a bit off as well
To me it looks like the position is off
Yep, rotation too. Moving one end into place causes the other end to be even further off
After running the 3den position command, confirm that their posWorlds are the same
[getPosWorld _line, getPosWorld _line3den]
You can also do the same for rotations
See which one is actually off
(I'm 99% sure it's the position only)
And rotations?
Ah wait nvm I see the issue. You scaled your objects
[[-4.33699,0.0386578,0.366959],[-4.33697,0.0386578,0.366959]]
You must normalize all those 3 vectors first
Also why do you write _x1 in there? 
Just put private before your variables
You don't need to create new var names
Oh I was just double checking there wasn't a syntax issue because it was _x and it was used that way later
Well yeah just make it private
Looks promising
I'll have to test more thoroughly to be absolutely sure but if this is all because I forget about the scale thing I am quite annoyed by that
["Position:",[5033.98,6446.33,28.4747],[5033.98,6446.33,28.4747],"Rotation:",[-1.88902,0.0683772,-178.847],[-1.889,0.0510004,-178.454]] Seems to be a very slight rotation difference
What is the pitchbankyaw function rn?
BTH_fnc_getPitchBankYawAccurate = {
private ["_v","_y","_z","_x","_ay","_az","_ax"];
_v = _this select 0;
_y = vectorDir _v;
_z = vectorUp _v;
_x = _y vectorCrossProduct _z;
_ay = -asin(_z#0);
_az = _y#0 atan2 _x#0;
_ax = _z#1 atan2 _z#2;
[_ax, _ay, _az]
};
Normalize? Like vectorNormalized?
BTH_fnc_getPitchBankYawAccurate = {
params ["_v"];
private _y = vectorNormalized vectorDir _v;
private _z = vectorNormalized vectorUp _v;
private _x = vectorNormalized (_y vectorCrossProduct _z);
private _ay = -asin(_z#0);
private _az = _y#0 atan2 _x#0;
private _ax = _z#1 atan2 _z#2;
[_ax, _ay, _az]
};
Yes
["Position:",[5037.13,6260.28,23.7286],[5037.13,6260.28,23.7286],"Rotation:",[-2.02298,-0.126705,176.418],[-2.02296,-0.126704,176.418]] MUCH closer. Shouldn't really be noticeable I would imagine but I guess that would need some testing to be sure
Seems legit
Thank you so much for all your help with this
np
btw can you structure params like this params ["_o1", "_o2", ["_model","Land_Powerline_01_Wire_50m_f",[""]], ["_eden",false,[false]]]; with inconsistent use of the string or the array with additional info?
it appears you can
Is there a easy way to get a list with class name of all vehicles? I have many mods, but documentation is lacking.
private _configs = "true" configClasses (configFile >> "CfgVehicles");
private _classes = _configs apply { typeName _x };
Thank you so much Dart! Thats really helpfull!
๐
Displays open: [Display #0,Display #8,Display #18,Display #70,Display #46,Display #6969,Display #12]
if (dialog) then {
diag_log format ["Displays open: %1", str allDisplays];
} else {
diag_log "No dialog is open.";
};
wow that looks awsome
Hey all, I have a custom SP/MP sniper battle mission with tons of parameters and customization, complex dynamic AI teams, scripted helicopter transport, artillery, etc. So far, I've been able to let the AI do everything the players are able to do, and calling down a supply drop is last on my todo list for them.
I have a virtual supply drop provider/requester for each team, and of course when it's available a player can activate it through their supports menu and it spawns the plane, flies over the indicated spot, drops a custom initted crate, then does whatever it wants until I make it available again.
However it doesn't look like I can manually activate that request from a non-player unit. Anyone know if that can be done? I plan to just scrap the internal support altogether if not, and make my own supply drop code that does the same thing. Just hoping I can save myself a little effort.
hey, newbie here need help
_vehicle = createVehicle [_vehicleType, _position, [], 0, "FLY"];
_vehicle setDir (markerDir _marker);
_vehicle setPosATL _position;
_unit moveInDriver _vehicle;
why when i respawn in the jet the jet stalling?
if i remove
_vehicle setDir (markerDir _marker);
_vehicle setPosATL _position;
everything is fine, how can i fix that?
setPosATL etc resets the velocity too
setVelocity or setVelocityModelSpace to reset the velocity
ty
Hi, on the right side you can see respawn inventory loadouts. As you can see it calls the default cfgvehicles's loadout. On the left you can see my custom loadout exported via BI arsenal. How can i apply my custom loadout to be called instead of the default cfgvehicle?
sorry for having to many question, i want to delete the jet after explotion to save FPS in the long run, what script command should i use ?
params ["_unit", "_corpse"];
if (!(isNull _corpse)) then {
_vehicle = objectParent _corpse;
if (!(isNull _vehicle)) then {
_vehicle deleteVehicleCrew _corpse;
} else {
deleteVehicle _corpse;
};
};
_side = side (group _unit);
_vehicleType = switch (_side) do {
case blufor: { "B_Plane_Fighter_01_F" };
case opfor: { "B_Plane_Fighter_01_F" };
case independent: { "B_Plane_Fighter_01_F" };
default { "B_Plane_Fighter_01_F" };
};
if (_vehicleType == "") exitWith { };
_markerPattern = format [
"respawn_vehicle_%1", toLowerANSI (str _side) ];
_markers = allMapMarkers select { ((toLowerANSI _x) find _markerPattern) == 0 };
if ((count _markers) == 0) exitWith { };
_marker = selectRandom _markers;
_position = getMarkerPos _marker;
_position set [2, 2000];
_vehicle = createVehicle [_vehicleType, _position, [], 0, "FLY"];
_vehicle setDir (markerDir _marker);
_vehicle setPosATL _position;
_speed = 300;
_vehicle setVelocity [
_speed * sin (markerDir _marker),
_speed * cos (markerDir _marker),
0
];
_vehicle addEventHandler ["Fired", { (_this select 0) setVehicleAmmo 1 }];
_unit moveInDriver _vehicle;
deleteVehicle and deleteVehicleCrew
Do you mean CfgRespawnInventory?
That's right
I have a tamplate how to type in all the items but thats a lot of time, exporting would so much easier
I know this, with this solution i only can call the default cfgvehicles (vanilla soldiers) OR i can start typeing a tons of lines for the custom loadout... but i know that there is an easy way and somehow call the exported loadout (you can see on the left picture)
I'm sure somebody online wrote such "export"
https://community.bistudio.com/wiki/Arma_3:_Arsenal#Shortcuts
...Or, somebody in BI did
_vehicle = createVehicle [_vehicleType, [0, 0, 500 + (random 500)], [], 0, "NONE"];
_vehicle setDir (markerDir _marker);
_vehicle setVehiclePosition [_position, [], 0, "FLY"];
Hello! I was directed here by an exasperated friend after asking one too many questions, and I'm stumped as far as finding a solution goes, so here it is:
I am trying to set a trigger to run playSound3D (an alarm) and loop the audio 3 times after the sound file finished playing each previous time. My planned approach was to sleep for the equivalent time of the sound file, then play it again, but I'm encountering problem after problem and the bohemia wiki provides not much relief. Can anyone here help?
To get started, provide your code, screenshots, error messages, etc.
Sorry yes
On Activation
for "_i" from 1 to 3 do { playSound3D ["a3\sounds_f\sfx\alarm_blufor.wss", Speaker1, false, getPosASL Speaker1, 2, 1, 500, 0, false]; sleep 5.0; };
And where is the error
spawn your code.
Like that? how do I get it like above?
_this spawn {for "_i" from 1 to 3 do { playSound3D ["a3\sounds_f\sfx\alarm_blufor.wss", Speaker1, false, getPosASL Speaker1, 2, 1, 500, 0, false]; sleep 5.0;};}
I did the above and got no error but the sound never played
Are you sure the trigger is even triggering
It did when I ran my code without the spawn command, and I didn't change the trigger since
Are you still sure it is
There is no _this var in "On act." field.
Let's say put a hint etc, to make it more obvious
Sorry I don't follow, can you make it more simple for me? ๐
There is no that variable. Pass empty array instead.
Variables like _this have to be defined before you can use them. Sometimes they're provided automatically, but not in this context. So _this does not exist and the game is silently getting confused.
However, spawn requires us to put something as its left parameter, so replace it with a safe dummy value, like 0
Had to search up what 'Pass empty array' means, but now it is working. Thank you so much everyone.
Thanks!
[] spawn {
for "_n" from 1 to 3 do {
playSound3D ["a3\sounds_f\sfx\alarm_blufor.wss", Speaker1, false, getPosASL Speaker1, 2, 1, 500, 0, false];
sleep 5;
};
};
While I'm here, is there any command that tells the script to wait for the previous audio file to play out before repeating it/continuing the script?
That all makes sense, thanks!
It's preferable to use 0 rather than [] where possible because it is slightly faster than creating a new empty array
Last note on the playSound3D page iirc.
Trust me my mission isn't going to be busy with code, but good to know :)
๐
is there a way to move a dropped weapon so it is only visible when checking the inventory of a dead body? and not exist as a "ground" object?
I managed to delete the weapon using getCorpseWeaponholders but then i cant loot it. any way to find the actual weapon classname (it just says dummy) and add that to the corpse before deleting?
Try getting a weapon from a weapon holder and adding it to the corpse.
any way to find the actual weapon classname (it just says dummy) and add that to the corpse before deleting?
https://community.bistudio.com/wiki/weaponsItemsCargo
that one returns a empty array unfortunately
Code?
i just tried with weaponsItemsCargo corpse in console
Because corpse isn't a weapon holder.
Hello again! I have a fresh new problem straight from the printing press if anyone could help me. The purpose of this script is to make this Opfor say a random voice line from a set array, from the start of the mission until he dies like, 2 minutes later. Currently my problem is that instead of waiting between voice lines, he just says them all instantly, overlapping each other.
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
Because it spawns 10 times, not wait
for "_i" from 1 to 10 do { [] spawn {
playSound3D [selectRandom [getMissionPath "DT_C_Death_CHAOS_1.wav", getMissionPath "DT_C_Death_CHAOS_2.wav", getMissionPath "DT_C_Death_CHAOS_3.wav", getMissionPath "DT_C_Death_CHAOS_4.wav"], CM1, false, getPosASL CM1, 2, 1, 100, 0, false];
Sleep 10;
}
};
Oh there I did it
Could you explain a bit?
for is repeating the spawn execution
for "_i" from 1 to 10 do {
[] spawn {
// sound
sleep 10;
};
};```This is your code right now, as you can see you have no code after the `sleep`
Oh! Ok I switched the 'for' and 'spawn' strings around and it works now? Is that right?
String is not the term you use in this context, but yes
Apologies, right
I'm not asking you to say sorry either
for and spawn are scripting commands ๐
If you think about it hard enough, they do become strings at some point in execution 
!burgerpan @dusk gust 50y questioning High Scripting Authority
Hey all, I've got some questions about weather functions. Working on a pvp mission to be hosted on a dedicated server.
BIKI Example:
skipTime -24;
86400 setOvercast 1;
skipTime 24;
0 = 0 spawn {
sleep 0.1;
simulWeatherSync;
};
Does any part of this need to be executed on the client via remote exec? Current'y am remote executing most settings on client and host.
I am also a little befuddled on forceWeatherChange vs simulWeatherSync. forceWeather change doesn't seem to have any effect on rain, for example.
Essentially, I have a few environmental params related to rain, cloud cover, wind, waves, etc, set by the host in desc.ext. Those settings are then applied. I want to ensure that the weather not only is implemented instantly when applied, but that those settings remain persistent for the duration of the match, be it 2 hours or 2 days.
My thought process was to just spawn a thread that reapplies the weather settings every few minutes, ensuring the weather doesn't change. If that isn't necessary, it'd be nice to have that verified. Rain for example, seems to begin dissapating after awhile. Using the above example, but with rain instead of overcast results in no rain.
Also, it seems simulSetHumidity has made a return. I assume that's server executed?
Current script in progress:
https://pastebin.com/CmuXBLby
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
The weather system is scuffed, you script contains lots of unneeded, broken and wrongly used stuff.
No need to setDate,skiptime etc via remoteExec, waves are broken and cannot be used etc
Read the wiki, it contains all needed info about how the commands should be handled.
All working weather commands need to be server executed and not on the client. (Client syncs with server).
The only thing you need to remoteExec on JIP players is overcast, since the syncing is broken.
So already online players could have drastically different values for overcast compared to ones that join later.
https://feedback.bistudio.com/T183693
6969 sounds like a mod ๐
I don't know how to get proper readable names, like classnames. There is probably some way
There is probably some game bug there.
But I don't have steps to reproduce it in vanilla, and I don't have the time to guide you through getting me the information I need :/
6969 might have been me lol ๐
๐ 6969 Itโs the debug menu where I executed the code from
class AH_ExecMenu {
idd=6969;
movingEnable = false;
class controlsBackground {
class AH_DevBackground: LIFE_RscText {
idc = 1031;
x = 0.0312851 * safezoneW + safezoneX;
y = 0.104778 * safezoneH + safezoneY;
w = 0.183014 * safezoneW;
h = 0.830355 * safezoneH;
colorBackground[] = {-1,-1,-1,0.7};
};
class AH_DevHeaderBg: LIFE_RscText {
idc = 1000;
x = 0.0313498 * safezoneW + safezoneX;
y = 0.0811797 * safezoneH + safezoneY;
w = 0.183014 * safezoneW;
h = 0.0235679 * safezoneH;
colorBackground[] = {-1,-1,-1,0.9};
};
class Background: LIFE_RscText {
idc = 1000;
x = 0.259373 * safezoneW + safezoneX;
y = 0.105053 * safezoneH + safezoneY;
w = 0.598062 * safezoneW;
h = 0.492593 * safezoneH;
colorBackground[] = {-1,-1,-1,0.7};
};
class ExecutorTopBackground: LIFE_RscText {
idc = 1000;
x = 0.259285 * safezoneW + safezoneX;
y = 0.0809917 * safezoneH + safezoneY;
w = 0.598125 * safezoneW;
h = 0.0238519 * safezoneH;
colorBackground[] = {-1,-1,-1,0.9};
};
class WatchTitleBackground: LIFE_RscText {
idc = 1000;
x = 0.259285 * safezoneW + safezoneX;
y = 0.601321 * safezoneH + safezoneY;
w = 0.598125 * safezoneW;
h = 0.0238519 * safezoneH;
colorBackground[] = {-1,-1,-1,0.9};
};
class WatchBackground: LIFE_RscText {
idc = 1000;
x = 0.259373 * safezoneW + safezoneX;
y = 0.625007 * safezoneH + safezoneY;
w = 0.598084 * safezoneW;
h = 0.310168 * safezoneH;
colorBackground[] = {-1,-1,-1,0.7};
};
};
I donโt know, man. Like I said before, 6 months ago, nothing happened, and the server was running smoothly. Itโs like Arma 3 changed something over these 6 months, but I donโt know what it is. I tried looking at the update changes but didnโt find what I needed to know, so Iโm still not sure. Thanks for trying to help; I really appreciate it.
Have you tried this: #arma3_scripting message ?
Yes Arma 3 changed alot, specifically related to UI controls and dialogs recently. Most of it isnt in changelog as its background stuff
But I don't know what specifically could cause this
There is BIKI.
Providing links to BIKI where everything is explained is rude?
ยฏ_(ใ)_/ยฏ
In the middle of a mission or when a player joins?
Since you add the intel on server side, you can move your code to initPlayerServer.sqf.
Hey guys. Working on a script to precisely align an object. I'm unable to reposition it exactly where it was. The original position is achieved by spawning in the object, attaching it to another. Making it seamless. When I get it's position after it's been spawned, and attached ( and detached) I cannot get it back into the same position without having gaps
Position, direction and vector up should be enough.
getPosWorld/setPosWorld are required.
Not entirely sure how that's going to work with attached vs detached though.
The object is detached when I'm attempting to get it's position
Your code and screenshots?
It's a Joint Project with a friend; he wrote the original piece to orientate the object, I'm now making another part to save the configuration of those objects, and load them on demand
It's a modular killhouse system which supports saving and loading of layouts
Well, without code and screenshots we can't say exactly what the problem might be.
I understand, I'm going to try what John recommendend, and I'll follow up in here if that doesn't work
Good luck.
I'm doing something nightmarish to mess around in the editor, and I have this line of code to get all things derived from type HOUSE on the map:
AllUsableBuildings = nearestObjects [[(worldSize/2),(worldSize/2),0],["HOUSE"],(worldSize / 2),true];
Is there any magical thing I could search for besides HOUSE or BUILDING that would get me structures only? In a perfect world, it'd only find things that have path LODs. Or am I approaching this a weird way?
As is, this returns lots of walls, lamp posts, etc. that derive from the base house class. About 11k objects on Malden.
- Since scanning the entire map is a very expensive operation, I would place markers within which I would search.
- There is https://community.bistudio.com/wiki/nearestTerrainObjects.
- Most likely you will filter the found objects using, for example, https://community.bistudio.com/wiki/getModelInfo.
cc: @faint burrow
This is better, but I'm still hitting a roadblock. Important parts of the script(s):
saving:
{
private _pos = getPosWorld _x;
private _dir = getDir _x;
private _class = typeOf _x;
//private _nearestObject = nearestObject [getPosASL _x, "Land_HelperObj"];
//systemChat str _nearestObject;
// Push the positional array into the main array
_killhouseObjects pushBack [_class, _pos, _dir];
// Delete the object
deleteVehicle _x;
// systemChat str (_x call BIS_fnc_getPitchBank)
} forEach _objs;
loading:
private _type = _x select 0; // Object name
private _location = _x select 1; // getPosWorld
private _dir = _x select 2; // getDir
private _v = createVehicle [_type, [0, 0, 0], [], 0, "CAN_COLLIDE"];
_v setDir _dir;
_v setPosWorld _location;
First screenshot shows it's seamless, then the second shows the gap/issue when re-creating the objects stemmed from setPosWorld
instead of dir, try using vectorDir + vectorUp ?
So basically like this:
- setPosWorld
- setVectorDir
- setVectorUp
Try saving/restoring vector up.
Another option -- attaching objects to some "center" object.
setVectorDirAndUp ๐
@faint burrow Re-attaching back to the original object is unreliable as there are too many (there are about 200-300 of those helper objs in this area)
thanks lol
Why? Saving their [_class, _pos, _dir] is not a problem, but saving [_class, _dir, _offset] is a problem?
Ah I get what you mean, I've done that for another layout system before
Try saving [_class, _vectorDir, _vectorUp, _offset] and restoring like that:
{
_class = _x select 0;
_vectorDir = _x select 1;
_vectorUp = _x select 2;
_offset = _x select 3;
...
_object attachTo [_center, _offset];
_object setVectorDirAndUp [_vectorDir, _vectorUp];
} forEach _objectsInfo;
We use setPosWorld & setVectorDirAndUp and it's accurate. Might have some dependence on object sim type though.
{
private _type = _x select 0;
private _location = _x select 1;
private _dir = _x select 2;
private _vector = _x select 3;
private _v = createVehicle [_type, [0, 0, 0], [], 0, "CAN_COLLIDE"];
// _v setDir _dir;
_v setPosWorld _location;
_v setVectorDirAndUp _vector;
} forEach _killhouseObjects;
{
private _pos = getPosWorld _x;
private _dir = getDir _x;
private _class = typeOf _x;
private _vectorDir = vectorDir _x;
private _vectorUp = vectorUp _x;
private _vector = [_vectorDir, _vectorUp];
//private _nearestObject = nearestObject [getPosASL _x, "Land_HelperObj"];
//systemChat str _nearestObject;
// private _vector = vectorDir _x;
// Push the positional array into the main array
_killhouseObjects pushBack [_class, _pos, _dir, _vector];
// Delete the object
deleteVehicle _x;
// systemChat str (_x call BIS_fnc_getPitchBank)
} forEach _objs;
Could simplify the vector defition, but still leads to the gap. Starting to wonder if it has something to do with the terrain or something.
The Walls inherit from Helper_Base_F
wait, how large is this gap?
no need to store dir, just store [vectorDir _x, vectorUp _x] and setVectorDirAndUp _vectorDirAndUp
Very small - like nearly unnoticable lol, but the problem is when it's done without the script, it's non existant
yeah you can't do that, Arma just isn't that precise.
you get some wobble in the low precision bits even with setPosWorld.
I had another approach to this problem; wondering if you could throw some insight into it
The goal is to be able to "save" and "load" the configuration of the walls on demand; instead of placing them (creating new objects, and aligning them), do you think you could accomplish this by changing an existing object? If the bar at the top (which is the helper object) had the same offset as the wall (so the wall, and bar would be combined into a 2nd Wall object), could that work?
I don't know what you mean.
You could try just reversing the setVectorDirAndUp and setPosWorld.
Right now, the objects are 2 parts, the 1st one has an act interact to spawn the 2nd object, and attach it
If the first object was just the top, and you had a second object which was both the bar, and the bottom piece, would you be able to "change" an existing object without having to re-align?
gap is still there unfortunately
Nevermind, I don't think anything exists in ARMA to do this unfortunately
Attaching everything to a dummy object seems like the next move.
whats the diffrence between normal and _O shells in the vehicle weapon list thing?
I assume it is for OPFOR (but I may be wrong in this case)
ok, thx
It is. There's one difference between the magazine classes: the name displayed on MFDs for vehicles with the magazine loaded. For the OPFOR variant, it's in Cyrillic.
Hi all could someone tell me whats wrong with this script here?
Context - I am trying to do a multiplayer addAction that is placed on a unit which will give out random objectives.
[[Dimitri], ["Request Job", "DJobInit.sqf",[],1,false,true,"","_this distance _target < 2"]], "addAction", true, true] call BIS_fnc_MP;
BIS_fnc_MP is deprecated, you should use remoteExec(Call)
So would this then be the correct format?
[Dimitri, ["Request Job", "DJobInit.sqf", nil, 1, false, true, "", "_this distance _target < 2"]] remoteExec, ["addAction"];
No, but there's an example pinned in this channel as well as examples on the BIKI
Check pinned for some explanation for remoteExec usage
...Also, tell what's wrong with your current code
Got it to work thank you for pointing me in the right direction!
[Dimitri,["Ask for a job","core\Objectives\DJobInit.sqf",[],1,false,true,"","_this distance _target < 3"]] remoteExec ["addAction",0];```
Why does briefingName in 3DEN preview return the name of the mission folder (trigger_testing) instead of the briefingName property from description.ext?
[briefingName, getText (missionConfigFile >> "briefingName")]
returns
["trigger_testing","Operation Haha"]
What do you expect?
I was expecting them to match since the description of briefingName mentions:
Returns the name of the current briefing/scenario name.
implying (from my interpretation at least) that it would "mirror" the property under the same name from description.ext
... Especially when missionName behaves the same way under the same setup
As far as I can tell it is working fine to me
Are you sure your description.ext is loaded
...? Guess I forgot to reload the mission after I shoved the file in
Lovely stuff
Thanks
If I'm not mistaken, briefingName gets value from mission file, and there can be several briefingName props.
It does, yeah, I just didn't figure to reload my mission after I updated the files in my mission folder ๐
Afternoon everyone, where can I locate and edit the mission start config file in 3den?
Say, to get certain scripts to run on mission start?
SO far I've just placed down a random object and put everything I need in it's Init
In the Editor there's a mission init field in the uhhhhhhh Attributes menu.
You can also create init.sqf in the mission folder and then edit it externally, as well as description.ext (https://community.bistudio.com/wiki/description.ext) for config stuff.
I usually prefer the external files as they are easier to access and offer more flexibility. (Caution: I don't know which takes precedence if you have both an Editor mission init and an init.sqf)
Description.ext has higher priority
Thank you!!
Yeah, but I don't know about the inits. Do they both run, in what order, etc
Object initialization fields are called before init(XXX).sqf.
I'm referring to the Editor mission init field, not object inits
It's probably the same but I don't know for sure
does anyone know if theres a way to make a trigger that gets tripped if only 1 specific unit detects players, instead of just "detected by X faction"
im trying to set off a claymore if one specific unit sees players inside the trigger
ty :)
Hello, is there any way to make sure that when putting on clothes, she also occupies the bulletproof vest slot, as is done with the helmet, which occupies the nvg slot
Silly little question - for some reason in my mission using stationary turrets is broken (freelook while in it and can't fire) would an unsuspecting script have done that, or would it be something else entirely? It's something else
You could try adding a sub item to your uniform, I don't know if it will work.
That's a #arma3_config thing though, not scripting.
ok, thank
Silly question #2; I am trying to make an addAction that only shows when the player is in the vehicle of the aforementioned addAction; what would the condition parameter be to achieve that?
You can check with
ObjectParent or player in yourVehicleVar
Thank you very much... I think I didn't believe it was going to be that simple
_this in _target
Does anyone know how to call the end mission splash screen without ending the mission? im trying to use triggers to make it pop up for a min
Not relevant to this channel but also far too much manpower required
Whoops thought I was in A3 channel. Gonna re-paste over there. Not sure what you mean about man power though... The content is already made, it's just porting.
Perhaps I'm over simplifying it but seems like it would be worth it's while.
Hello, does anyone know where this directory is? I've searched as hard as I can.
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa"
Should be UI_F_Data.pbo (or similarly named)
If that's what you mean
That is what I mean, thank you. I've since learned that I can just see a repository of icons and their strings for in-game purposes, but knowing where they are still helps. Thanks again!
Mmm I love when you find fixes to little bugs that were making you doubt things... The only doubts I have are my abilities to always get things right the first time ๐
also, even with intercept drawLine3D is still a slow as fuck function ๐
Hi I'm trying to just delete a light source the documentation says i just use delete Vehicle but it does not seem to be working
private _lightSource = "#lightpoint" createVehicleLocal _position;
_lightSource setLightColor [0,1,1];
_lightSource setLightAmbient [0.2,0.0,0.3];
_lightSource setLightUseFlare true;
_lightSource setLightFlareSize 3;
_lightSource setLightFlareMaxDistance 3.5;
_lightSource setLightBrightness 4;
_lightSource setLightDayLight true;
_lightSource spawn {
while { sleep 0.05; player distance _this > 2 } do
{
_this setLightBrightness 4 max (40 / (player distance _this));
};
deleteVehicle _this;
};
0 spawn {
sleep 5;
hint "deleting light";
deleteVehicle LightPosHere;
};
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
woops sorry
And which deleteVehicle supposed to delete the lightsource?
the one in the sleep at the bottom
oh thought if you deleted the object it would get rid of the light
just tried it. all i got was this . https://gyazo.com/d8205a1d4f0a8a205340d7888bfa1f30
Because in your spawn it is undefined
Look at the previous spawn.
You mean the middle one correct?
here you go friend i set it up for you ok
private _position = LightPosHere modelToWorld [0, 20, 1.5];
private _lightSource = "#lightpoint" createVehicleLocal _position;
_lightSource setLightColor [0,1,1];
_lightSource setLightAmbient [0.2,0.0,0.3];
_lightSource setLightUseFlare true;
_lightSource setLightFlareSize 3;
_lightSource setLightFlareMaxDistance 3.5;
_lightSource setLightBrightness 4;
_lightSource setLightDayLight true;
_lightSource spawn {
while { sleep 0.05; player distance _this > 2 } do
{
_this setLightBrightness 4 max (40 / (player distance _this));
};
deleteVehicle _this;
};
0 spawn {
sleep 5;
hint "deleting light";
deleteVehicle LightPosHere;
};
just for easy to see
i didnt change anything
thank you
Sorry, So I'm a bit confused do i have to tell the code in the middle which uses spawn. What is the actual light source through assigning it a variable?
Schatten will fix u up, he's a super pro
why do u want to delete the _lightSource
i have a hard enought time creating a _lightSource i never want to delete it lol
_lightSource spawn {
while { sleep 0.05; player distance _this > 2 } do
{
_this setLightBrightness 4 max (40 / (player distance _this));
};
deleteVehicle _this;
};```This chunk of code uses `_lightsource` properly
Your last spawn doesn't
ah POLPOX he great also
he helped me alot
and btw thx to all you awsome people that helped me, i love you guys
where would i be with out you guys
oh i get it now. So in the spawn i need to reference the light source before because its not understanding what im trying to do in the spawn command without that. Got it working, Thank you
Is anyone familiar with a way to override displaynames for inherited actions. For example; I'd like to change the displayname for "Turn In" to something else.
You would have to override the config for it
Specifically here to change eject, you need to write a config (while inheriting the need classes) all the up to UserActions and the action config. Then set displayName to something else. This can only be done in a mod, no scripting allowed.
Thanks!
You can't, some actions like "Turn In/Out" are engine driven and you can't really change much about them
For example, B_T_MBT_01_TUSK_F doesn't even have a UserActions class defined in it at all
Not all scroll wheel actions are defined in UserActions
This would explain why my greps are fruitless; thanks!
@faint burrow Hey sorry to bother you but i was looking through the isFlashlightOn documentation again and cant see to find if there is a variable to check if flashlight is off is there not one?
_flashlightTurnedOff = !(_unit isFlashlightOn _weapon);
Same as any other condition, just use !, the not operator, to invert it.
!true; // false
!false; // true
1 > 2; // false
!(1 > 2); // true
Had another look at this again doesn't that mean i can just add ! and it should invert it basically right and i can do this with alot of stuff right. like for example the code you gave me
!(player inArea thisTrigger) and !{ player isFlashlightOn (currentWeapon player) }
For the second condition ! should be inside brackets.
And if you want to invert the whole condition, ! should be placed at the beginning and parentheses should be used.
would i have to do it for each variable in there aswell. like !player !isFlashlightOn
No, just for the statement that you want to negate
so like
!(player inArea thisTrigger) and { !player isFlashlightOn (currentWeapon player) }
I would use parentheses for readability.
!(player inArea thisTrigger) and { (!player) isFlashlightOn (currentWeapon player) }
so like that
!(player isFlashlightOn (currentWeapon player))
ohhhh
i see now
wait does that mean i dont need the {} Brackets if i replace them with curly ones or does is it case by case scenario
hey guys, not my usual place in this discord so apologies in advance for any misunderstandings or limited knowledge on this front but:
As of late, we have been playing a modded scenario on ALIVE and have noticed that UAV's seem to not listen to Commands from the Operator. (Example: Operator connects to UAV and places a loiter command, then tries to update altitude to a certain number - but the UAV refuses and stays at 100m indefinitely.) Is there some sort of init script we could utilize to ensure that commands are regularly updated and carried out or is that too expeditious and isn't something that would be possible?
(Dare I say I tried concocting something on ChatGPT, but from history on these channels - people have stated a lot of this is essentially code gibberish it picks up from random sources.)
I think the UAV thingy is a bug in current game version, there have been similar discussions/reports elsewhere after the latest update
I'm not 100 % sure though
I'm at my wits end with this tbh lol, i've tried every trick in the damn book other than turning to essentially the big brain minds of y'all over here.
It seems to work fine in the Editor; but as soon as it hits the server: BOOM no worky.
I was hoping maybe there could be some sort of updated script that looped to ensure that the commands were carried out. But if this is a bug, guess I just gotta wait on the server updates from good ol' BI.
hey, I'm pretty confident in Arma scripting, but I just can't get inArea to work. I place a trigger in mission editor, give it a variable name, and then when I check in-game using watch variable for player inArea triggur then it always prints false, and it's not a variable name problem, since if I spell it wrong it just doesn't output anything
the trigger has -1 default height, but even if I give it a fixed height, it's the same result. Trigger is just default from editor, nothing changed. I try to run the mission in multiplayer, if that changes anything
play -> play in multiplayer
Send screenshot with trigger settings.
Are you sure you're within trigger area?
the thing I want to do is to restrict player from spawning in certain zone in a CTI server when server initializes, so I guess I check it like that, just place triggers with forbidden zones, and then check with inArea or inAreaArray after I get multiple
yeah I teleport to the place and nothing, even when I drive into it from outside
I can do a short video
OK, let's see.
gotta cut it so it fits lol, 117MB, 80% is just mission loading
Works for me. I still think that you're not within the trigger area.
it's such a basic function that i'm surprised it isn't working for me lol
is there a chance that idk mission somehow removes/disables all triggers?
Haven't used Watch field. Try executing in the main field.
I pasted little script which was checking for it every 1 second
and watch field checks result of a statement when you pree esc key
so if I would place a hint there I would need to keep pressing escape to display it.
I have an idea, ill make a empty mission and test that way
yep it instantly works
so the mission does something weird
I guess I'll figure it out. Thanks anyway lol
Stupid question on my part, but does "addMPEventHandler ["MPKilled" need to be on the client or the server?
Had strange results running it on a single player which is why I asked.
Multiplayer EHs are added globally to every client and the server will fire on itself and every client upon event.
When you are getting up there in size, it's time to think about making a mod. Especially if you are reusing things between missions.
that's video size
Oh okay
ok maybe I'll ask another way: how can a mission remove trigger? Cause when I check for my trigger in init.sqf it returns empty list of all missionObjects of type "Trigger" and "Empty_Detector". Is this some weird setting in Eden editor which can disable them?
Using deleteVehicle command.
cause some weird shit is going on with the mission
Well, the correct classname for a trigger is "EmptyDetector", with no underscore, so that may be part of the problem
ok ill check it
ok so at the moment of init.sqf it's there, let's see further
and after mission's init it's gone. So at least we've gone somwhere
Just curious, is the magic variable _x defined outside of the forEach block too?
@faint burrow that's how it was deleting it.
That's not a deletion, that's just initialising the variable _simple with the value of objNull. I'm certain that function does delete the object somewhere, based on what it's meant to do, but that line isn't how it's doing it
I know
but it just does it later using that way, setting to objNull
oh nah
it's actually deleteVehicle
_x is automatically defined in the select filter code, like with forEach
setting things to objNull is just not a deletion method that exists in the game. If you set a variable to objNull, or an element in an array, you're just replacing that saved reference, not the object itself.
What would be the reason I can still see markers that are supposed to be in the direct channel (5)?
code excerpt
if (getPos self distance getPos _x < detectionRange) then {
_ins = terrainIntersect [getPos self, getPos _x];
if !(_ins) then {
activeMarkers pushBack _markerName;
_marker = createMarker [_markerName, getPos _x, 5, objNull];
_marker setMarkerType "mil_triangle";
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Unk. Munition";
I believe markers can only be global, side or group, no?
Well that's kinda a bummer
It's interesting though, because if I switch to the direct channel, the marker goes from being half-alpha, to fully visible
But it shows up globally to all sides
Well, how would it know who to show or hide it from?
I assumed direct did some shenanigans with vicinity, but guess not. Just gonna add a foreach loop that sets the alpha to zero for players outside 50m
if markers could be created in direct by players (unclear) then it might use proximity to the author. But this is a script-created marker - it has no author, especially since you've specified its owner as objNull, i.e. nonexistent. So whose proximity would it use?
That's fair. This opens up me being able to get it to show for people outside the TOC as well, I suppose
BTW, if you're going to specify the owner as objNull, you can just skip specifying it entirely, since objNull is the default and there are no parameters after that that you might need to specify it in order to reach
So I am in the process of trying to a game of capture the flag with forklifts. I've got the system down for when you capture the opposing teams forklift and bring it back to your base.
But I am trying to get it to when you get in to the opposing teams forklift it pops up a hint that the flag was stolen. I am not quite sure where to start with this to have it only pop up when a specific side gets in to the vehicle
Is there a place to ask reforger scripting questions?
Add a GetIn event handler to the forklift and then check the side of the unit
#enfusion_scripting sure
Thanks, somehow I missed that
thanks
hello all, So i made this Outro Mission ending script that plays after all condistions are met,
and if people are flying a pawnee Chopper, ofcorse they crash,
how do i make all pawnee choppers go into (Auto Hover Mode) while the script is playing
Good day. I want to create "Library_WeaponHolder" but I want to prevent any actions with it. Unfortunately even with all the
_holder lockInventory true;
_holder enableSimulation false;
_holder setDamage 1;
It is still available to player to interact with. Is it even possible?
maybe with https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#InventoryOpened not sure, just a guess
Yeah, that's what I ended up with, check if container is of "Library_WeaponHolder" type. Not ideal, but at least something. Thanks
Hey folks,
i am trying to find something out. In the Arma Wiki for the HEMTT it is said that the HEMTT Flatbed is capable of loading HURON Containers as cargo.
But I can't the fuck find out how. It seems I would have to add an addAction in the Editor for this, but I am not sure how I would do this. I can't be the first one trying to look into this. So does anyone know how this works or maybe even can point me to a how to?
Here is the Wiki Page that says that:
https://armedassault.fandom.com/wiki/HEMTT#HEMTT_Flatbed
Try moving the container on the HEMTT.
Hey man, yeah true, in the editor this works. But I would like to design a Mission where Players have to resupply different points that need different things. So they would have a storage where they decide what to load on which vehicle and how to organise that. So I would need that to work ingame. and not only in Editor.
Yeah, found that site. I just thought that this was something a bit more common and someone already did a solid function for this.
I could not imagine that there is no BIS_fnc or script that already does that
I'm surprised too.
Yeah, it's wild. But thanks. I was hoping some of you cracks already did that, but well, I will have to do something myself
you can make anything into a Ammobox
i need the creator of EZM pls.
im the creator of th e1st zombie warlords in arma 3 and the creator of the arma reforger 2022 Conflict - Early Access.
i need some help bc his mod on my server is ya.... extrem weird loadet aso
this is what i use to make anything into a AmmoBox
and why tf one guy delite all my rolls???
_crate = _this select 0;
_Bomb = 7;
_Ammocount = 20;
_Nades = 20;
_MedicAidCount = 10;
clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearBackpackCargoGlobal _crate;
_crate addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", _Bomb];
_crate addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag_Tracer", _Ammocount];
_crate addMagazineCargoGlobal ["1Rnd_HE_Grenade_shell", _Ammocount];
_crate addMagazineCargoGlobal ["HandGrenade", _Nades];
_crate addItemCargoGlobal ["FirstAidKit", _MedicAidCount];
just a small EX
Hey, try looking into liberation files or apex framework functions, they've already have those things set up
it's basically attachTo
What is general oppinion on the best and most performant way nowdays to repeat periodically certain cleanup action of low priority all the time during mission run? "EachFrame" event handler, or simply spawned code with some pause...or something from CBA events handling functionalities (e.g. waitAndExecute which runs in unscheduled)...or...?
Thanks ๐
You can either use a CBA PerFrameHandler, which will run X code with a configurable delay (each frame if 0, or seconds if > 0) or a looping CBA waitAndExecute
There won't be too much of a difference between the two. Personally if I'm going for a large delay I'll use a WAE loop
You could use spawn, however if its constantly running it would eat up the allowed time of every other scheduled script, not to mention the other downsides of scheduled.
Is this still valid information (initPlayerServer.sqf vs. CfgRemoteExec)? https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec#initPlayerServer.sqf
Many thanks man!
i know this is for scripting but is anyone familiar with host havoc? Im trying to get a server to work with mods and I cant get the server to start do to something called DMNS_Ace_Compat and support is less than reliable
If you don't need to specifically pass a param in a specific index, what is the best way to "skip it" or "leave it blank"?
For instance, I do not need to write anything in the second index here because the third index is what I need to pass along. This works by leaving the quotes blank but perhaps there is a consensus on what is proper?:
["intro1", "", marcinko] remoteExec ["FoxClub_fnc_Conversation"];
Params like this can be listed in any order correct? For example, below I could switch the index of _args and _target without any negative effects.
params ["_target", "_caller", "_actionID", "_args"];
No.
The names that you put in there are your choice. The positions are not. If you swapped _args and _target then _args would then be the target object.
If you need to skip something, just use an empty string
params interprets the input in the order it's passed.
[1, 2, 3, 4] params ["_one","_three","_two","_four"];
// _three contains 2, _two contains 3```
When you do `params` with no left argument, it's still doing the same as what I just showed; it automatically uses the autogenerated `_this` variable containing arguments passed to the script. The names still don't matter - the input is still parsed in the order it was given.
If you're generating the input array yourself, by passing your own arguments to your own `spawn` or whatever, then you can switch them around as you like. If the input is being generated by someone else (e.g. EH params, addAction information) then you have no choice but to accept it in the order it's given.
Is there a way to make Turrets look certain direction?
Like I wanna make a sam look directly up
So how come this works just fine? As you can see the params are out of order in the way I remote exec them. I feel like this should break but it doesnt.
params ["_target", "_caller", "_actionID", "_args"];
["question7", _caller, _target] remoteExec ["FoxClub_fnc_Conversation"];
remoteExec is not params.
params has generated the new variables (_target, _caller etc) from its input.
Now that has been done, you're free to use those variables however you like. You don't have to keep them in order wherever you use them - that would make it impossible to use them.
Try doWatch or lockCameraTo
_target should be grabbing the variable name of my addaction unit correct?
_target will be whatever the first param passed to it is
No, _target contains a reference to the object the action was attached to (I'm assuming this is all happening in an addAction code scope, anyway). It does not contain the variable name. If you do str _target it will print the variable name* because that's the human-readable result of doing str on an object, but what's actually in the _target variable is an object reference.
* if the object actually has a variable name. If it doesn't, then a string containing some other identifying information like net ID, group ID etc will be generated.
When I pass _target to my function (as you see third index). I change it to _npc for readability reasons. Doing that should have the addaction unit speak as follows:
private _sound = _npc say3D "answer1";
But the unit of a different addaction speaks not the one I'm trying to pass with _target.
Sorry it's confusing, I know.
So I must be passing _target incorrectly. Or just plain dont understand fully what I'm doing. Or both, lol.
It would help to see more of the content of foxclub_fnc_conversation
I'll post an example. Let me cut out all the extra stuff so it's more readable.
Here is my addAction. I want scout to respond to the question. Function to follow...
scout addAction [
"<t color='#FFFF00'>""So, you're our carson?""</t>",
{
params ["_target", "_caller", "_actionID", "_args"];
["question8", _caller, _target] remoteExec ["FoxClub_fnc_Conversation"];
},
nil,
8,
false,
true,
"",
"_target != _this", //so scout can't ask himself this question
4
];
In the function _player correctly plays the sound from the player. However sound is not played from _npc which is the same as _target which is the same as scout.
case "question8": {
private _sound = _player say3D "question1";
_player customChat [FOX_DialogueChannel, "Whatโs your story, pal?"];
["answer8", _player, Marcinko] spawn FoxClub_fnc_Conversation;
};
case "answer8": {
private _sound = _npc say3D "answer1";
_npc customChat [FOX_DialogueChannel, "blah blah blah"];
};
You'd have to show more of your function, that part alone doesn't tell you much
Small note, you probably want _originalTarget, not just _target in your condition.
_target: Object - The object to which action is attached or, if the object is a unit inside of vehicle, the vehicle
_originalTarget: Object - The original object to which the action is attached, regardless if the object/unit is in a vehicle or not
From https://community.bistudio.com/wiki/addAction
just post your whole function on pastebin and give us the link
The function is very long I can't post it all but basically its has _npc as a different addaction previously in the code.
I will try this. What is pastebin?
A website
It's just a thing to copy/paste stuff onto
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
It does have SQF as a language for syntax highlighting, so you should pick that when making it
I just pasted it. Im try to see how to "share" it.
"Create New Paste" at the bottom, and then copy/paste the url
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
That's not the whole function
You didn't copy it then
You just selected the content, and then pasted whatever you had copied last
lol I am the worst. Yes
Ok it says please wait cause its like 400 lines long or something.
I've got a strong feeling there's a way to optimise it substantially. But we'll get to that after solving this initial issue.
Its a conversation with like 10 different npcs. its basically the same stuff I posted on here repeated over and over again.
That's why it could probably be optimized
Eh, its taking too long. Ill just post the .sqf
It's very likely that you have a lot of code that's repeated, when it could be just one set of code that receives different inputs
okay, so here's the units you pass into the function: _target and _caller, which become _npc and _player.
But on the first pass through - the Question pass - you don't use _npc (_target). You have instead a hardcoded reference to Marcinko, which is what you then use as _npc for the Answer pass.
My suspicion is that Marcinko is a different unit and not the same one as the original action target.
You need to check what unit Marcinko actually is and what unit you've added this action to.
Or replace the hardcoded Marcinko with _npc in the first place.
Spot on! Okay I need to change:
["answer8", _player, Marcinko] spawn FoxClub_fnc_Conversation;
to
["answer8", _player, scout] spawn FoxClub_fnc_Conversation;
That way scout says the say3d. I'm embarrassed. I should have spotted that. Thank you both so much for the help!
Well, change it to _npc so it dynamically uses the action target, then you don't need to worry about keeping track of variable names
Of course, the real secret to optimisation is going to be that you don't actually need to distinguish between "player" and "npc" at all
Ohhh I see what you are saying. I don't need the hardcoded unit varible name, Just:
["answer8", _player, _npc] spawn FoxClub_fnc_Conversation;
If I dont distiguish between these then the say3d could get mixed up on who is saying what though, correct?
You only use one of them at a time though
For example in here, in "answer1" you only use _npc.
In "question2" you only use _player.
I should mention this is for MP too, if that matters.
You need to distinguish between two units, but it doesn't matter which is which [identity] for the purposes of this function. It only matters which is the speaker and which is not.
so player isn't always player. That's why I need _caller for the addaction
So you can make this code much more reusable by making it only care about the speaker, rather than specifically keeping track of which is the player and which is the NPC.
With that fixed, you could simplify a lot of your code to not have nearly as much copy/pasted stuff.
Something like:
// fn_speak.sqf
params ["_unit", "_text", "_soundClass"];
private _sound = _unit say3D _soundClass;
_unit customChat [FOX_DialogueChannel, _text];
_unit setRandomLip true;
waitUntil {isNull _sound};
_unit setRandomLip false;
And then in your conversation function:
// fn_conversation.sqf
params ["_convo", "_player", "_npc"];
private _text = "";
private _soundClass = "";
private _speaker = objNull;
switch toLowerANSI _convo do {
case "intro1": {
_text = "Good morning gentlemen. There's an arsenal right there if you want to adjust your equipment. I'll be over here if you have any last minute questions.";
_soundClass = "intro1";
_speaker = _npc;
};
// ...
};
if (_text != "") then {
[_speaker, _text, _soundClass] call FoxClub_fnc_speak;
};
Also as a heads up, those CfgSounds classes should have prefixes (if those are your classes, which I assume they are)
I had a version of this going last week where I just had _speaker for everything. But the sound would play from only the _npc and not the _caller on questions that had follow-up questions. By separating the _player and _npc it works now. I haven't update my githb. Lemme see what it looked like before.
What is a prefix? Yes those are sounds in my description.ext
A prefix / tag is just an identifier to make sure you and another mod don't accidentally conflict
Like you have your functions prefixed with FoxClub
So just rename intro1 to fox_intro1 and it solves the issue?
So like have _speaker and !_speaker or something like that? Or what would be the inverse of a variable?
Oh I'm trying to understand Darts code. I think I see.
No, I mean you have one piece of code that just works on "the speaker" and does all the message-sending, sound-playing etc., and something else determines who is the speaker to pass to that code
_unit and _speaker
That way, all the operational code is completely reusable and doesn't need to be repeated
I'm writing something to do this in a slightly more in-depth way, I just need to test it
Oh I think I see what Dart is doing. A functions calls a function. That way it doesnt need to run the whole 400 lines each time the function is called?
Partly, and also those 400 lines are substantially reduced because you don't need to have say3D and customChat etc written out multiple times per dialogue instance - that's all written once in the "speak" function, which then gets called by the dialogue instances.
Is this a coincidence that you are doing something like I am, or are you saying you are writing an example like Dart has?
I'm writing something for you to do this
Much appreciated!
what kind of error is this? (dedi server)
Note that this is designed for back-and-forth conversations where the speaker always alternates between two people. Supporting conversations with more than 2 units, or where 2 consecutive messages can come from the same person, is doable but more complicated. (You can sort of do it within this system by using extra single-message conversations run in sequence)
So this and what Dart wrote and what I wrote do the same thing but mine is inefficient. What's the difference between yours and Darts?
Just slightly different philosophical approaches to the design.
I think I would say Dart's is a bit less efficient because it uses a switch case rather than a hashmap. Maybe a bit less flexible in terms of running a whole conversation off of one input.
I'm not criticising Dart's work though, it's better than what was there before and it's similar to things I've used in the past too. It would be a reasonable way to do it.
I've actually just figured out a clean way to have non-alternating speakers
Ah okay, so it's the minutia that I can't see since I'm so new. Either way is excellent.
updated
Okay so most of this goes over my head. But I kinda see how I might plug and play some of this. What is the sleep needed for?
It's just presentation timing. You can adjust it as you like to find a natural pace between dialogue lines.
The value could also be baked into the conversation data instead of a universal constant, if you need to have different delays between some lines
Thanks for the help! I will try and implement it right now. Would this work with two npcs talking to each other (no addaction)? How about just a one liner from an npc when the player gets near?
Updated: delay-after-line is now specified in the conversation data. It is optional, default 1 second.
The system itself has no connection to being called from an action or not. All it cares about is that you can provide it with a valid conversation key string, and enough speaker units to account for every role specified in that conversation's data.
["keyword reference",[_speakerUnit0, _speakerUnit1, _speakerUnit2]] remoteExec ["foxclub_fnc_conversation"];```
This is the activation code (with placeholder arguments, obviously). As long as `"keyword reference"` is one of the key strings in `foxclub_var_conversations`, and as long as the array of speaker units contains however many units are needed for the conversation in question, it doesn't matter where the activation originated. If your conversation only uses speaker `0`, then you only need to provide one speaker unit.
So cool. Do I need to make any other considerations for Multiplayer besides the remoteExec?
Make sure only one machine is sending the remoteExec
Well default is 0 which IIRC means it gets sent to all clients and the server. If that's what you mean then I need to be more specific on which client it goes to?
No, sending to all clients is fine (assuming you want everyone to see it). You just need to be sure that the broadcast is only sent by one machine. Otherwise it will be duplicated.
Gotcha. Yes I place the remoteExec in a server only trigger usually.
In addAction code you can be sure of this, because addAction code only runs on the machine that activated the action. Other contexts can be less controlled.
This is custom chat. I am using %UNIT_NAME to show the "speaker". What I like better about sidechat though is that in MP it shows the Group Name and the user. Is there a way to do this for customChat? I would prefer it to look like sidechat: Group Name (MP Usersname)
https://community.bistudio.com/wiki/radioChannelSetCallSign
%UNIT_NAME is not the only option available
I was just about to link that but I dont see one that has BOTH. Perhaps I could nest one inside of the other within the index?
Ever used format before?
No sir
Well, I was going to say it works the same way, but now that's not going to help :)
No worries. If it's advanced it's just a small nitpick. I can come around to it later.
Things like %UNIT_NAME are special wildcards you can use, but the string you end up with doesn't have to be just one of them
or any of them, for that matter
I think you should try it
Here goes nothing
LOL, it worked! The one idea I've ever had that actually worked. Ima go buy a lottery ticket today.
I am trying to mimic what happens IRL when someone speaks on a radio next to someone with a radio. If the person is close enough they will hear their voice and their voice on the radio at the same time. So I have this:
private _sound = _player say3D "wait1";
private _sound2 = playsound "wait1";
They both play the same sound file. But there seems to be a little offset when the audio files are played so it breaks immersion.
Depending on how big the offset is (and how reliably it happens) you might be able to use a very small sleep between the commands to correct for it.
Whats the lowest a sleep can go? Like .01?
Depends on frame rate, technically. sleep will always suspend until at least the next frame. So at low frame rates, the minimum is higher.
At 30 FPS the effective minimum suspension should be 0.03s
Is this the most efficient way to set hashmap data that is being broadcast as public?
// Assuming "hashmap" is set as a public object variable
private _objectData = _object getVariable ["hashmap", createHashmap];
_objectData set ["key", 10];
_object setVariable ["hashmap", _objectData, true];
Looks like the set command doesn't have a parameter to set it public there
Where do you use it and how.
Currently we have likely a few thousand objects across the map of which are unique to players and stores their data. Previously that data was stored as individual public variables. With recent JIP changes though we want to cut down and reduce our usage of those dozen variables we have on each object and combine them instead. Since some of them may also be nil at a given time, I figured a hashmap would be more appropriate in terms of storing data opposed to something like an array where a part of it's length many not exist.
Hey folks,
I am trying to add an addAction to all Boxes that can be loaded into a vehicle via ViV.
I thought about doing this with an Event Handler in the initServer.sqf.
["ReammoBox_F", "init", {
_this addAction
[
"Load into Vehicle",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_vehiclesArr = nearestObjects [_target, ["Car", "Plane", "Helicopter"], 50];
_vehicle = _vehiclesArr # 0;
if (! vehicleCargoEnabled _vehicle ) exitWith {
hint "Vehicle cannot transport cargo";
};
_check = _vehicle canVehicleCargo _target;
if (_check isEqualTo [true,true]) then {
_vehicle setVehicleCargo _target;
}
else {
if (_check select 1) then {
hint "Vehicle has not enough free space for cargo.";
}
else {
hint "Cargo is to large for this vehicle.";
};
};
},
nil,
99,
true,
true,
"",
"isNull (isVehicleCargo _target) && nearestObjects [_target, ['Car', 'Plane', 'Helicopter'], 50] isNotEqualTo [];",
50,
false,
"",
""
];
}, true, [], true] call CBA_fnc_addClassEventHandler;
But I get the following Error Message in the Log and can't really wrap my head around it:
0:05:40 Error in expression <r.sqf"
["ReammoBox_F", "init", {
_this addAction
[
"Load into Vehicle",
{
param>
0:05:40 Error position: <addAction
[
"Load into Vehicle",
{
param>
0:05:40 Error addaction: Type Array, expected Object
Can anyone help me with that?
Hehehe
I could be wrong because I just glanced but could it be because you are attaching the addAction to _this instead of this?
@remote cobalt sorry forgot to tag ๐
Thought about that as well and changed it to "this" but had the same error.
I had the "_this" from the CBA page:
https://cbateam.github.io/CBA_A3/docs/files/xeh/fnc_addClassEventHandler-sqf.html
I should mention: The addAction is testet. Added it manually to objects in the init and worked fine.
My bad appears you also have that within the event handler too so I would imagine _this would make more sense provided the object is being passed as an argument.
_this contains an array. This array only contains one element, the object in question, but it's still an array. You should use _this select 0.
My thoughts as well that it was passed within the array. Out of curiosity how do you know it only contains one element?
Well, it's an init EH, at that moment there's nothing else useful to pass.
(Same behaviour as the vanilla init EH https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Init)
Yesss, that's it. Thank you so much. Wasn't aware that was an array. Weird. But thanks
Gotcha makes sense. Just was curious your thought process and how you deduced that. Thanks :)
Event handlers all use the same system for passing their parameters, and most of them have more than one parameter, so they all pass an array, even if that specific EH only happens to have one.
Ah, thanks for the explanation. Somehow I missed that in the last years. But that is really great. Thank you so much.
Hello maybe you can help me and I'm trying to code, I think that's the easiest way
the map Kandahar province has a black sky i want to get rid of it, the problem is i used hindukush black sky patch as a guide i renamed the pbo's and i changed the config, everything the map name but it still doesn't work
am i stupid or is there no easy way to get the current state of a planes landing gear? like, if it's up or down
guess i have to use the EH. hm. but maybe better that way
vehicle player animationSourcePhase "gear"
Hello, I would like to detonate disconnected RC-40 Drone with below code. I will server exec the code but I'm worried because the isUAVConnected command works for local terminal. In that case dedicated server cannot detect if some uav is disconnected or not.
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if ((typeOf _entity) isKindOf "UAV_RC40_Base_RF") then {
[_entity] spawn {
params ["_rc40"];
while {isUAVConnected _rc40} do {
sleep 1;
};
// Use native "Detonate"
_rc40 forceWeaponFire [weaponState _rc40 select 1, weaponState _rc40 select 2];
};
};
}];
Yeah, isUAVConnected is client-local command
I think UAVControl could work
I have no idea how RC-40 drone works, I guess you want something like this:
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if (_entity isKindOf "UAV_RC40_Base_RF") then {
[_entity] spawn {
params ["_rc40"];
waitUntil {sleep 0.1; !isNull(UAVControl _rc40 select 0)}; // Wait until somebody connects the first time
waitUntil {sleep 0.1; isNull(UAVControl _rc40 select 0)}; // Wait until they disconnect
// Use native "Detonate"
_rc40 forceWeaponFire [weaponState _rc40 select 1, weaponState _rc40 select 2];
};
};
}];
I guess it automatically connect after spawn
Its that underbarrel launched drone, right?
yes
I don't know how its done exactly, I guess there is connection on Fired event but who knows what happens and how many frames of delay there is, so I added the check just in case
You might be correct
Also I don't know drops your current connection to connect to new drone
In case you were connected to something else
I thought that forceweaponfire command can trigger it.
That is not how it works
The problem is...
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if ((typeOf _entity) isKindOf "UAV_RC40_Base_RF") then {
[_entity] spawn {
params ["_rc40"];
systemChat str _rc40; // THIS DOES NOT WORK!
while {!isNull ((UAVControl _rc40)#0)} do {
sleep 1;
};
_rc40 forceWeaponFire [weaponState _rc40 select 1, weaponState _rc40 select 2];
};
};
}];
Even the systemchat in spawn does not work even in editor
Since I can debug it with local exec for now..
Add it earlier before isKindOf check to see if its the problem
My rpt file is full of mess. I'm doing it in liberation
add some long string to ctrl+f it
good idea
diag_log [1, "FUUUUUUUUUUUUUUUUUUUUUUCK", _entity];
...
diag_log [2, "FUUUUUUUUUUUUUUUUUUUUUUCK", _entity];
lel
seems like its working
thank you. But as POLPOX said it detonates only with setdamage for now.
[rc40,"Explode"] call lxRF_fnc_RC40```
well, now i'm happy we didn't do that gl pistol
is there an alternative for createVehicleCrew for filling up cargo with soldiers?
Nope, you gotta script it yourself
Its easy with fullCrew [vehicle, type, includeEmpty]
can get typicalCargo class too
or use needed one
Hello maybe you can help me and I'm trying to code, I think that's the easiest way
the map Kandahar province has a black sky i want to get rid of it, the problem is i used hindukush black sky patch as a guide i renamed the pbo's and i changed the config, everything the map name but it still doesn't work
I wanted to give the blackfoot the weapons of a AH-64 helicopter. It all worked fine but i want to set the fire rate of the GMG higher and want to lower the reload time between each 200rnd mag. But i cant figure out how to use the setWeaponReloadingTime command. Someone knows how to change fire rate and magazin reloading time?
here is the code if it helps:
this removeWeaponTurret ["gatling_20mm", [0]];
this removeMagazinesTurret ["1000Rnd_20mm_shells", [0]];
this addWeaponTurret ["GMG_20mm", [0]];
this addmagazineturret ["200Rnd_20mm_G_belt" , [0]];
this addmagazineturret ["200Rnd_20mm_G_belt" , [0]];
this addmagazineturret ["200Rnd_20mm_G_belt" , [0]];
this addmagazineturret ["200Rnd_20mm_G_belt" , [0]];
this addmagazineturret ["200Rnd_20mm_G_belt" , [0]];
this addmagazineturret ["200Rnd_20mm_G_belt" , [0]];
this removeWeaponTurret ["missiles_DAGR", [0]];
this removeMagazinesTurret ["24Rnd_PG_missiles", [0]];
this addWeaponTurret ["missiles_DAR", [-1]];
this addmagazineturret ["24Rnd_missiles" , [-1]];
this addmagazineturret ["24Rnd_missiles" , [-1]];
this removeWeaponTurret ["missiles_ASRAAM", [0]];
this addWeaponTurret ["missiles_ASRAAM", [-1]];
this addmagazineturret ["2Rnd_AAA_missiles" , [-1]];
this addWeaponTurret ["missiles_SCALPEL", [0]];
this addmagazineturret ["8Rnd_LG_scalpel" , [0]];
I tried using the command like that but it didnt work so far: this setWeaponReloadingTime [gunner this, "GMG_20mm", 0];
Literally the example there can help you
so far i tried
this setWeaponReloadingTime [gunner this, gunner this, 0];
this setWeaponReloadingTime [gunner this, "GMG_20mm", 0];
this setWeaponReloadingTime [gunner, "GMG_20mm", 0];
this setWeaponReloadingTime [(gunner), "GMG_20mm", 0];
this setWeaponReloadingTime [0, "GMG_20mm", 0];
this setWeaponReloadingTime [0, 1, 0];
this setWeaponReloadingTime [this, "GMG_20mm", 0];
but none of em work
?
wouldn't it be easier to just make a new config for the helicopter
i want it in the init box so i can spawn it in pub zeus
nvm i found some random code on redit that seems to work
Hello, I've been making a mission for a while now that includes some vehicle compositions. A part of one of these compositions is a vehicle with a spotlight I added through scripting, which can be turned on through an action. This spotlight uses a basic 'addAction' in order to do this, with the argument/script vaguely like;
centaur addAction [
"Floodlight", {
if (lightIsOn source == "ON") then {
source switchLight "OFF"
}
else {
source switchLight "ON"
}
},
nil,
1.5,
true,
true,
"headlights",
"player in centaur",
50,
false,
"",
""
];
Now my problem; The script works, but ONLY for the client that activates thw action. for anyone who isn't the client. no light turns on. Does anyone know why??
Thank you!
So, move the whole command within a remoteExec string?
Don't know whole command mean here but I guess yes
All good, thank you. I'll look into seeing how to do that
why the fuck does Orbat have to be so fucking difficult
It keeps giving me the Error of Class Not found, and now theres several units that does not show up on the map. You could keep it simple and just have "HQ" and then a couple of squads or whatever, but if i wanted to have Companies and then Platoon, it has a stroke and dies
Impossible to diagnose without seeing the code
2 seconds then
I assume the problem comes with the way i've done the "};" I just cannot decipher what causes the issue, as i've tried multiple ways of ending it
Back to report it did not work
I just decided to make it easy and keep the light on always
I'll look at it on a bigger screen in a minute to be sure, but your { }; appear to be correct (although the indentation could use a little work, that's just readability, not functionality)
Can you tell me the exact and full error it gives you?
Anyway! Another fun question for anyone who may be able to help me; In the same vehicle, I have actions to switch from the vehicle into turrets placed on top. Although I have discovered through testing that in multiplayer, only the driver can switch to the turret, and if someone is in the driver when you switch back to the vehicle FROM the turret, you get ejected. Any suggestions?
centaur addAction [
"Move to Gunner", {
moveout player; player moveInGunner bolter
}, nil, 1.5, true, true, "", "player in centaur"
];
bolter addAction [
"Leave Gunner", {
moveout player; player moveInAny centaur;
}, nil, 1.5, true, true, "", "player in bolter"
];
yeah idk how to make it easier to read like the one Valky just posted.
This is the only Errors i get, the Debug thing doesnt really elaborate or anything.
This is current view of Orbat, I want the Platoons in A-company to be parallel to each other. The Map only shows CSAT, Air, HQ, and oddly enough the 1st Platoon under the A-Comp.
(Map example)
Two seconds, i may have found the issue, there was no ">>" between Acom, and Pla3 on the eden module
That'd do it
only the driver can switch to the turret
moveInGunnerrequires local vehicle object.
if someone is in the driver when you switch back to the vehicle FROM the turret, you get ejected
You wrotemoveout player;.
Okay, well its not done yet, but it works now. The reason Acom did not show up on the map but it did in Orbat, was because of a spelling error... ๐
It's a classic
thanks for the help eitherway, how can i do that fancy coloured script for easier readability in the future?
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
ah, i see
Note that that example uses sqf for...SQF syntax. Config, like in cfgOrbat, is not actually SQF. It's closer to C++, so use cpp to get more useful highlighting when posting config.
I see, cheers mate.
- I wrote
moveInGunner bolter, 'bolter' being the object - As you can see, I wrote after that
moveInAny centaur, 'centaur' being the vehicle
About indentation as I mentioned before, the trick is to have the opening { and closing } of any class (or code scope) be at the same level of indentation. You should be able to trace a straight vertical line between any matching pair. Getting it right makes a big difference to how easy it is to read.
Here's your CfgOrbat with the indentation fixed:
* works if you open it in a text editor, Discord lets you down as usual
The script works whenever no-one is in the drivers seat other than the player moving
Yeah, i did trying doing that in the Txt file aswell, not sure wether it matters for arma scripting, but it does make it easier for me to read it myself lol. I'll have to try identation at some point myself, thanks.
I wrote moveInGunner bolter, 'bolter' being the object
And?bolterisn't local for you, but is local for driver: https://community.bistudio.com/wiki/Multiplayer_Scripting#General_information_about_locality
As you can see, I wrote after that moveInAny centaur, 'centaur' being the vehicle
As you might guess,moveoutmoves a unit out of the vehicle. Then yes, you move a unit in the vehicle usingmoveInAny.
The bolter shouldn't be local to anyone when executing the action moveInGunner bolter, because it is empty.
As for the second point, I don't get how this helps? I am asking why the command does not work only when someone is in the driver's seat of the vehicle I am moving into
Sorry for inquiring again. But the description for one of the groups seems to just not wanna expand. I assumed it could be a length problem so i cut it short, but the HQ description is way longer than this one and works fine, any ideas?
Funny how Arma doesn't give me an error in regards to that. Is there a description limit at all in that case?
The & unfortunately does not work. But i'll just write "and" instead. Nvm, i'm just thicc and forgot to save the txt files.
The bolter shouldn't be local to anyone when executing the action moveInGunner bolter, because it is empty.
Empty vehicles are local for the server.
As for the second point, I don't get how this helps? I am asking why the command does not work only when someone is in the driver's seat of the vehicle I am moving into
I guess it's because of locality.
Okay, so how do I bypass this locality?
Strictly speaking it isn't an error. & is the opening character for inserting a special character by its HTML entity code, so it sees & and goes "OK, everything after this must be an HTML entity code". Since it then receives...the rest of the string, instead, the result is "uhhhhhhhhhhh". Which is valid, sort of, just not what you wanted.
About limits, I have no idea what the limit is for the ORBAT viewer, if there is one. There is a limit on string size in general, so presumably that's the absolute maximum.
I think the string limit is 10,000,000 characters. Hopefully you won't need to exceed that.
Ah i see, makes sense now actually. And i definetely wont need to exceed 10mil characters lol.
Okay can someone quickly ELI5 why something like, attachTo doesn't need to use remoteExec in MP but moveInAny does? Specifically when the machine executing the command is just trying to leave or enter someone else's 'local' vehicle?
It's just the way the different commands work in the engine.
Read articles the links to I provided above.
There's not really a "why" that we can understand (because we can't see the source code), it's just how BI has decided the system works.
So if I remoteExec just to the server, will what I'm trying to achieve work? (To anyone's best estimate)
Not always.
Hmm ok
Try using the vehicle object as the remoteExec target.
moveInAny claims to be global-argument...
Like, as in the machine it's executed on?
Which is different from the other moveInXXX commands. Not sure if true. I gave up on moveInAny a while back due to other bugs.
[_unit, _vehicle] remoteExec ["moveInAny", _vehicle];```
I thought it's supposed to be a number?
Numbers are one option out of many.
The other moveInXXX commands are unit-local, not vehicle-local, IIRC.
So say, moveInPassenger (if that exists) wouldn't encounter this problem?
Maybeโข
https://community.bistudio.com/wiki/remoteExec
See "targets" for a full list of possibilities
I guess I'll try things when I get up. Thanks everyone for slowing down to get me to understand.
If remoteExec with the vehicle as target doesn't work, try doing it with the unit as target instead.
Can't hurt to try all the options ๐คท
moveInCargo says:
The command should execute where the unit (not vehicle) is local.
The Arma 3 Config thread cant help me.
Maybe you can
Kandahar province Config
maybe check the terrain makers thread. but you'll find less people here that can help you than in config and terrain
Yes but They answer Not, it is ONLY a Config more Not
They are pro i am a beginner
And it would be cool if you could learn something from the pros
its not only a config. everything you are listing is within the config when making a terrain. and sometimes, the pros don't have an answer.
maybe check out the PMC terrain making wiki
maybe there is an answer in there
Any way to block the ejecting from a vehicle if you press double V via scripts or a mod ? ๐ค
onkeyDown + onKeyUp EH's do the job
To preface, I know right now this script's syntax is incorrect but I'm not quite sure how to rearrage this particular function. Where would I go from here? (truck = the base vehicle I want the action on, laz2 = turret attached to the vehicle)
wait - I may have figured it out, be right back
AAAAA okay so I'm getting this error
truck addAction [
"Move to MultiLas", {
remoteExec [
player moveInGunner laz2, truck
]
}, nil, 1.5, true, true, "", "player in truck"
];
But I don't see what's wrong with this
remoteExec works like this:
_leftArgument command _rightArgument;
// --->
[_leftArgument, _rightArgument] remoteExec ["command"];```
So:
player moveInGunner _vehicle;
// --->
[player, _vehicle] remoteExec ["moveInGunner"];```
oh my god I think I'm getting how to reformat it for the first time
๐ซถ
no error at least but also now it just does nothing
could I replace "player" with "caller"?
nevermind, seems not
If you want to use the provided action information like _caller, you have to extract it from the autogenerated _this variable, using select or params
how do I target just the person who uses the action?
Action code is only executed on the machine that activated the action. So if that's who you want to target, don't use remoteExec.
I can't because then it doesn't work when another person is in the vehicle ๐ญ
Well, using remoteExec to only target the caller won't help with that, because it's the same as not using remoteExec, just with an extra step
I feel guilty at this point for just pasting code and asking if it's correct, but that's what I'm doing right now...
truck addAction [
"Move to MultiLas", {
[player, laz2] remoteExec [
"moveInGunner" , 0
]
}, nil, 1.5, true, true, "", "player in truck"
];
Does this not work because if I use "player" with remote exec, that targets every person on the server?
That's functional code, though breaking up the remoteExec onto different lines like that is a bit weird.
No.
player is a command that returns the local player unit. It is evaluated before the remoteExec is sent. So the player who activated the action is the unit the remoteExec refers to, on all machines.
Okay so do you mind re-explaining what the other person tried to explain to me last night then? I'm obviously not getting something
I'm not completely sure what they were getting at, to be perfectly honest.
Okay, so one issue you might have here is that moveInGunner requires the unit to not be in a vehicle to begin with. You must move them out of their original vehicle before moveInGunner will work. Your current action doesn't do that.
I feel like I shouldn't have to frick* with remoteExec right now to be honest, what that guy said before seems wrong (if it isn't then I deserve this but yeah)
I didn't say frick first time but the server didn't like it
let's try that
When it comes to putting this into action for real, you might want to make the unit invincible before moving it out. Just in case of unforeseen consequences. But don't worry about that for now, it's not the main issue.
OKAY so the moveout fixed it, thanks. I removed it when starting this f*ckfest this morning, forgetting I needed it
I'll have to grab a poor soul today to test it in multiplayer before I find out if it works
I'm baaaacck :P
Unfortunately, still an issue
SO the action works as intended if the person using it is in the driver's seat, or the only person in the vehicle.
BUT if you are a passenger and another player is in the driver's seat, using it will just kick you out of the vehicle but not move you to the turret.
I propose that the problem is not to do with the local and server gunk that was proposed originally; could it actually be that the first command to move the player out, then stops the second command from working because one of the conditions of the action is '_player in _object'
This still leaves the question; why does it work still for me in SP when I test it?
No, it can't be that.
The condition is only for the action to be displayed and interactable. Once the action code is actually started, the condition has no effect on it.
Ok scratch that then; could it maybe be then that since the player is out of the vehicle for a split second, and the command was executed locally, that the command has no effect on the player?
The player is always* local to themselves. The command was executed locally, so the command was executed where the player is local.
I see two potential options**:
- you may need to introduce a (very tiny) delay between moving out and moving in. Trying to do both on the same frame may lead to a contradiction when you consider network delays.
- the command's alleged locality requirements may not be entirely true, meaning you may need to actually execute the command where the target turret is local, or possibly even where the target turret is local and where the player is local.
* there are actually some edge cases where this is not true, but these occur during mission loading so they're not relevant.
** doesn't mean there aren't other options that I'm too stupid to see
So does that mean I'd have to do a spawn command to be able to use sleep?
Yes
Easy, I'll try it, thanks!
PS; added you because you seem cool, if you would rather not idc/idm
All works! the sleep did it. I don't know why but the moving back to the vehicle works as well now, even though I didn't touch that code. Thanks again
I kind of suspect that rather than the sleep, the spawn {} actually fixed it, but I can't say why
All the spawn does is move from the Unscheduled environment (code happens immediately and nothing else happens until it's done) to the Scheduled environment (there is a per-frame limit on how much time scheduled code can take up, and anything that exceeds that will be delayed; also deliberate delaying is now allowed). This code is very small, so that change shouldn't make any difference on its own ๐ค
f*ck me dead, I have zero clue why these all work now. All I can do now is just be happy about it, so thanks again lmao
hello ummm How do i get the script,,, to exit,, when a condition is true
i tryed,, BrackOut "Main" and exitwith and it still dont Exit
if (_condition) exitWith { _return }; will exit the current scope
You can also just return nil, i.e. exitWith {};
so this dont work ?
if ( ((getPosASL Helo2) select 2 > 9) && ((getPosATL Helo2) select 2 > 9) && Alive Helo2 && CanMove Helo2 && Alive Pilot2 ) ExitWith
{
"Pilot: BlackHawk IN Flight Wait One" remoteExec ["systemChat"];
};
how would i make this work ?
it just dont exit the script
hmmm it does hmm
Oh nevermind, ATL and ASL
SQF commands / variables are case-insensitive
oh ok
ExitWith is the same as exitwith and exitWith
It's camelCase by convention though
wounder why that dont exit the script then
Show more of your script
um ok
exitWith exits the current scope, which isn't always the script itself
oh so its just exiting the current line ?
No, if isn't a new scope
You could simplify that code quite a bit, and definitely cut down on indentation
Like instead of wrapping the whole thing in a if (hasInterface) you can just do:
if (!hasInterface) exitWith {};
hmmm ok
That wouldn't be your issue though
ah i had that but i changed it lol
ok ill try to cut it down ok
its for a DED server
and this part i run on the client
or that part
exitWith exits the current scope, which isn't always the script itself
so this is my issue right
Seemingly, you could do something like this to test it though:
private _condition = ((getPosASL Helo2) select 2 > 9) && ((getPosATL Helo2) select 2 > 9) && Alive Helo2 && CanMove Helo2 && Alive Pilot2;
systemChat str _condition;
if (_condition) exitWith {
"Pilot: BlackHawk IN Flight Wait One" remoteExec ["systemChat"];
};
ahhh ok i see
Oh also that line where you just have Exit; doesn't do anything
It's a holdover from SQS scripts, and does nothing in SQF
ahh ok nice i see thx m8 awsome
really cool friend thx alot
thats awsome
ill delete that crap up there i made lol
@tulip ridge woohoo hell yeah it worked thx mate woohoo Arma 3 yeah
worked like a charm love you man
where would i be with out you guys
Still some other things that could be improved / updated
Here's a bunch of changes I made, with some comments explaining them
If something doesn't make sense, ask away
ok mate thx
wow awsome i see totaly awsome thx you so much
i understand it
really great work m8
If you don't need the exact clicked position on every machine, you could also just replace:
missionNamespace setVariable ["TAG_mapPosition", _pos, true];
With just:
TAG_mapPosition = _pos;
So that it's not synced over the network
Since logically, the marker would also be at the position they clicked at on all clients anyway
Oh that mapPosition = nil bit on Line 12 can be deleted, I missed it
ok
super cool m8
i did as u say
holy cow m8 thats great work
your awsome
you just made my day friend
now im super happyer then i was before
cuz of you
Nice, glad it's all working for ya
it is works great
thx you so much for your help
holy cow thats an awsome script, thx to you @tulip ridge
and you are correct , i did want, ||=and or there thx again friend
and you did that so fast too god your awsome
oh and btw @tulip ridge im going to tell How Awsome you are in my Script;
You talk about LazyEval in this script but donโt use it
Yes I do
if ((getPosASL Helo2) select 2 > MAX_HEIGHT && {
(getPosATL Helo2) select 2 > MAX_HEIGHT
}) exitWith {
"Pilot: BlackHawk IN Flight Wait One" remoteExec ["systemChat"];
};
I was just reading your comments, but then realised you likely took them out while debugging
hello Dart i have another ?,,, if i click on land close to sure line how can i make the Helo2 find a safe pos on land somewhere
btw the script works perfect
There's https://community.bistudio.com/wiki/BIS_fnc_findSafePos, which might help. I've never used it before personally
ok cool thx
It does sometimes things like in the pic ๐ But it's still useful
I mean, in its defense, the car is safe in there
It's not findSafeDrivablePos 
yes i used this for placement of soldiers
works good
_spawnPos = [_pos, 50, (RANDOM 360)] call BIS_fnc_relPos;
_spawnPos = [_spawnPos, 10, 20, 3, 0, 1.0, 0] call BIS_fnc_findSafePos;
yes Dart My Chopper script works so great after you helped me thx again so much
you must be a pro scripter
ok friends im off to eat ill bb soon Arma 3 woohoo Hell yeah !!!
Did the commands for increasing uniforms' max load break/change behavior after 2.18?
Good morning, I am trying to animate a spaceship flying 'out of warp speed' above a map using setVelocityTransformation. Unfortunately, even after a night of reading too much mathematics I can't figure out why it won't work. Currently, I have this code:
ship setVelocityTransformation [
[
1787,-2031, 1000
], [
1787, 835, 1000
], [
0, 3000, 0
], [
0, 0, 0
], [
0, -1, 0
], [
0, -1, 0
], [
0, 0, 1
], [
0, 0, 1
], [
0,0,0.5
], 1
];
And am getting this error:
I am lost for reasons as to why this keeps on popping up. Any suggestions?
You have nine vectors there. There's only eight before interval.
Was the last one supposed to be customCenter? Because that goes after interval.
Can and how do I include a composition in a addon?
ship setVelocityTransformation [
[
1787,-2031, 1000
], [
1787, 835, 1000
], [
0, 3000, 0
], [
0, 0, 0
], [
0, -1, 0
], [
0, -1, 0
], [
0, 0, 1
], [
0, 0, 1
], 1
];
nevermind it's not that
I think you may be completely misunderstanding what setVelocityTransformation does.
For continuous movement this command should be executed each frame while changing the interval value.
If you call it with interval 0, it'll use all the "start" values. If you call it with 1, it'll use the "end" values. If you call it with 0.5 then you'll get an interpolation.
It's pretty difficult to implement correctly.
What is I somehow implemented a 0 spawn {} and then also put a sleep 0.1, then looped that?
so within the spawn would be the setVelocityTranslation and sleep, plus some type of looping command?
the things that are past my expertise is how to tell the code when to change the interpolation, and when to end the loop
Okay so could someone tell me why this code upsets the game? I thought I could use %1 as a number?
0 spawn{
[10] call BIS_fnc_countdown;
While {[true] call BIS_fnc_countdown} do {
ship setVelocityTransformation [
[
1787,-2031, 1000
], [
1787, 835, 1000
], [
0, 200, 0
], [
0, 0, 0
], [
0, -1, 0
], [
0, -1, 0
], [
0, 0, 1
], [
0, 0, 1
], %1
];
sleep 0.01}}
I thought I could use %1 as a number?
But you can't.
Because you should provide a number, %1 isn't a number.
Doo you have any suggestions on how to fix the code to do as intended?
Try this:
[] spawn {
for "_i" from 0 to 1 step 0.01 do {
ship setVelocityTransformation [..., _i];
sleep 0.01;
};
};
Thank you! I had to step away but I will as soon as I get back. I knew there had to be a way to dictate progressing a number from A to B but just couldn't find the right documentation. You are a saviour.
hello Schatten how are you friend,,, love having you around
I'm good, thanks. Hope you're good too.
oh yes completely good Dart helpped me with my chopper script and it works awsome
i love you guys you guys are pros
you guys are important to the operations of my missions
thx you guys so much
i really can't thx you guys enough
You're welcome.