#arma3_scripting
1 messages Β· Page 702 of 1
@little raptor btw, which one is the correct way?
"sound1", "sound1.ogg" or "music/sound1.ogg"
none
Well thats the problem then 
whatever you named the class in cfgMusic
Its sound1 i think
can't you be more original?! what on earth is sound1?! didn't you think what would happen if someone else has a music by that name?!

always add tags to your variables
it reduces the chance of collisions
e.g. :BT_sound1 is still better
What is the conventional format for the description written at the beginning of a script? And if everyone does it differently, could I please have a couple examples of how people do it? Thanks
There's no actual convention. They usually stick to some template used by their group/studio/org/etc. (template is usually used in VS Code)
some common items are:
/*
File: blabla.sqf
Author: Leopard20
Date: 2021-08-03
Description:
Parameter(s):
0: SCALAR - Bla bla
1: BOOL - Bla bla bla
Returns:
NOTHING:
*/
you can also look at the BIS/CBA/ACE functions to see how they do it
Format I'm using in most of my projects (based on cba/ace) + plugin for VSCode to automate it.
I got a question on sound
I am trying to have a modify weapon function
Player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
If (_weapon == primaryWeapon _unit) then {
[_projectile, _unit] spawn {
params ["_projectile", "_unit"];
Private _ShooterData = (getShotParents _projectile);
Private _HHH = createVehicle ["B_20mm_Tracer_Red", (GetPos _projectile)];
_HHH SetShotParents _ShooterData;
_HHH attachTo [_projectile, [0, 0, 0]];
detach _HHH;
_HHH setVelocityModelSpace (velocityModelSpace _projectile);
deleteVehicle _projectile;
playSound3D ["A3\Sounds_F\weapons\Cannons\cannon_1.wss", _unit, false, getPosASL _unit, 5, 1, 0, 0, false];
}}}];
Everything works, except for the sound, I have tried to configure this in the cfg sounds as well and then use the Say3d command, no error message and seems to fire just fine, except there is no sound
Any suggestions?
Is it the fileFormat?
should work if the file path is correct
except for that false at the end
local: Boolean - (Optional, default false) If true the sound will not be broadcast over network Since Arma 3 v2.05.147858
try without it
Didnt work
I tried giving it a wrong filepath just to see and then I did get an error message
try playSound3D ["A3\Sounds_F\weapons\Cannons\cannon_1.wss", _unit] just that
if that doesn't work, then your path is wrong
hi, i've found a mission intro script which includes following two lines:
#define DELAY_CURSOR 0.10;```
could someone explain what is the purpose of those? It's not a macro, it's not used or undefined in any other place of the code, just placed at the lower parts of the code where some cutText things are defined and black screen goes away.
it is a macro
but it's not called anywhere else, no ##some_thing## or lines inheriting any part of them
where are you looking for it?
if ([] call BIS_fnc_didJIP) exitWith {};
titleCut ["","BLACK IN", 6000];
playmusic "intro";
sleep 10;
[
[
["Lorem","<t color='#33FF99' align = 'center' shadow = '1' size = '0.7' font='PuristaBold'>%1</t>"],
["Ipsum","<t color='#33FF99' align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"],
["Dolor sit amet","<t color='#33FF99' align = 'center' shadow = '1' size = '1.0'>%1</t>"]
]
] spawn BIS_fnc_typeText;
playmusic "intro";
#define DELAY_CHARACTER 0.10;
#define DELAY_CURSOR 0.10;
sleep 8;
["", "yada"] call Bis_fnc_infoText;
sleep 2;
["yadayada", "dayada"] call Bis_fnc_infoText;
sleep 3;
[rank player, name player] call Bis_fnc_infoText;
sleep 1;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 5;
titleCut ["", "BLACK IN", 2];```
is that the entire file?
then it serves no real purpose
so the DELAY_X is just a custom macro that is not hardcoded in engine, right (I assume that because I couldn't find anything similar on biki)?
i think the guy who wrote this just doesn't understand how preprocessor works
these macros are just probably from some BIS function, you can try looking up infoText or typeText and im sure you will find it in their source
okay, I'll try that, thank you
and second question, I'd like to play a video/cutscene during the scenario, for which I need all other sounds to be either lowered down or suppressed completely. fadeEnvironment and fadeMusic work, however fadeSound, from what I've read, is not usable at all because a) it's overwritten by user settings and b) audio in this video also counts as Sound that will be faded. Is there any way to simply make everything quiet besides the video and/or sounds defined in my cutscene script?
I thought about teleporting the player somewhere in the corner of the map and place him inside a building, and after the cutscene he teleports back to the previous place, but maybe there's something more... efficient
was gonna say teleport him yeah, can't think of anything else right now
and yeah fadeSound will also make the cutscene quiet
I have a question about sound as well.
I set the sound to play via trigger effects. But if player goes in menu everything pauses but sound keeps playing (on zero volume I guess). So when player returns from menu he hears sound not from the point where he stopped. Same thing with music. How can I avoid that?
Hey I have a question regarding waypoints, Im working on a little paradrop script and currently I get an error code which I dont understand. It says 1 element provided 3 needed, but I cant figure out where I provide to little arguments. Here is part of the code which is not working:
_resultgroup = [[0,0,0], 180, "LIB_C47_Skytrain", side player] call BIS_fnc_spawnVehicle;
_transport = _resultgroup select 0;
{_x moveInCargo _transport} foreach (units _newpara);
_transport setPosASL (getPosASL _transport vectorAdd [0, 0, 1250]);
_mPos vectorAdd [0,0,500];
_grp = _resultgroup select 2;
_grp addWaypoint [_mPos];
Adding the unit into the cargo plane and moving the plane into the air works, but when I try to add the waypoint I get the error.
it's engine-side, you can't do things
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Better?
lovely! β€οΈ
addWaypoint
see its doc
https://community.bistudio.com/wiki/addWaypoint
radius is not optional π
Oh god I feel so stupid, I see. I thought the 0 in the example was the optional index
So I just tell everyone not to go to pause menu so the action and sound are synchronized?
btw I saw they somehow done it in official sp campaigns
in MP? music should continue, no? π€
I am making sp campaign
so... when I play Arma 3 campaign and when paused, the dialogue sound sometimes skips - it's engine's fault?
But in my case it happens not sometimes but every time
yeaaah�
In my mission I mean
yep
so... how can I block usage of ESC button when a dialogue is playing? π
you're welcome, skeletor!
But what if player has his pause menu button set not to ESC
1/ you can check which key is attributed to "Pause Action"
2/ you cannot reassign ESC iirc
Ok. Thank you for the advice. I'll try to implement this
Sorry for asking again, but when I spawn my plane for the paradrop above land everything is fine and the planes goes to the waypoints as intended. But when I spawn the plane at [0,0,100] (above water) it spawns and just crashes into the water. Any ideas why the plane behaves that way?
how do you create it?
and don't apologise for asking, I mean, that's the meaning of this channel π
Do you set the special mode to "fly"?
_resultgroup = [[0,0,100], 180, "LIB_C47_Skytrain", side player] call BIS_fnc_spawnVehicle;
_transport = _resultgroup select 0;
{_x moveInCargo _transport} foreach (units _newpara);
_transport setPosASL (getPosASL _transport vectorAdd [0, 0, 1250]);
_grp = _resultgroup select 2;
_mPos vectorAdd [0,0,500];
_grp addWaypoint[_mPos,0];
_grp addWaypoint [[0,0,500],0];
Thats the code
Use your own code
It is my own code
set pos ASL right after then
Why do you use the BIS fnc
Its the first thing that comes up when googling how to spawn crewed vehicles
So move the 4. line right after the first line?
It's not gonna make any difference
If it's unscheduled
You might want to give the plane a velocity instead
So something along the line of:
_transport setVelocity [200, 200, 0];
The velocity must be parallel to the plane's direction
Otherwise it's gonna crash again
Look at vectorDir and vectorMultiply
Will take a look at it, thanks
Also, how do you execute that code?
because you must make sure it's unscheduled
It is executed in a trigger
Yes, in the "On Activation field"
ok it's unscheduled then
With these two it worked, appreciate the help !
Is the Script set by setWaypointScript executed on waypoint completion or directly?
Im talking about this command: https://community.bistudio.com/wiki/setWaypointScript
same as script set in waypoint directly
if you want to execute the script immediately, use execVM
Thanks
So if I have a Waypoint _wp1 and write the following code: _wp1 setWaypointScript "eject.sqf"; It should execute eject.sqf upon reaching _wp1 right? Because right now it is not executed, although the waypoint is reached. I put eject.sqf in the mission folder in documents (right next to mission.sqm).
it might be on waypoint's completion though
I'm no expert on Waypoints, you should try with an editor-placed waypoint to see I guess
while {true} do {
playMusic "Track_C_18";
sleep 170;
};
}```
why this isn't working? also i'm running this on a "game logic" object init
because it's simply code
remove the outer {}
also, you can't sleep in an object init
read the errors you get in Eden π
I gotta use spawn or exec?
so where do I put this "spawn"?
just before the first {, [] spawn {
I see... and what field do I put the code in? since object inits won't work in this case
wat? sorry I don't understand
in script files, .sqf π
for the music part, you can create an init.sqf file that will run for every player, even if they join later
initPlayerLocal...
β¦that too
it's a singleplayer mission
yep, still works
for a single player mission init fields are more or less safe; it's for multiplayer that the hell is breaking out
So I finally made my ingame pc, but its killing the fps big-time. Any advice on how to make this more fps friendly?
Tally_Fnc_IngamePC = {
Params ["_Screen"];
_Screen SetObjectTextureGlobal [0, "Pictures\Alphabet\Signs\Space.jpg"];
_Screen SetVariable ["Pixels", [], true];
Private _xAxis = 1.6;
Private _yAxis = 2.355;
Private _Selector = 0;
Private _AlphSel = 0;
Private _Resolution = 0.1;
Private _Overlap = 0.0015;
Private _Shift = (_Resolution - _Overlap);
For "_I" from 0 to 494 do {
Private _Pix = createSimpleObject ["UserTexture1m_F", (GetPosAsl _Screen), false];
_Pix AttachTo [_Screen, [(_xAxis),0.05,(_yAxis)]];
_Pix setdir 180;
_Pix setObjectScale _Resolution;
_Pix SetObjectTextureGlobal [0, "Pictures\Alphabet\Signs\Space.jpg"];
(_Screen GetVariable "Pixels") PushbackUnique _Pix;
_xAxis = (_xAxis - _Shift);
_Selector = (_Selector + 1);
_AlphSel = (_AlphSel + 1);
If (_Selector == 33)
then {_yAxis = (_yAxis - _Shift);
_xAxis = 1.6;
_Selector = 0;};
If (_AlphSel == ((Count _Alphabet) - 1))
then {_AlphSel = 0};
};
};
yes: don't draw per-pixel π
lol!
you are using 1m texture for 10cm squares, there is that too
Any smalle objects available?
I don't think so, but you could have an addon
truee.. (I dont like addons)
I don't think there will be any difference
yaa I made a musicloop.sqf file and used execVM on the mission init file and it is working
GJ! π
is there a way to add magazines to vehicle pylons that don't have magazines?
I do have markers with variables, want to find marker with highest number. Number is set as variable to marker.
private _inZones = _markers select { _unit inArea _x };
private _max = _inZones select { _x getVariable ["number", 0] }
no you don't. markers don't have variables
hmmm, MakePBO doesn't seem to like the new import directive, or is there some magic i'm missing ?
How can I have the alarm sound ring untill a certain condition is met?
Putting it from Effects only plays it for a couple of seconds.
how do you plan to evaluate the condition?
also what is the condition?
I want the alarm to stop once everyone is dead
wdym :p
why?! everyone's dead!

Ill see what the condition will be later, might make it stop after some time or smth else idk, doesnt matter
The condition is not the problem, making it play for more than 5 seconds is where im stuck
well just use createSoundSource
the sound is looped anyway
so you don't have to do anything about it
just store the returned source
and delete it when you want the sound to stop
btw another reason why that's slow is the attachTo. if you don't expect your "PC" to move, don't use attachTo
If bots spawned by a HC jump into a vehicle spawned on server
does the HC now own the vehicle
thanks
Hello. I'm making an infection gamemode (MP mission) and I'm trying to make it so when the player dies (as Blufor) they will then respawn but then control a playable zombie that gets spawned in (as Opfor) and be able to control it (Like how zeus is able to control units)
(Cause I don't want players to go to the lobby and switch to a zombie controllable unit for many reasons).
The commands I've found that seem the closest to what I want so far are selectplayer which seems to only work in SP and remoteControl which from what I saw seems to be for vehicles. I tried remoteControl but I still had my original unit's camera view and the controlled unit couldn't interact with doors and such.
Are there possibly some better commands out there for this or am I missing some commands?
(I'd preferably like to control the units like zeus does)
only if they get in driver seat iirc
I think any seat that makes you the effectiveCommander
?
is there a debug command to show current draw calls, etc?
i could swear i have seen something like that
draw calls?
how much is the game drawing on screen right now
i want to figure out what affects my terrain performance
afaik there's no such thing
there's lots of stuff for the diagnostics exe, but sadly nothing that seems to help my cause
oh you mean, object drawing
Hey i have an question about hashmaps:
lets say i have as key the playerid of 4 players i just save something like an object as value
theoretically could i change 2 values at the same time, like unlikely and maybe only theoretically but if i say only the server can change the hashmap and he would change 2 values at the same time, would this give a problem?
and if not why, is there something like an scheduler for the hashmap?
I, huh, what?
you can change the hashmap as much as you want server-side, then publicVariable it (or setVariable public but still)
i do not care about sending it thru the network, the hashmap should be local to the server but my concern is that if there is a possibility that the server wants to change 2 values at the same time in the hashmap
"at the same time" doesn't exist
it's one change then the other, and there is no multithread concurrent issue
no race condition in SQF in that case, if you prefer π
okay thank you
who said selectplayer only works in SP?
it works in MP too
thanks
how tf are people getting mods into pub zeus?
How do you get a player so you can run the command for them? Cause it's not like unitA selectPlayer unitB. I assume it has to do with local stuff but I don't really understand it.
not #arma3_scripting-related I'm afraid.
It does involve scripting
you remote exec the command where you want it to happen
im curios how to do it
yeah, and we're not teaching hacking π
as Lou said, it must be executed where unitA is local
you can make a function and remoteExec that
Im afraid you could try and think a little harder about what im trying to say
all I am saying is that
1/ you won't get an answer about it here (or anywhere else on this channel)
2/ keep your attitude and I can show you the wooorld π΅
or, tell me what you are trying to say?
[unitB] remoteExec ["selectPlayer", unitA]; // :-)
You know what never mind i wouldn't be able to even get my point across cause i myself barely understand what im trying to ask
okido ^^ if you happen to do so, don't hesitate
its not hacking tho it was something else
i just can't describe it since it was my first time hearing about it
you mean, "creating objects by scripting"?
you can, but in your own mission with your scripts, just not on a public server
though there are some custom compositions allowed now π€ IDK if it's only vanilla ones or all of them
Thanks! @little raptor @winter rose
Spent so long trying to figure this out, but it's going to help a lot though.
just use local killed event handler
add one in initPlayerLocal.sqf
I think you also need one in onPlayerRespawn.sqf
it gives you the new unit that spawns instead
since it runs locally you won't need remoteExec anymore
Alright, so I'm trying to do the command:
[timeline] call BIS_fnc_timeline_play;
But I need it to work on a dedicated server, so that'd mean I'd have to remote-exec it.
Wondering how to.
No I mean I've already searched that up, it's just that I don't know how to write it down
look at the pinned messages for some examples
see example 4 too
Sorry for stupid question but how would I access this from script? I need a Location type variable and my brain doesn't work (once again!) after getting the 5G chip yesterday
mission.sqm
class Groups
{
// ...
class Item112
{
side="LOGIC";
class Vehicles
{
items=1;
class Item0
{
position[]={6627.4536,6,2308.7083};
id=306;
side="LOGIC";
vehicle="Logic";
leader=1;
skill=0.60000002;
text="respawn1";
};
};
};
// ...
};
^^^^ Note! Arma 2
don't vaxx & code π
what do you want to access?
name that logic and use that name?
Thanks so much man, I found the solution
I just need its location extracted as Object or Location type variable
getPosASL Item112?
getPosASL respawn1?
Que π
I guess the latter yes? in the editor, name the logic "myLogic" then getPosASL myLogic π
go home, u drunk
B-but... I don't even drink! I was born like this!
OH SHβ
Tbh, this is the con of being very deep learner. I keep making stupid mistakes and getting confused all the time because I haven't completed my puzzle (with its missing pieces) about the topic I'm studying yet
surface, then deep, then deeper π but I totally get you with the "oh look, let's nerd that squirrel"
The pro of it is that usually deep learners have better results - in the end, given that they've had enough inspiration and perspiration to go through the whole topic π
curious, does commy2 hang out here or does he just use a different handle on discord.
he used to but not anymore, Y ?
@fair drum I think he was banned from here?
nah, I just follow his responses on the A3 Dev subreddit. curious to why he doesn't direct people here since reddit has garbage formatting
I remember there being an argument between him and the mods after which he ended up getting banned
Can't recall the reason though...
many discords are realizing that's not a good channel to have haha
Hmm, nice, I'll try without it (Maybe just add a detach command at the end)
How do I get the current status of a check box from sqf?
Can't find a script command but maybe im blind
Yeah im blind nvm, cbChecked
So I was getting lag spikes on a regular interval (Maybe refresh-rate?), however it stopped after I detached the textures. Thank you for the gold good sir!
I'm trying to teleport a unit from a initPlayerLocal.sqf.
params ["_playerUnit", "_didJIP"];
_playerUnit setPos (getPos playerSpawn);
I tried this but it doesn't teleport the player because apparently isPlayer _playerUnit = false. So how would I go about getting the actual player so I can teleport them?
I used this in my mission:
params ["_unit","_baseLoc"];
private _pos = [_baseLoc, 1, 10, 3, 0, 20, 0] call BIS_fnc_findSafePos;
_unit setpos _pos;
This is a function, but it works just fine, just use _unit and _baseloc as parameters.
The same param value is going to be passed through their slot. Changing the name only changes how you reference that value.
(You sure you used that for initPlayerLocal.sqf?)
An addaction on a laptop.
this addAction [""Teleport to FOB"", {[player, [5309.6,10749.3,0]] call KER_fnc_teleport;
That MP?
Yes.
huh
I assumed player wouldn't work even though it is initPlayerLocal.sqf because of MP
In MP player is different on each computer and on dedicated server it is objNull by default (however this doesn't mean there couldn't be one). When user is joining dedicated server mission, at the moment of onPlayerConnected the player object is remote to the joining client, as the player unit is created on the server, but once control of the unit is passed to the user moments later, the player objects becomes local to the client and stays local. See Multiplayer Scripting's player topic for additional helpful information.
By the time you are playing it is local to the client.
Yo bros how do i find the list of memory points of a unit
can someone link me to the wiki page for creating a function? I remember a page that talked about creating a function, but I cant find it.
iirc waitUntil {!isNull player} to workaround it
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
thanks
if I just want to make my own script to "call" multiple times, can I just do this:
call "myScript.sqf";
```if not, what do I do instead? im a bit confused about whether or not I need a function, and how I need to create that function.
I dont quite get the difference between a function and a script. (i know a function is a type of script)
Thanks
using a function would be the proper way
okay, so do I need to "register a function to the functions library" or is that just for publishing a function? and how do I turn a script I have written into a function?
You just define it in description.ext
read the link i sent, has everything in there
ok
so, I need to do something like this in description.ext?
class CfgFunctions
{
class myTag
{
class myCategory
{
class myFunction {file = "myFile.sqf";};
};
};
};
do I need a "tag" class?
pretty sure yeah, it needs to be two classes deep, then the actual file, tag>category>fnc
you should prefix your source files with fn_, then you won't need to explicitly provide the file for each function, only the directory
class CfgFunctions
{
class myTag
{
class myCategory
{
file = "functions";
class myFunction {};
};
};
};
should look for functions/fn_myFunction.sqf
okay
whats the discord syntax highlighting language for the class stuff?
cpp
thanks
class CfgFunctions
{
class TRI
{
class gameModes
{
class TDM { file = "TDM.sqf"; };
};
{
class FFA { file = "FFA.sqf"; };
};
{
class AAD { file = "AAD.sqf"; };
};
class misc
{
class vehicleCleanup { file = "vehicleCleanup.sqf"; };
};
};
};
so my gamemode functions are now TRI_fnc_TDM, TRI_fnc_FFA, TRI_fnc_AAD, my misc function is TRI_fnc_vehicleCleanup. I'm not sure about what I want to put for the tag. What would the purpose be in my case? this is just for a mission that im making for me and my friends to play.
also, im not 100% ive done the stuff correctly
looks ok to me
you can read more about tags here: https://community.bistudio.com/wiki/OFPEC_tags the one you have is already good
Ok thanks
are there some scripting commands to get current air temperature? π€
you mean for ACE?
don't think so
ace for example does calculation based on overcast/humidity etc, but its not the actual thing
AFAIK the only things are to get humidity (aka rainy, which affects to make it rain obviously and show the rainbow(s)) and how cloudy it is, in vanilla. Temperature never be a thing in vanilla Arma I thought?
Or, the heat haze? IIRC I saw some config values but never thought it does something
Temperature is a thing - it's used by i.e. thermals for instance
hmm is there a script command to check if an ai unit is following me?
yeah and it sucks that we apparently can't influence / adjust terrain temperature for different seasons. :>
Aha that makes sense. What Lexx said, the only thing we can do is just to get vehicle's temperature
script or config wise? Afair there are settings for different seasons
i havent found any config entries for that
internal exe has something like that
for example a terrain like tanoa should be hot all around, but if you set the month to winter, thermals will be wrong there
anyways, it's not related to scripting :>
are there some scripting commands to get current air temperature? π€
my guess is it could be⦠:3
oh right, this one
If they make one!
but i meant my stuff :p
// Maximum and minimum temperatures (night and day) specified for every month - the game temperatures will vary in those limits // _VBS3_TI
temperatureDayMax[] ={ 10, 12, 15, 20, 25, 35, 35, 35, 25, 20, 10, 10};
temperatureDayMin[] ={-10, -6, -5, -1, 5, 6, 7, 10, 5, 2, -5, -10};
temperatureNightMax[]={ 5, 6, 8, 10, 13, 18, 26, 25, 15, 13, 8, 4};
temperatureNightMin[]={-10, -10, -10, -5, 0, 4, 5, 6, 5, 0, -5, -10};
I guess I could fetch it from world & then calculate it based on day time & overcast
// _VBS3_TI```
π
TI in A2:AO was ported from VBS afair
but i cant find these entries in any vanilla config?
it is from vanilla config though
from DefaultWorld to be precise
huh
oh wow, found it under weather now. that makes a lot sense
someone should fix tanoa weather then.
the values are wrong
teasing aside, is a get (set?) weather command cookin'? π
Yo bros how do i convert azimuth to vector?
Its for camSetDir
// How much we limit the minimum (resp. maximum) temperature during the day (resp. night) if the sky is clear // _VBS3_TI
// 0 means no limit (the max and min will stay as stated above), 1 means full limit (the min and max will be equal)
overcastTemperatureFactor = 0.4;``` I guess I will make some function based on those inputs
configFile >> "CfgWorlds" >> "Tanoa" >> "Weather" >> "temperatureDayMax" ->
temperatureDayMax[] = {10,12,15,20,25,35,35,35,25,20,10,10};Okay, so A3 thinks Tanoa is in the Northern hemisphere
sin and cos
Can you give example
I could tweak it then - please create a FT ticket if you can so I don't forget about it
Minutes please
Livonia might be wrong too
very likely wrong π
seems nobody ever bothered with these values before
and considering the current ongoing heatwave, i'm wondering if altis is still representative in 2035 π
would explain the complaints about thermals being useless in oldman
Yeah Tanoa's value is just inherited from CAWorld directly
It seems, yeah. Enoch on the other hand isn't?
[sin _angle, cos _angle, 0]
Well, regarded to the topic about the temperature, take it to #arma3_feedback_tracker shall we, if we have a topic still?
or feedback tracker π
That's better? I guess
I might later post some function here to get current air temperature
Any reference materials on starting to script for zeus games?
I got a premade mission and I got some scripts I want to implement in. Unfortunately being a day old in Arma kinda makes that venture a hassle.
Awesome thanks brother
I have a mission where, after running for an hour or so, players can no longer join in progess - they get an infinite loading screen and are disconnected after about 15 min. I suspect the JIP queue may be too long.
I ran #exportJIPqueue, the resulting file has time = 8008.061, about 1000 cryptic event entries, _initMessages - Total: 119937 (in breakdown, it's >90% Type_56), about 10MB's worth of ------------------- over and over, and finally _initMessagesRE - Total: 9, Type_375 : 9, and _jipMarkerInfos - Total: 8.
Any ideas what this means, if long JIP queue is in fact the problem, and how I can debug this?
Haven't looked at an exported JIP queue before, but it 10MB seems excessive, and that is around 15 JIP messages (1.28kB) being generated each second.
daheck are you doing here
Yeah, sounds right. I wonder if there is a way to determine what causes the JIP events?
when you remoteExec, don't use true as third parameter all the time
I don't have any of that case in my own code.
The biggest mods involved by other authors are ACE and ALIVE.
Do you know if there's a tool to detect the source of the excessive JIP events?
exportJIPMessages, logNetwork/logNetworkTerminate, other than that, check your mods
Ok, I'll look into those network ones
My exported JIP queue seemed to be mostly Type_56 events. Any idea what that is?
I don't think ACE or ALiVE would make such mistakes, at least people would have reported them
that I don't know I'm afraid
Makes sense. I'll look into it further... thanks for the help.
While it probably is a mod causing the issue, it may in fact be the mission just so you are aware
Ok, I've had this happen in a few missions actually. They all basically have a main base with some player services I scripted (repair, rearm, recruit AI, etc), and use ALIVE modules to set up an AO. Since I'm a newer author, I figure there's a good chance it's my own mistake somewhere...
There is one bit of code I wrote which I expect to run very often. It is a CBA XEH on every unit's init (ALIVE spawns and despawns a lot of units as player/zeus moves around):
class Extended_InitPost_EventHandlers {
class CAManBase {
class jib_inventory {
init = "_this call jib_inventory_fnc_setupAIInventory";
};
};
};
fn_setupAIInventory.sqf:
// Setup AI inventory custom items
params ["_unit"]; // AI unit
if (
not local _unit
|| isPlayer _unit
|| {side _unit != west}
) exitWith {};
if (
_unit isKindOf "B_Soldier_SL_F"
|| {_unit isKindOf "B_Soldier_TL_F"}
) then {
[_unit, "ItemAndroid"] call jib_inventory_fnc_maybeAddItem;
} else {
[_unit, "ItemMicroDAGR"] call jib_inventory_fnc_maybeAddItem;
};
fn_maybeAddItem.sqf:
// Add item to unit if not already in inventory
params [
"_unit", // Unit to add item to
"_item", // Item classname to add
["_quantity", 1] // Quantity to add
];
while {
{_x == _item} count (items _unit) < _quantity
} do {
_unit addItem _item;
};
That is fine. Nothing network-wise going one here
Ok. I'll keep poking...
unless the functions themselves have any JIP thing ^^
addItem has the GE label in docs. Do you think that could be the culprit?
one command is not the culprit (but remoteExec)
Honestly, no. AFAIK the only commands available to scripters/modders that modify the JIP queue is remoteExec, remoteExecCall or the old BIS_fnc_MP.
Hmmm, there is not a single remoteExec, remoteExecCall or the old BIS_fnc_MP in my code.
So, addItem, even though it has GE (global effect), shouldn't cause a JIP message? Because this one is definitely called thousands of times in my mission.
It will definititely cause network traffic, but not a JIP message
then it may be a mod
https://community.bistudio.com/wiki/BIS_fnc_exportEditorPreviews
I used exportEditorPreviews on decals that are displayed only on the surface and I have them invisible in the preview
Am I doing something wrong?
my code:
[nil, "all", [], [], [], ["Land_ConcretePanels_01_single_F"]] spawn BIS_fnc_exportEditorPreviews;
I have this https://ibb.co/ctnncjs, but vanilla img https://ibb.co/ryGvL62
Regarding my JIP queue issue, seems my own mod is at fault. I watched the size of the exported JIP queue over time and saw that it constantly grows. After removing a feature from my mod, the queue size stays constant.
Seems the problem is in the following code snippet:
// Called once per second, _x is helicopter with AI crew
crew _x select {
alive _x && { not isPlayer _x };
} apply {
[_x, _x] call ace_medical_treatment_fnc_fullHeal;
_x setUnitLoadout typeOf _x;
[_x] call jib_inventory_fnc_setupAIInventory; // Shown above in Discord
};
_x setDamage 0;
_x setFuel 1;
_x setVehicleAmmo 1;
so either ace_medical_treatment_fnc_fullHeal or jib_inventory_fnc_setupAIInventory
β jib_inventory_fnc_maybeAddItem
// Called once per second
why you're healing the AI once per second.
fullHeal adds the healing event to the patient log. However the log is limited to 8 entries per patient, so that should not overflow your jip queue.
The jib_inventory sources are above in my older message.
ah yep, missed maybeAddItem
therefore what veteran said!
you can try using the target event instead of the function so the log entries are not added at all.
["ace_medical_treatment_fullHealLocal", _patient, _patient] call CBA_fnc_targetEvent;
but I don't see how that would flood the JIP queue.
logEntries is an array variable that's set on the unit.
we have no context for this snipet, how and on what it's executed.
I didn't know about CBA target event, but in this case the units are already local, as this code is run on server.
// Setup to auto service AI and its vehicle
if (not isServer) exitWith {};
params [
"_object", // Service provider
"_distance" // Service max distance
];
if (isNil "_distance") then {_distance = 7};
[_object, _distance] spawn {
params ["_object", "_distance"];
while {true} do {
uiSleep 1;
_object nearEntities ["AllVehicles", _distance] select {
_driver = driver _x;
not isNull _driver
&& { not isPlayer _driver };
} apply {
crew _x select {
alive _x && { not isPlayer _x };
} apply {
[_x, _x] call ace_medical_treatment_fnc_fullHeal;
_x setUnitLoadout typeOf _x;
[_x] call jib_inventory_fnc_setupAIInventory;
};
_x setDamage 0;
_x setFuel 1;
_x setVehicleAmmo 1;
};
};
};
This function is called in the object init for helipads where AI combat support units spawn, so that they are healed/rearmed/repaired/refueled when they RTB.
This function is called in the object init
gniiiiiiiii
I don't see what could cause such big growth of the JIP queue then π
btw:
params [
"_object", // Service provider
"_distance" // Service max distance
];
if (isNil "_distance") then {_distance = 7};
=>
params [
"_object", // Service provider
["_distance", 7] // Service max distance
];
Is this an ACE medical thing? In game, it shows "X used personal aid kit" many times in the ACE medical UI.
yes, it's added by the function you're calling.
Thanks, yes I learned that bit after writing this.
Replace with the event as I told you and it will heal them without adding log entries.
But as I said it's limited to 8 entries.
So it won't grow beyond that.
Would this cause any difference? In this case, the units were already owned by the server.
What would make difference? using event instead of function or using target instead of local event?
Event instead of function.
well.. I just told ya what's the difference... event heals without adding log entry.
Ah, i see what you mean.
Again, not sure if this ACE medical bit is the root of my issue yet, but regardless I may use this event, as the ACE medical logs are not necessary in my use case.
Let me do further testing with my code snippet and checking the JIP queue, then I'll report back the results in a bit.
try commenting out features one by one, first healing, then adding the items. Observe if it grows, || adapt, survive, win ||.
@hollow thistle I don't know ACE at all, but basically what is happening here is always adding an Event Handler instead of "just" healing?
no
targetEvent is just better remoteExec... simplyfing it a lot.
It just sends the event over network to the target or executes the event locally if target is local.
hey,
i am are currently working on an money system, so it would be very important that nothing like a race condition or so can happen.
as @winter rose told me it's one change then the other, and there is no multithread concurrent issue [...] no race condition in SQF in that case, if you prefer
so just to be very clear / so that i can understand it:
I am planing to remoteExecCall an function on the server which edits an hashmap.
Theoretically when 2 clients would remoteExecCall the script on the same time what would happen?
I know that this barley can be the case but if it would this just would mean that the script gets added to the stack and executed when its time to. (call adds provided Code to the stack and wait for it to execute, then returns the code's last returned value.)
so there just would be some kind of qoue and one of the two scripts is getting executed first but they can't be executed at the same time / parallel
am i right with this?
Theoretically when 2 clients would remoteExecCall the script on the same time what would happen?
one of them executes the first, and after that the second one
so i am right thanks :3
I know that this barley can be the case
No actually its impossible for that to ever happen
Even network messages that the server receives are in a queue.
A server cannot process two network messages at the same time, thus it will also not receive your remoteExec's at the same time
thank you very much :3
_x setUnitLoadout typeOf _x; seems to be causing the JIP queue growth
oof, it should replace the "set loadout" in the queue I guess but maybe it's appending instead.
ooooooh, @still forum ?
I guess that's something for FT ticket and Dedmen investigation.
ticket-worthy?
if haz repro, probably
@peak pond could you prepare an easy (vanilla) repro mission plz? :3
Yep, I have vanilla repro "JIPQueue.VR.zip" ready.
Is there somewhere to open a ticket with this?
sure, right here!
https://feedback.bistudio.com/maniphest/task/edit/form/3/
Thanks again
No prob, just trying to fix my mission so people can JIP...
PS: I zoomed on your profile picβ¦ and validate it, carry on π
Do you know an appropriate category and severity for this bug report?
severity⦠major?
lol
category⦠Performance
I don't like sounding the alarm, but...
there is minor or major, nothing "normal" so Major it is
no u!
it's a sneaky one you found out, so kudos to you π
if I call a function, do I need to pass any variables I want to use into the function with parameters?
no
okay
local variables, scopes n stuff
yeah, the variables stay defined when using call then
just checking
This is my description.ext. I am getting an error on line 9: '{' encountered instead of '='```cpp
class CfgFunctions
{
class TRI
{
class gameModes
{
class teamDeathmatch { file = "functions\gameModes\teamDeathmatch.sqf"; };
};
{ //ERROR HERE
class freeForAll { file = "functions\gameModes\freeForAll.sqf"; };
};
{
class attackAndDefend { file = "functions\gameModes\attackAndDefend.sqf"; };
};
{
class captureTheFlag { file = "functions\gameModes\captureTheFlag.sqf"; };
};
class misc
{
class vehicleCleanup { file = "functions\misc\vehicleCleanup.sqf"; };
};
};
};
you have unnamed scopes
class
wait, can all functions from the same category go together like this?
class CfgFunctions
{
class TRI
{
class gameModes
{
class teamDeathmatch { file = "functions\gameModes\teamDeathmatch.sqf"; };
class freeForAll { file = "functions\gameModes\freeForAll.sqf"; };
class attackAndDefend { file = "functions\gameModes\attackAndDefend.sqf"; };
class captureTheFlag { file = "functions\gameModes\captureTheFlag.sqf"; };
};
class misc
{
class vehicleCleanup { file = "functions\misc\vehicleCleanup.sqf"; };
};
};
};
is that what im doing wrong?
this is correct
okay
I swear one day I will redo this CfgFunctions page as it is mixing up things and in the wrong order
du eet nau
I have a unit named blue1 and I need to get that variable as a string during the mission. When I use str, I get "B Alpha 1-1:1". I need to get "blue1"
How would I find what mod adds a specific object?
use setVehicleVarName
not sure about mods, but you can check which addon adds it
Yeah, I guess that does
I really don't have a clue how anything with configs works
you just get the config:
configFile >> "CfgVehicles" >> typeOf _obj
or
configOf _obj
there's also a variant that takes a class name
unitAddons
Great, thanks.
I've got the addon now.
I'd found the weird looking thing in Eden and just wanted to know what it was from.
https://imgur.com/gallery/WByE2zw
Turns out it's Clafghan

Noob question -- if I execVM a .sqf through the init.sqf, will it be evaluated on each client separately? Say, for example, MyScript.sqf checks the UID of a player against a predefined list of UIDs, and ends the mission for them if they're on the list. Will that end the mission for everyone? Or just that specific player?
how many triggers can I have on a mission before the performance gets affected?
depends on the command/function you use to end the mission
the script itself executes locally
but might have global effect
1
ahem, noticeably*
depends on your PC; it's not a static value
actually its 198.90291...
Okay, Iβm using an if-then clause
banList= [βsomeSteam64β];
banUID = getPlayerUID player;
If (banUID in banList) then {endMission βEND1β;};
I donβt think the script works yet, but Iβll iron out the syntax later. I just want to make sure Iβm at least using the right commands. The wiki says BIS_fnc_endMission should be used to get the mission to end for everyone at the same time, so I assume endMission has the potential to send only one player to the debrief screen.
Sorry to ask such a specific question, but it seems like this is the best place to get some coaching.
The wiki says BIS_fnc_endMission should be used to get the mission to end for everyone at the same time
it does?
where?
BIS_fnc_endMission has local effect
Ah, I misread. Thanks.
"To end mission properly so that everyone goes to debriefing at the same time, this command should be executed on every machine."
^ in regards to endMission
Scripting on no-sleep is addictive.
why do you use those weird quotes? 
anyway:
_banList = ["someSteam64"];
_banUID = getPlayerUID player;
If (_banUID in _banList) then {"END1" call BIS_fnc_endMission;};
Woah that's some neat formatting. I've obviously got a lot to learn. Thanks man!
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
That's amazing. Thanks, dude. I figured it had something to do with local variables.
no
Oh?
you were using weird quotes
what you had:
βsomeSteam64β
```but it should be:
```sqf
"someSteam64"
Sorry, I meant that I don't know when to use private variables, or preface a variable with an underscore.
well I was referring to your error
in simple terms, when you only need a variable in a specific script
and it's not used outside of that script
Gotcha. Much appreciated!
Hey, question
Not sure if this would belong in scripting or not, but is it possible to load an .SQE (composition file) in a running mission?
Or only in 3den?
[east, "task1", ["Empty magazine at Target", "Shoot at Target", objNull] "assigned", 1, true, "kill", false] call BIS_fnc_taskCreate;
cannot find the error here, again
debug says it's missing a ] but idk where it's supposed to go
missing ,
before "assigned"
description parameter: objNull is not a marker
destination parameter is missing (that's probably where you wanted objNull)
how do I check if the player is in a vehicle?
vehicle player != player
!isNull objectParent player
better yet, how do I prevent the player from leaving or ejecting from a vehicle?
Lock the vehicle π
can't get in but still can get out
With ACE?
i guess you can use getout event handler, and put them back in
Locked vehicle usually goes both ways; what's out can't get in and what's in can't get out.
Is it the ejection seat that still works?
when the jet is grounded, cant get out or eject. as soon as it starts moving the "eject" action shows up and I can eject regardless of lock state
so its the ejection seat
mhm, looks like so
I think ejection seats are handled differently, I don't know if you can disable them somehow.
any simple scripts for AA to fire randomly in the air? haven't had much luck with anything found online
I think I'd find this useful too
isNil {
private _missile = createVehicle [<ammo_class>, [0, 0, 0], [], 0, "CAN_COLLIDE"];
_missile setPosASL <asl_pos>;
private _magnitude = vectorMagnitude _missile;
_missile setDir <dir>;
_missile setVelocity (vectorDir _missile vectorMultiply _magnitude);
_missile setMissileTarget <target>
}
idk something like that
giving speed is probably redundant as ammo has a launch velocity already iirc, edited, should be more proper
Working on tank commander override/"commander designate"...
wanna see something horrible?
params ["_vehicle","_lookAt"];
private _turretCfg = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret";
private _horRotSpeed = [_turretCfg,"maxHorizontalRotSpeed", nil] call BIS_fnc_returnConfigEntry;
private _turretAngularSpeed = 45 * _horRotSpeed; // degrees/sec
private _gunRotSource = [_turretCfg,"animationSourceBody", nil] call BIS_fnc_returnConfigEntry;
private _gunDirRel = -(deg (_vehicle animationSourcePhase _gunRotSource));
if (_gunDirRel<0) then {_gunDirRel = _gunDirRel + 360};
private _dirTo = _vehicle getRelDir _lookAt;
private _traverseDist = abs (_gunDirRel - _dirTo);
_traverseDist = (360 - _traverseDist) min _traverseDist;
private _traverseTime = _traverseDist/_turretAngularSpeed;
systemChat str [_gunDirRel, _dirTo, _traverseDist, _traverseTime];
private _dummy = createAgent ["B_RangeMaster_F", [0, 0, 0], [], 0, "NONE"];
_dummy allowDamage false;
private _cameraView = cameraView;
moveOut player;
_dummy moveInGunner _vehicle;
_dummy switchCamera _cameraView;
_dummy doWatch _lookAt;
private _time = time;
waitUntil {time >= _time + _traverseTime * 1.2};
moveOut _dummy;
deleteVehicle _dummy;
player moveInGunner _vehicle;
player switchCamera _cameraView;
I know this is a painfully noob question, but where do I fill that in?
so, objects dont have "vehicle variable names" by default
yes. it's empty
ok
only the ones placed in Eden Editor and with a variable
i placed down a bunch of units with the name blue1, blue2, blue3, etc
i just need to get that as a string from the unit
if they come from the editor, they have a varname
okay...
only if I give it a variable name tho, right?
vehicleVarName is just the variable name assigned to a vehicle
β¦yes
ok
initServer preferably
that code is not functional though, you need to generate positions, fill in the gaps
trying to use holdaction add
aint working, dont know why. any pointers?
[
"generator", // Object the action is attached to
"Initiate Backup Power", // Title of the action
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Idle icon shown on screen
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Progress icon shown on screen
"_this distance _target < 5", // Condition for the action to be shown
"_caller distance _target < 7", // Condition for the action to progress
{}, // Code executed when action starts
{}, // Code executed on every progress tick
{ _this remoteExec "mechanics\radiostart.sqf" }, // Code executed on completion
{}, // Code executed on interrupted
[], // Arguments passed to the scripts as _this select 3
12, // Action duration [s]
0, // Priority
true, // Remove on completion
false // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", 0, generator]; // MP compatible implementation
comes up with an error i cant quite see (blips off quickly) and doesnt add it to the object id like it to
ignore me
im a complete, utter, bumbling bambling baboon
******* "" on object name
im an idiot
only question that remains is;
how do i make it exec a file after its done
currently _this remoteExec ------
returns an error saying it expected an array, as is said in the wiki
(still learning sqf)
how on earth can i get it to exec the file then?
after what is done? the action?
yes
also if possible id like to know if i can execute say a sound file on interrupted / at start
see second pinned message, you want to use https://community.bistudio.com/wiki/execVM like that, though the best way is to use cfgFunctions or something similar, and just remoteExec the function instead, like you do with the holdAction one
i did tho
{ _this remoteExec "mechanics\radiostart.sqf" },
and it said it expected an array which is why im confused
no you didn't, read what i wrote again
you can but don't have to, i just said it will be more effective
wait so to execute an sqf file i should do what? currently i read that as "execute it as you have"
and i can also use playsound for the tick / start
because im already asking it to execute an sqf file via remoteExec
you can use playsound i already answered that
to remote execute a file properly see #arma3_scripting message (pinned message) combined with https://community.bistudio.com/wiki/execVM
Is there a function that will allow you to crush the grass in a certain radius (as it happens when a player crawls along it)?
no, but there are "grass cutters" you can place to remove grass in certain locations
Can I refer to units set in the editor/mission.sqm with ```sqf
for {[i...
missionNamespace getVariable format ["unit%1",_i];
Arma 2: CO v1.64 again
This is an example unit from mission.sqm:
class Item11
{
side="GUER";
class Vehicles
{
items=1;
class Item0
{
position[]={6854.9751,45.859566,2502.2217};
azimut=218;
id=16;
side="GUER";
vehicle="ru_Profiteer4";
player="PLAY CDG";
leader=1;
skill=0.60000002;
text="civ4";
init="this setpos [getpos this select 0, getpos this select 1, (getpos this select 2) - 0.01];this setpos [getpos this select 0, getpos this select 1, (getpos this select 2) + 0.75];";
description="Civ 4";
};
};
};
If I refer to the unit with this
for [{_i=1}, {_i <= civscount - 1}, {_i=_i+1}] do
{
// ...
_wantedCiv = missionNamespace getVariable format ["civ%1",_i];
diag_log _wantedCiv;
// ...
all I get is <NULL-Object> spam
yes you can
also this for is slow
Well, taking a closer look it actually prints the unit that I've spawned as
use for "_i" from 0 to civsCount -1 do
But the rest of the code just fails silently... Ugh
Rgr
Ok, scripted Arma for 6 hours and I want to throw my PC out of the window now... The game should carry a black box warning for content creators 
"be wary: Ezcoo, drop that now"
Hey guys I'm getting an error running a script (https://forums.bohemia.net/forums/topic/197937-release-gom-ambient-aa-v121/) from this section
};
//make sure weapon is of projectile type
_weapons = weapons _gun;
_projectileIndex = _weapons findIf {
_mag = getArray (configfile >> "CfgWeapons" >> _x >> "magazines") select 0;
_ammo = getText (configfile >> "CfgMagazines" >> _mag >> "ammo");
_ammo isKindOf "BulletCore" AND toUpper _ammo find "SMOKE" isequalto -1;
};
says there's an undefined variable in _mag expression
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Because the array you're trying to get may be empty
how could that be possible? could it be the particular AA vic I wanted to use?
Yes. Maybe the magazines belong to the turrets
Not the vehicle itself
right, thanks mate
I'm trying to fix code from a mod that was abandoned a few years back. This code should place a gas mask to the target, but it doesn't do anything (interactions appear just fine). Is there anything obvious I'm missing that's wrong?
/* your code */
params ["_player", "_target"];
//First figure out which unit has the mask, preferring the target
if (_target call CBRN_fnc_hasMaskInInventory) exitWith {
private _masks = (items _target) arrayIntersect (CBRN_allLevel1Masks);
//Remove our item
_target removeItem (_masks # 0);
//Take the targets glasses and add it to their inventory (or ground if they run out of space)
[_target, goggles _target, true] call CBA_fnc_addItem;
//Finally put the mask on the target
_target linkItem (_masks # 0);
};
//If it's player that has it then do that
if (_player call CBRN_fnc_hasMaskInInventory) exitWith {
private _masks = (items _player) arrayIntersect (CBRN_allLevel1Masks);
//Remove our item
_target removeItem (_masks # 0);
//Take the targets glasses and add it to their inventory (or ground if they run out of space)
[_target, goggles _target, true] call CBA_fnc_addItem;
//Finally put the mask on the target
_target linkItem (_masks # 0);
};
CBRN_allLevel1Masks might be undefined, dunno
i am using fn_exportEditorPreviews to create editor preview images. for some objects the camera zooms in too much. .. i'm trying to figure out right now to fix that, but no matter what i try, the camera doesn't budge. has anyone had any experience with this before?
nevermind, i just figured it out
thanks for the help, guys
gniiiiii
the usual 7yo internet topic where you have the exact same problem as the guy and it ends "nvm fixed it" and you're stuck with hairloss forever π
I used to be in a forum where there was a rule on the help section for "helping future generations" that forbid editing/locking topics by the OP
just doing my part
the fn_exportEditorPreviews.sqf sets camera fov _cam campreparefov 0.075; - i simply tweaked that value until it worked with my model.
it's some manual work, but still faster than trying to come up with anything else
I was mostly kidding but I always suffer silently in such occasions π thanks for telling!
Where did u guys learn scripting cus 3 of my friends got arma and ive turned into a mission creator for them and so that the missions are better i gotta learn scripts
Hi! I learnt with Operation Flashpoint by trial & error, then by reading other people's scripts then reading forums;
now we have tutorials! see https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting π
well, about 15 years ago i've read how you start a fireplace in operation flashpoint. from there it went downhill
β¦I felt that
good old times where starting a fireplace was considered a tough task
the fire place no, having it on was lit
i seem to remember it was one of the most common questions at the time "how do i start the campfire"
That dad humour π
I realised while typing it, but hell yeah to both! π
Is this why Arma has both unlit and lit (and ability to turn it on/off) campfires
I guess, so that Humanity can move to its next goalpost π
Arma 4 will be full of things then... its had almost 10 years of scripts to add 
I can confirm, it will be possible to have up to two bonfires! 200% rate!
script a simple computer based on campfires being set on and off
and then play doom on it
we can even do analog signal with smoke particles!
Who needs radios when youve got smoke signals
Well, I'll try for the last time before I give up. This is the last call for help before I move permanently in trash bin 
sqfbin? :3
playerarrays.sqf
civstringarray = ["Civ1", "Civ2", "Civ3", "Civ4", "Civ5", "Civ6", "Civ7", "Civ8", "Civ9", "Civ10","Civ11", ...];
init.sqf
// ...
execVM "briefing.sqf";
call compile preprocessfile "triggers.sqf";
if(!debug)then{["basicintro"]execVM "introcam.sqf";};
if(local server)then{execVM "targets.sqf";};
waitUntil { ( (time > 1) and ((alive player) or (local server)) ) };
_h = [] execVM "playerarrays.sqf";
// ...
mraw!
Kinda cyberpunk btw
if ( ((call compile format ["%1_wanted;", (civstringarray select _i)]) == 1) )
WAT
and can't you setVariable, young man? π
I pasted it from other parts of (not my) code, haven't touched that part yet π
gniiiΒ²
I'm editing an ancient mission with legacy code
Don't copy paste bullcrap oof.
that hurts me brain
Ahem... Are you suffering from stack overflow?
Yeah, shouldn't do that. Just wanted to make it work at first (that line of crap does work elsewhere in the code, though) and optimize in the end
instead of "trying to patch something one doesn't know", is it possible to get to "a system one could understand" from what you have? or is it too deeply rooted in the old system π¬
Depends on who you ask π
My issue is that _wantedCiv returns always nullObj, no matter what I do
objNull π
Whoops π
have you tried debugging civarray, _i, and parenthese (_i+1)?
anyone here know how to make the enemy force retreat if there's too many casualties? and when they retreat a task to be completed
This reminds me from the golden words of a legendary university teacher (lector?) who teaches at my faculty: "the difference between horrible and splendid programmer is that the latter uses debug lines / debugging 100 times more" π
reduce their courage
when they flee: fleeing becomes true
(_i+1) doesn't affect it...
but why is it one index ahead?
Already fixed a ton of bugs with debug lines... I actually don't understand how that mission has managed to not to fall apart during the gameplay
First element in civstringarray is Civ1, the next Civ2 etc
sure but what about:
civstringarray select _i)
civarray select _i+1
that code is just...oooooof
question1: what's wrong with a simple forEach
why for?
Mm. Should be civstringarray select _i+1
question 2: why on earth are they storing an array of variables?
just use setVariable
Question 1: I haven't refactored the old code yet - Question 2: Absolutely no idea π
the main problem with that code is that the values are not bound properly
they're just using global variables in one place, object varspace in another...
no both should be _i
but still it's not worth it imo
you can write something better in less than 10 minutes
{
if (_x getVariable ["wanted", false]) then {
_bounty = _x getVariable ["wanted_bounty", 0];
//blablabla
};
} forEach civs;
This is what you get when you put a game designer to code... π
Yeah, though integrating it to the rest of the mission might take a tad longer... π©
so like I want to make all independed forces the variable how would that work
if -- fleeing true, call BIS_fnc_taskCompleted;
smth like that?
so you will have to use units, the side of your enemy, and findIf (or count if you want a percentage of them fleeing)
it's Mujahid not Muhajid....
brah
you get the point
broh
does AI fleeing work well when they are under fire? Or do they just crawl in the opposite direction then, but continue making as much progress as a snail
{
_x allowFleeing 0.85;
} forEach mujahideen;
waitUntil {
sleep 3;
mujahideen findIf {alive _x && !fleeing _x} < 0
};
["sometask", "SUCCEEDED"] call BIS_fnc_taskSetState;
is mujahideen the variable for the faction or?
array of enemy units
I don't know what that means tho..
it means you got a bit of reading to do
Mh.
do you:
- want to learn scripting? welcome, read the wiki π
- want to recruit (even for free) someone to write you a script? #creators_recruiting is the place
if you want all enemies, you can simply type:
mujahideen = units east;
(assuming they're on the east side)
thank you Leo
also according to the wiki you should only check the group leader
the whole group will flee together
I mean, I put it on a trigger condition and I got some generic expression error
no
it's not a trigger condition
plus it must be executed scheduled
because of the sleep
say I have 8 people, and 8 locations. I want each of those players to be set (randomly) to each of those locations. I want each player to have a unique location from a selection.
PS: https://community.bistudio.com/wiki/Structured_Text
π
a bit late, but still
you can execute it from a trigger On Activation statement like this for example:
[] spawn {
_mujahideen = units east;
{
_x allowFleeing 0.85;
} forEach _mujahideen;
waitUntil {
sleep 3;
_mujahideen findIf {alive _x && !fleeing _x} < 0
};
["sometask", "SUCCEEDED"] call BIS_fnc_taskSetState;
}
aight, thanks man
I guess the easiest way to do that is to use a loop:
{
_cnt = count _posArray;
_id = floor random _cnt;
_pos = _posArray param [_id, [0,0,0]];
if (_cnt > 1) then {
_posArray deleteAt _id;
};
_x setPosASL _pos;
} forEach _units;
nice, so string is ok, but text is no no
or (bad practice)```sqf
["<t size='2'>Big</t> text", { hint parseText _this }] remoteExec ["call"];
Is there any way to determine if a text is unicode?
Or alternatively, convert text to not be unicode
why though?
https://community.bistudio.com/wiki/lnbSort isn't working for some reason
it mentions that it doesn't support UNICODE
@tough abyss to change a flag's texture, see setFlagTexture
https://community.bistudio.com/wiki/setFlagTexture
flag textures are listed here:
https://community.bistudio.com/wiki/Arma_3:_Flag_Textures
@tough abyss β¦ ?
Hey
Yeah hello
So I wanna make a custom banner
How do I do that
I've never done such a thing
you open a software like gimp or photoshop and paint a banner.
Well what's the thing called cus I can't fiind it
uhh, I don't know the Thing.
but if you click both of the links Dr House posted a while ago, you'll know how to start.
first one is about showintg the banner in game, second one can give you a base canvas on which you can paint your stuff.
Yea thats what I was looking for
Cus I was searching arma 3 folders and couldn't find it
Thanks guys
just make sure to make the image brighter than you want, because it will be darker ingame for some reason
so, now two questions from me.
- If shadows are handled by engine and game mechanics at all, is it possible to execute a script when player is within the shadowed area?
- If not, can I do similar thing with light beams, so an EH or any script could be executed when player finds himself within the range of a flashlight?
I have flashlights in mind because afaik the lighthouse beam is handled locally and it would be weird in MP
- not (afaik) though you could try
getLightingfor the lolz (note that a player could have his shadows disabled) - try
getLightingthen yes
okay, I'll try that
getLighting doesnt do shadows
when player is within the shadowed area?
No, engine doesn't know if things are in shadow
it does light direction π¬ so it could be a (wonderful painful) way to check, with lineIntersectSomething
I'm trying to add a music EH to allow the while loop to choose another song to play after the current has finished but I must not be doing it right. (Aka ambient music)
private _musicArray = getArray (missionConfigFile >> "CfgMusic" >> "tracks");
private _musicPlaying = false;
while{true} do {
_randomMusic = selectRandom _musicArray;
_musicID = playMusic _randomMusic;
addMusicEventHandler ["MusicStop", {_musicPlaying = false;hint "done";}];
_musicPlaying = true;
waitUntil {_musicPlaying == false};
sleep 1;
hint "New Song";
};
*lightingAt
what? why are you using a loop?
the whole point of event handlers is not to use loops
getArray (missionConfigFile >> "CfgMusic" >> "tracks");
unless you're adding them yourself, I don't think that entry is necessarily updated with all songs
I'm trying to play a random song, then when the song stops start a new one. Should I do this another way?
just use the event handler
also _musicPlaying was a local variable
what you wrote was never gonna work anyway
altho the event handler is not gonna be reliable if you expect something else to interfere with it
also I don't think it'll work after loading from a save
so perhaps just use the loop
Β―_(γ)_/Β―
Thx man
This seems to work
private _musicArray = getArray (missionConfigFile >> "CfgMusic" >> "tracks");
while{true} do {
musicPlaying = false;
_randomMusic = selectRandom _musicArray;
playMusic _randomMusic;
addMusicEventHandler ["MusicStop", {musicPlaying = false;hint "done";}];
musicPlaying = true;
waitUntil {musicPlaying == false};
sleep 1;
hint "New Song";
};
waitUntil {musicPlaying == false};
->
waitUntil {!musicPlaying};
Got it
why not use the event to play a music directly? π
Can a pass a script into itself? Like
_sqf = [_sqf] execVM "someFile.sqf";
wat?
ik it's dumb and prob won't work
what you wrote doesn't obviously
Figured as much. Was worth a shot though
what is the point anyway?
Terminating a script from inside itself. Was going to give a player and addAction to terminate the intro sqf. But I do know another way I could do it (but not from inside the sqf)
you can do that
assign it to a variable that isnt private?
terminate _thisScript
From an addAction?
_thisScript is probably not available in this place
so _thisScript changed to thisScript should do the trick
I have no idea what you mean
Was going to give a player and addAction to terminate the intro sqf
the script you want to terminate is outside addAction then
_thisScript is a magic variable
it holds the handle to the currently spawned code
well but that won't work from another script
what he wants to do is run a script and then terminate it from somewhere else
so myScript = [] execVM "someFile.sqf"; .. then later use terminate myScript and it should probably work, i guess.
but dunno. i'm just a noob
I'll work with this to make it easy initPlayerLocal.sqf
_introSQF = [_playerUnit] execVM "introLocal.sqf";
_playerUnit addAction
[
"Cancel Intro", // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
terminate _introSQF;
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
50, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
the script is not even on this machine
you can't terminate it like that
then why on earth do you remoteExec it?
Oh yeah
If I wanted to run some code for a player that joins the server for the first time how would I do that? I saw onPlayerConnected but that seems to run every time they join.
Do you need to run the code on server or on client?
Client
I think you could just add a variable like _hasJoinedPreviously = false/true and save it to their profileNamespace. Disclaimer: I'm not the best scripter π
Then you could have persistence even between e.g. server restarts
sure but what if they restart the game?
the code never runs for them again
because it's in profileNamespace
Server could send another variable, e.g. a RNG'd code that would have to match and if it didn't, it would run the code again
That's fine. I only want it to happen once and never again
it never runs anymore
for their entire life!
yup
(well kinda)
well then store the player's UID on the server
check if the UID exists
if not run the code for them
If it's a popular mission he'll need a database soon, no? Just trying to keep the solution simple π
It's like 2 minutes long where they can do nothing and it's a replayable scenario so they would get annoyed
Ah, like a cutscene?
Yeah intro with music and some background info
What about playing the intro anyway and just adding some hint or such text that'd tell to e.g. press ESC to skip the intro?
Would this work in the intro.sqf?
(findDisplay 46) displayAddEventHandler ["KeyDown", "terminate thisScript;"]; //Kills intro.sqf when Spacebar is pressed
I think you need to add the key that kills the intro (?)
yo can anyone give me some insight on how do I make this trigger of mine only activate when there's no more vehicles of a given side present?
no, thisScript is a reference to the current script, which would be the display eventhandler if it exists at all
change the condition to sth like:
{side _x == east} count (vehicles inAreaArray thisTrigger) == 0
this seems to be working!
if I have an element of an array, how can I get the index for that element in the array?
find
It says that the object I'm looking for is in a folder called Orange
but i can't find the orange folder in PBO
am ib eing stupid or
bruh i cant upload images
A3_Structures_F_Orange_Humanitarian_Flags
Says to go there
but that doesn't exist
I'm already in Structures in PBO but can't find the folder
from UNPACKED data
for your steam install: steamapps\common\Arma 3\Orange\Addons\structures_f_orange.pbo
thank you so much
holy shit thank you
now gotta find out how to convert p3d to png
les go
what
β¦ a p3d is a 3D model.
hence the "what" π
Thank you for saying it lol
I'd be here for 2 hours looking for a p3d to png converter
lol
not that the thought didn't amuse me, butβ¦ π
so when starting the mission. inside initplayerlocal.sqf i have
if (side player == west) then {
_subtitles = [
[ "System", "Loading, please wait. This may take some time...", 0],
[ "System", "Almost done, final touches...", 10],
[ "System", "Loading complete, transmitting data...", 20]
];
_subtitles spawn BIS_fnc_EXP_camp_playSubtitles;
sleep 30;
0 fadeMusic 0;
sleep 0.1;
titlecut ["","BLACK IN",7];
playMusic "EventTrack01a_F_Tacops";
6 fadeMusic 1;
_camera = "camera" camCreate [12031.02,4828.08,0.92];
_camera cameraEffect ["internal", "back"];
sleep 30;
_camera cameraEffect ["terminate", "back"];
camDestroy _camera;
};
followed by ```sqf
[] spawn _EndSplashScreen;
_video = ["MissionIntro.ogv"] call BIS_fnc_playVideo; BIS_fnc_playVideo;
i was hoping this would set the player camera to a fixated point as specified, give them scenery to look at whilst some scripts time to startup in the background and make sure they are running and give everyone time to load in. then show a cutscene
if i remove the video at the end, and remove the cam terminate lines then it does just that but wont show the video or leave the camera
so your stuck staring at scenery
if i dont remove them. it plays the video with the text over the top and then returns you to normal after. but loses the scenery wait screen
i tried using sleep to delay the executions but it seems to ignore it, any idea why?
Any way to do a ingame screenshot?
I was thinking about some sort of satellite surveillance function But I do not wanna use the r2t function. Id rather have a stillshot being updated every few second
No... Unfortunately. Maybe with some extensions
I know yeah. Sadly RV Engine is not flexible enough like Source Engine
When i'm on foot zooning with right mouse button, if i press left control, the screen zoom out. This is supposed to happens?
Thanks in advance.
_winner = ( allPlayers inAreaArray _mapTrigger ) select 0;
[parseText "<t color='#000000'>" + name _winner + "<t color='#ffffff'> WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
```Why am I getting `error: type text`?
(Structured) Text != String
Remove parseText, you dont need it there
ah
thank you
I have also been using parseText in this line of code and it has been working for a while for some reason.
[parseText "<t size='1.0'><t color='#0000ff'>BLUE</t> TEAM WINS!", -1, 0, 6, 0, 0] remoteExec ["BIS_fnc_dynamicText"];
Then the error comes from + operator cos you are parsing till name winner
that function must be handling parsing internally but maybe it also accepts Structured Text
parseText "<t color='#000000'>" + name _winner + "<t color='#ffffff'> WINS!"
parseText "<t color='#000000'>" finishes first then + operator is trying to add name _winner to a Structured text, since + operator does not support (Structured) Text + String, it returns error.
Parentheses are your friend in this scenario :)
okay, makes sense
thanks
use format instead
Hi, could someone help me set up my environment for file patching? I am developing a mod and would like to be able to test code changes while the game is running. I have done quite a bit of setup already, mostly following this guide https://community.bistudio.com/wiki/CMA:DevelopmentSetup#Develop_with_unpacked_data but it still does not work.
So far, I have installed Arma 3 development branch via steamcmd, created directory junction to locate my mod source (and PBO) inside the Arma 3 directory, added a trivial function (print message to systemChat) to the mod addon for testing, and can run arma3diag_x64.exe with -filePatching and the mod enabled. In game, however, it appears to only use the packaged form of the mod, not the edit I make in the source code.
I did find some mention of file patching in the ACE development environment setup guide: https://ace3mod.com/wiki/development/setting-up-the-development-environment.html
They mention that use of MakePBO is necessary for file patching (i.e. Mikero's tool, not Addon Builder from Steam). Is this true? I'm in the process of trying Mikero's tools in the hopes this will solve my problem.
Ok, I have some progress after using Mikero's tools. Upon (arma3diag_x64.exe) game start, it appears to load the unpacked edited SQF function in my mod -- good! However, the source does not appear to be re-loaded upon mission restart in Eden editor. It only uses the source code from when I started the game. That is not sufficient for iterative development.
In short, with file patching, how do I get the game to reload the SQF source after I edit some code?
AHA! I needed the magical recompile = 1; attribute in my CfgFunctions entry. Now it works π
anyone here know how to activate a keypoint animation via trigger?
What does this have to do with scripting?
afaik not possible
yes unless you remap your controls.
PS: indeed not a #arma3_scripting question, #arma3_questions would have been a better channel π
argh, ty for heads up
is there possibly a method
where i use pausing?
im not sure if its cause im using 3den enhanced but im noticing a 'pause' checkbox
if i could somehow manipulate that i could choose when to activate the animation
hint "Lights going out."; _lighttypes= [ "Lamps_Base_F", "Land_LampAirport_F", "Land_LampSolar_F", "Land_LampStreet_F", "Land_LampStreet_small_F", "PowerLines_base_F", "Land_LampDecor_F", "Land_LampHalogen_F", "Land_LampHarbour_F", "Land_LampShabby_F", "Land_PowerPoleWooden_L_F", "Land_NavigLight", "Land_runway_edgelight", "Land_runway_edgelight_blue_F", "Land_Flush_Light_green_F", "Land_Flush_Light_red_F", "Land_Flush_Light_yellow_F", "Land_Runway_PAPI", "Land_Runway_PAPI_2", "Land_Runway_PAPI_3", "Land_Runway_PAPI_4", "Land_fs_roof_F", "Land_fs_sign_F" ]; for [{_i=0},{_i < (count_lighttypes)},{_i=_i+1}] do { _lights = getMarkerPos "facility" nearObjects [lighttypes select_i, 500]; {_x setDamage 0.95} forEach_lights; };
first time messing with scripting, and i picked up this script from a DayZ Medic video
it's meant to create a blackout in the surrounding area, and i can't get it to work. anybody know what the issue may be?
forEach_lights?
also don't use that deprecated for syntax, infact, you shouldn't even use for here, just use forEach
where would i use the forEach syntax? would i use it in replacement of the for syntax in line #27?
yes
the video is quite old, from 2017 i think, so that might be the reason why it's outdated
saw that people were saying it worked so i gave it a shot lol
it says i'm missing a semicolon somwhere
Post the code
u mean dis?
Nah, that's crap
oh lol
replace for with forEach as told above
yeah, i switched that and it's still giving me an error about missing a semicolon now
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
No need to be sorry. All good
_lighttypes= [
"Lamps_Base_F",
"Land_LampAirport_F",
"Land_LampSolar_F",
"Land_LampStreet_F",
"Land_LampStreet_small_F",
"PowerLines_base_F",
"Land_LampDecor_F",
"Land_LampHalogen_F",
"Land_LampHarbour_F",
"Land_LampShabby_F",
"Land_PowerPoleWooden_L_F",
"Land_NavigLight",
"Land_runway_edgelight",
"Land_runway_edgelight_blue_F",
"Land_Flush_Light_green_F",
"Land_Flush_Light_red_F",
"Land_Flush_Light_yellow_F",
"Land_Runway_PAPI",
"Land_Runway_PAPI_2",
"Land_Runway_PAPI_3",
"Land_Runway_PAPI_4",
"Land_fs_roof_F",
"Land_fs_sign_F"
];
for [{_i=0},{_i < (count_lighttypes)},{_i=_i+1}] do
{
_lights = getMarkerPos "facility" nearObjects [lighttypes select_i, 500];
{_x setDamage 0.95} forEach_lights;
};
is that the right way to do it?
{
_x setDamage 0.95;
} forEach nearestObjects [getMarkerPos "facility", _lighttypes, 500];
just use it like that
oh
i replaced the last 6 lines with that, and it's saying
"On Activation: Local variable in global space"
as an error message
_lighttypes= [
"Lamps_Base_F",
"Land_LampAirport_F",
"Land_LampSolar_F",
"Land_LampStreet_F",
"Land_LampStreet_small_F",
"PowerLines_base_F",
"Land_LampDecor_F",
"Land_LampHalogen_F",
"Land_LampHarbour_F",
"Land_LampShabby_F",
"Land_PowerPoleWooden_L_F",
"Land_NavigLight",
"Land_runway_edgelight",
"Land_runway_edgelight_blue_F",
"Land_Flush_Light_green_F",
"Land_Flush_Light_red_F",
"Land_Flush_Light_yellow_F",
"Land_Runway_PAPI",
"Land_Runway_PAPI_2",
"Land_Runway_PAPI_3",
"Land_Runway_PAPI_4",
"Land_fs_roof_F",
"Land_fs_sign_F"
];
{
_x setDamage 0.95;
} forEach nearestObjects [getMarkerPos "facility", _lighttypes, 500];
{_x setDamage 0.95} forEach_lights;```
like that
?
remove {_x setDamage 0.95} forEach_lights;
oh woops wait
and to avoid that error, wrap everything into a
call {
...
};
?
the
call
_lighttypes= [
"Lamps_Base_F",
"Land_LampAirport_F",
"Land_LampSolar_F",
"Land_LampStreet_F",
"Land_LampStreet_small_F",
"PowerLines_base_F",
"Land_LampDecor_F",
"Land_LampHalogen_F",
"Land_LampHarbour_F",
"Land_LampShabby_F",
"Land_PowerPoleWooden_L_F",
"Land_NavigLight",
"Land_runway_edgelight",
"Land_runway_edgelight_blue_F",
"Land_Flush_Light_green_F",
"Land_Flush_Light_red_F",
"Land_Flush_Light_yellow_F",
"Land_Runway_PAPI",
"Land_Runway_PAPI_2",
"Land_Runway_PAPI_3",
"Land_Runway_PAPI_4",
"Land_fs_roof_F",
"Land_fs_sign_F"
];
{
_x setDamage 0.95;
} forEach nearestObjects [getMarkerPos "facility", _lighttypes, 500];
call {
...
};
that's what i have so far
did you read what i say?
OH
OH I SEE
sorry im uh
a bit small brain currently
alright so it didn't give me error messages
gonna test the actual blackout rn
well, lights didn't go out
gonna try again in a different area, and it could also be the fact that i don't have all of the light variable names
thank you for the help
Hello everyone, i have a small problem with spawing smoke grenades via a script on a didicated Server. I am using this to spawn the grenade "_smoke = "SmokeShellRed" createVehicle _pos;", the grenade spawns but no smoke is coming out of it. In the Editor it works just fine. Dose someone know what im doing wrong?
@little raptor@winter rose, it's a script thing, i have a code that run when you press ctrl+key, and i want this code to run when the player use temporary zoom (it's a 3D mark to mark objects, so players may want to zoom to mark far away objects), but when he press ctrl the screen zoom out.
then you should rethink your design ^^
I tried to "cut" ctrl effect when inputAction "zoomTemp" is running, but i can't.
as Lou said check ctrl, see what it's mapped to
It's default Arma 3 controls, i never changed it.
Thanks for the answers.
I tried that to cancel ctrl effect while temporary zooning:sqf (findDisplay 46) displayAddEventHandler ["keyDown",{ params ["_control","_key","_keyShift","_keyCtrl","_keyAlt"]; private _onlyCtrl = !_keyShift && _keyCtrl && !_keyAlt; private _return = false; if (_key isEqualTo 0x1D && _onlyCtrl && inputAction "zoomTemp" > 0) then { systemChat "AAA"; _return = true; }; _return }];
While using temporary zoom, if i press ctrl, i receive the "AAA" message from systemchat, what means the event handler returned true canceling the key, but it stills zoom out.
I don't understand what is design in this situation? The combination of pressed keys, may be?
I mean, your design is quite ok actually
pressing Ctrl = disabling modification key if there is zoom
you should do a display EH on ctrl itself I believe
π
//[this, ["PERSE", {[getPosASL this, 25, 60, 1] call CBRN_fnc_spawnMist}]] remoteExec ["addAction", 0, true];;
