#arma3_scripting
1 messages ยท Page 666 of 1
All I know is that it's a visual error
everything is correct
oh wait nvm
it's not correct
ok, the portion they do allign is when the vectorLinearConversion is 1
so it IS vectorLinearConversion that is fucking it up
when the rangeTo is 1, the linear conversion returns correct
it might be floating point imprecision because the vector is too long and the rangeTo argument of vectorLinearConversion too small
it's not
I told you before
when the math is correct the issue is somewhere else
you can't trust drawLine3D
it can't be
but i CAN trust the arrows
look at the arrows
and listen to me
the arrows and the lines allign at rangeValue 1
but anything less than one and they diverge
of course they do
rangeValue 1 = end
its maybe the drawLine3D. it accepts AGL positions and Z coordinate in AGL system denotes the height above GROUND, so you need to adjust for that
everything is correct
well I fixed it ๐
it was just ASL AGL conversion chaos
the first arrow is still a bit fussy around hilltops
you fixed what?
both start and end were in AGL
lines 26 and 27 should be
arrow2 setPosASL _pos;
arrow3 setPosASL _end;
and you're converting them to AGL again?
well, they're no longer diverging, I thought that was the issue here
well it's because you're using setPos
and you're double converting to AGL
so Z is less than zero
so it always sticks to the ground
so you didn't fix anything
"it works on my machine"
nothing is broken in the first place
nothing needs fixing
@dusty whale actually I just realized what's wrong
I can't believe I didn't see it before

you're using vectorLineaConversion wrong
you first take the average of two AGL positions
then convert them to ASL
you have to convert them to ASL
then do the linearConversion
why?
because AGL is a relative position
you have to use ASL
which is absolute
yet another reason why I tell people to always use ASL

the correct version of your code:
arrow2 = "Sign_Arrow_F" createVehicle [0,0,0];
arrow3 = "Sign_Arrow_F" createVehicle [0,0,0];
addMissionEventHandler ["Draw3D",{
private _end = [0,0,0];
private _ins = lineIntersectsSurfaces [
AGLToASL positionCameraToWorld [0,0,0],
AGLToASL positionCameraToWorld [0,0,viewDistance],
player,
vehicle player,
True,
1,
"FIRE"
];
private _start = vehicle player modelToWorld (vehicle player selectionPosition ["konec hlavne", "memory"]);
if (count _ins > 0) then {
_end = ASLToAGL (_ins select 0 select 0);
} else {
_end = positionCameraToWorld [0,0,viewDistance];
};
drawLine3D[_start, _end, [1,0,0,1]];
private _perc = 100/(_start distance _end);
private _pos = (vectorLinearConversion [0,1,_perc,AGLToASL _start,AGLToASL _end,True]);
arrow2 setPosASL _pos;
arrow3 setPosASL AGLToASL _end;
drawLine3D[_start, ASLToAGL _pos, [1,0,0,1]];
hintSilent str(_pos);
}];
All I did was move AGLtoASL inside vectorLinearConversion
it should work
is exists any command to check player connection to server?
can you explain in more detail?
i mean - need to check if player connection not lagged atm, something like -
call checkPlayerConnection;
without send request to server with script and waiting for answer,
or sending data from server to all players every few seconds
can't really do that without sending data/request
getting the client's connection status from the client is doable I believe (when desync is found)
getting the client's connection status from the server mayhaps ๐ฎ
understood :\
needed to check if player's connection is not lagged when player open inventory of container
Hi, how can I remove the right picture of a item in a tree view? Passing an empty string like: _ctrlTree tvSetPictureRight [_path, ""] doesn't seem to work...
Are there class name lists of weapons and equipment from popular mods like RHSUSAF etc?
Wanting to create a restricted arsenal with just those mod weapons without going through it one by one
There's probably a property on that in their config
you just need to dig through it
I do not have RHS installed right now, but it would be something like:
private _arr = "getText (_x >> 'property') == 'somethingRHS'" configClasses(configfile >> "CfgWeapons");
private _RHSWeaponNames = _arr apply {configname _x};
I'm trying to find the side of a player before he dies via onPlayerKilled.sqf
The wiki says that this has the passed argument of _oldUnit so I attempted side (_this select 0); but that returned CIV even though the player was BLUFOR. Same with side player, that also returns CIV. Is there a reliable way in which I can identify a player's side in onPlayerKilled.sqf or do I have to just do it quick and dirty with a global variable in initPlayerLocal.sqf?
was the player unconscious?
also afaik _oldUnit is already dead
so he is civilian
your other option is side group _oldUnit
was the player unconscious?
Nah. Straight up respawn button
Just tested side group _oldUnit and stumbled across playerSide and both work in that they display WEST. Thanks
note that playerSide is local
I have the same codeblock in three switch-cases. Is there an efficient way to define it only once and re-use?
I know that you can define a function like KI_myFunction = {}; not sure if this is the correct way to do such things in this case
you can yes
private _myCode = { hint "it works!"; };
switch (true) do
{
case false: { hint "it does not workโฆ"; };
case true: _myCode;
};
hmmm interesting, thanks!
I've added a write to log file functionality to this fps monitor script: https://github.com/MildlyInterested/Arma3-Stuff/blob/main/FPS_Monitor.sqf (linking to github because script too long for discord).
Unfortunately it doesn't work correctly if executed on the server.
Executed on the player it looks like this in the rpt:
[Local FPS: 18 - 19] [Server FPS: 100 - 110 Servers: 1] [Headless FPS: 0 - 0 HCs: 0] [Client FPS: 48 - 69 Players: 1]
Executed on the server it looks like this:
17:22:38 [Local FPS: 111 - 111] [Server FPS: 0 - 0 Servers: 0] [Headless FPS: 0 - 0 HCs: 0] [Client FPS: 0 - 0 Players: 0]
I'm guessing this is because of some arma 3 locality thing in scripting? Can anyone point me in the direction as to what exactly in that script would need modifying?
Quite new to scripting, thanks ๐
@winter rose question to that, my sqflinter displaying a warning stating that the variables I define at the start of my script might be undefined in the code block now (https://i.imgur.com/JNlIKgY.png) is this a expected behaviour? Do I need to have a params inside the codeblock and pass the variables to it?
If they are defined depends on where your function in there is called from
If you use it in a switch or "call" it directly below, it'll be fine
from the same script in a switch-case where the variables are accessible to the switch-case
yes
didn't read your script but you can check this out:
https://community.bistudio.com/wiki/Multiplayer_Scripting
sqf is not statically typed, so linting makes very little sense
thanks ๐
Q: trying to understand techniques such as # and ## better defining bits like MVAR(varName), which might yield something like "KPLIB_mission_varName". any pointers?
based on the preprocessor docs, not sure this makes sense...
#define LIB KPLIB
#define MODULE mission
#define MVAR(var) LIB##_##MODULE##var
#define MVAR_S(var) #(MVAR(var))
With quotes?
with or without yes
Without:
#define MVAR(x) LIB##_##x
```With (not 100% sure)
#define QUOTE(x) #x
#define MVAR_s(x) QUOTE(MVAR(x))
ah ok, cool. thanks...
Also I typed this on the phone so there might be typo
no worries, I have enough of a hint, thank you
but of course preproc does not work in a debug console ๐
Okay, I got a question: It seems like BIS_fnc_respawnTickets is executed twice in onPlayerKilled.sqf. If I have it set to subtract 1 ticket, it subtracts 2. If it's set to subtract 2, it subtracts 4. How can I fix this?
Might be related:
0:59:39 Error Missing ;
0:59:39 File C:\Users\Admin\Documents\Arma 3 - Other Profiles\ComboTombo\mpmissions\OP_Timber.Altis\onPlayerKilled.sqf..., line 10
0:59:39 Error in expression <st, -1] call BIS_fnc_respawnTickets;
Well I must say, these error messages are very detailed and informative! I'm trying to end a mission in onPlayerKilled.sqf only when a side has no players alive AND no tickets left. I've tried this:
if (_numPlayersOnSide isEqualTo 0 && _numTicketsOnSide isEqualTo 0)
then {
endMission "END1";
};
and also this:
player call BIS_fnc_respawnEndMission; //I've also tried using (this select 0) and the variable name of an empty vehicle.
In both cases, I simply get this error:
if (_numPlayersOnSide isEqualTo 0 && _nu>
9:56:11 Error position: <if (_numPlayersOnSide isEqualTo 0 && _nu>
9:56:11 Error Missing ;
10:06:27 Error position: <player call BIS_fnc_respawnEndMission;
10:06:27 Error Missing ;
10:06:27 File C:\Users\Admin\Documents\Arma 3 - Other Profiles\ComboTombo\mpmissions\OP_Timber.Altis\onPlayerKilled.sqf..., line 13
Post the entire code
_playerSide = side group (_this select 0); //Check side of _oldUnit (aka the player before he died)
_numTicketsOnSide = [_playerSide,0] call BIS_fnc_respawnTickets;
_numPlayersOnSide = _playerSide countSide playableUnits;
if (_playerSide isEqualTo west)
then {
[west, -1] call BIS_fnc_respawnTickets;
}
else {
[east, -1] call BIS_fnc_respawnTickets;
}
player call BIS_fnc_respawnEndMission;
Well it stopped screaming but it still executed -1 tickets twice
Is this the entire onPlayerKilled.sqf?
Yes
_playerSide = side group (_this select 0); //Check side of _oldUnit (aka the player before he died)
[_playerSide, -1] call BIS_fnc_respawnTickets;
player call BIS_fnc_respawnEndMission;```Try. I never experienced with such multiplayer things maybe simplify it makes the troubleshoot easier
Unfortunately it still takes 2 tickets
do a diag_log and see how many times the script is ran
Is there any chance that you're calling the script twice? Double check time
so diag_log [_playerSide, -1] call BIS_fnc_respawnTickets; ?
sorry I'm not the best in SQF as you can clearly see
10:30:48 [WEST,-1]
10:30:48 [WEST,-1]
That's not probably what he meant but you can see it's called twice
I think I know why. My custom respawn templates asks for a file to be executed when the player is killed, and I have that set as onPlayerKilled.sqf so what happens is that the mission calls that file once and then the respawn template calls for it again. I've removed it from my custom respawn template, hopefully it'll work now
Fuck yeah, its working!
Thanks guys!
I spent all of yesterday on this one file
if you see that there is a pattern when you change stuff e.g, -1 ticket but its -2, -2 tickets but it's -4, you can instantly assume that your script runs twice
Sorry i was off yesterday after when you sent this
You are correct, it's the fact that AGL is a position relative to the ground level
๐
i dont know how i didnt spot that
ofcourse the numbers would be scewed, since the position relative to ground level is always 0 at ground level
Thank you for spotting that
Hello, anyone knows why my script works on local server but not dedicated?
No, how would we without looking at the script?
๐
this is one of the script i am using: ```
deleteMarker "m_AC1";
localThis = laptop_1;
FOBThis = newFOB_1;
("ACE_G_Chemlight_HiGreen_Infinite" createVehicle position localThis) attachTo [localThis,[0,0,0]];
[west, FOBThis] call BIS_fnc_addRespawnPosition;
hint "FOB Alpha is now Available";
fob_1 = true;
things seems to work until fob_1 which was set as Activation for another trigger.
and this:```
_this addEventHandler["Killed",{params["_Victim", "_Killer", "_Intisgator", "_bEffects"];
if (isPlayer _Killer) then {
_Killer say3D "dontDiePlz";
hint format["%1 killed a civilian. The resistance is now Enemy. SHAME", name _killer];
peaceTreatyFail = true;}}]
this one is part of the `Civilian Presence`'s `Code on unit Created`. the `PeaceTreatyFail` works, the rest doesnt..

is fob_1 being set on the same device (host, client, etc.) where the trigger is
because if fob_1 is not a network variable, then it wont be updated on all devices
Oh? What should I do to make it a network var?
Oh looks like thatโs the problem, thanks ^^ imma test it out now
might also want to take a look here if you weren't already aware of how variables work in Arma 3. If you are, then disregard:
https://community.bistudio.com/wiki/Variables
Yea, it fixed most of the problems with the variables related. Thanks a lot
Is there some sort of a isMinized or isInBackground command to detect if Arma has been ALT+TABed out of?
subtract 0.5? ๐
or maybe find a way to make sure it only runs once, player setVariable ["lastTimeRan",System.currentMillis], if (getVar.. > 1 second passed) abort
OR:
subtract -1 in first run, subtract 2 in second run ๐
Tried 0.5 but didn't work. Either way I found out the problem, it was executed twice, once from my custom CfgRespawnTemplates and once from the mission (because it was named onPlayerKilled.sqf)
Hello, I would like to ask for help.
How to add(assign) already existing task to a player? (JIP)
Task is created by BIS_fnc_taskCreate
Reason: Lobby slots are for west. On the mission start (init.sqf) players side changes to independent. Therefor task is not shown for JIP players. I have to assign the task by script after player side is changed.
can i make cutRsc not fade?
the resource has duration = 9999999; in description.ext
but cutRsc ignores this
and fades out the rsc in about 5 seconds
it doesn't. it should work fine
hold on
here is the whole resource config
wait... is this #arma3_config ?
i'm posting this there
How do I increimentally add lines to a parse text? Something like
_textStringArr = ["<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>"];
_textStringArr append ["<br/>"];
_textStringArr append ["<t size='%1'><t size='1' align='left' valign='middle'>A Name</t> </t>"];
hintSilent parseText str _textStringArr;```
You mean: how to join strings together?
well I sort of know how to do that, just not in structured form
_textStringArr = ["<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>"];
_textStringArr pushBack ["<br/><t size='%1'><t size='1' align='left' valign='middle'>A Name</t></t>"];
_textStringArr pushBack ["<br/><t size='%1'><t size='1' align='right' valign='middle'>A Score</t></t>"];
_textStringArr joinString "";
hintSilent parseText str _textStringArr;
ยฏ_(ใ)_/ยฏ ?
_textStringArr = "<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>";
_textStringArr + "<br/><t size='%1'><t size='1' align='left' valign='middle'>A Name</t> </t>";
_textStringArr + "";
hintSilent parseText _textStringArr;
nah that just shows the top line
it's because the code above doesn't reassign the result of the +
ah right it should be
_textStringArr = "<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>";
_textStringArr = _textStringArr + "<br/><t size='%1'><t size='1' align='left' valign='middle'>A Name</t> </t>";
_textStringArr = _textStringArr + "";
_textStringArr = "<t size='%1'><t size='1' align='center' valign='middle'>------ Chickens Killed ------</t> </t>";
{
_textStringArr = _textStringArr + format ["<br/><t size='%1'><t size='1' align='left' valign='middle'>%1</t></t>", name _x];
_textStringArr = _textStringArr + format ["<t size='%1'><t size='1' align='right' valign='middle'>%1</t></t>", _x getVariable ["score",0]];
_textStringArr = _textStringArr + "";
} forEach (units (group player));
hintSilent parseText _textStringArr;
there we go
you could put everything into a single format, instead of doing that + mess
it looks better in my iDE
I'm trying to teleport an object a random distance within a 10 meter radius from it's position. How do I do that?
obj setPos (getPos obj vectorAdd [random 10, random 10, 0]); maybe this?
obj setPos (obj getPos [random 10, random 360])
https://community.bistudio.com/wiki/getPos alt syntax 2
Hey sharp, how would I sort my array based on _x getVariable ["score",0]]
I'm looking at BIS_fnc_sortBy
there is also bis function for it
ye that one
not sure which one is better in perf
my arrays are globs of structured text so how can I extract the actual value of the indexes?
_textStringArr = [_textStringArr, [], {_x select 1}, "DESCEND"] call BIS_fnc_sortBy;
you mean extracting score value from those strings?
yes
best thing would be if you kept score and the string
extracting it will be expensive
e.g [["the string", 5], ["another string", 4]], then you can easily get the score at index 1
right, but how do I do that with the parseText?
hmm? getting the full string out of it for parseText?
Hi. Quick question: Where can I find a list of all (or most) names of entities, or commands, or statements, or anything that can help me put a script together?
Instead of sorting I think I need to change the order of the array adding
look up pinned messages
Much appreciated.
@agile pumice looking at your code above, you should use https://community.bistudio.com/wiki/apply, https://community.bistudio.com/wiki/sort
then something like joinString, and pass it to parseText
is there a way to make a unit class with a certain camo?
private _textStringArr = units player apply {
private _score = _x getVariable ["score", 0];
[_score, format ["<t size='1' align='left' valign='middle'>%1</t><t size='1' align='right' valign='middle'>%2</t>", name _x, _score]]
};
_textStringArr sort false;
hintSilent parseText ("<t size='1' align='center' valign='middle'>------ Chickens Killed ------</t><br/>" + (_textStringArr apply {_x select 1} joinString "<br/>"));
something like that, will display in descending way (untested) @agile pumice
yes
(you're welcome)
oh and i dont want this
_veh = createVehicle ["Tomahawk_Red_IND",position player,[],0,"NONE"];
[
_veh,
["woodland",1],
["showCamonetHull",0,"showBags",0]
] call BIS_fnc_initVehicle;
ily, thank u xd
i want to somehow have, like, uh idk what u call that but like "Tomahawk_Red_IND" but like, its own......like "Tomahawk_Wood_IND" idk
ah for that you would need to create a mod
writes down: please stop making things harder for yourself you big dummy
hey! don't be so hard on yourself!
could i uhm...edit the existing mod
you're not that big
akjfgagh
negative for non-personal usage, but you could suggest a change to the author though ๐
you can absolutely do whatever you like for you personal usage ๐ so you could even make the change and offer the file to the original author for him to upload ๐
hm, now to just figure out how to do it!
Main Question
Hello, how do i make all of the animations in below list play in order, and not skip to final animation, which only plays for a second?
(My first thought was include sleep 3; after the comma of each line)
Side question:
Does formatting my code like this (new line for each animation) good working practice? or does it prevent code from working?
IF (script = true) THEN {[] spawn {
sleep 1;
{caw1dc1 switchmove _x } forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out'
]
};
if you want to sleep between the animations, add sleep x; after the switchMove inside the forEach, x being the amount of seconds you want to sleep for
IF (script == true) THEN {[] spawn { <<<< howcome this wont work lel? (amended: 'IF (script == true) THEN {chat here};')

you're missing a }
but then, what is that script = true?
pls don't tell me you were trying to do script == true
I blame you @winter rose ๐คฃ (or whoever it was that wrote the channel description)
script == true == true == true == true is same as just script
so, e.g;
{caw1dc1 switchmove _x } forEach, sleep 3;
['Acts_JetsShooterIdle', 'Acts_JetsShooterIdleMoveaway_in'];
?
nope
{
caw1dc1 switchMove _x;
sleep 3;
} forEach [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in'
];
ah, right, i see, the ; is for new commands like and , is for strings of command to work in connection, or something like that?
; and , is essentially the same thing, seperator, "end statement"
not the same thing 
even as end statements they may behave differently
ok but for the most part, they can be used in the same way, it's just that almost everyone uses semi colon hint "hi", hint "hi2"
Written something here but cant see *the error;
caw1dc1 switchMove _x;
sleep 3;
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};
?
[] spawn
{
sleep 1;
{caw1dc1 switchmove _x }
sleep 3;
}
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};
To me that looks like it will work kek
look at the example i sent you previously, also you have a , after the last element in the array, shouldn't be there
(Trying to format the code like this so its alot easier on the eye to take in info)
use
```sqf
<my code>
```
and indent your code properly, not only it's easier to spot mistakes, it's also much easier to read the code
sorry, what do you mean by indent?
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
it wont send when i press enter only carriy returns?
Without Indent
[] spawn
{
sleep 1;
{caw1dc1 switchmove _x }
sleep 3;
}
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};
With Indent
[] spawn
{
sleep 1;
{caw1dc1 switchmove _x }
sleep 3;
}
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};
You have to end the code with ```
you can instantly see that your curly braces are messed up
[] spawn
{
sleep 1;
{caw1dc1 switchmove _x }
sleep 3;
}
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};
hint "BRUH, where am i, what world am i in lol;
๐ฅณ
Hey, I was working on a banking system for my server.
I was bug fixing for the past few hours, and the way I was calling my function worked every time. It started ALMOST working, and I added a few diag_log's to check what my variables were, obviously.
After doing this, its not even executing on the server side. As none of the diag_log's are outputting anything, and there are no errors in my RPT.
I'm executing using this:
[player] remoteExec ['Server_fnc_getBanking',2];
And I'm executing this code:
private ["_player", "_fetch", "_banking"];
_player = _this select 0;
_fetch = ["getBanking", 2] call ExternalS_fnc_ExtDBasync;
_fetch = call compile str(_fetch);
_banking = [];
_uid = getPlayerUID _player;
{
diag_log format["Checking bank account %1", str _x];
if (getPlayerUID _player IN (_x select 1)) then {
diag_log "player is apart of epic bank account";
_banking pushBack _x;
};
} forEach _fetch;
diag_log str _banking;
[_banking, "BANK"] remoteExec ["client_fnc_openFinancials", _player];
If any can help me out it would b very useful, as I'm currently bashing my head off the keyboard. hehe
No errors in client or server rpt as well.
@cold mica @copper raven my bad guys, i remember what indent is now, thanks for bearing with
@opal sand this might work, lol not 100% sure
[caw1dc1] spawn {
private _person = _this select 0;
private _anims = [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out'
];
{
uiSleep 1;
_person switchMove _x;
uiSleep 3;
} forEach _anims;
};
diag_log variables see if they hold what you expect them to
I have, the issue is that it isn't executing the code at all anymore, no errors are thrown either.
The rest of the server mod is working though, as I'm able to login and such
well then the error is elsewhere
Weird, Ill take a longer look, I have 0 errors in my RPT, on client on server, and it was working before I put in diag_log's.
Not sure why doing that would cause other issues to pop up, thanks though.
What is _fetch after ["getBanking", 2] call ExternalS_fnc_ExtDBasync?
it doesn't even run that line from what i understand
@vapid wadi yes that code works thankyou sir
No problem,
I had a diag_log at the top of the code and it didn't even execute, but _fetch is just an array
what is the significance of the animations ending in _m?
?
I don't work with animations often, that would be a question for someone else sorry haha
You try to call compile a stringified array?
https://community.bistudio.com/wiki/AnimationTitles maybe you can find an answer there
Is that incorrect? I took quite a break from Arma, been coding in lua for the past 4-5 months. So I'm pretty rusty. But it is an array that has been stringified.
I had a diag_log at the top of the code and it didn't even execute, but _fetch is just an array
there is no point in trying to narrow down the issue in that function if it doesn't even get called
your remoteExec doesn't run, look there
this will be good for my new animations naming index, thankyou, as for my question actual, i believe _m just means movement, but there is now a new follow up question;
if writing a series of animations to play in succession (as previous chat), do you include the;
- _in
- _loop
- _out
animations, aswell as;
-_m?
Okay, I tried to manually call it from the debug console, and from my interaction menu, which works with every other interaction. And still nothing, any idea of how I could try and call it in a different way?
i'm not good at animations, so can't answer that, ask in #arma3_animation maybe
private _a = [1, 2, 3];
_a = str _a; //"[1, 2, 3]"
_a = compile _a; //{[1, 2, 3]}
_a = call _a; //[1, 2, 3]
```Pretty sure that it just goes full circle like this.
Yeah, I wasn't sure if It was an array or not. I have no way of seeing if its not being called currently :/
If you're not even getting output from the very first line of the function, you might want to ensure the function actually exists (under the name you are calling).
Its in my CfgFunctions under a class where every other function in it works...
Does the Functions Viewer display the source code?
im kinda pissed rn, sorry for wasting everyone's time. I just found an error at the top of my rpt.
Missed a colon...
Thanks for all of the help though guys.
You scrpting guys must have steam coming out of your ears quite often id imagine, when you miss a very small detail lol, very infuriating lol
for sure, 90% of my time is debugging.
I got another quick question. when I retrieve my array from the database. Everything that is a string returns with ""TEXT HERE"" wrappers, what causes that?
iirc there is an extDB setting for that
well, im looking into the rest of my db, and all of the other array's are the same as mine, so im going to check how the function that retrieves those handles it
Two questions;
- One; ive never seen that 'privateperson' code before? thats like mad level coding?
- Where should i go to learn coding (coding biased for this game) more? apart from just learning as i go? how long would it take to learn this game coding on a casual/part time basis?
I appreciate your guys help, but out of courtesy, will try to attempt to solve errors on my own first where possible, before asking for help*
It should be params lul
How do i improve the animation interpolation? right now it just chops through to next animation
IIRC, it might be wrong, there is an interpolate to code, does this even exist? or help? help? please? pops green flare
[caw1dc1] spawn {
private _person = _this select 0;
private _anims = [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in', 'Acts_JetsShooterIdleMoveaway_loop',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in', 'Acts_JetsShooterShootingLaunch_loop',
'Acts_JetsShooterShootingLaunch_out'
];
{
uiSleep 1;
_person switchMove _x;
} forEach _anims;
};
hint "This is the code im working with";
I could use a hand here, any help is appreciated.
while {true} do //Infinite loop
{
[/*Help?*/, nil, true] spawn BIS_fnc_moduleLightning //Should spawn a Zeus Lightning Bolt
sleep ((random 10) + 10); //Adds random delay, between 0 and 10 seconds
}```Objective: Make a Zeus Lightning Bolt (Not just ambient weather, but one that can kill!) spawn randomly on the map, every 10~20 seconds.
Problem: `spawn` demands an object to create a Zeus bolt, and not co-ordinates.
Situation: I was instructed to first spawn an invisible object, randomly on the map, then use said object to spawn the bolt, then despawn the object.
Question: What object can I use? And how do I spawn it? And how do I **de**spawn it after?
Question 2: I was also told that an infinite loop only executes like 10,000 times only, is that true? How do I avoid that?
Thanks in advance.
Note: I should've clarified, this is my very first script ever. I have the SQF coding skills of a newborn.
there is no interpolation code. Interpolation and/or connection is handled by the engine as defined in the animation config.
the reason it looks choppy is because you're using switchMove. switchMove jumps to the first frame of the animation you're specifying. It skips the interpolations and connections
I believe it takes a lightning module
you have to create a group in sideLogic
create the module in that group using createUnit
to delete it, simply use: deleteVehicle
also does any docs say it should be spawned?
when using switchCamera and moving from gunner view to external view, sometimes the gunner view audio doesnt go away and stays on an endless loop
The wiki page for BIS_fnc_moduleLightning says the syntax for it is [target, nil, activate] call BIS_fnc_moduleLightning and the call used in both examples is spawn. :/
Like I said, I have the scripting skills of a newborn. Obviously, most of my code is unnecessary, unsanitary, and a bunch of un-things.
I'm in a game rn so I can't help. hopefully some other guys will come along to help
that function needs to be spawned, it's ok to call it if you're doing so from scheduled environment
I was also told that an infinite loop only executes like 10,000 times only, is that true? How do I avoid that?
only in unscheduled
for the logic part, you just need to create a curator logic, and pass it to the script
Sounds great... except I don't know what's the meaning of (un)scheduled... ๐ฌ ||please don't hate me, we all gotta start somewhere lol||
By all means, enjoy your game. Would you kindly DM me at your earliest convenience afterwards? I'm not sure I know how to put your answer into use xD
Thankyou for that informative description, helped me understand current situation alot, but, what do i now need to do to get what im looking for, please?
switchMove is immediate, playMove uses transition animations
but some animations do not have transition and have to look "abrupt"
So... the way I understand it... my method technically isn't wrong? It could work?
correct
you could create an invisible object (e.g invisible helipad), use that object, then delete it
or keep it and move it when needed, of course
Can you give me an example line that can spawn it?
if the animation cannot be played with playMove (doesn't have enough connections/interpolations to get there) you'll have to switchMove to the first animation in the sequence
but use playmovenow for the rest
doesn't it need a module?
actually nvm
it's intended to be used with a module, but people use it without it from what i've seen
yeah it can be used without
ok, so, building off leopard20's comment and yours, i changed switchmove to playmove, but no animations played? please advise?
_obj = createVehicle ["Land_Invisible_Helipad", [0,0,0]];
while {true} do //Infinite loop
{
_obj setPos [random worldSize, random worldSize, 0];
[_obj , nil, true] spawn BIS_fnc_moduleLightning //Should spawn a Zeus Lightning Bolt
sleep ((random 10) + 10); //Adds random delay, between 0 and 10 seconds
}
I'm not sure about the classname
check it in the game
Not sure where to go from here, see below please;
[caw1dc1] spawn {
private _person = _this select 0;
private _anims = [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_loop',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_loop',
'Acts_JetsShooterShootingLaunch_out'
];
{
uiSleep 1;
_person switchmove _x;
} forEach _anims;
};
hint "replacing switchmove with playmove or playmovenow doesnt work?";
[caw1dc1] spawn {
private _person = _this select 0;
private _anims = [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in', 'Acts_JetsShooterIdleMoveaway_loop',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in', 'Acts_JetsShooterShootingLaunch_loop',
'Acts_JetsShooterShootingLaunch_out'
];
_person switchMove _anims#0;
{
_person playMove _x;
sleep 1;
} forEach _anims;
};
but I don't recommend doing it that way
it'll probably never work
@winter rose @little raptor letssss gooooooo 90% there, just seen some mad connection, of the deck crew pointing at the pilots and doing backflips n stuff ๐
because of AI interference
hey, leopard, lou, see the unit name as above? [caw1dc1], can i make the same code play on more than one unit? like this;
[caw1dc1, caw1dc2] spawn {
private _person = _this select 0;
private _anims = [
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_loop',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_loop',
'Acts_JetsShooterShootingLaunch_out'
];
_person switchMove _anims#0;
{
_person playMove _x;
sleep 1;
} forEach _anims;
};
hint "Does this work? >> [caw1dc1, caw1dc2] ??";
forEach
but like I said don't use that code
howcome? should i resort to something like we used earlier?
[] spawn
{
sleep 1;
{caw1dc1 switchmove _x }
sleep 3;
}
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out',
]
};
hint "more like this?";
ok, im completely new to eventhandlers, my knowledge goes as far as knowing the word, more or less, please let me know ๐
Much appreciated, I'll see what I can do
an event handler, as the name suggests, executes the code only when an event takes place.
it doesn't use a loop. so it is more efficient. plus, since it is unscheduled, the code will execute exactly when that event takes place.
For example, this is how the Fired event handler works:
you add an event handler to player with some code
player presses mouse button
the engine processes everything necessary to fire a bullet (such as creating the bullet object, muzzle flash, etc.)
it then sees you have a Fired event handler added to the unit and will execute it
as I said, that's not the actual classname of an invisible helipad.
you'll have to check in the game (configViewer)
also, I don't think you need to delete the object, so I didn't add it
Yup, I see. Much appreciated!
This is me trying to take some initiative to solve, using your advice/guidance;
(Source: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers (https://imgur.com/EUGAN3r))
this addEventHandler ["AnimDone", {
params ["caw1dc1", "'Acts_JetsShooterIdle'"];
}];
this addEventHandler ["AnimStateChanged", {
params ["caw1dc1", "Acts_JetsShooterIdleMoveaway_in"];
}];
hint "something like this? or even in right direction?";
i am trying to see how bad it is if i allow grass up to 1k. but the following functions are not helping me do that.
setTerrainGrid, setDetailMapBlendPars, setViewDistance, setObjectViewDistance
Does anyone know what settings enable me to allow grass up to 1k?
is there a way to add script to "hide terrain objects" so it'll show a specific set of objects? like, tell it to hide all building1s but ignore building2s?
@idle sierra there is an example here to do that just add black list types. or add in an if statment if not your house type in the for each
https://community.bistudio.com/wiki/nearestTerrainObjects
You need a mod to change the grass rendering distance. ClutterDistance in the cfgWorld config iirc
@split coral thx mate
this addEventHandler ["AnimChanged", {
params ["caw1dc1", "Acts_JetsShooterIdle"];
}];
this addEventHandler ["AnimDone", {
params ["caw1dc1", "Acts_JetsShooterIdle"];
}];
hint "Yes good?";
no
do you see how my brain sees it though? lol
the params is a way of naming the arguments provided to the EH by the engine; so _privateVars are required
mySuperUnit addEventHandler ["AnimChanged", {
params ["_theReferencedUnit", "_theNewAnimationName"];
hint _theNewAnimationName;
}];
oh my goodness, can this be done inside the triggers on act?
I don't know what you are talking about, but let'sโฆ reset back to what you want to do.
Alright, hate me if you will, but umm... say I finished my script and it 'should work'... how do I load it in my mission? xD
Resetting; basically im looking at how to how smooth animation transitions for video pieces
Referring to above message
(PREVIOUS) (1/2)
[] spawn
{
sleep 1;
{caw1dc1 switchmove _x }
sleep 3;
}
forEach
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out'
]
};
new code proposal (including Lou Montana guidance notes);
this addEventHandler ["AnimChanged", {
params ["caw1dc1", "Acts_JetsShooterIdleMoveaway_in"];
}];
this addEventHandler ["AnimDone", {
params ["caw1dc1", "Acts_JetsShooterIdle"];
}];
hint "so i wasnt far off then?;
read what https://community.bistudio.com/wiki/params does
[1, 2, 3] call {
//_this = [1, 2, 3];
params ["_one", "_two", "_three"];
}
is same as
[1, 2, 3] call {
//_this = [1, 2, 3];
private _one = _this select 0;
private _two = _this select 1;
private _three = _this select 2;
}
instead of you providing arguments, in the eventhandler engine passes you some arguments (depending on event handler), you can look them up on wiki
You got a script file?
Well, it's currently saved as a .txt ๐ ๐
is this in regards to my subject? as no reply, not quite sure
yes
for example with this EH you're provided a unit that triggered the new animation, and the animation that the unit started params ["_unit", "_anim"];
Read https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting#Basics to learn how to get a script file going.
(like Lou explained here #arma3_scripting message)
Thanks ๐
Because I have not gotten around to writing the section about file locations (and because this probably answers your next question): You need to place the script file(s) in the mission root folder (that's a folder called MyMissionName.Altis for example). You can find the mission root folder in your Arma profile directory (most likely located at Documents\Arma 3 - Other Profiles\NiceGuyKc) (the missions and mpmissions subfolders) or you can open your mission in the Editor, then go to Scenario > Open Scenario Folder in the top left.
@opal sand ```sqf
_anims = [...]; //array of anims to be played
{
_unitAnims = +_anims; //get a copy of this array, since it'll be modified using deleteAt
_x setVariable ["anim_queue", _unitAnims]; //add a new variable to the unit, called "anim_queue", which hold the animation list
_x addEventHandler ["AnimDone", {
params ["_unit", "_anim"];
_anims = _unit getVariable ["anim_queue", []]; //get the variable, default to [] if it doesn't exist
if (count _anims == 0) exitWith { //done, delete the event handler
_unit removeEventHandler ["AnimDone", _thisEventHandler]
};
_unit playMoveNow _anims#0; //play the first anim from the list
_anims deleteAt 0; //delete the first anim from the list
}];
_x switchMove _anims#0; //play the first anim from the list; needs switchMove to jump to the first frame
_x playMoveNow _anims#0; //need a playMove after switchMove for the AnimDone event handler to trigger
_unitAnims deleteAt 0; //delete the first anim from the list
} forEach [_unit1, _unit2, ...]
@winter rose @copper raven im losing track, Lets reset again...
Target: playing several animations through one trigger (in on act), lost from here
so many additional variables has got my mind boggled;
_privateVars
params
addeventhandler
I just want to play several animations through one trigger, but lack of knowledge means its too hard to fix on my own
this addEventHandler ["AnimChanged", {
params ["caw1dc1", "Acts_JetsShooterIdleMoveaway_in"];
}];
this addEventHandler ["AnimDone", {
params ["caw1dc1", "Acts_JetsShooterIdle"];
}];
read again what i wrote
all you need is in the code I wrote
for descriptions re-read the previous comments
where is this code sorry?
literally one post before yours 
think its going to take me a while to get my head around all of that, will all of the coding aspects make sense once the beforementioned is understood?
didnt notice this message had passed me, my bad
Read the documentation about commands you are not familiar with to be enlightened ๐
ok think this makes sense, i just replace the _words with the necessary unit names/anim names, job done? reading that script now does make alot of sense
missing semi colon in there
yep saw it
I added some comments + fixed a missing ;
best I can do is half a fart
@little raptor
How does this look? Hopefully its not a
or a
๐ (included the +)
_anims =
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out'];
{
_unitAnims = +_anims;
_x setVariable ["anim_queue", _unitAnims];
_x addEventHandler ['AnimDone', {
params ["cac1d1", 'Acts_JetsShooterIdle'];
_anims = _unit getVariable ["anim_queue", []];
if (count _anims == 5) exitWith {
_unit removeEventHandler ["AnimDone", _thisEventHandler]
};
_unit playMoveNow _anims#2;
_anims deleteAt 1;
}];
_x switchMove _anims#2;
_x playMoveNow _anims#1;
_unitAnims deleteAt 1;
} forEach [cac1d1, cac1d1, cac1d1]
hint "good!";
why did you remove the +?
and why did you change the indices?
they all should be 0
so it's a 
count _anims == 5?
5 anims in the list ๐
all you had to do was put the animation list and unit names
everything else was ok
i was trying really hard to not just accept your script but understand it also
making your helping me more worthwhile, but i guess i overanalysed
Questions:
- _unit = do i leave this blank because theyre mentioned at forEach [1,2,3]?
-_animqueue = leave this as this calls stored anim list?
_anims =
[
'Acts_JetsShooterIdle',
'Acts_JetsShooterIdleMoveaway_in',
'Acts_JetsShooterIdleMoveaway_out',
'Acts_JetsShooterShootingLaunch_in',
'Acts_JetsShooterShootingLaunch_out']; //array of anims to be played
{
_unitAnims = +_anims; //get a copy of this array, since it'll be modified using deleteAt
_x setVariable ["anim_queue", _unitAnims]; //add a new variable to the unit, called "anim_queue", which hold the animation list
_x addEventHandler ["AnimDone", {
params ["_unit", "_anim"];
_anims = _unit getVariable ["anim_queue", []]; //get the variable, default to [] if it doesn't exist
if (count _anims == 0) exitWith { //done, delete the event handler
_unit removeEventHandler ["AnimDone", _thisEventHandler]
};
_unit playMoveNow _anims#0; //play the first anim from the list
_anims deleteAt 0; //delete the first anim from the list
}];
_x switchMove _anims#0; //play the first anim from the list; needs switchMove to jump to the first frame
_x playMoveNow _anims#0; //need a playMove after switchMove for the AnimDone event handler to trigger
_unitAnims deleteAt 0; //delete the first anim from the list
} forEach [cac1d1]
that's it
also cac1d1 is duplicated
bruh, thats so good, so, to help me get my head around this, its all generic calls for code built into game, which are connected together via engine, and makes it possible to crunch through loads of code through some simple call lines of code like above?
not connected together via "engine"
the engine simply executes my code. it's up to me how I program it
there's no "magic"
just carefully constructed system
just had to shout 'haha woooooooooooooooooooooo' we did it!!!!!! task#1 and only task done today ๐ but happy, this is such an amazing piece of code and will be very productive in my workflow, thankyou @little raptor sir!
(and honorable mentions to @copper raven @winter rose @cold mica @willow hound giving love to all)
I'm trying to use addMissionEventHandler ["EntityKilled", { inside an initServer.sqf but it the eventhandler only seems to work in the editor and not on dedicated
and what is the code?
its kind of a goofy mission
I suppose so, prepare the Holy Hand Grenade ^^
but yeah it should work as far as I can see
I'm using this for the loading image lol https://twitter.com/S20UL/status/1278577906105683968/photo/1
[_text] remoteExec ["BIS_fnc_dynamicText"];
gives me error
Performance warning: SimpleSerialization::Write 'params' is using type of ',TEXT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
any idea for alternative ?
maybe
[_text, "BIS_fnc_dynamicText"] remoteExec ["call"];
?
parse the text on the client system
hmm, I am calling that from server and send to clients
it doesn't matter
the text (structured text) must be composed on the client's system
you shouldn't send them over the network
@real tartan example:
instead of _text = parseText "blabla"; [_text] remoteExec ["BIS_fnc_dynamicText"];
you should use:
["blabla", {[parseText _this] call BIS_fnc_dynamicText;}] remoteExec ["call"];
@little raptor your such a good guy dude, helping everyone out so consistently, even if you helped me or not, i want to let you know i see you, and appreciate what you do my guy ๐ช โ๏ธ (theres probably many others, @copper raven @winter rose been my guy since day one, @cold mica @willow hound)youre all Kings
tell us something we don't know ๐
joke aside, you're welcome ๐
is it impossible to do setVelocity on ambientLife units?
(findDisplay 46) displayAddEventHandler ["KeyUp", {
params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
if (_key == 47) then {
_vel = velocity player;
_dir = getdir player;
player setvelocity [(_vel select 0) + 1 * (sin _dir),(_vel select 1) + 1 * (cos _dir),(_vel select 2) + 5];
playSound3D [selectRandom[getMissionPath "bounce1.ogg", getMissionPath "bounce2.ogg"], player, false, getPosASL player, 5, 1, 50]
};
false
}];
``` works on players, not rabbits
maybe not if they touch the ground
any proposed solutions?
lift them by 10cm before throwing them
with just a simple setposatl?
yup
hurray, its working
(findDisplay 46) displayAddEventHandler ["KeyUp", {
params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
if (_key == 47) then {
_vel = velocity player;
_dir = getDir player;
player setPosATL ((getPosATL player) vectorAdd [0, 0, 1]);
player setVelocity [(_vel select 0) + 1 * (sin _dir),(_vel select 1) + 1 * (cos _dir),(_vel select 2) + 1];
playSound3D [selectRandom[getMissionPath "bounce1.ogg", getMissionPath "bounce2.ogg"], player, false, getPosASL player, 5, 1, 50]
};
false
}];
this is hilarious
Also about my mission eventhandler, I don't think its triggering any script errors on the server
I checked the rpt
Also, I think I'm having server performance issues. I'm running this on the server:
initServer.sqf
gameTimeLeft = 1200; // 20 mins * 60 seconds
publicVariable "gameTime";
while {true} do {
if (gameTimeLeft == 0) exitwith {"timeUp" call BIS_fnc_endMissionServers};
gameTimeLeft = gameTimeLeft - 1;
publicVariable "gameTime";
sleep 1;
};```
and this on the clients:
fn_ScoreBoard (cfgFunctions defined)
while {true} do {
private _textStringArr = units group player apply {
private _score = _x getVariable ["score", 0];
[_score, format ["<t size='1' align='left' valign='middle'>%1</t><t size='1' align='right' valign='middle'>%2</t>", name _x, _score]]
};
_textStringArr sort false;
hintSilent parseText (
"<t size='1' align='center' valign='middle'>------ Rabbits Killed ------</t><br/>" +
format ["<t size='1' align='center' valign='middle'>------ Time Remaining: %1 ------</t><br/><br/>", [gameTimeLeft, "MM:SS"] call BIS_fnc_secondsToString] +
(_textStringArr apply {_x select 1} joinString "<br/>")
);
sleep 1;
};```
but the timer decreases every 4-5 seconds instead of 1. I'm testing in the editor
So I'm struggling a bit here.
I want to add a players name to a dairytask. But I can't seem to get the game to reconize that I'm trying to call a variable instead of just a text. Like is there a certain format within the string text I can use to make it understand to look for that?
use format
or one of its sister-commands
oooh, thank you! ๐
what's the practical difference between:
https://community.bistudio.com/wiki/disableAI / https://community.bistudio.com/wiki/enableAI
and
https://community.bistudio.com/wiki/enableAIFeature
is it just to have them both in one command?
Also interestingly, gameTimeLeft isn't sent from the server to the clients on my dedicated server either
gameTimeLeft shows as 00:00
Which would help explain why the missionEventHandler isn't doing anything either
disableAI
Disables an AI feature
enableAI
Enables an AI feature that was disabled by disableAI
enableAIfeature
Let's you either enable or disable an AI feature
"Also interestingly, gameTimeLeft isn't sent from the server to the clients on my dedicated server either"
You'd think so since youre sharing gameTime and not gameTimeLeft
publicVariable "gameTime";
you'd want to do publicVariable "gameTimeLeft";
what is the best way to store value for each player from array?
Let's say I have PlayerArray and inside I have Player1 and Player2
What's the best way to add 1 + 2 to Player1 and 2 + 3 to player 2?
so when I fetch the values are Player1[1,2] and Player2[2,3]?
I, huh, what ?
well basically, I'm adding a player to an array right
then another player is added to the same array
so I have player1, player2 array
so how would I go about giving values to each of them?
how about an array where each element is also an array:
[[player1, player1value1, player1value2], [player2, player2value1, player2value2]]
or, you could use setVariable on the player objects. What the 'best' way is may be determined by how you plan to use the information.
@dusty whale I renamed the var and forgot to rename all instances of it
So with this:
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
}];```
Is _killer and _instigator usually the same object? Why bother having both?
I guess if you shoot from a vehicle, the vehicle is the killer, and the gunner is the instigator
hmmm okay
So everything works, its just that the server is performing so terribly that the effect is very delayed
I was spawning a bunch of rabbits (800) in a 4km radius so maybe that was the reason
I'm going to try adding a cfgWorlds to my description.ext instead and see if I can get a result I like
class CfgWorlds
{
class Malden
{
class AmbientA3
{
maxCost = 500;
class Radius440_500
{
areaSpawnRadius = 440.0;
areaMaxRadius = 500.0;
spawnCircleRadius = 30.0;
spawnInterval = 4.7;
class Species
{
class Rabbit_F
{
maxCircleCount = (200 * (0.1 - houses)) * (1 - sea); //20 * 10
maxWorldCount = 40; // 4 * 10
cost = 5;
spawnCount = 10; // 1 * 10
groupSpawnRadius = 10;
maxAlt = 600;
minAlt = 0;
};
};
};
};
};
};
You cannot edit CfgWorld through mission config. Only exception is
class CfgWorlds
{
class Any // or specific world name
{
author = "author";
description = "description";
pictureMap = "picturepath";
pictureShot = "picturepath";
loadingTexts[] = {"text1", "text2", "text3"};
};
};
oooh, 'tis neu and shiny
So guys I need a second opinion.
I want to subtract an array of strings (hashmap keys, let's call it _arr1) from a second array of strings (_arr2)
_arr2 can potentially have thousands of elements.
Which one do you think is faster?
- using
pushBackto fill _arr2 - using
pushBackUniqueto fill _arr2 - using
setto fill a hashmap, and later usingkeysto get_arr2
I'm more inclined towards 1 and 3. set is nearly ~2x slower than pushback. but it also avoids duplicate elements, which can potentially make the subtraction faster.
you can use insert to insert lots of elements at once
also, if you need more context, this is for my Debug Console mod's dictionary
instead of calling set multiple times
I want to delete stale keys
I'd say the one that uses the least amount of sqf commands
but how about _result = _arr1 - _arr2
?
array insert also has a "only unique" option
like pushBackUnique in bulk
what do you mean how?
I thought you have _arr2 already?
I have _arr1
how do you want to subtract something from something you don't have
where does _arr2 come from
your question starts about subtracting array elements.
But then you only ask about filling an array, not subtracting/filtering
stop defining things twice
class Radius440_500: Radius440_500 no
class Malden: Malden malden doesn't inherit from malden
you need to use the same inheritance, as the class you are modifying
that means if Malden inherits from Altis, you need to also inherit from altis
This should have gone in config editors sorry
yes
well it's complicated
I don't know how to explain it
but simply put, I have an array (_arr1) containing old + current dictionary keys
and a second array called _arr2 that contains only current dictionary keys
_arr2 is built by going thru every word in the debug console. so it can have many duplicates if I use pushBack
the question is about getting the best performance out of a combined process of filling an array (_arr2) and subtracting two arrays (_arr1 - _arr2, which can be affected by duplicate elements).
yes to delete them
_oldKeys = _arr1 - _arr2

I know
but I mean how to fill _arr2 to make it faster?
using hashmap?
or pushBack?
or pushBackUnique?
the bigger _arr2 , the slower the subtraction
but also hashmap set is slower
but isn't the filling method always the same? "_arr2 is built by going thru every word in the debug console"
probably pushBack, and then arrayIntersect to remove duplicates
everything else is slower too
You are asking if, while going through debug console and all the words.
Instead of collecting all the words and then deleting in bulk.
You want to get rid of the collecting
But you cannot do that.
you can either delete/remove for every word.
or you can collect them all and delete in bulk
the latter would be way faster due to SQF

yes I'm doing the latter
let me explain again
with an example
this is how my mod does the syntax highlighting:
first it uses a hashmap which is constant (used in each document tab, let's say _hm = _tab getVar "hashmap"). this is read on each iteration. now the process:
-
splits the text into lines and goes thru all lines
-
detects if this line existed in the last run
-
if it didn't (new line):
detect all words (goes thru them word by word). usesetto add them to _hm (so they'll be unique). also add these words to_arr2(if array: pushBack, if hashmap set) -
if it did (old line): simply add the words it detected before to
_arr2(if array: append, if hashmap: merge) -
once this is done for all lines:
{
_hm deleteAt _x;
} forEach (keys _hm - _arr2);
this is done everytime it detects that the debug console contents are changed
now the question is whether I should fill _arr2 using hashmaps or arrays
in other words, _arr2 can be either an array, or hashmap
it's a temporary storage
the objective is to make filling _arr2 and later the subtraction faster
"5. once this is done for all lines:"
maybe make a cache for all the lines. And only do it for the lines that actually changed
A line is probably not longer than a hundred words. Which isn't that "huge"
_arr2 as array is probably faster
even if it has hunderds of duplicates?
unless you can do bulk insertions
yes
actually. Gotta change something for hashmap bulk insert.
That you only need to provide keys, and the values just stay nil.
So you can just bulk insert one array of strings as keys
but array insert command also has "only unique" parameter
dozens of pushBackUnique calls bad, dozens of pushBack + 1 single unique insert == better
but isn't array uniques slower than hashmap unique?
deeepends on size
hundreds of elements, probably
but only if you can bulk insert into hashmap
hundreds of set calls are pretty slow
but there is no good hashmap bulk insert currently
not even merge?
merge merges two hashmaps
insert does bulk insert, but only for key-value pairs. but you only have keys and don't care about the values
I can use that too (if I go with hashmap method)
for non-new lines
I don't
it's a temporary storage. I only need the "keys" (or just the elements if array)
Yes as I said. You don't have values, you only have keys
Arma 2.06 gets insert [keys, values]
so you can just give it a big array as keys
and leave all values as nil
btw which one is faster?
arrayIntersect
or hashmap createhashmapFromArray?
or merge?
(just some hashmap method)
they are all different things
for merge, you need a hashmap first.
createHashMapFromArray needs values too, not only keys
you don't care about values, so constructing all the arrays with nil values is a HUGE waste of time
but you'll also get in 2.06 the ability to just pass keys as one array
thousands
for low number the array will be faster
arrayIntersect is O(Nยฒ) (if zero duplicates), every element is compared to every other element.
HashMap insert is O(1) for one element. So in total for inserting many elements its generally O(N) (Average case, can be O(Nยฒ) in worst case)
@still forum anyway, did you say bulk inserting into a hashmap is faster than set?
in other words, is something like this wise or stupid?
_hm = createHashmap;
_arr = [];
{
_arr pushBack [_key, _value];
} forEach _something;
_hm insert _arr;
you are creating arrays (expensive-ish) with values that you never care about
so its pretty wasteful
and very probably worse
2.06 gets some more hashmap goodies that will help in that regard
_hm insert [_arrayOfKeys, []]
btw do you mean 2.04 or actually 2.06?! cuz that's way too far away!
the next one
2.04 then! ๐
ah. My brain
is there a way to use || / or in switch do?
it sounds to me you don't need a switch at all
but you can still try explaining what you want to do
in a nutshell:
..switch bla bla
{
case (varA # 0 isEqualTo varB # 0)
so how would I go and do it so it's like
case (varA # 0 || varA # 1 isEqualTo varB # 0)
}
that's just a normal switch bool case bool
so yes
so it's possible?
yes
I'm probably placing operators wrong aren't I
yeah
switch brah do {
case 0;
case 1: {}; //When 0 or 1
case 2;
case 3;
case 4: {}; //When 2, 3 or 4
};```IIRC
not sure what you mean
case (varA # 0 || varA # 1 isEqualTo varB # 0): {}; is what I wanna do but I'm not doing it right
Hmm...
case ((DATA_PLAYER_DB # 0 || DATA_PLAYER_DB # 1) isEqualTo DATA_TEST # 1): { DATA_PLAYER_DB set [2, "test_x"] };
obviously not working
case (DATA_PLAYER_DB # 0 isEqualTo DATA_TEST # 1 || DATA_PLAYER_DB # 1 isEqualTo DATA_TEST # 1):
Hello guys. I may or may not need some help, I've been scratching my head on this one for a while. So I have a mission where every player gets two personal respawn tickets, and 1 is deducted every time they die. Once they have no personal respawn tickets, they're sent to spectator mode. I've ran into a problem: Although the player's tickets are 0, and the player goes into spectator, their body actually respawns somehow.
Here's my description.ext:
respawn = 3;
respawnOnStart = -1;
respawnDelay = 10;
respawnVehicleDelay = 300;
respawnButton = 1;
respawnTemplates[] = {"Counter"};
respawnDialog = 1;
Here's my initPlayerLocal.sqf:
[player, 2] call BIS_fnc_respawnTickets;
Here's my onPlayerKilled.sqf:
_killer = (_this select 1);
[player, -1] call BIS_fnc_respawnTickets; //Deducts one respawn ticket from player.
[_killer, 1] call BIS_fnc_respawnTickets; //Adds one respawn ticket for player's killer.
_numPlayerTickets = [player,0] call BIS_fnc_respawnTickets; //Checks number of respawn tickets of player.
if (_numPlayerTickets == 0) //If a player's personal tickets have run out, they'll be sent to spectator mode.
then {
["Initialize",[player]] call BIS_fnc_EGSpectator;
};
The question is: How do I disable a player's ability to respawn once they're either in spectator mode or their tickets have ran out?
This is what I meant
https://youtu.be/2EoQQQKCpJA
onPlayerKilled.sqf:
_killer = (_this select 1);
_numPlayerTickets = [player,0] call BIS_fnc_respawnTickets;
if (_numPlayerTickets == 0)then
{
["Initialize",[player]] call BIS_fnc_EGSpectator;
}
else
{
[player, -1] call BIS_fnc_respawnTickets;
};
[_killer, 1] call BIS_fnc_respawnTickets;
~~I think the problem is that the tickets get checked before this script and you check for the number of tickets 1 ticket early. When the player has 1 ticket, it means, he can respawn 1 more time. So I just rearranged the script to account for that. The player can totally have 0 respawn tickets, except he won't get respawned the next time he dies. ~~ Somebody correct me if I'm wrong ๐
EDIT: This assumption is wrong; it's an off by 1 type of bug
i think i found a bug
running vehicle player setAmmo ["autocannon_40mm_CTWS", 0] when inside a marshall will not set the magazine to 0
can someone confirm?
same command works on the slammer just fine
same issue with gorgon
can it be the case of marshall having multiple magazines of same type?
try removing all magazines but one
it does have that, but the magazine count doesnt drop
hopping in the gunner seat and running the command clears this avenue
wait so, you were running the command while not being in gunner seat?
you dont need to be in the gunner seat to run it
look at the examples on the wiki
?
what of them?
it's in a singleplayer mission
all objects are local
nvm, anyways, what i was trying to say is that you need to have the gunner seat manned for it to work
vehicle player setMagazineTurretAmmo ["60Rnd_40mm_GPR_Tracer_Red_shells", 0,[0]]```Works pretty fine
yeah, i'd also use that over setAmmo ^
that's all fine and dandy, but im asking if im the only one having this issue
if not, then i'll make a bug report on the feedback tracker
because the command works on the slammer and the other tanks, but not on the APCs
vehicle player setAmmo ["autocannon_40mm_CTWS", 0]```Just clarify this is the code for sure?
yep
vehicle player selectWeapon ("autocannon_40mm_CTWS"); doesnt work either
selectWeapon doesnt work on the APCs the same way it works on the tanks
And the code works for Slammer?
yep
Sounds like you're doing something wrong... There's no such weapon/magazine/whatever on default Slammer
That's what you should said
Listen here. Troubleshooting does need the exact steps to reproduce, otherwise that's a garbage
i am SPECIFICLY talking about the setAmmo command
and the selectWeapon command
not the classnames
vehicle player setAmmo ["cannon_120mm", 0]
Even though the point was the commands, the exact step is required
here's the command i use for the slammer
that WORKS
there is nothing to talk about in it
the issue is the vehicle player setAmmo ["autocannon_40mm_CTWS", 0] which DOESNT work
Doesn't work on Marshall, right
and the vehicle player setAmmo ["cannon_120mm", 0] works on the slammer
same command
you can also replace the classname with (vehicle player weaponsTurret [0])#0
vehicle player setAmmo [(vehicle player weaponsTurret [0])#0, 0]
that is the exact same command
works on the slammer
doesnt work on the marshall or other APCs
im guessing the command doesn't work on weapons that have more than one muzzle
that would be nice to document
specifically muzzles[] array in the weapon's config
Please detail the what and how indeed, then either ask for a fix on the feedback tracker or ask for doc in #community_wiki (not both)
then i should use selectWeaponTurret instead of selectWeapon since that supports muzzles
and setMagazineTurretAmmo
Okay so...
vehicle player setAmmo ["HE", 0];```Works pretty fine for me on Marshall. So, this actually takes a muzzle not a weapon
ah, here we go ๐
My very best guess is if the currentMuzzle is "this", works fine with the weapon name but if isn't, don't
that's a good find
doc change?
the doc for the command details "weapon"
Should be muzzle I suppose
Looks like it's better to do. Let me do some further test before edit
Thanks POLPOX
So well, I think it's working just the same method with ammo command?
selectWeapon also does take a muzzle
Hello, I'm looking for a way to get a return value with the path calculations tools (calculatePath,EH PathCalculated,
setDestination,setWaypoint "move"). Whether he can plan the route or not. So if the route cannot be planned then an empty array should be returned. The event handler only works if the calculation was successful. I need a solution before whether the way is possible or not. Thanks in advance. P.S. maybe there is also another solution (what I actually don't want is a time solution, wait so long and if nothing happens, no way out)
but removeWeaponTurret doesnt take muzzle
as the name suggests
my GOD
now i have to make amends to the scripts
to take into account that APCs have muzzles
is there a specific trick to get a helicopter to fly on a waypoint?
_onTarget = _helicrew addWaypoint [_destination, 1, 1, "Dropzone / Pickup"];
_onTarget setWaypointType "MOVE";
[_helicrew, 1] setWaypointSpeed "FULL";
[_helicrew, 1] setWaypointCompletionRadius 30;```
is my current implementation. Yet the chopper just hovers 78 meters before the _destination. Instead of max 15m.
the expected result would be that the helo flies very close to the waypoint. Instead of waiting far away
Set the waypoint a bit farther ahead
how do I know if I need to adjust the X or Z axis? I have no defined flight path, the helo could be coming from anywhere
The path calculation actually fails about 10 seconds later (13s according to my tests). So you can't get an instant result from that event handler (which is why it's an event handler and not a command)
Yes i wrote it the the Eventhandler is no option, so the time is everytime 13 s or is it how far is the distance?
Use a waypoint a couple of hundreds of meters before the actual position
The second waypoint has to be dynamically calculated when the first waypoint is complete (in its waypoint completion statement)
Based on my tests yes, 13s. (At least on my system)
okay and there is no other solution?
But surely the AI โโhas to be told somewhere that it doesn't work? Where is this return value? or is it hidden in the FSM?
The return value is what the event handler gives. If you want to know the result beforehand, you can run a path generation on an agent. Add a variable to the agent for the "owner" (who you're running the path gen for).
Then add a path calculated event handler to the agent and give it a destination.
When you get a result, read the "owner" and do whatever you want there (e.g if it was moving tell it to stop and go some other way)
Sadly there is no good solution
Okay, thanks for the quick answers and the good explanation. Have a good time
Does anybody remember an article possibly in armaholic that explained how to increase grenade blast damage by randomly spawning "invisible" crates (server side only) triggered by explosion? It had a proof of concept piece of code showing how it would also fell trees in the blast radius too. I can't find it anywhere now I am looking for it. Or if anybody could point me at something similar it would be very appreciated ๐
Or did I dream the whole thing lol
@robust tiger I can still infinitely respawn even with 0 tickets
_killer = (_this select 1);
_numPlayerTickets = [player,0] call BIS_fnc_respawnTickets;
if (_numPlayerTickets == 0)
then {
["Initialize",[player]] call BIS_fnc_EGSpectator;
} else {
[player, -1] call BIS_fnc_respawnTickets;
};
//[_killer, 1] call BIS_fnc_respawnTickets;
I got it fixed. Added the official "Tickets" respawn template and just set onPlayerKilled.sqf to this:
_killer = (_this select 1);
[_killer, 1] call BIS_fnc_respawnTickets;
_numPlayerTickets = [player,0] call BIS_fnc_respawnTickets;
if (_numPlayerTickets == 0)
then {
["Initialize",[player]] call BIS_fnc_EGSpectator;
};
The tickets template automatically deducts the personal tickets of the player. onPlayerKilled.sqf will give tickets to the killer and manage spectator mode once the player has no tickets left
So the player cannot respawn if he had 1 ticket left before he died?
ok guys, so, basically im trying to make 2 jets fly via the vehiclecapture, but when i trigger play (bear in mind the jets are being flown by unnamed class fighter pilot)
the jets just blow up whereever they are midflight, what to do please?
(https://imgur.com/Ruru2Gw)
@robust tiger Yes. If he had one ticket, it'll get deducted and now he has none
Think of it as a "life ticket" rather than a "respawn ticket"
3 tickets = 3 lives
Yeah, I was on the opposite side of that
well I can just use the already present one on the "destination" and just set the completion radius to 80 meters (chopper is always 75m before the point) and then calculate a second one.
Question is now how do I calculate the second wp? Du I just use velocity _aircraft select 1 and create a wp based on the y-axis (aka check if the y-axis goes minus or plus and then create a wp further to that axis) or how would one do this?
Or do I jusy use getRelDir and create a wp in that direction just a few hundred meters away?
@opal sand I normally disable damage on vehicles when I do unit capture have you thought about trying that?
vectorAdd
@opal sand https://www.youtube.com/watch?v=Yw-xDuBhFro this is a great tut on unit capture. I'm not that great with scripting and such but this video explained it very well to me
Even doMove has this tolerance for helicopters. I cheated the waypoint system a little bit. If you really need this:
//made in debug console so globals everyhwere
wpPos = getWPPos [group player,1]; //heli has single editor-placed WP
vect = (getposASL heli) vectorDiff [wpPos select 0,wpPos select 1,getposASL heli select 2];
phi = (vect select 1) atan2 (vect select 0);
heli doMove ([(wpPos select 0)+88.3*cos(phi+180),(wpPos select 1)+88.3*sin(phi+180),200]);
//You could just relocate the waypoint also with SetWpPos
phi;
The magic number of 88.3 is for AH-9 Pawnee, it is slightly different for helicopters with different maneuverability. It is the distance where the heli stops in front of the WP. If you want it exactly, best way to do that is to measure it in editor. Obviously, this does not cover the case when the heli has more waypoints and you want it to stop at the doMove position. No guarantee it will work 100% of the time because AI.
gonna check this out, thanks! Helo has only one wp created, so should be fine. After it has reached the wp it will be deleted anyway after 20 seconds so that's fine
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
@primal belfry Although thanks for your assist, used (https://www.youtube.com/watch?v=V2fWndbgtDA)
and found out;
rec = [car1,180] spawn BIS_fnc_UnitCapture;
hint "good!";
And was using car2, car3, car4 on the intended vehicles to be/recorded instead of changing this value, which caused the car2, car3, car4, to propel forward and be destroyed
@opal sand Glad you worked it out
Is there a default-value for the get command?
https://community.bistudio.com/wiki/get
oh wow, didnt see that
Also listed under "See also" at the bottom
yes
Value can be anything
be careful not to cause any circular references (inserting hashmap into itself)
not to worry, i'm building my hashmaps on startup and not chan... wait, why dont i just use dummy-configs?
config lookups are somewhat slow-ish, depending on usecase tho
mmmh
i thought Configs were just CPP classes
but i guess theyre handled internally in some other way
because im never actually changing the values
i just need it to be hashed
because some have the values and some dont
Anyone know if there is a way for a hint to appear when someone uses respawn from the pause menu
Like hintSilent "name used force respawn";
https://community.bistudio.com/wiki/Event_Scripts
Here are the full details. You would basically need to put the command into a file onPlayerRespawn.sqf which activates when a player respawns.
Nice ok thanks pal
hi, is possible to get memPoints list via script?
(i mean - memPoints for attachTo command)
@cosmic lichen thank you a lot!
Hi. I have this code below which is run from a units init which basically means every time a unit shoots all units with 200 meters go into combat mode. I'm a trying to make the AI be more responsive rather than staying still whilst a group near it is in full on combat. The script works as intend and so does the silencer check which means the script doesn't do anything when a silenced weapon is fired. However the delay does not work. Any idea how to add a sleep to this to simulate reaction time?
{
_x addEventHandler ["Fired",{
params ["_firer"];
hasSilencer = _firer weaponAccessories currentMuzzle _firer param [0, ""] != "";
if !(hasSilencer) then {
_delay = [] spawn {
sleep random[1.8,2.2,3.5];
};
{
_x setBehaviour "COMBAT";
}forEach (allUnits select {_x distance2D _firer < 200});
_firer removeEventHandler ["Fired", _thisEventHandler];
};
}];
}forEach allUnits;
First of all, singleplayer or multiplayer?
@primal belfry
also, the delay is running in it's own thread, it decoupled from the rest of the script so to speak
single player atm as I understand multiplayer would mess evrything up with this script
How would i go about integrating it?
{
_x addEventHandler ["Fired",
{
_this spawn
{
params ["_firer"];
if !(_firer weaponAccessories currentMuzzle _firer param [0, ""] == "") exitWith {};
sleep random [1.8, 2.2, 3.5];
{
_x setBehaviour "COMBAT";
} forEach (allUnits select {_x distance2D _firer < 200});
_firer removeEventHandler ["Fired", _thisEventHandler];
};
}];
} forEach allUnits;
Not tested but should work.
I get undefined variable _thiseventhandler
position _firer nearEntities ["CAManBase, 200]
Might be faster than allUnits select....
Should be fixed.
still getting same error
Oh wait, for some reason it didn't edit the code
I have changed it to this which seems to work
{
_x addEventHandler ["Fired",
{
_this spawn
{
params ["_firer"];
if !(_firer weaponAccessories currentMuzzle _firer param [0, ""] == "") exitWith {};
sleep random [1.8, 2.2, 3.5];
{
_x setBehaviour "COMBAT";
} forEach (allUnits select {_x distance2D _firer < 200});
};
_firer removeEventHandler ["Fired", _thisEventHandler];
}];
} forEach allUnits;
@cosmic lichen you asked earlier about single player & mp how would this make a difference?
it is?! 
I have replaced my array method for configs with hashmaps
It seems to be a lot faster 
btw a question I forgot to ask yesterday
if I know that the values will be unique, will batch insertion be faster?
talking about this:
#arma3_scripting message
@robust tiger works flawless, thanks.
yes. less script commands...
though array building for batch insertion will also be many script commands 
i lvoe bohemia:
40 round belt of 40mm red tracer apfsds: "40rnd_40mm_apfsds_tracer_red_shells"
60 round belt of 30mm red tracer apfsds: "60rnd_30mm_apfsds_shells_tracer_red"```
wait 'til you see 6.5mm LMG belt that is both caseless and cased
is it possible to disable via scripting config based useractions but keep scripted? (per object/vehicle)
Not afaik
Much appreciated!
can someone point me in the direction of a solution for disabling server messages like join and disconnect messages. google is not helping.
have you tried disableChannels + 6 ?
i dont want to disable channels i want to disable the messages for join and disconnect
ill give it a try
it doesnt work. systemchat still works and i see join messages
@winter rose
rgr my bad
@winter rose the wiki pages for enabling channels and checking if their enabled channel id 6 is the first custom channel. but on the description.ext wiki 6 is system chat. lol fml.
f the doc mostly
something may have gone wrong at some point, I remember it was a pain
hard_coded_
I found some mods about it in my Google search
I suppose overriding some stringtable entries might do the trick
links?
closed the pages ๐ฌ it was mostly about KeyCat giving it in dm in 2012
Hey Guys, sorry if this is the wrong channel but I could really use some help with a script I'm trying to run.
I'm trying to implement a teleport script with Fade In/Out, Time, Date and Weather Change. Linking to an Object with addAction, so all players on the server get teleported at the same time to a predetermined location.
For some reason, this only works for the host (if im trying on local) and for none if its on dedicated. The Teleport is working, but no Time/Date/Weather Change or Fade Out.
This is the script I'm running:
teleport.sqf:
0 setFog [0.4, 0.1, 25];
{
[0,"BLACK",0.1,3] call BIS_fnc_fadeEffect;
_x SetPos ((getPos t1) vectorADD ([random[0, 12.5, 25], random[-1.5, 0, 1.5], 0]));
[1, "BLACK",5,1] call BIS_fnc_fadeEffect;
0=[[["near the coast... ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["5 days later","align = 'center' size = '0.7'","#aaaaaa"]]] spawn BIS_fnc_typeText2;
}foreach allPlayers;```
and this is in the
Object Init:
```[this,["To U-Boat","scripts\teleport.sqf",[],1,false,true,"","_this distance _target < 3"]] remoteExec ["addAction",-2, true];```
Does anyone know what I'm doing wrong? I watched some youtube videos, but am new to scripting or mapping in general. Some insight if anyone has any would be really great. Thank you tons in advance.
setDate should be run on the server
so remoteExec 0
but ideally remoteExec something on the server that will then remoteExec to clients what is needed (e.g, remoteExec'ing setPos should not happen)
Switched RemoteExec to 0, still not working sadly
oh wait, I did not realise x)
you are remoteExecuting addActionโฆ
use addAction normally, and remoteExec 0 the script
Do structured text hyperlinks support anything other than browser addresses? I'm trying to add a clickable link to join my TS server to a welcome message. Here's what I have.
private _ts = parseText "<a href='ts3server://74.91.115.227'>Teamspeak IP: 74.91.115.227 (Click Me!)</a>";
private _discord = parseText "Be sure to join our <a href='https://discord.gg/fxeATZR'>Discord (Click Me!)</a> if you are interested in learning more about our unit.";
private _arsenal = parseText "The Arsenal can be accessed by ACE Self Interaction > APM Arsenal.";
"Welcome to APM!" hintC [_ts, _discord, _arsenal];
The Discord link works fine, but the TS one doesn't do anything.
Added this to the Object Init, but it wont execute.
[
"To U-Boat",
{
remoteExec ["scripts\teleport.sqf", 0, true];
},
[],1,false,true,"","_this distance _target < 3"
];```
Sorry, I'm really dumb at scripting. The teleport.sqf did not change
sure, that's not how it works
try this instead (ugly but should work)
this addAction
[
"To U-Boat",
{
[[], "scripts\teleport.sqf"] remoteExec ["execVM", 2];
},
[],1,false,true,"","_this distance _target < 3"
];
@finite imp?
Oh sorry, I forgot to send an answer. Yes, the teleport is working like that. SetDate aswell, but the setFog command does only get executed on the host for some reason. And, for another reason, the fadefunction from the teleport.sqf gets executed on the host only aswell
yes, you need to use remoteExec 0 the fading inside the file
So I have to remoteExec everything separately inside the file?
// we are on the server
setDate [2012, 9, 1, 4, 30];
0 setFog [0.4, 0.1, 25];
[0,"BLACK",0.1,3] remoteExec ["BIS_fnc_fadeEffect"];
_x setPos ((getPos t1) vectorAdd ([random[0, 12.5, 25], random[-1.5, 0, 1.5], 0]));
[1, "BLACK",5,1] remoteExec ["BIS_fnc_fadeEffect"];
[[["near the coast... ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["5 days later","align = 'center' size = '0.7'","#aaaaaa"]]] remoteExec ["BIS_fnc_typeText2"];
```more or less
Give me a second to try that
// we are on the server
setDate [2012, 9, 1, 4, 30];
0 setFog [0.4, 0.1, 25];
[0, "BLACK", 0.5, 3] remoteExec ["BIS_fnc_fadeEffect"];
sleep 0.5; // may help, dunno
_x setPos (getPos t1 vectorAdd [random [0, 12.5, 25], random [-1.5, 0, 1.5], 0]);
[1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect"];
[
[
["near the coast... ", "align='center' size='0.7' font='PuristaBold'"],
["", "<br/>"],
["5 days later", "align='center' size='0.7'", "#aaaaaa"]
]
] remoteExec ["BIS_fnc_typeText2"];
setDate and Text is working now (with sleep looks pretty smooth now), but teleport is broken. For some reason the fog does not work in any iteration. Would remoteExec help here aswell?
yep for setFog
teleportation should work, but yes I removed the forEach allPlayers mb
use this
{ _x setPos (getPos t1 vectorAdd [random [0, 12.5, 25], random [-1.5, 0, 1.5], 0]) } forEach allPlayers;
Tried that already, does not work. Not for anyone, neither host nor player
wat
Ill try again
try that?```sqf
// we are on the server
setDate [2012, 9, 1, 4, 30];
[0, [0.4, 0.1, 25]] remoteExec ["setFog"];
[0, "BLACK", 0.5, 3] remoteExec ["BIS_fnc_fadeEffect"];
sleep 0.5; // may help, dunno
{
_x setPos (getPos t1 vectorAdd [random [0, 12.5, 25], random [-1.5, 0, 1.5], 0]);
} forEach allPlayers;
[1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect"];
[
[
["near the coast... ", "align='center' size='0.7' font='PuristaBold'"],
["", "<br/>"],
["5 days later", "align='center' size='0.7'", "#aaaaaa"]
]
] remoteExec ["BIS_fnc_typeText2"];
I really appreciate the help, I hate scripting lmao. Give me a second
It worked. Thank you so much โค๏ธ
Learned a lot today
what we did here:
- add an action in init field (so everyone has it)
- trigger the script by the client on the server
- from the server, send instructions for local-effect commands/functions
et voilร ย !
hello i want to ask is their a script that let soldiers roam around specific area ( camp or base ) in safe mode
and if they get attacked they go take cover and fight
i was looking through places and ive been wondering if there is a way to add an EH that removes any silencer from the gun of the player who has just closed an ACE arsenal box?
My current throught is to use something like
_suppressorlist = getArray (configfile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems");
removePrimaryWeaponItem
{
_x = _temp;
if (((primaryWeaponItems player) arrayIntersect _suppressorlist)!= nil) then {player removePrimaryWeaponItem "_temp"};
} foreach _suppressorlist ;
Look at ACE Wiki's ACE Arsenal framework, should be an eventhandlers section.
Can use getUnitLoadout _unit, edit the loadout array, then setUnitLoadout again.
Although, at that point, why don't you just remove suppressors from the arsenals?
@wild prairie sorry just updated my last reply with my intial code thoughts
but i dont think that would would work
Is there any way to have an addaction on a simple object at all? Thanks.
You could use addAction on the player and have it only show when you look at your object
4 times out of 5, I'm getting 0,0,0 reported in the message, not the location of the grenade prior to explosion. The only time it seems to pick up the coords is if the RGO has lodged in a tree or wall corner prior to exploding. What am I doing wrong? I already tried changing the velocity check from ==0 to <1, but no difference. Trying to hack the CRS grenade script for something else. It seems I'm missing the boat for grabbing the coords prior to the grenade despawning.
CRS_NadeList=["HandGrenade","CUP_HandGrenade_RGO","CUP_HandGrenade_M67","CUP_HandGrenade_RGD5","CUP_HandGrenade_L109A1_HE","CUP_HandGrenade_L109A2_HE"];
player addEventHandler["Fired",{
if(_this select 5 in CRS_NadeList) then
{
_nade=(_this select 6);
[_nade]spawn
{
private _nade=(_this select 0);
waitUntil{vectorMagnitude velocity _nade<1};
private _nadePos=getPosATL _nade;
sleep 0.1;
waitUntil{isNull _nade};
hint format["grenadeyboom! %1", _nadePos];
// spawn projectiles and stuff, then deleteVechicle each one after 5 secs
};
};
};];
@little raptor that should help you if you just want a set
_hm = createHashmap;
_hm insert [true, [1,2,3,4], []];
_hm
[[2,<null>],[4,<null>],[1,<null>],[3,<null>]]
I am attaching two objects and trying to change the direction of the attached object after its attached but its not working. im geting the objects dir before attaching and then reapplying it after attaching but it only changes direction slightly. Any reason why thats happening?
I think direction is relative to the object its attached to
I thought that might be the case so I even did get dir of object that its attached to and calculate difference to obtain original dir relative to the object its attached to but im getting odd results.
idk im prolly screwing something up. ill take a break and work on it later.
if someone can tell me what im doing wrong i would appreciate it.
https://pastebin.com/L5G1Jgd5
I have a tricky situation with joinSilent command. Originally I have FFA setup for all sides including civilian. When I generate blufor group and use joinSilent civilian, it becomes civilian. All works good. But when I start killing them staying on other side (west, east, resistance) I am becoming renegade and friendly units start shooting me. Is there any way out of it?
@warm blaze https://community.bistudio.com/wiki/addRating
do like 10000 though.
To clarify are you trying to join civilian to bluefor or bluefor to civilian?
blufor to civilian
shall I use addRating each time after killing of any civ unit ?
on EH side f.e.
ok then increase player rating and they will never upset their friendly faction for killing civis or same team. or you can add an eventhandler on civi killed to negate player rating points if you want to upset friendlies for team killing but not for civi killing.
you can set it once when misison starts or on player join
what is max limit value for addRating ?
not sure but 10000 does it. i use it
does it decrease everytime I have friendly fire in eyes of side logic ?
yes
so if I have potentially 20 civ groups and they all have been killed by a player, his rating can become -2000 after some time
so it's better to check it dynamically I assume
yes
on civi killed EH check if killer is player and then increase player rating by the amount reduced. i dont know the amount deducted each time you will have to test that.
is addRating server side command only ?
it tells you on the wiki
yup, sorry ๐
you could use this instead of onkilled EH on civi.
everytime rating changes check to see if its because the players civi kill has gone up. you will have to maintain a global var with previous civi kill count to detect the difference.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleRating
https://community.bistudio.com/wiki/getPlayerScores
yeah, looking at it now. Also I found this addEventHandler ["HandleRating", {
params ["_unit", "_rating"];
}];
can be attached to a player
yep thats the way i would go. cleaner that way let EH firing on server
does ai bot also have rating ?
no idea
I mean if some bot kills tons of civ bots then he could become a renegade too in theory
AIs can kill without being worried
yay lou, can you help me with my SIT code i posted above? cant get setdir to work properly on an attached object.
what Dedmen said, setDir is relative to the base-attach object direction
e.g setDir 0 will face the same way, 90 to the right etc
rgr got it working. im dumb. so dumb. thank you @still forum & @winter rose. Not enough sleep.
Q: if we are passing around a HASHMAP as an argument, is there an objNull analog we can use as a type constraint? i.e. ["_hashmap", _hashmapValue, [hashmapNull]] ?
Hello, I'm new to Arma scripting. I'm trying to trying to make units take cover behind walls, in order to give them a said position i require the center of the object. though the problem is that some wall centers are not the same(e.g green arrow is center , red is the position unit takes). I tried using bounding center but it didn't work. Could I have some help with this please?
createHashMap
@still forum and what do you do with the memory hole afterward? it GC's automatically?
what memory hole?
createHashMap creates a new instance, correct? that's not a potential memory leak?
no.
You already asked if you need to delete the hashmap, and you were already told no.
About a month ago
sorry if I don't trust that. seems like a memory leak to me.
right with no delete
its the exact same as objNull, grpNull, scriptNull
no it's not exactly the same. those are "null" placeholders. whereas there is none for hashmap that I know of
It is the exact same.
so you're saying an empty hash map is considered the same? which in and of itself, that's something to consider.
createHashMap returns a empty hashmap.
objNull returns a empty object.
scriptNull returns a empty group.
[] creates a empty array.
so we can do something like emptyHashMap = createHashMap and use that instance
yeah
groovy, that's all I needed
maybe this?
https://community.bistudio.com/wiki/getPosWorld
but beware of the memory leak that way
๐
@winter rose have had a few fall the cracks over the years, yessir, thanks
mostly poking fun at you ๐ I have yet to use the hashmaps!
@winter rose it's all good, cheers ๐ป
Thank for your reply!, Unfortunately it didn't work it just increased the altittude. The problem is the center point of this stone wall (Land_Stone_4m_F) is on it's left corner , I've thought of getting the two corners of the object to try to get it's center but I can't think of a way to implement it. here's the code I'm using
//naming pattern for units : Blue_"Acronym"
_coverableTerrain = ["Wall"];
private _WestUnits = allUnits select {side _x == west};
_result1= nearestTerrainObjects [Blue_M, _coverableTerrain, 50];
sleep 1;
systemChat format ["%1", _result1];
//gothere is nearest object (stone wall)
gothere= _result1 select 0;
// Blue_m doMove getPosATL gothere;
// Blue_M setBehaviour "STEALTH";
// _objDir1 = vectorDir gothere;
// systemChat format ["%1", _objDir1];
_meter = Blue_M distance gothere;
_Lamba = 1+ 2/_meter;
//----bounding center test
_center = getPosWorld gothere;
//equation to put unit 2m behind nearest object using the center point of said object
_result2 = ((getPosATL player) vectorMultiply (1 -_Lamba)) vectorAdd ((getPosATL gothere) vectorMultiply (_Lamba));
private _arrow = createVehicle ["Sign_Arrow_Large_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_arrow setPosATL _result2;
private _arrow = createVehicle ["Sign_Arrow_Large_Green_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_arrow setPosATL ((getposATL gothere) vectorAdd [0,0,2]);
systemChat format ["green arrow position is: %1", _result2];
systemChat format ["bounding center position is: %1", _center];
Found an issue with the switchCamera command where audio keeps playing if you stay in the same vehicle as the camera you switched to:
https://streamable.com/zz38tz
switching to a camera outside the vehicle or stepping out of the vehicle is a dirty fix
but you need to stay in that camera for atleast what seems to be a single frame
you can immediately switch
introducing an annoying flicker
same issue occurs witch selectPlayer
thenโฆ ticket in #arma3_feedback_tracker ?
ah, it changes something ๐
need to ensure first it's not an issue with just my system
I cannot replicate it :(. The green arrow is always above the center of the wall (although very slightly offset), and the red arrow on the other side of the wall. The only explanation I can think of is that there are some walls that are TWICE as long (8m) than their smaller size counterparts (4m) so it appears "off-center".
You could be right, thank you for your help! ๐
is it possible to get gear loadout by unit classname only?
yes
can't find command to get gear array by provided classname string.
ah, thanks a lot, you saved my day ๐
w/ pleasure! have fun ๐
Feasibility idea - Script for Mute/Selectively Mute Arma 3 Players to display typing in the world
Using drawIcon3D text lines to show text after they type it or, preferably, as they type it.
Big stretch: American Sign Language hand animations as they type.
Anyone with experience -- can systemChat be read from (figure yes), and can it* be read from in real time, as someone types? (figure no without CBA keybind or some way to manually read the typing)
Text would be on body or above head. Playing with mute players frustrates me sometimes, this would help with that a lot. Give them an avenue to communicate easier.
One important note is, obviously, when people are typing they cannot input anything else. This may help make implementation a lot easier.
Good evening gents, a quick question: Does the CfgFunctions set scopeName for functions defined in it automatically?
yes
Reads "scriptName _fnc_scriptName;" if that's what you're refering
but is scriptName == scopeName when it comes to breakOut
Aight, cheers. I guess breakOut is rarely used anyhow so shouldn't be too hard to remember to put a scopeName at the top lol
so...a few days ago, you 2 made me cry converting my 30 lines code to a shameful 17 lines of easier & cleaner code...
today, a kill-counter script which uses global mission entity killed event:
//On mission start
private _mission_event_entity_killed = addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if(isNull _killer) exitWith { false };
//systemchat format ["%1 was killed by %2", name(_unit), name(_instigator)];
if (isPlayer _instigator) then {
//systemchat format ["PMCES %2 KILLED %1", name(_unit), name(_instigator)];
diag_log format["PMCES %2 KILLED %1", name(_unit), name(_instigator)];
};
}];
//On mission end, remove event handlers
private _mission_event_mpended = addMissionEventHandler ["MPEnded", {
removeMissionEventHandler ["EntityKilled", _mission_event_entity_killed];
}];
is that ok? any room for improvement? would it be a bad idea to invoke a SQL insert each time someone kills an enemy? (i can handle an array of players, each one with kill counter and insert at mission's end instead)
you don't need to remove EHs if the mission ends ๐
aside of that?
you could inline isNull _killer && isPlayer _instigator, other than that nothing ๐
name _instigator, it is not a JS function ๐
is there a command to delete a single magazine from a container (GroundWeaponHolder) without totally clearing it (clearMagazineCargo<Global>) ?
no
?
you are writing name(_instigator)
yep...to display the name of the killer
no need for () is what I am saying
oh!...."name _instigator"
tbh, I dont like this language grammar xD neither he likes me
which one should be a fair pick to store this on mariadb/which is the most used ddbb extension for arma3...extdb3?
dunno
want to make AI do a simple reload script for some arma cinematic i'm doing, can someone link me the correct arma wiki? there are a bunch of different ones not sure which one I need exactly.
hmm...can I store a hashmap as a global variable? or do I have to serialize it/make it an array?
Yes can
I am trying to make a helo have itโs engine started up in-air, the mod Iโm using doesnโt start it when doing an air start so Iโm trying to do it manually with
this engineOn true;
Not quite sure why it wonโt work. I have minimal scripting knowledge
Maybe itโs the mod? Or my code
Iโm thinking itโs the mod but Iโm not quite sure
the issue i'm having is that it plays the animation, but he doesn't actually reload
I used playActionNow and playAction
which does the animation, but he "fake" reloads it
try action
see the wiki
you have to do 2 things: animation AND reloading
yeah looking at the wiki
s action ["loadmagazine",s,s,0,0 ,"arifle_MX_Black_F","arifle_MX_Black_F"];
Can someone help me understand why "Player in thisList;" doesn't work as a trigger condition?
what i got so far, still working on it though.
kiwi arma wiki for the reloading?
i don't care if the weapon is actually loaded or not, i care if it plays with the animation and the actual mag gets taken out a new one gets put in
hey @winter rose, just to be sure:
//...
function={
if (foo) then {
_myvar=0; <---------------- is this variable local/private/if-scope only or I need to explicit "private"?
};
//_myvar shouldn't exist here!
};
//...
private is needed to make it local in the scope, otherwise it exists in the entire code
any way to avoid needing to type private everywhere?
https://community.bistudio.com/wiki/Variables#Local_Variables_Scope
Unfortunately... ยฏ_(ใ)_/ยฏ
I used to hate write private everywhere but I don't anymore. So just be patient and write
ok so got it to work
s action ["loadmagazine",s,objNull,0,10002809 ,currentWeapon s,currentMuzzle s];arma wiki was wrong, 0 for the id does not work.
Or, maybe here's an idea, you can put private into an #define, like#define P privateso sqf P _myVar = 0;is a privated
@winter rose Thanks, figured it out!
thisList only contains entities that fulfil the trigger's activation condition ("Activated By" i think it is called in 3den)
Ah! That's a good tip. Okay, what about normal list?
I basically need a condition like:
East countSide thisList < 0.7 West countSide thisList;
``` If I do
```SQF
Alive NamedUnit;
``` or
```SQF
!Alive NamedUnit;
``` In a condition field, it works just fine.
But, if I do
```SQF
NamedUnit in thisList;
``` Then I get nothing.
cant you just set the unit as the trigger's owner?
Which unit?
The named unit is just for experimentation.
I need to compare a ratio of occupation of nameless units.
East countSide thisList < 0.7 West countSide thisList;
``` in this case the trigger has to be activatble by anyone
also:
East countSide thisList < 0.7 * (West countSide thisList);
That makes sense, and was my initial inclination, but I was concerned that civilians and the like might mess with it. I guess that was a needless concern.
Thanks SO much!
Haha, yeah, the count was just like my pseudo code to convey what I needed.
would only be a problem if you would use the default condition
Gotcha! Thanks so much!
performance wise i am not too sure how much impact a larger thisList array has, since literally every entity in the trigger area is listed
That is important to consider, since the scenario will require many triggers of this type. I was however going to slow the trigger checks WAY down. One check every ninety seconds or so.
Performance is one of the reasons I'm not using the default sector control modules.
if it is only every 90 seconds it should really not be too bad
Fingers crossed. This is my third or fourth attempt at this scenario.
i also can't think of a way to make it more simple, all alternatives would include more sqf commands and that is worse for performance
I am going to try to cross that bridge when I get there, haha. Might be able to figure a way to just count groups or something. IDK.