#arma3_scripting
1 messages · Page 165 of 1
The issue with for/sleep is that sleep won't actually sleep for 0.01 seconds, so timing will be off.
Most likely it'll just sleep for one frame, or two if you have very high FPS.
uiSleep?
Nah, the only difference with uiSleep is that it doesn't wait when paused in SP.
Thought that it's more accurate. I must have confused it with some other command.
Why?
Because the SQF scheduler only runs once per frame.
In-line with everything else that happens in the main thread.
you can do while/sleep 0.001 and use diag_deltaTime, but as you can't guarantee that your code will be called every frame under heavy script load, it's not entirely safe.
you can use diag_tickTime instead but the accuracy goes if the server's been running for a long time. On the plus side that's not a huge problem in Arma.
Proper method is to use an EachFrame mission event handler.
(with diag_deltaTime)
Ah I got confused and thought you meant that sleep might suspend for less than the specified amount of time.
Is there a scripting command to force AI to move forward for example? Waypoints aren't working for my intended use case
oh my yes awsome super cool woohoo Arma 3
if (isEngineOn Helo2) ExitWith {
"Pilot: BlackHawk We CanNot Help Wait One" remoteExec ["systemChat"];
};
god i love this game
its posible to detect when the player started and ended listening a radio in TFAR?
i saw this eventhandlers, but ontangent but its local for the player.
https://github.com/michail-nikolaev/task-force-arma-3-radio/wiki/API:-Events
what i want to do is to play a sound when another player starts and end transmiting on the radio
im not sure what OnRadiosReceived really does, i guess is an inventory thing
disableAI "move" and playActionNow/playMoveNow
Does that actuall ymove them or does it just play the moving animation?
ah, I'm trying to do it for a vehicle specifically. dont think it would work that way
You could try move. It's a bit lower-level than waypoints and sometimes works better.
If those are all numbers, vectorAdd
Don't use setPos + getPos. They're slow and use an inconsistent Z axis.
Try with getPosASL and setPosASL.
Hello. I'm executing this code with remoteExec (client and server). It's a timer.
How come that on dedi this only works (timer showing for the client) if I call this script twice, literally?
If you remoteExec it on client and server at the same time my guess would be that the countdown isn't initialized/transmitted to the clients before the while loop returns a false and isn't running at all. Would try to add a short sleep before the client sided code starts and check if it helps ^^
That actually did the trick lol thanks
waitUntil {([true] call BIS_fnc_countdown)};
Yeah that's the safest variant i guess ^^
I need some help with concating strings and then converting them into the right format to be read as a variable in a loop.
I'm making a group spawning script that I'm having do a bunch of stuff so I can split it later into simpler parts as needed. Issue I'm getting stuck on is naming each unit generated with a unique ID and then loading that ID into a generic variable I use later in the loop to assign skills, kits, random spawn dispersion, etc.
I keep getting the attached error about missing a ; which I think is because I'm trying to have the game read a string as a variable?
_unitCount = 5;
_groupID = createGroup OPFOR;
unitArray = ["vn_o_men_vc_01","vn_o_men_vc_02","vn_o_men_vc_03","vn_o_men_vc_04","vn_o_men_vc_05","vn_o_men_vc_06","vn_o_men_vc_07","vn_o_men_vc_08","vn_o_men_vc_09","vn_o_men_vc_10","vn_o_men_vc_11","vn_o_men_vc_12","vn_o_men_vc_13","vn_o_men_vc_14","vn_o_men_vc_15","vn_o_men_vc_16","vn_o_men_vc_17"];
Index = 0;
while { Index < _unitCount } do
{
_unitIdentify = format["unit_%1 = this", Index]
_unitID = format[unit_%1, Index];
_unit = selectRandom unitArray;
_unit createUnit [_dest, _groupID, _unitIdentify];
_unitID setSkill 0.5;
_unitID setSkill ["aimingShake", 0.15];
_unitID setSkill ["aimingSpeed", 0.30];
_unitID setSkill ["aimingAccuracy", 0.40];
_unitID setSkill ["commanding", 0.40];
_unitID setSkill ["courage", 0.40];
_unitID setSkill ["general", 0.30];
_unitID setSkill ["reloadSpeed", 0.30];
_unitID setSkill ["spotDistance", 0.20];
_unitID setSkill ["spotTime", 0.40];
_unitID setSkill ["endurance", 0.40];
Index = Index +1;
};```
missing ;
oh my god I'm dumb. I was looking where the # was, not at the end of the line
hey, it happens for all of us
Continuation error for mine. Now it seems I am getting a string instead of variable error
createVehicle
position: Object; Array format Position2D or PositionATL (PositionAGL if watercraft or amphibious) - desired placement position
Is helipad an object or just a postion?
What's the issue you are hitting with addAction?
Sorry I meant the inventory clearing
this addAction["Spawn MH-6", {createVehicle ["B_Heli_Light_01_F",helipad,[],0,"CAN_COLLIDE"]}] You could try it like this
_dest = getpos tgt1;
_unitCount = 5;
_groupID = createGroup OPFOR;
unitArray = ["vn_o_men_vc_01","vn_o_men_vc_02","vn_o_men_vc_03","vn_o_men_vc_04","vn_o_men_vc_05","vn_o_men_vc_06","vn_o_men_vc_07","vn_o_men_vc_08","vn_o_men_vc_09","vn_o_men_vc_10","vn_o_men_vc_11","vn_o_men_vc_12","vn_o_men_vc_13","vn_o_men_vc_14","vn_o_men_vc_15","vn_o_men_vc_16","vn_o_men_vc_17"];
Index = 0;
while { Index < _unitCount } do
{
_unit = selectRandom unitArray;
_unitID = _groupID createUnit [_unit, _dest, [], 0, "NONE"];
_unitIdentify = format["unit_%1", Index]
missionNamespace setVariable [_unitIdentify, _unitID];
_unitID setSkill 0.5;
_unitID setSkill ["aimingShake", 0.15];
_unitID setSkill ["aimingSpeed", 0.30];
_unitID setSkill ["aimingAccuracy", 0.40];
_unitID setSkill ["commanding", 0.40];
_unitID setSkill ["courage", 0.40];
_unitID setSkill ["general", 0.30];
_unitID setSkill ["reloadSpeed", 0.30];
_unitID setSkill ["spotDistance", 0.20];
_unitID setSkill ["spotTime", 0.40];
_unitID setSkill ["endurance", 0.40];
Index = Index +1;
};
Beware that in MP if unit is created in remote group with older syntax, the unit init will execute on calling client sometime in the future, after the unit is created on remote client, therefore the following code will fail:
// real example of the bad code
"O_Soldier_AR_F" createUnit [position player, someRemoteGroup, "thisUnit = this"];
publicVariable "thisUnit";
hint str isNil "thisUnit"; // true!
// the unit reference is nil because init statement has not been executed on this client yet
Not actually sure the _unitIdentify = format["unit_%1 = _unitID", Index] part works
Think it should work to what i changed it just use getVariable to get the unit
But watch out spawning to helis like this will allow them to spawn inside each other 😛
Can you post your addAction code?
hmm I do need to start and stop speak3d commands using the unit IDs that are sent to players from the units created by this. Is there a better way to do it?
Mhh what do you mean?
testing an addAction that does what you want right now
Shouldn't:
this addAction ["Spawn MH-6",{ _veh = createVehicle ["B_Heli_Light_01_F", getPosATL helipad, [], 0, "CAN_COLLIDE"]; clearBackpackCargoGlobal _veh; clearItemCargoGlobal _veh; clearMagazineCargoGlobal _veh; clearWeaponCargoGlobal _veh;}];
work ?
["Spawn MH-6",
{
//added a variable name to the helicopter by adding a variable name and equals sign to the left
_heliSpawn = createVehicle ["B_Heli_Light_01_F", getPosATL helipad, [], 0, "CAN_COLLIDE"];
//clearing all the inventory item types
clearMagazineCargoGlobal _heliSpawn;
clearWeaponCargoGlobal _heliSpawn;
clearBackpackCargoGlobal _heliSpawn;
clearItemCargoGlobal _heliSpawn;
//clearing the variable name from the helicopter so it doesn't cause any trouble later
_heliSpwan = objNull;
}
];```
Ahh SLIN you're too fast for me
I added the // comments in discord. may not work in-game with those.
@mellow jolt Can you explain to me why putting the unit in a Variable won't work for you didn't rly get you explanation ^^
Global commands are MP synchronized
Doing it normally will only clear it where the command gets executed ^^
Yeah in this case for the player using the action ^^
Also, because it took forever for someone to tell me this, if you need to transfer information from an addAction into a script you have executing inside of it, add params ["_target", "_caller", "_actionId", "_arguments"]; inside the action like so:
["Something",
{
execVM "scripts\somthing.sqf";
params ["_target", "_caller", "_actionId", "_arguments"];
}
];```
The Params are automatically generated variable created by the `addAction` that can be passed to things inside to do various things.
.
For instance you can make a self destructing addAction by writing it like this so it notes it's own actionId and removes it as soon as it's done executing. (_target is the action holder)
["Recall Helicopters",
{
execVM "sequences\helicopterStart_2.sqf";
params ["_target", "", "_actionId"];
_target removeAction _actionId;
}
];```
You could also have an `addAction` on an object that looked at who triggered with `_caller` it and use it as a booby trap to set off a script on someone who interacted with an object you place in the world.
oh I meant self destructing as in if you want the action to remove itself from whatever has it. Like a button you can only press once
that second addAction is for me as a zeus to let me have some helicopters lift off from an LZ once my players get out, but once they do, I don't need the action clogging up my menu, so it self destructs and deletes itself
sorry got distracted.
I'm not well versed with timing. I don't fully understand what you have under your correction of my code, but it sounds like there may be an issue where the unit variables may not be synchronized between players and the server possibly causing issues when I execute speak3d commands.
I'm making a (very late) horror op that has lots of audio based events and invisible entities using speak3d with individual speaker ID's so that I can stop them early if the players meet certain criteria or just because I'm trying to reuse as many audio files as I can and I stop them early in certain places. Having a unit variable get disconnected when trying to remoteExec to the players to cut that units speaker ID would be annoying if not immersion breaking in some spots.
Make the Variable containing the Unit public and it shouldn't be a problem
_unit = selectRandom unitArray;
_unitID = _groupID createUnit [_unit, _dest, [], 0, "NONE"];
_unitIdentify = format["unit_%1", Index]
missionNamespace setVariable [_unitIdentify, _unitID, true];
_speakUnit = missionNamespace getVariable [unit_1, objNull];
sorry, I've also not gotten my head wrapped around public and private variables yet. is it the use of missionNamespace setVariable that makes it public?
ahh I see
and having a player remote executing a function with setVariable in it set to public will cause them to phone home even though they are executing locally?
if set to true, the variable is broadcast globally and is persistent (JIP compatible) must cover that
Yes, it is also set for the local machine
Public and global are mostly used interchangeably
Yeah if the variable is set to public no matter which machine is setting the Variable it will broadcast to all clients + server. If you need the unit only known on the machin executing the code keeping it private is enough ^^
Private and global are different
Global means the variable is in the global scope. Such as mission variables, variables on an object, etc.
Private is only for local variables, i.e. variables that start with an underscore
Think saying you can keep them not public would be even more confusing in this context. But yeah you right bad wording ^^
_localVar = 0;
private _privateVar = 0;
TAG_globalVar = 0;
missionNamespace setVariable ["TAG_syncedGlobalVar", 0, true];
so the TAG_globalVar is accessible, but I would need to use getVariable or something to find it before I could call it?
if I wasnt on the machine that generated it
Global variables can be accessed by just writing out the name if you're in that same namespace
So these two statements are identical (if running in missionNamespace)
TAG_globalVar = 0;
missionNamespace setVariable ["TAG_globalVar", 0];
The second one is mainly for if you need to sync a variable across machines, or if you need to set a variable in a different namespace
with missionNamespace do {
TAG_globalVar = 0; // define var in missionNamespace
uiNamespace setVariable ["TAG_globalVar", 0]; // define var in uiNamespace
};
hay @tulip ridge i just want to say, iv been trying for years and years, to have my chopper script run the way it does, after you helped me , it works so great, your the Best mate ever
Nice, glad it's working for ya
thx you so much your the Best
You may want to check out: https://community.bistudio.com/wiki/Multiplayer_Scripting
to get some of the basics
yeah, I've just started learning at the beginning of October and started on the effects side. I'm just recently coming around to the network side of things
i started learning 15 years a go and i still need lots of work
only thing i can do is help you with your GolfSwing he he
Arma 3 1st, Life 2ned, he he
The box itself is where you can put code that will run when the vehicle respawns.
The tooltip shows what parameters are passed to the code you put in
Would be easier to use params ["_newVehicle"] but yeah
If you don't need to do anything extra with the vehicle, you can just leave it blank
It works. you are a savior.
Hi guys. Im making a module for zeus to change the fog based on the setFog Array. Parameters of the fog are to be set by sliders. How can i read the choosen value from the slider to pass it over to private variable upon execution of the script, after i press the "OK" button to launch it?
I think i figured it out. Is it good?
_fogTime = sliderPosition 1900; _fogDens = sliderPosition 1901; _fogDecay = sliderPosition 1902;
_fogAltitude = sliderPosition 1903;
_fogTime setFog [_fogDens, _fogDecay, _fogAltitude]; ```
ANyone know where to find the mission config file?
As in, this thing;
I'm trying to add a font to my mission by putting the .paa & .fxy folder in my mission folder, then editing the config file to add it. But I can't find where to do that?
is in the init?
Mission's config is not Mod config
So that screenshot is actually Mod config?
Yes
you scroll down below the "configFile" part of tree to find "missionConfigFile" 
could I run a command in my mission's init file to add a font?
or in my mission's config
No
https://community.bistudio.com/wiki/Arma_3:_Adding_Custom_Fonts seems to say it has to be a mod 
and https://community.bistudio.com/wiki/Description.ext#Custom_Content_Definition doesn't contain CfgFonts or whatever as valid config entries for mission file 
Yeah I get it, sorry to be a numbskull lol
I'll pack it into a 1kb addon for my mission
looks good I'd say... but whats the range of the _fogTime slider? i guess its 0-1 but what when anyone wants a time bigger than 1 second
im using sliderSetRange [1900, 0, 600]; inside module init upon GUI launch
so hopefully the slider range will be 0-600
didnt test it yet
Use systemChat str _var and diag_log _var to debug.
Copy that Be There in No Time---- WooHoo Arma 3 Yeah
oh no,,, we lost contact with the Aircraft WooHoo Arma 3 yeah lol
im having too much fun in Arma 3
what a great game
and what great help we have here on Discord
all my fun in Arma 3 is because of all the great guys that helped me here in discord, thx to all you guys you guys are so Awsome, i freeking love you guys
Good evening, please advise - writing a script for my mission to play random music when activating the radio, but arma gives an error, referring to “this” before “say3D”. And so with all methods of playing sound, the eternal error with this. Script:
private _sound = nil;
this addAction ["Поймать радиостанцию", {
if ((isNil "_sound") == true) then {
_sound = this say3D format ["music\radio_music%1", random 4];}
else {deleteVehicle _sound}
;},nil, 1.5, true, true, "", "true", 3, false, "", ""];
Thanks in advance!
No. The ingame script doesn't know that there is a transmission coming in
That is fully handled inside teamspeak.
The game knows that another player is speaking, but not whether that speech is reaching you.
So you can detect when someone else is sending (Just add OnTangent on the player and remoteExec broadcast the information to other players) but not detect when player is receiving something.
The statement of the code doesn't know what this is, because it runs in a different scope.
this addAction ["Поймать радиостанцию", {
params ["_target"];
private _sound = _target getVariable ["TAG_sound", objNull];
if (isNull _sound) then {
_sound = _target say3D format ["music\radio_music%1", random 4];
_target setVariable ["TAG_sound", _sound, true];
} else {
deleteVehicle _sound;
};
}, nil, 1.5, true, true, "", "true", 3, false, "", ""];
You're my savior! Thank you so much!
I made some other changes, such as removing the private _sound = nil;, because it doesn't do anything on its own, and the code inside the action doesn't have access to it anyway, so it does nothing.
This also saves the sound to the object making the sound, since it wouldn't have access to variables from a previous time it was used
{heliArray select 0} lockInventory true;```
Wrong brackets type. You have used `{ }` which are for enclosing a Code data type. You should use `( )`, which are for forcing order of operations.
No.
No
Just create the array before adding the action
Also that's a global variable, which means it should be prefixed / tagged.
If you're unfamiliar, it's just an identifier that's unique to you, the mission, the mod, etc. to prevent conflicts.
For example, BOT_heliArray, or whatever you would like
Nice, thanks!
It’s expensive so that remote exec every time someone transmit? Or meh ?
You're still doing {heliArray select 0}
Well yeah, you're doing pushBack [0, createVehicle ...]
pushBack always adds to the end of an array, it doesn't accept an index, if that's what you're trying to do
pushback add it to the end
So just do pushBack createVehicle [...]
GAS_heliArray = [];
this addAction ["Remove Last Spawned", { GAS_heliArray deleteAt (count GAS_heliArray - 1) } ];
this addAction ["Request MH-6", {
private _v = createVehicle["B_Heli_Light_01_F", getPosATL GAS_helipad, [], 0, "CAN_COLLIDE"];
GAS_heliArray pushback _v;
_v lockInventory true
}];
*dont use chatgpt 🫣 *
chaty trends to create weird syntax on sqf
Usually new ppl in this channel, asking why the code dont work... usually cames from chatGPT, nothing personal
not meant to be rude
if you are new scripting you are doing it really good 😄
Don't blame him, a lot of ppl comes here with chatgpt scripts lol
it has nothing wrong either, in other languages works quite well, just like in sqf it dont works at all
Yeah
Nothing wrong with it...except the massive environmental damage, frequent hallucinations, theft of other people's work, etc
fixed the {}
It's because the vast majority of code will be bad, that goes for any language.
ChatGPT just spits out the same stuff it finds, which causes a feedback loop of bad code being the most of what people see.
FYI, array deleteAt -1 is not supported. That syntax does not support negative indexes and can simply silently fail if you try it.
Only syntax 3 (array of indexes) supports negative indexes. Try array deleteAt [-1].
Also the statement of the second action only ever locks the vehicle of the first object in the array, not the last thing that was spawned
@slim trout How is your dialog opened?
private _vehicle = createVehicle [...];
GAS_heliArray pushBack _vehicle;
_vehicle lockInventory true;
It didn't. It doesn't say syntax 1 supports negative indexes.
Are you using BI's contrived dialog system and the module config property?
Because the vehicle was deleted but the reference wasn't removed from the array (because deleteAt was silently failing), the last element in the array would just be a leftover objNull. Obviously attempting to delete that doesn't do anything.
Yes, originally negative indexes weren't a thing in Arma, so people got used to relying on the "silently fail when negative" behaviour. So when negative indexes support was added, it could only be added as part of a new syntax, to avoid breaking the old usage.
Dialog works, pops out, even the function to apply the fog works. The only issue Im facing now is making sure the slider range is not default 1-10
Was thinking about writing a function for dialog opening
Ah I see
Yeah, having a function dedicated to initializing a dialog isn't a bad idea
Yea. The one thing im facing right now is implementing the slidersetRange. Wrote a simple script like: sliderSetRange [1900, 0, 600]; sliderSetRange [1901, 0, 10]; sliderSetRange [1902, 0, 1]; sliderSetRange [1903, 0, 5000]; and then adding a line on onLoad = "_this call compile preprocessFileLineNumbers 'fogInit.sqf'"; seems not to work
will simple _x sliderSetRange [1900, 0, 600]; work?
Do like this:
params ["_display"];
_slider = _display displayCtrl <idc>;
_slider sliderSetRange [1900,600];
idc is 1900
Since you're passing _this from the onLoad event, which contains the display
and there are 4 sliders on this gui
Right, I'm only showing the basic principal 😃
It's more explicit this way, think the form where you use the idc rather than the control only works with createDialog
Do i need one _display param per slider?
Nope, that's for the whole function
params ["_display"];
_slider1 = _display displayCtrl 1900;
_slider2 = _display displayCtrl 1901;```
That won't work, it will only work when you call the function like so:
onLoad = "_this call compile preprocessFileLineNumbers 'fogInit.sqf'";
Since the display is stored in _this
thats how im calling the script
but that event only fires after the dialog is created?
Wait, does createDialog raturn the display now?
Looks like a nope
i got it like
{
idd = 6000;
movingenable = 0;
onLoad = "_this call compile preprocessFileLineNumbers 'fogInit.sqf'";```
Inside your fogInit file is where you'd initalise the sliders
yes
Using the code I gave it should work, I was confused because you posted _dialog = createDialog "Fog_Module";
Which wouldn't make sense inside the onLoad event 😛
a yea, thats the optional thing
was going to delete the onLoad line and just launch the gui trough the function
which then would be added to zeus module
so adding params ["_display"]; _slider1 = _display displayCtrl 1900; _slider2 = _display displayCtrl 1901; to Fog_init
will work then?
Doesn't matter enough
Works perfectly, thanks!
I'm trying to pass a local variable _r to an event handler:
_unit1 addEventHandler [
"Killed", {
systemChat "TEST STRING"; //this shows up in systemChat
_r = _unit getVariable ["VLRS_AT_R",0];
systemChat str _r; //this doesn't. I don't even get an error message that _r isn't defined, and I don't get "0" or "" either.
}
];```
What am I missing?
_unit is undefined in EH -- missed params ["_unit"];.
fixed it, cheers. Didn't realize you needed to define the default params on the EH. 👍
Just look in BIKI: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed
Those are just names for what the passed value is
They could be anything you'd like
Is there an EH/clean way to detect when somebody changes their FOV? aka scopes in/zooms in?
hi, in my clan a really big problem that some of them is a loot monster, always tries to loot enemy bodies. If i spot them from zeus i strike them with lightning, but most of the time i can't see it. Can someone share a script with me, when someone opens a dead enemy's inventory a zeus lightning strikes down? maybe a hint with the player's name would be great also
Standby, this might be exactly it
Yea works great, ty 🙂
👍
Now my follow up, is there a clean way to find out if somebody is just zooming in with right click/+
Not really
You could add an key handler for right click, but that's kinda meh
Yea I had a feeling it may come down to that, I'm trying to avoid locking anything to specific keys
That EVH for scoping is a great start tho
There might be an action for it, i.e. https://community.bistudio.com/wiki/addUserActionEventHandler
Yeah there's zoomTemp and some camera actions
Can't grab specific ones easily on my phone, but you can just search for "camera" / "zoom"
I’ll have a look tomorrow, thanks for all the suggestions!
Heya all, my marker that I create via create3DENEntity wont accept the Color change.
_mrk set3DENAttribute ["Color", ["ColorRed"]];
// or
_mrk set3DENAttribute ["Color", "ColorRed"];
wont work, does someone know a fix? 😄
Wiki says you need an array
RGBA array
"baseColor", not "Color"
Also, I'm really dubious of that claim about it being an array on the wiki. I don't think that's true. I think it's a string with a CfgMarkerColors class, like every other case where you manipulate marker colours.
I'm having a ton of trouble with titleText, cutText, and valign.
I'm trying to fade out the screen, display one group of text of text at the top of the screen, add another below that without hiding the first, then add a third, and then fade all text and fade back in. I can't get valign to have any effect however and I can't work out how titleText and cutText is interacting as far as if they are overwriting each other or I'm just not using the cutText layer correctly.
This is the text script I'm working with right now
2 cutText ["", "PLAIN",0, true, true, true];
titleText ["", "BLACK OUT",3];
uiSleep 3;
1 cutText ["<t size='3'><t color='#ffffff' valign='top'>Lorem Ipsum</t></t>", "BLACK OUT",3, true, true, true];
uiSleep 6;
2 cutText ["<t size='3'><t color='#ffffff' valign='top'>Lorem Ipsum<br/><br/>Lorem Ipsum</t></t>", "BLACK OUT",3, true, true, true];
uiSleep 6;
1 cutText ["", "PLAIN",0, true, true, true];
2 cutText ["", "PLAIN",0, true, true, true];
titleText ["", "BLACK IN",3];```
the second text block being a repeat of the first with the second text section added is an attempt to solve the issue of the second cutText covering the first, but now neither of them are showing
holy cow wow
i just use BIS info TXT
mayb theres sonthing in here can help you
there many diff kinds of BIS fnc infoText
I wasnt aware of that function, I'll have to look througyh them, but I have this text set to an audio track so the timeing is limiting
yeah i see im sorry m8 im not good enought to help you
mayb DART can help hes a super pro
ooh, BIS_fnc_dynamicText looks promising
yes
can you just run an intro with music and txt in it
i put all that stuff in an Intro
and then give the player an optins to play the intro or not in the params
well that what i do anyway it may not be the best way
heres a small EX of 1 of my intros
i hope that helps you my brother
BIS_fnc_dynamicText is actually perfect, but it looks like it's covered by titleText. Testing to see if I can work around it
Thanks for the tip
Got it sorted, but it does require a few more pieces to keep the game from messing with the text and black out mask. Here's the final product if you want to use it in the future.
private _otl0 = ["otl_0"] call BIS_fnc_rscLayer;
private _otl1 = ["otl_1"] call BIS_fnc_rscLayer;
private _otl2 = ["otl_2"] call BIS_fnc_rscLayer;
private _otl3 = ["otl_3"] call BIS_fnc_rscLayer;
private _otl4 = ["otl_4"] call BIS_fnc_rscLayer;
//Fade out the screen, speech, environment, and sounds (leaving music for audio effect)
_otl0 cutText ["", "BLACK OUT",3, true, true, true];
ACE_Hearing_DisableVolumeUpdate = false;
3 fadeSpeech 0;
3 fadeEnvironment 0;
3 fadeSound 0;
uiSleep 3;
//lock in the fade out for the duration of the text
_otl0 cutText ["", "BLACK FADED",13, true, true, true];
//text blocks
["Lorem Ipsum", 0, 0.05, 13, 3, 0, _otl1] spawn BIS_fnc_dynamicText;
uiSleep 3;
["Lorem Ipsum", 0, 0.15, 10, 3, 0, _otl2] spawn BIS_fnc_dynamicText;
uiSleep 3;
["Lorem Ipsum", 0, 0.25, 7, 3, 0, _otl3] spawn BIS_fnc_dynamicText;
uiSleep 3;
["Lorem Ipsum", 0, 0.35, 4, 3, 0, _otl4] spawn BIS_fnc_dynamicText;
uiSleep 8;
//fade back in
_otl0 cutText ["", "BLACK IN",3, true, true, true];
3 fadeSpeech 1;
3 fadeEnvironment 1;
3 fadeSound 1;
uiSleep 6;
ACE_Hearing_DisableVolumeUpdate = true;```
This would be executed locally for each player using execVM
i wanted to use object as key for hashmap but it isnt supported. can I use "str object", is it reliable?
Depends on your situation. IIRC save/load and/or MP can make mess with it
oh saving wont be a problem as the hashmap is recreated from time to time
I am not 100% sure about save/load but MP surely can do it
ok
But if that's what you really want, you can reconsider the idea since setVariable can work
setVariable how?
yourObj setVariable ["YourValue",0] can do the trick no?
An object can accept setVariable, which basically do the same thing with HashMap'ing an object and store a value within, no?
ah i see. but cant use that im building a list of objects
HashValue
Just be aware that it changes between sessions
Wait, list of object? What it does mean
i mean like this: ```sqf
devicesinEnemyBases set [_key,[_side,time,_device,_fob]];
And what is _key in this context?
That sounds what you really can do with setVariable
sorry i dont get it XD. maybe too early here or something
but im happy with the current implementation
My theory:
devicesInEnemyBasesbeing an array which stores objects- The objects within store values
[_side,time etc]usingsetVariable
Mainly because I'm not sure how that HashValue workarounds can work 100%ly
so you mean like creating a regular array and not hashmap where the objects are stored?
That's my suggestion/method
ah ok
well hashmaps are fast so... i doubt performance is a problem
so if hashValue works im happy with that
If you're going to use devicesInEnemyBases in loops, it's better if it's an array.
ok might change to that because I also need to delete the objects from the hashmap and I dont know if deleteAt works well in hashmap foreach loop
str object is a bad idea because depending on object its output can change
if its a vehicle it will return group name of commanding unit
if you assign vehicleVarName later, it will change to that
hashValue object is the way to do it
oh right, wont be using that then
Don't see any problem:
{
if (_deleteKey) then {
_hashMap deleteAt _x;
};
} forEach (keys _hashMap);
cool
but you are using keys...
And?
if object isn't null you can do _hashmap deleteAt hashValue _object
i need to check the values too before deleting
When I use objects as keys I sometimes add Deleted EH to the object so it cleanups the hashmap it was used in
ok thx, didnt know those commands even existed. I would prefer the direct hashmap loop though
CODE forEach HASHMAP has both keys and values in it as _x and _y
It's also possible, in this case _y is values.
yep i know
While iterating through them is possible with forEach, it is less efficient than looping through Arrays.
hard decisions 😄
You shouldn't delete while looping over sth
forEachReversed at least
So e.g. you should get the keys separately and loop over them, then check the values using get (in a separate container)
That's for arrays
Yeah just realized context
Hashmaps don't have a "direction" exactly so...
It might work tho. Depending on the hashmap implementation
i dont think its a big deal
It can lead to stuff skipping for example
In the worst case it can lead to crash (don't remember how safe the engine looping was so could be either here)
I'm surprised this code prints all the keys and doesnt skip anything ```sqf
_hm = createHashMapFromArray [["a", 1], ["b", 2], ["c", 3]];
{
systemchat format ["test %1", _x];
if (_x == "b") then
{
_hm deleteAt _x;
};
} forEach _hm;
Can there be skipping with forEach HASHMAP? 🤔
skipping is concern yes
Oh yeah there can be
Well hashmaps in Arma are arrays of arrays
The inner arrays can have skipping yeah
Why order isn't guaranteed then though?
Because of hashing
Oh yeah, makes sense
h = createHashMap;
for "_i" from 1 to 10 do {h set [_i, _i]};
{h deleteAt _x} forEach h;
h
``` => `[[6,6],[10,10],[2,2],[4,4],[5,5]]`
h = createHashMap;
for "_i" from 1 to 10 do {h set [_i, _i]};
{h deleteAt _x} forEach keys h;
h
``` => `[]`
Basically this is how the hashmap works in A3:
hash key, and % by buckets count to select an array (i.e. bucket), then put the key value in that array
I was thinking that forEach does keys HASHMAP by itself already
No it just iterates each outer array then each inner array
weird question but are keys and *values * command return in correct order?
just asking because hashmaps usually dont have order
toArray
They do have an order it's just not guaranteed to remain the same after you add sth
thats what i meant
Well in this case you don't add anything so keys and values commands should iterate in the same order
sounds bit hazardous 🙂
because i do deleteAt
like Sa-Matra pointed out
I will probably just use array then. thx for the help guys 🙂
hashValue, or netId
str object is not reliable.
If someone uses setVehicleVarName, that changes
It seems that I am late to the conversation.
No, it wouldn't work well.
On C++ side that is true, on SQF side the difference is so small that it really doesn't matter. The main cost there is having the _y variable in the loop too.
Then I think it makes sense to add, for example, word "slightly".
it is faster to lookup data from a hashed key (without having to parse through all items)
ahh i see ok thx Lou
For everything 
Searching 842 files for "createHashMap"
2114 matches across 116 files
wow i never use them before

awsome
book mark lol
looks cool
i guess cuz i make 10 player missions i have hardly a need
it does not matter the amount of players, but the systems used 🙂
Hey buddy, if you understand data arrays, you will also understand Arma's HasMap basics in data structure that contains key-value pairs. Otherwise, there is no need to learn it and use this advanced system in a basic code. This is my opinion.
Hashmaps aren't that advanced, they're just a tool that can be used for particular data
hashmaps are my friend
they keep me safe at night from all the unstructured data that lurks in the dark
boo
yes realy. but i didt find something to that waht i need to do in forums
You have (un)fortunately this channel for such purpose
okey, let me explain
- what are you trying to achieve (different from "how do you want to do it")
- where do you get stuck
ideally, use steps (e.g "I want to get all soldiers around said vehicle, then if there is room for all of them put them in it")
tldr. You cannot jump into the conclusion
Not even specifically, it's horrible for any programming language
Also TIL you can change what message you reply to with Ctrl and Up/Down arrow
(doesn't work for me 🥲)
to put it very briefly, the following problem:
I've tried different ways to fix a bug for my Zeus scenario that keeps happening on my server.
To fix this bug, I have to spawn VirtualCurator_F a unit (preferably (Class C_Soldier_VR_F)) in the locked interface of (Class ModuleCurator_F) at the start VirtualCurator_F of the mission, which should not be defined as playable in the editor, but only serves to reflect the unit as Zeus. So that means, the unit should spawn at start, be the character/player unit of Zeus, but not be played by him or something like that, but should be the character of Zeus (immortalized and placed in the editor)
wait, rewind a bit, what is the bug? first things first 😄
on my server, when I load the addon EZM, I have the choice to create a playable character and join a side channel, as soon as I select (Create Character) it loads the character and puts me in the 1st person so I can't do anything more in any of my Zeus slots. Because he can't find a playerZeus to what he can apply it to. when I turn it off with the player spawn, then the EZM interface of zeus appears but plays an error code sound all the time and repeats in the bar at the top "FinalBiologic is now the game master"If it doesn't go away, I place a unit for taxation, but if it does, I never come back to the Zeus interface afterwards. Regular everything works on my mission I tried it for so long and also made my own watcher perspective after death for a few seconds. But for that I have to use "Respawn 3" in the description ext and turn off the respawn on start, which then leads to leads to an error code (because the respawn is only generated by Zeus) no respawn found, which then closes the circle. I can record a short video
it's ok
but yeah it's a mod-related bug, so custom script workaround it is (unfortunately)
unless you can convince EZM to update their thing ofc 😄
my editor and script settings, in MP it works. but you see the error code in the left corner after start in MP. i will show now on server (i will put it on youtube and send a link thats better i think right?
_mrk set3DENAttribute ["Color", [1, 0, 0, 1]];
Didnt worked
So wiki is wrong then
Do what NikkoJT said
The Error on my Server https://youtu.be/9sCiRLm1__0?si=alEV2LpohMllSSFS , The Settings of Mission + description... https://youtu.be/WC6uVnrgpzw?si=TTrKm0cBvB1w9B7y its becurse i dont have a player as zeus. so, becurse that i asked for the help here
Did work, thanks!
hey i was curious if it was at all possible to animate the rotor blades of a helicopter? what i'm trying to achieve is a crashed helicopter where the rotor blades are still spinning (ideally a bit slowly), i've specifically tried using
this animate ["hrotor", 0];
and have played with different values for it as well as animateSource and have dug into the config files and used animationNames to try different stuff to no avail, does anyone have any ideas?
So i am dealing with this wierd problem.
When I call my function, it does not call the function. When called, it is expected to to exit early and re-spawn itself.
When I spawn the function it works fine.
Easy enough work around, just spawn the function.
But what is going on with it not even calling?
Your debug variable is undefined, however the error only shows when it is run scheduled.
Also diag_log doesn't return anything
And if it did return the message that was logged, you would log your message twice
I think you missed the issue. The debug variable is undefined (because for some reason, my XEH_preinit function didnt run).
So if i call the function, it should get an error that the debug is undefined. It doesnt.
When I call the function, it does not call.
When I spawn the function, it does get called (rather, spawned) and it throws an error that debug is undefined.
No, because you wouldn't get a pop up error for unscheduled (i.e. called) code
.
Also, if set the debug variable, spawning will result in 2 logs, then an error cause im not passing any params
But calling results in no erros and no logs
*in most cases
I spawned it just now. I got my logs and errors.
I called it, i should get the first log at least, and if it works correctly, I should get 2 of the first log (call -> log -> exitwith into spawn -> log -> errors that end execution).
I dont get any logs. I dont get any errors (which I shouldnt get any errors? I didnt know call didnt throw errors)
Yeah unscheduled code usually doesn't display pop up errors
The first thing I see is that you're setting message to the return of diag_log, which doesn't return anything, and then outputting that message.
But that shouldn't be any different between scheduled and unscheduled
Oh i see. I didnt notice that... ops. But that will still log something. I still get the logs from spawning
ill retry now.
I mean, it should return nil and then log nothing since the input is nil
diag_log having some return when running in scheduled would be... interesting
_msg = diag_log format ['[BAX] (%1,%2) %3', _fnc_scriptName, LINE, "Drop Pod activation called: " + str _this];
_msg will be nil. But the right hand still executes and logs that
I mean for the second diag_log / hint
the stuff below wont, yeah
Which you seemed to imply you were getting, but I could've misunderstood
things are working better. I fixed the debug variable not getting initialized.
But the issue is still there.
I ran a diaglog that printed the debug variable value. It is set.
So the droppod function got called, it should hit that first debug log, logs to output.
Then it exits and re-spawns itself, log again twice, then start throwing errors because there weren't any necessary params and end execution at least.
Also, since it is getting re-spawn, shouldnt it start printing out those thrown errors on screen?
but there is not anything...
i might be doing something stupid. I am fine with the workaround. I just want to understand what is going on here that I dont understand, and what i mistake might be making
I am doing something stupid. But also something i have somehow never ran into before. I was just missing a ; that was stopping the call? I have never seen that before. Oops
Odd, I thought syntax errors would cause errors on startup when they're compiled
You can also open the file in ADT (i.e. open the file so you can edit the copy) to check basic errors
same. Another mistake is when i was testing with spawn, I was expecting errors since i was passing an object needed, so I just didnt read all the errors.
Hello guys. Is it possible that the deleteTask function is so slow that can actually delete the created one in this code? (It's a PVP scenario, the same task can appears from time to time).
If I put a sleep in between the deleteTask and createTask functions, this does not happens (the task is not deleted)
is there a way to define the size of an image use in a composeText command? I'm trying to display some images over a black cutText background, but my images just show up tiny.
private _otl01 = ["otl_01"] call BIS_fnc_rscLayer;
_text_1 = composeText ["", image "images\outro_1.paa"];
_otl00 cutText ["", "BLACK OUT",3, true, true, true];
uiSleep 3;
_otl00 cutText ["", "BLACK FADED",300, true, true, true];
[_text_1, 0, 0.5, 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText;
uiSleep 5;
_otl00 cutText ["", "BLACK IN",3, true, true, true];```
There doesn't seem to be a way to apply formatting to the actual image instead of the text
I'd suggest using an RscPictureKeepAspect UI control instead
You could try using structured text with the extra attributes for the img tag described here: https://community.bistudio.com/wiki/createDiaryRecord (in spoiler at the top), but I don't know for sure if they work outside of diary records.
unfortunately it doesn't seem to
Well no, not like that, use it in a structured text string, not with the image command
private _otl00 = ["otl_00"] call BIS_fnc_rscLayer;
private _otl01 = ["otl_01"] call BIS_fnc_rscLayer;
_text_1 = parseText "<img size='1' image='images\outro_1.paa'/>";
_otl00 cutText ["", "BLACK OUT",3, true, true, true];
uiSleep 3;
_otl00 cutText ["", "BLACK FADED",300, true, true, true];
[_text_1, 0, 0.5, 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText;
uiSleep 5;
_otl00 cutText ["", "BLACK IN",3, true, true, true];
Should allow you to change the size as needed
like this?
Works perfectly, thank you!
sigh New issue. There seems to be a defined area in the center of the screen where the text/image can display no matter the size. What should I be looking into to overcome this? I assume it's a UI element?
Nevermind. I'll just make the text block taller
That's the default size of BIS_fnc_dynamicText but you could define pos and size on your own
[_text_1, [posX, width], [posY, Height], 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText
Best check out https://community.bistudio.com/wiki/Arma_3:_Pixel_Grid_System to get the right size and pos ^^
It could look something like this
//Centered Version
private _otl00 = ["otl_00"] call BIS_fnc_rscLayer;
private _otl01 = ["otl_01"] call BIS_fnc_rscLayer;
_text_1 = parseText "<img size='10' image='\a3\Data_f\Flags\flag_Altis_co.paa'/>";
_sizeW = 150;
_sizeH = 90;
_otl00 cutText ["", "BLACK OUT",3, true, true, true];
uiSleep 3;
_otl00 cutText ["", "BLACK FADED",300, true, true, true];
[_text_1, [0.5 - pixelW * pixelGrid * (_sizeW/2), pixelGrid * pixelW * _sizeW], [0.5 - pixelW * pixelGrid * (_sizeH/2), pixelGrid * pixelH * _sizeH], 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText;
uiSleep 5;
_otl00 cutText ["", "BLACK IN",3, true, true, true];
//Centered but lowered
private _otl00 = ["otl_00"] call BIS_fnc_rscLayer;
private _otl01 = ["otl_01"] call BIS_fnc_rscLayer;
_text_1 = parseText "<img size='10' image='\a3\Data_f\Flags\flag_Altis_co.paa'/>";
_sizeW = 150;
_sizeH = 90;
_otl00 cutText ["", "BLACK OUT",3, true, true, true];
uiSleep 3;
_otl00 cutText ["", "BLACK FADED",300, true, true, true];
[_text_1, [0.5 - pixelW * pixelGrid * (_sizeW/2), pixelGrid * pixelW * _sizeW], [0.9 - pixelW * pixelGrid * (_sizeH/2), pixelGrid * pixelH * _sizeH], 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText;
uiSleep 5;
_otl00 cutText ["", "BLACK IN",3, true, true, true];
Switched the image so try it with your own ^^
Is there actually a way to clamp the image sizes so that their vertical heights are clamped to the players screen height? I'm worried that it may work on my monitor and resolution, but not on all my players.
The images I'm using are all the same page of text cut into blocks with transparent windows cut out so the end effect is a page of text fading in one paragraph at a time
I somehow have another client 20 seconds behind in serverTime 
estimatedTimeLeft fixed it, still very strange
Hello. Does anyone know if it's possible to disable ace hearing in game through something like a function? Thanks you 🙂
Just go to the addon options and disable it
Are you not trying to disable it entirely or something?
The setting for it is how you can turn it off
I'm wondering if there's a way where I can turn it off while in game but I think the menu seems like the only way.
not possible because the create function wont be reached until code before that is executed
unless a new thread is created but why would that be done
maybe you need to use unique _taskID and not use the old one
is player action ["GunLightOff", player]; working? it doesn't seem to have any effect.
A workaround: https://community.bistudio.com/wiki/enableGunLights
i thought that was for ai?
Didn't check.
doesn't seem to work sadly 😦
adding a small sleep solve this problem, it's weird
the first time that that code runs, it works, the task is created normally, the second time, it creates a new one (you can see in the map) but less than a second later it gets deleted, then the third time works normally lol, forth time don't... and so on
not convenient for my scenario
A workaround:
_taskExists = [_taskID] call BIS_fnc_taskExists;
[...] call BIS_fnc_taskCreate;
if (_taskExists) then {
[_taskID, "CREATED"] call BIS_fnc_taskSetState;
};
hmmm interesting, a completed/failed/canceled objective can be "recreated"?
I think so.
gonna test it out, thanks Schatten
Hm, works for me.
so it must be a bad mp sync
First time > task cancelled > second time (also it notify twice)
i wonder why there isnt flatbed tempest? can this be done via script? I tried removing textures but it looked quite bad
try just
player action ["GunLightOff"];
i've been working on a mission that utilizes that and it seems to work for me
ace_hearing_disableVolumeUpdate = true;
THANK YOU! I somehow missed this and spend several hours yesterday and today trying to decipher how to apply the pixelGrid system and was coming back to ask for more help and just noticed that you actually just showed me how yesterday.
this worked, thank you
i think my problems may just have been arma jank?
Kind of. Weapon mounted light/laser is lil bit janky feature
I've yet to load up ace and try that yet but how did you find that? I only see a couple of mentions on google.
_particle = "#particlesource" createVehicle getPos player; //doing createvehicle and createvehicleLocal same result
_source1 setParticleParams [
["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8],
"", "Billboard", 1, 3,
[0,0,0], //start at 0 0 0
[0,0,0],
0, 0.005, 0.003925, 0.1, [0.25, 0.75],
[[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]],
[1],
0, 0,
"", "",
player
];
_source1 setDropInterval 0.02;
_source1 attachTo [player, [0, 0, 1]]; //doesn't do anything ```
This doesn't seem to be applying the attachTo.. Note sure, I'm new to particles and everything works fine except the attachTo
Just look at ace source directly
https://github.com/acemod/ACE3/tree/master/addons
Is there a reliable way to tell when a player enters and exits a UAV? Can't find any good eventhandler for it
I did see that, I guess I can just check _vehicle with iunitIsUAV
https://github.com/acemod/ACE3/blob/c14056e7b99e085fc210388674b7c3445c5ee524/addons/common/XEH_postInit.sqf#L378
Interestingly ACE uses a diff event
Probably as VisionModeChanged won't give an easy way to detect if you left the UAV
https://github.com/acemod/ACE3/blob/c14056e7b99e085fc210388674b7c3445c5ee524/addons/common/XEH_postInit.sqf#L380 this doesn't give me confidence
the note
because I'm a contributor. and probably the mentions on google were probably me as well lol
if (missionNamespace getVariable [QGVAR(disableVolumeUpdate), false]) exitWith {};
private _volume = GVAR(volume);
// Earplugs and headgear can attenuate hearing
_volume = _volume min GVAR(volumeAttenuation);
// Reduce volume if player is unconscious
if (lifeState ACE_player == "INCAPACITATED") then {
_volume = _volume min GVAR(unconsciousnessVolume);
};
[QUOTE(ADDON), _volume, true] call EFUNC(common,setHearingCapability);
QGVAR(disableVolumeUpdate) extends to ace_hearing_disableVolumeUpdate
Hi there. Now CSWR has a Video Tutorial playlist. So, if you want to try, feel free the rise questions.
https://www.youtube.com/watch?v=kUdOFMLCy7k&list=PL9C3CUvV0NhM0HspcB9ajPNBj9lLy3ozN
CSWR is an Arma 3 script that allows the Mission Editor to spawn AI units and vehicles (by ground or air paradrop) and makes those groups move randomly to waypoints forever in-game.
Download the script (on GitHub):
https://github.com/aldolammel/Arma-3-Controlled-Spawn-And-Waypoints-Randomizr-Script
Download the Notepad++
https://notepad-plus-p...
Need some more help. Trying to figure out what I'm doing wrong with setGroupIdGlobal. When I use is in the following partial code I end up with strangely random group names like [any_any, any_18, any_14, Alpha 1-5, and_15]. The code works otherwise.
_groupVariablePrefix = "test"; // variable prefix used for groups created
_groupNamePrefix = "test"; // name prefix used for groups created
_unitVariablePrefix = "test"; // variable prefix used for units created
_unitNamePrefix = "test"; // name prefix used for units created
_groupsArray = [""];
_groupCountLoop = random [(_groupCount - _groupVariation), _groupCount, (_groupCount + _groupVariation)];
IndexGroup = 0;
while { IndexGroup < _groupCountLoop } do
{
_groupID = createGroup _groupSide;
_groupVariable = format["_groupVariablePrefix_%1", IndexGroup];
missionNamespace setVariable [_groupVariable, _groupID];
_groupName = format["_groupNamePrefix_%1", IndexGroup];
_groupID setGroupIdGlobal [format ["%1_%2", _groupPrefix, IndexUnit]];
_groupsArray set [ IndexGroup, _groupName];
_groupArray = [""];
_groupMemberArrayName = [_groupVariable,"unitArray"] joinString "_";
_groupMemberArrayName = format["_groupMemberArrayName_%1", IndexGroup];
missionNamespace setVariable [_groupMemberArrayName, _groupArray];
IndexUnit = 0;
while { IndexUnit < _unitCountLoop } do
{
_unit = selectRandom unitArray;
_unitPrefix = _groupID createUnit [_unit, _dest, [], 0, "NONE"];
_unitIName = format ["%1_%2_%3", _groupID , _unitPrefix, IndexUnit];
missionNamespace setVariable [_unitIName, _unitPrefix];
_groupArray set [ IndexUnit, _unitPrefix];
};
};```
Wow nice to meet you thanks for the detailed response and for contributing to ace ❤️
any is what is given if a variable is nil. might need to do some additional logging to find out where the nils are happening
Was there any recent changes to how doWatch works? In the past I've been using it to get turrets/vehicle gunners to aim in a specific direction, but now once they look at it, they start glancing around. No additional AI mods are being used
disabled related AI states?
Tried adding that to the function, but I think some weird locality stuff is having it ignore it
Relevant code block
params ["_azimuthMils", "_elevationMils", "_gun", "_vrBlock"];
_azimuthDegrees = _azimuthMils * 0.05625;
_elevationDegrees = _elevationMils * 0.05625;
_x = cos(_elevationDegrees) * sin(_azimuthDegrees);
_y = cos(_elevationDegrees) * cos(_azimuthDegrees);
_z = sin(_elevationDegrees);
_directionVector = [_x, _y, _z];
_vrBlockPos = getPosASL _gun vectorAdd (_directionVector vectorMultiply 1000);
_vrBlock setPosASL _vrBlockPos;
_gun reveal _vrBlock;
_gun doWatch _vrBlock;
};```
Its frusterating, because as of 2 weeks ago, I was using this for mult-hour ops without the currently seen behavior
try doTarget and use it on the gunner
Yeah, tried those things as well. Stuff like mortars just ignore/don't point the tube correctly, and anything else won't shift targets to anything else
Started simplifying the code and realized I had changed the variable names for the group and unit name prefixes at the top, but not in the loops and I had also used the unit creation loop index counter in the group creation loop. All sorted now, thanks!
If anyone knows why the attachto doesn't work for my vanilla particle please let me know thank you
@lyric pasture you just have your variables named wrong/referenced wrong - also, you really want to use createVehicleLocal
<#arma3_scripting message>
<#arma3_scripting message>
my brother in miller... please refrain from saying things like this. this doesn't add to the discussion.
copy that
Sorry I pasted the wrong vars in there but that still doesn't work the attachTo doesn't move the particle after it's created. The particle is fine just the attachTo part.
my post above gives me what I think you want. is this not what you want?
https://streamable.com/6ge5g4
I think that's still at 0,0,0. Even this doesn't work for me
oh so that's what you mean
Yes
one sec
remove attachTo
_particle = "#particlesource" createVehicleLocal getPos player;
_particle setParticleParams [
["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8],
"", "Billboard", 1, 3,
[0,0,1], // this is the offset for the reference object
[0,0,0],
0, 0.005, 0.003925, 0.1, [0.25, 0.75],
[[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]],
[1],
0, 0,
"", "",
player // this is the reference object
];
_particle setDropInterval 0.02;
I see I guess it's already attaching there.. I appreciate your help
if you need to change it at any time, do something like this:
XAE_savedParticleParamsExample = [
["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8],
"", "Billboard", 1, 3,
[0,0,1], // this is the offset for the reference object
[0,0,0],
0, 0.005, 0.003925, 0.1, [0.25, 0.75],
[[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]],
[1],
0, 0,
"", "",
player // this is the reference object
];
_particle = "#particlesource" createVehicleLocal getPos player;
_particle setParticleParams XAE_savedParticleParamsExample;
_particle setDropInterval 0.02;
XAE_savedParticleParamsExample set [5, [0,0,2]];
_particle setParticleParams XAE_savedParticleParamsExample;
Yeah that's what I'm looking for, thank you!
Hey Folks, I was working with GUIs for a while but with every iteration I realise I still struggle with them.
Does anyone know a good tutorial about GUIs that goes a bit deeper than just placing a text and a listbox?
The Wiki is nice, but leaves a lot of questions and what I found on YouTube was pretty simple.
I know, I have to work my way through the Wiki and I already did, but I was curious if anyone knew some good resources to read.
hello! im making a function to use vehicle in vehicle loading for a basic logistics system for my mission. currently, i have a function that executes this code:
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
if (count _sortedVehicles > 0) then {
_logisticsVehicle = _sortedVehicles select 0;
if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
_logisticsVehicle setVehicleCargo _objectToLoad;
} else
{
hint "Vehicle can't load cargo";
};
} else
{
hint "There are no vehicles in 10 meters";
};
this works for all non-vehicle things (things like supply crates), but when trying to load an actual vehicle into another vehicle. it tells me that "Vehicle can't laod cargo". and i understand why this is happening, i'm just not 100% sure how to fix it. im assuming the nearEntities is also adding the vehicle to be loaded into the _sortedVehicles array. and obviously the nearest vehicle to that vehicle is the vehicle itself so its trying to load the vehicle into itself. my question is, is there any way to exclude that vehicle from the array?
Got it working! heres the code incase anyone is curious:
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
_logisticsVehicle = "";
if (_sortedVehicles find _objectToLoad == 0) then {
_logisticsVehicle = _sortedVehicles select 1;
} else {
_logisticsVehicle = _sortedVehicles select 0;
};
if (count _sortedVehicles > 0) then {
if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
_logisticsVehicle setVehicleCargo _objectToLoad;
} else
{
hint "Vehicle can't load cargo";
};
} else
{
hint "There are no vehicles in 10 meters";
};
Personally what worked for me was reading through controls configs to understand what's possible
Back in the day this was only available on VBS wiki but now on Arma wiki too
hm, came across this issue when i try and load a vehicle into another vehicle using my script when there are no available vehicles for it to load into
Then exit before you run the rest of the code if undefined ?
what do you mean?
Put after line 10
if(_logisticsVehicle isEqualTo "") exitWith {hint "There is no Vehicle to load"};
So it will cancel if there is no vehicle to load
_sortedVehicles might be empty, or contain just one entry I think? _logisticsVehicle can become undefined then
its still giving me an error which is strange
I.e. if you select an element that doesn't exist in array, the variable becomes undefined
also, _logisticsVehicle is defined before any of the If statements as "". wouldn't that mean that it should never be empty? or am i being incredibly stupid
ah interesting
Especially this part sqf private _array = ["a", "b", "c", "d"]; _array select 0; // "a" _array select 3; // "d" _array select 4; // nil - no error shown _array select 5; // error in your case it might be the _array select 4 issue
Why does it work like that – no idea
Just count the list of vehicles from nearEntities immediately after you generate it, and if it's 0, exit there
you mean like this?
cause thats still giving me an error, now on line 16, but still the same error that _logisticsVehicle is undefined
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
if (count _vehiclesList < 1) exitWith {hint "There are no vehicles within 10 meters"};
Post the whole function
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
if (count _vehiclesList < 1) exitWith {hint "There are no vehicles within 10 meters"};
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
_logisticsVehicle = "";
if (_sortedVehicles find _objectToLoad == 0) then {
_logisticsVehicle = _sortedVehicles select 1;
} else {
_logisticsVehicle = _sortedVehicles select 0;
};
if (count _sortedVehicles > 0) then {
if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
_logisticsVehicle setVehicleCargo _objectToLoad;
} else {
hint "This vehicle can't load cargo";
};
} else {
hint "There are no vehicles within 10 meters";
};
It's probably the "if sortedvehicles find objectToLoad then ..." part
The variable can still become nil here: ```sqf
if (_sortedVehicles find _objectToLoad == 0) then {
_logisticsVehicle = _sortedVehicles select 1;
If the objectToLoad is the only object in the array, then it will be index 0, in which case you try to use index 1, which doesn't exist because there's nothing else there
ah i see
Why not just subtract the objectToLoad from the array as a first step?
i added that part because previously, when i tried loading specifically vehicles into other vehicles, it was trying to load the vehicle into itself as it was the closest vehicle. so that was my solution to overcoming that
_vehiclesList = _vehiclesList - [_objectToLoad];```
then count and exit if 0, and then you don't need any further checks to try and work around `_objectToLoad` being detected
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
_vehiclesList = _vehiclesList - [_objectToLoad];
if (count _vehiclesList < 1) exitWith {hint "There are no vehicles within 10 meters"};
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
_logisticsVehicle = "";
if (count _sortedVehicles > 0) then {
if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
_logisticsVehicle setVehicleCargo _objectToLoad;
} else {
hint "This vehicle can't load cargo";
};
} else {
hint "There are no vehicles within 10 meters";
};
alright so i have this, you think this would work?
You don't need the "if count sortedvehicles > 0" - you know that must be true because you counted it before sorting it
gotcha
alright i have this:
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
_vehiclesList = _vehiclesList - [_objectToLoad];
if (count _vehiclesList < 1) exitWith {hint "There are no vehicles within 10 meters"};
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
_logisticsVehicle = _sortedVehicles select 0;
if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
_logisticsVehicle setVehicleCargo _objectToLoad;
} else {
hint "This vehicle can't load cargo";
};
and it appears to be working great! thank you for all the help o7
For a user QoL thing, you might want to make a distinction in response between vehicles that can load cargo (but are currently full) and vehicles that can't load cargo at all. At the moment you report both as just "can't load cargo", which could be misleading.
I'd suggest reporting the vehicle display name too, so the players can understand which vehicle is being detected as closest and reposition if needed.
i already had this planned, i just wanted to get the actual functional part of the script dealt with first
I'm using setTerrainHeight to create a hole, and then placing objects in the hole. The center of the hole created is not the same as the position I give the command. This makes it difficult to decorate the hole. I remember reading somwhere that this command is driven by whatever the lowest cell size for a grid coordinate is for a given map (it those are the right terms). When I use this command, how can I find the true center of the hole created? Here is the commands I'm using:
_pos2 = _pallet modelToWorld [0,3,0]; _pos2 set [2,-.5]; (setTerrainHeight [[_pos2],false]) remoteExec ["call",2];
I think the answer may be to pass setTerrainHeight a position whose x/y coords are rounded to whatever the lowest cell size is for the map?
setTerrainHeight manipulates the closest vertex in the terrain grid, which is made up of triangles (cells).
https://community.bistudio.com/wiki/getTerrainInfo may be useful for automatically generating coordinates.
what if you create object in server and then do remoteExec on client and do something with the object, how do you know if the object is already created on the client?
can you check like isnull on the client to wait until the object is created?
hop over to #arma3_gui and we can help you there
in general, you can wait for the client variables to populate if you need to. not just for objects. and you'd check for isNil. You'd want some sort of callback system to the server if everything is handled on the server
yeah in not checking the variable but more of the object the variable points at
are you using createVehicleLocal on the server?
createVehicle
then don't worry about it
i thought i maybe trying to do something with the object before the object is created in client as well on the server
i haven't had an issue with it. even down at the frame level
hmm ok
guess i can't say, "don't at least keep an eye out for it", but yeah, never had an issue
i'll make some debug checks..
Do you mean the server is sending a remoteExec to the client to do something with the object? If so, then you're fine - messages are handled in order, so the client will receive the object creation message before the remoteExec
yes exactly
i wonder how that works though because the remoteExec cant be tied to the object creation
createVehicle has global effect so I guess the queue is handled by the engine, if that's what you mean
yeah im sure it is. just question is when client also creates the vehicle
thats what you guys keep telling me 😁
It would be a nightmare if the order wasn't guaranteed on both ends. So I would assume that engine adds some kind of numbering to the actions getting sent over the network and that the receiving end respects the order of those
true
Then again, BIKI says: "The order of persistent remote execution for JIP players is not guaranteed, i.e. the order in which multiple calls are added is not necessarily the order they will be executed for joining player." ...I wonder why that is...
because of networking
The order of live broadcasts is guaranteed, but remoteExecs for JIP are stored in a queue (separate from the JIP queue for other types of broadcast, apparently) which is not guaranteed to stay in order
I think this is bad, especially since it's inconsistent with the main JIP queue, but this is how it is
i thought its because in net packets may get lost so the order of arrival may vary. not that i know which protocol arma uses
Arma uses a system where some messages can be guaranteed: the sender will keep sending them until there is a report of successful complete receipt. Not all messages are sent like this, but important ones are.
so in that case it may take a while before its successful
"a while" is relative
yes
a client that's failing to receive this remoteExec will also be failing to receive any subsequent messages, so it will still be in order
er, or failing to receive the creation message. You know what I mean
but its "normal" in some protocols to lose packets
The guaranteed messages don't necessarily need TCP as protocol, as you can also use UDP but just require "manual" confirmation of arrival of a message on the other end in engine code itself
It's normal for some packets to be lost - and it's also normal to keep trying until those packets are received, if the packets are important.
Packets that aren't important (e.g. per-frame position updates) can be ignored if lost because the next update will force things back into sync anyway. remoteExec and object creation are important, so the engine makes sure they get through.
makes sense
Hey folks,
does anyone know a way to get the magazine size of artillery?
not sure what you mean by size but this should get you started: https://community.bistudio.com/wiki/getArtilleryAmmo
Sorry, I need to know how many rounds an artillery element has in its magazine before it has to reload.
hmm i forgot how that works but this command returns list of all ammo counts: https://community.bistudio.com/wiki/magazinesAmmo HTH
and an alternative (some mods doesn't return correctly magazinesAmmo): https://community.bistudio.com/wiki/magazinesAllTurrets
hi, trying to make a script template (to be used in public zeus) to make objects interactable such that if you interact with it a message will appear to all players.
so far i only have this script
this addAction ["ACTION", {hint "INSERT MESSAGE"}];
however when a player interacts with the object, the hint only appears to that one player.
You need use remoteExec to broadcast that to everyone.
Hint is local event
@remote cobalt this also seems to work: ```sqf
gun ammo (currentWeapon gun)
Many examples, and you will easily get your hint for everyone,
And addaction event is local, it only will be executed on a client who used an event
Perfect, thank you. Was close to skimming the Config again 😄 but this is way easier
How can I spawn a waypoint for a unit via a trigger? that the unit only gets the waypoint when it has passed a trigger?
i dont use trigger often but now i make a escape mission and my normal missions ar zeus and warlords/zombie warlords
https://community.bistudio.com/wiki/addWaypoint in trigger activation
thanks
I don't really understand what it says. e.g. With the player position. The player should first be abseiled from a helicopter and then he moves towards the trigger with the path point, It is not a fixed map position
you can make the waypoint to a specific coord: ```sqf
groupName addWaypoint [[11,222], 0];
hello friends would this set up work
if (local player) then
{
//all this runs client
//all this runs client
//all this runs client
//all this runs client
//all this runs client
};
//Server Run
if (!isServer) exitWith {};
// this runs server
sleep 1;
Exit;
yea but Exit only works in SQS scripts https://community.bistudio.com/wiki/exit
I need to write some code whose value returns the player closest to a group of AI that changed their behavior state (aware to combat).
Basically, I have a section in my mission where players have to sneak past a patrol. The trigger area condition is BLUFOR detected by OPFOR. When the players are spotted the player closest to the enemy patrol (the one most likely to have been spotted) will say "We've been spotted!".
I already have a solution for getting the player to speak. But I need a way to FIND the player that caused the behavior change. With my limited knowledge, I'm guessing I will be using some form of combo of findIf, (switchableUnits + playableUnits), and maybe an event handler for the AI behavior change.
actually you probably meant if (hasInterface) then rather than local player
ok i try that thx friend
because player is always local in client
this would be on a DED server
oh shoot thats right
well at least im trying to learn
lol
ok thx m8 i start working on it right now thx you very much friend
sounds like you need something like this: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#CombatModeChanged
Awesome this seems like a great starting point!
My problem, I can't find a tutorial or anything anywhere that helps me to figure out how to work with a trigger to get the following: I (as a player) run into a trigger, then I activate (me as a player) a waypoint that I have placed is displayed. As soon as I have passed this waypoint, the next waypoint takes place and the waypoint that lies on it should disappear again with the help of a trigger when it has been completed as visibility. This should be repeatable
not sure i follow. maybe you could tell what your trying to achieve?
A player abseils down from an airplane. He is now alone on the island without GPS, map, etc. He sees a waypoint in front of him and follows it. He reaches the waypoint. Now the waypoint is to disappear and a new one appear. The player follows these again. After reaching the waypoint, this waypoint should be removed from visibility. If the player respawns in the helicopter and has to abseil again. So the same thing must be repeatable.
So I have the player attached to an object, but when they are made "uncon" https://community.bistudio.com/wiki/setUnconscious they fall to the fall regardless of the fact they are connected to an object. Is there any way to prevent this, or is the best approach to prevent setUnconsious from triggering?
have to say im not sure how player waypoints work but i would create those waypoints for player everytime he respawns/starts the mission. id think that upon reaching waypoint the next one is automatically selected but not sure
there's the https://community.bistudio.com/wiki/setCurrentWaypoint command so you dont really need to delete any waypoints just select the next one, I think
I haven't found anything about it anywhere on the internet or in forums. The fun only starts when there are more players 😅😂.
I'll take a look at it
That doesn't really help either.... @winter rose Do you have any ideas? You have helped me several times, for example in zombie Warlords back then
Just now waking up and I'll help you when I come back to existence soon.
Thanks for any help 🫶🏻
sorry for the delay, I pushed a patch to modules enhanced last night that broke the teleport menu cause I was dumb, so I had to fix that real quick. let me do a little write up for you.
you want to do it via trigger?
or have it progress automatically to next waypoint without triggers?
@brittle badge
over trigger yes
Quasi when a player runs into a trigger a waypoint appears for this player (visible in the scenario / not mapp)
whos gonna be the target? individual players? groups of players? etc
Individual players
and are you going to have other waypoints in the system other than these trigger induced ones?
wait a sec i mark it with pain
make a discord thread for this
You will see 3 waypoints that lead from the plane, to the island, up to the mountain and into a valley. These are now only used so that I can set the aircraft correctly, but these 3 waypoints will later be the ones I want to activate with triggers. the other 2 waypoints are for the plane. and the rest for a military convoy
ok so the large diag waypoints will not be there in the end. what about that bio module? is that a waypoint or just a synced module?
Waypoint 1 will be the drop zone for players to collect, waypoint 2 will mark the path up to the mountain and waypoint 3 into the valley. Waypoint 1 is to be triggered by a trigger. After waypoint 3, the waypoints for the respective player should be removed
oh it looks like there is a waypoint under that module, nvm
The BIO module spawn for the convoy. He is attacked by zombies and kills all units that were there (but the zombies don't attack players, only AI)
does anyone know if it is possible to hide the map grid lines with a script or mod? did not find anything on the internet
you can mod it and make it transparent
Here's what I got so far. It looks okay but one thing that maybe wont work is the distance part. The wiki says it returns a number in meters but perhaps like this it will get the closest player? The other part I'm having trouble integrating is I dont want the code to run if the patrol group that spotted the players is dead within a few seconds. I wanna give players some breathing room here. I might have to just place this code block on the groups individually instead of the forEach.
// 3 groups players must sneak past
_patrolGroup = [group1, group2, group3];
// event handler checks for state changes
{
_x addEventHandler ["CombatModeChanged", {
params ["_group", "_newMode"];
// Check if the patrol went to 'Combat' mode
if (_newMode == "COMBAT") then {
// Get the player closest to the patrol unit that triggered this
private _players = switchableUnits + playableUnits;
private _closestPlayer = _players select {
_x distance _group
};
// Make the closest player speak
[_closestPlayer, "We've been spotted!"] remoteExec ["say3D", _closestPlayer];
};
}];
} forEach _patrolGroup;
The code in select needs to return a bool (true/false) so this won't work.
There is no good way to find the closest unit to a point in A3. I could suggest some bad ones.
Also a group isn't a valid input type for distance
You need to pick a metric. Group center can be calculated manually, or use the leader.
Fastest method is probably:
private _leader = leader _group;
private _distances = _players apply { _x distance _leader };
private _index = _distances find selectMin _distances;
private _closestPlayer = _players select _index;
Apparently that one is super spammy, but also an option.
Spammy meaning?
It fires a lot.
Maybe there would be a way to activate it only at the time in the mission it is necessary?
You could do something like use KnowsAboutChanged to record the unit, and then do your thing in the CombatModeChanged handler.
You can install and uninstall event handlers whenever you like.
You can even install an event handler within an event handler recursively and crash Arma :P
I'm unclear of what the wiki says about KnowsAboutChanged. It says it returns numbers. What exactly is it checking for that's changed? AI behaviour?
See knowsAbout
Ahhh. This might work. I wouldn't need to check distances either so that could solve that issue.
Okay here's what I got:
// 3 groups players must sneak past
_patrolGroup = [patrol1, patrol2, patrol3];
// event handler checks for state changes
{
_x addEventHandler ["KnowsAboutChanged", {
params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
// Check if the AI patrols know about a player
if ((_targetUnit in (units playergroup)) && {_newKnowsAbout > 1.5}) then {
_group removeEventHandler [_thisEvent, _thisEventHandler];
// give players 5 seconds to kill patrol or else
[_group]spawn {
params["_group"];
sleep 10;
if ({alive _x} count units _group > 0) then {
//Fail task
["detected"] remoteExec ["hint"];
};
};
};
}];
} forEach _patrolGroup;
It will check the 3 patrols. if a patrol group sees the player then the player has 5 seconds to kill the group that spotted them or the task gets failed.
It won't work, you can't stop code in EH
I asked chatGPT to check for errors and it wants me to change if (_group knowsAbout group player;.
you must use spawn
don't use chatGPT for scripting
Is there a more intelligent AI for scripting help?
all information that you want is on biki
So I wrapped the sleep and if statement with a spawn as suggested.
I think it's time to try this bad boi out.
it might get _group as undefined variable inside the spawn
Ah so I can pass that I think. I saw it does like this somewhere.
yes
params["_group"]; also
or change _group (inside spawn) for _this, but remove [] from spawn
_group spawn {....
that might work, try it
Copy that. Launching.
oh, if condition doesn't return bool
put like (_group knowsAbout (group player)) > 1.5
I'm putting this in initServer
What is the number value its comparing it to?
https://community.bistudio.com/wiki/knowsAbout
knowsAbout isn't a boolean (true/false) command, it returns a number between 0 and 4. An if condition must evaluate to either true or false to be valid.
knowsAbout returns a number ( 0-4 )
so if is more than 1.5, it will return bool
Ah this must be the _newKnowsAbout it says on the biki. That returns a number. I'm not sure how implement that tho.
Biki says 4 is maximum knowledge. So 1.5 is on the lower side I guess then.
yes, it was just an example
you could do something like this if you name your player's group:
if ((_targetUnit in (units playergroup)) && {_newKnowsAbout > 1.5}) then {....
Actually yes I did previously name it playergroup.
Ah yes. I'm forgetful of that one. I've been told more than once that player doesn't exist on the server.
well, it's not prohibited, you can still use it, but you have to know where
but that EH of yours might not work
I opted for your suggestion before even trying what I wrote. It works in SP. Now I'ma test in MP.
Okay I'm testing in a MP with a second client open. It appears the sleep isn't working. What I do is use Zeus to delete the AI group after they see the player group but the hint still gets sent almost immediately.
Hmm maybe the group not existing breaks it. I'll try to just kill them fast.
press endto kill units in zeus
Yeah this is the issue. If I kill them with the delete key it breaks it. I've been killing them with a gun and it seems to work. I guess end is different then.
end is kill, delete is straight up deletion which is not the same as death
Now for performance reasons what would be the easiest way to turn this off and on? I've gotten some experience with public variables. I kinda know how they work. Could I perhaps wrap the whole code block in an if statement in a variable like so?
if (PatrolSpotting) then {
// in the code I can then turn it off if it runs.
missionNamespace setVariable ["PatrolSpotting", false, true];
};
you mean delete the EH?
Well, I don't want to delete it if the other patrols still haven't seen the players. But yes I guess after a certain point in the mission it isn't needed anymore.
https://community.bistudio.com/wiki/removeEventHandler see Example 2
try to put it after the first if condition
If I did that then it would remove the EH for all the other patrols, no?
nop, just for that one in particularly, when pass the if condition
Ah, okay. And then if the player doesn't encounter the other 2 patrols then later in the mission I can just remove the EH for them in a trigger elsewhere.
of course
for that, I recommend using https://community.bistudio.com/wiki/removeAllEventHandlers instead
it removes the same EH for that unit/group
if has more than one
Okay and since I have a different EH that isn't this type it shall not be effected if I specify the type.
the thing is that you don't need the event ID in this command
yes, it's safe to use it for your scenario, the problem for that command is if you have more than one of them and they do different stuff
Okay, I've added _group removeEventHandler [_thisEvent, _thisEventHandler]; just after the first if
yes it should work
Do event handlers "stop" after the condition is met? For example if the player is detected and runs away from the group that saw them. Is that group able to REDETECT them, or is the EH "complete" and wont do its thing again?
I guess the pure existence of removeEventHandler means they always run till you tell it to stop.
if you remove the EH with that command, it will stop firing because the EH is not there anymore
until it's not removed, it will fire
I guess I'm trying to figure out how to test that it has stopped firing to see if my code works.
Okay so I should break contact then rengage and see if I get my hint again. That will tell me.
put a systemChat "test"
that way you can see if it stops firing
can I haz a smol summary of the issue plz?
Interesting. I tried it without the removeEventHandler and it only sent the systemChat twice, then never again. So perhaps it does turn itself off?
Oh maybe it was only once actually cause I remoteExec'd systemchat which might not be necessary.
maybe it will fire once they have contact with enemy, I don't remember
Hey folks,
how can I check if a variable I am giving is a single object or an array?
Is there a way to check variables for their kind they are off?
isEqualType
Uh, thats sexy. Thank you!
check out isEqualTypeArray and isEqualTypeParams for even more sexy mass checking
Now that I got that sorted I saved this part for last. I think it might be hard. Instead of the systemchat I want to have the group fire a flare into the air. I guess I need to make sure to put a flare in the groups inventory first. But how to actually make 1 person in the AI group fire the flare?
Mh, yes. Thats good 😄 You always got me covered for weird addictions 😄
just use whoever is the group leader
add the flare when you want to use it
or even easier, create the flare ammo, add velocity to it, and launch it in the air. now you dont even need to use AI
This might be better cause now that I think about it. I want the AI to fire the flare into the air and it might fire it at the player.
Or you can spawn Flares above the group just falling down:
if (!isServer) exitWith {};
params ["_pos", "_number", "_delay"];
for "_i"from 1 to _number do {
_flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];
_flare = createVehicle ["Sub_F_Signal_Red", _flare_pos, [], 0, "FLY"];
_flare setVelocity [random 2, random 2, 0];
sleep _delay + (random 5);
};
or, use a handflare, then launch the unit into the air with a parachute 😉
If possible I'd like the player to see the unit fire the flare for immersion. But I'll give up that idea if it's a PITA.
Or at least watch a flare go up.
Not necessarily watch the unit fire it.
I'd like to add a loud whistle if the in-game flare doesn't have one for auditory player feedback.
Ah, I see selectweapon and fire commands on the biki. So I guess I need to separate these by a sleep?
Well, that falls under the category "is it worth it".
No code for you but how you would approach it (and I am not sure if this could work):
Spawn an object in the Air where you want the unit to shoot. Use createVehicle then setPos with the right height.
Then use doTarget for the unit you want to fire. This is needed for the next:
doFire: The unit fires onto the target.
Just before that, use the selectWeapons function.
Not sure if this could work, but its worth a try
Also, selectWeapon could give you some trouble. A safer approach could be to remove every weapon from the character and just give him a flare gun.
So I have the player attached to an object, but when they are made "uncon" https://community.bistudio.com/wiki/setUnconscious they fall to the fall regardless of the fact they are connected to an object. Is there any way to prevent this, or is the best approach to prevent setUnconsious from triggering?
You can just use vectorAdd, and also create _flarePos outside of the loop to not create the same array multiple times
if (!isServer) exitWith {};
params ["_pos", "_number", "_delay"];
private _flarePos = _pos vectorAdd [0, 0, 90];
for "_" from 1 to _number do {
private _flare = createVehicle ["Sub_F_Signal_Red", _flarePos, [], 0, "FLY"];
_flare setVelocity [random 2, random 2, 0];
sleep _delay + (random 5);
};
I see what you mean. He took out the flare gun (me: Yay it works!) only to then put it up and shoot his rifle at me (me: awwww man...)
Ill try removing his kit.
try to follow this idea
if you manage to do this flare thing, tell me cuz I want it too lol
I have tomorrow off work, so I'll spend a couple hours on it then and see where I get.
hmm, antistasi has some code about firing flare
so does LAMBS
they just spawn it
this is a good idea for an environment effect for Modules Enhanced. I'm gonna go make a repeatable ambient flare launcher. except i'm actually going to create and launch, then detonate the shell.
any easy or straightforward way of converting Dir and Up to XYZ degree values,
like converting Dir [1,0,0] and Up [0,0,1], to Rot [90,0,0]
there are some pitch bank functions that do the math for you
one group has a "retreat" code if a certain number of soldiers are killed, it works but only when it finishes its current waypoint and then retreats, and I want it to remove the current waypoint and retreat immediately? this doesn't works: ```private _fnc_retreat = {
params ["_group"];
waitUntil { sleep 1; {alive _x} count units _group <= 3 };
{
deleteWaypoint _x;
} forEach waypoints _group;
_wpp = _group addWaypoint [getMarkerPos "escapepoint", 0];
_wpp setWaypointType "HOLD";
_wpp setWaypointSpeed "FULL";
_wpp setWaypointCombatMode "BLUE";
};```
Hey guys, a while ago someone gave me this teleport script to tp everyone in an area trigger. I'm trying to reverse-engineer it and use it to only send a hint to the player(s) that are in an area trigger ("beepzone" is the trigger's var name). What would I replace the teleport parts with? Or is there an easier way to do this?
_x inArea beepzone;
};
private _teleportPos = getPosASL destination;
{
_x setPosASL _teleportPos;
} forEach _players;```
remoteExec a hint
private _players = ([] call CBA_fnc_players) returns an array of all players in the server,
select { _x inArea beepzone; }; limits this array to players just inside a trigger called beepzone
private _teleportPos = getPosASL destination; just stores a destination value (where all the players get teleported)
{ _x setPosASL _teleportPos; } forEach _players; in a foreach loop, '_x' represents the current element, this code is what actually teleports people
Thank you, though I'm mostly trying to figure out what to use instead of the teleport part. I'll look into what Lou suggested
once given a velocity with setVelocityModelSpace how do we allow the engine to take over velocity physics again?
wydm?
It immediately does, next frame
for CfgAmmo things (in this instance, flares, F_40mm_Green) it doen't seem to. its locked at [0,0,0] once set
and if you use [0,-10,0] its locked at -10, gravity doesn't effect it
just sits there lol
Yeah, overwriting the Ai behaviour is impossible without modding and deep AI knowledge. And even with that, when the AI has entered some fsm, they never gonna leave that no matter what you do. This has been the bane of many mission makers, and even some of the best AI modders.
That's the reason most people here would recommend to go for the "spawn" option, if with velocity up or just starting them in the Air, doesn't matter.
Regarding the air spawn: Most flare ammo would fly high up without flare and then fire the flare load after a few seconds (so it's not that unrealistic). If you want to give it a little extra nudge, play some sounds with playSound3D when the flares are fired.
can you check testRound itself?
i lied, it does exist. let me test a few other things
okay, so if given a velocity of 0, it breaks, but when given a value other than 0, say -10, it stays at -10 velocity until the flare engine code starts, then will be taken over by gravity physics.
Okay it looks like it worked, thank you! I'm sure it'll break when my group goes to play it
there is way to detect granades? ive tryed both nearentities and nearobjects but cant detect them
Make sure you're searching for the CfgAmmo class, not the CfgMagazines class (e.g. magazine HandGrenade fires ammo GrenadeHand)
yep was that. worked like a charm, thankyou
Hello friends
If (i have a script, that has a spawned in chopper called _Heli, on a DED Server) then
{
How can i teleport to The _Heli, from a Flagpole that has a Addaction in the Flagpole
};
every one is Sleep 7hrs; i guess🙂
to The Heli, or IN the heli
in the Heli
moveInCargo
it keeps saying Error Undefined variable in expression: _heli
and the script clearly say _heli is difined
hmmmmm
show full script
Variables that being with an underscore are local variables, meaning they are only defined in that scope
private _someFunction = {
_one = 1;
};
_one; // Error: _one is undefined
// this is my telepot script that get execVM from the flagpole
if (!hasInterface) Exitwith {};
if ((Alive _Heli) && (CanMove _Heli) && Alive Pilot2 && (_Heli emptyPositions "CARGO" == 8)) then {player moveincargo _Heli} else
{
"Waiting For Empty CargoPosition On BlackHawk" remoteExec ["hint", 0];
if ((!Alive _Heli) or (!CanMove _Heli) or !Alive Pilot2) then
{
"HQ Chopper Is Down Wait ONE" remoteExec ["hint", 0];
};
};
oh ok i see so ummm
there is no _heli
oh no
You don't define _heli in that script
oh ok so
hmmm
so i must defin _heli in the script ?
so mayb i can use the class name in the script
nope must be object
hmmm
there smoke coming out my ears lol
man i should do drugs lol
no lol
so mayb i can change the _Heli to Helo
or Helo1
unless that is an object referance, it likely won't work
try using the varable name of the object
yeah so in the chopper script i should change the _heli to Helo1
then in my teleport scrtpt also
Dart said Variables that being with an underscore are local variables, meaning they are only defined in that scope
hmmm
its not really that important that i can teleport to the chopper i was just wanting to do so
is there away i can pass the _heli to my teleport script
when you put an underscore in scripts, it doesn't inherently do anything, it just clarifies things so you dont mix up _vectorDir with the actual vectorDir command, its a good habit
it should work?
ok cool ill try it
thx again friends love you guys you guys make my game work and make my day
Yes it does
someVar = 1; // global variable
_someVar = 1; // local variable
All local variables have to start with an underscore
For another example:
params ["someVar"]; // Error: invalid local variable name
ahh haaa it worked thx m8s
i see yes cool
ahh ok yes thx Dart you da man
Dart is a super pro i love him
where would we be with out him
id be w8ting on the tarmack lol
ok im back in the editer bb soon
The problem has been solved for now, another problem still exists but I will explain that later, I have to go now. I'll be back in the evening. It was about me as a player walking into a trigger and then activating a waypoint with a restriction of e.g. 100 meters activation completion
It's under thread "FinalBiologic help"
just to be sure, since i've never really done a lot of arma 3 scripting. this should just work, right?
like, i don't need to do anything else to make it so that when this unit is damaged, the independents become hostile to blufor
and same here, this'll just delete the respawn position, right?
first one is
Damaged
independent setFriend [west, 0]
second one is
Deleted
farmspawn call BIS_fnc_removeRespawnPosition;
Hey folks, I am stuck with groups and groupIDs and I was hoping someone could help me.
I am writing a teleport script with a GUI. That contains a list of all playergroups and a button to teleport to the selected group.
We earlier did this with predefined groups but now I was curious if I could get it working without that.
In the listBox of the GUI there is the name of the groupID and as data the group as string.
getPlayerGroups:
_groups = [];
{
_groups pushBackUnique (group _x);
}forEach allPlayers;
{
lbAdd [1000, (groupID _x)];
lbSetData [1000, _forEachIndex, str _x];
} forEach _groups;
The teleport function would look like this;
_index = lbCurSel 1000;
_teleportGroup = lbdata[1000, _index];
hint _teleportGroup;
// Get the group Variable from String from listbox
_group = missionNameSpace getVariable _teleportGroup;
//Get a unit from the group to teleport to
_target = units _group select 0;
//Check if you are the target
if (_target == player) then {
if (count (units _group) < 2) then {
hint "You are the only member of this group. Select another Group";
}
else {
_target = units _group select 1;
};
};
if (vehicle _target == _target) then {
_centre = getPos _target;
_teleportLocation = [];
_max_distance = 2;
while { count _teleportLocation < 1 } do
{
_teleportLocation = _centre findEmptyPosition [1, _max_distance];
_max_distance = _max_distance + 2;
};
player setPos _teleportLocation;
}
else {
if ((vehicle _target) emptyPositions "cargo"== 0) then
{hint "No room in vehicle. Wait until your Group dismounted."}
else {
player moveincargo vehicle _target;
};
};
The teleport function does not work, because "missionNameSpace getVariable _teleportGroup;" gives back a String of the group, for example "B Alpha"
Even though this is what "group" returns, it is not enough to use this as a data type, because "units _group" doesn't return anything.
Does anybody have an idea what I am doing wrong here or how I could get this to work? Feels like I am missing something important here that maybe has to do with objects and variables, but I am right now at a loss.
You got a reference to the group in your local variable already.
Make that global or store it in the display.
The index of the group is identical to the index of the selected row, provided the player can't sort it.
you want to look at the command "UID" call BIS_fnc_getUnitByUID so you can pick individual players by their steam ID's rather than thier group.
also look at the moveOut command, so you can teleport players, even in vehicles!
lbSetData [1000, _forEachIndex, str _x]; wot
@cosmic lichen I am sorry. I can't follow completely. You talking about the _teleportGroup variable?
lbSetData [1000, _forEachIndex, >>str _x<<]; here you convert Group to String which breaks it. Because you can't convert String representation back to Group 
Obivously. Sadly, lbSetData only allows for strings
you can setVariable on UI controls
That was why I was using: missionNameSpace getVariable _teleportGroup
why would there be a variable named that?
Because I would get it from the ListBox?
and why should missionNamespace have a variable named after a random string of characters?
displayCtrl 1000 setVariable ["groups", _groups];
{
lbAdd [1000, (groupID _x)];
} forEach _groups;
...
_index = lbCurSel 1000;
_teleportGroup = displayCtrl 1000 getVariable "groups" select _index;
// do whatever you want with that group```
don't forget about UI event handlers eh, it's useful
i don't see how EHs relate to data storage, tbh
just a tip, not related
Thanks, I see where my error in thinking was.
I'm curious of what kind of script errors stops executing a script? seems like the scripts are continued to run after error but if there is like error in the while condition then the loop wont run
After messing around for a couple hours without progress I decided to play around with your code. I trimmed it down because I just need one flare to fire and the code is in initServer so I dont need the exitWith. I get an error tho. I think it's because its looking for a position to put the flare and doesnt know where. So could I use the param _group to get the base position?
// 3 groups players must sneak past
_patrolGroup = [patrol1, patrol2, patrol3];
// event handler checks for state changes
{
_x addEventHandler ["KnowsAboutChanged", {
params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
// Check if the AI patrols know about a player
if ((_targetUnit in (units playergroup)) && {_newKnowsAbout > 1.5}) then {
//removes EH from the specifc group
_group removeEventHandler [_thisEvent, _thisEventHandler];
// give players a few seconds to kill patrol or else
[_group]spawn {
params["_group"];
sleep 5 + (random 5);
if ({alive _x} count units _group > 0) then {
//fire flare
params ["_pos", "_number", "_delay"];
_flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];
_flare = createVehicle ["Sub_F_Signal_Red", _flare_pos, [], 0, "FLY"];
_flare setVelocity [random 2, random 2, 0];
//subtitles and task failure
["playersspotted", [objNull]] remoteExec ["FoxClub_fnc_Conversation"];
missionNamespace setVariable ["PlayersSpotted", true, true];
};
};
};
}];
} forEach _patrolGroup;
_flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];
Basically this part is what I don't understand. What position is the param _pos? Is it the players' position? The enemy group?
Does that even work?
Which part? Everything seems to work minus the flare.
Yeah, because that params is wrong
At the moment it's nothing. It's not defined. That params was never given any new inputs, it's still working from the spawn's arguments (i.e. _group).
Is it cause it's in the spawn? Maybe I need to pass it first?
{
_x addEventHandler ["KnowsAboutChanged", {
params ["_group", "_targetUnit", "_newKnowsAbout"];
// Check if the AI patrols know about a player
if ((_targetUnit in (units playergroup)) && {_newKnowsAbout > 1.5}) then {
// Removes EH from the specifc group
_group removeEventHandler [_thisEvent, _thisEventHandler];
// Give players a few seconds to kill patrol or else
[_group]spawn {
params["_group"];
sleep 5 + (random 5);
if ({alive _x} count units _group > 0) then {
private _pos = getPosATL leader _group;
_pos = _pos vectorAdd [0, 0, 90];
private _flare = createVehicle ["Sub_F_Signal_Red", _pos, [], 0, "FLY"];
_flare setVelocity [random 2, random 2, 0];
//Subtitles and task failure
["playersspotted", [objNull]] remoteExec ["FoxClub_fnc_Conversation"];
missionNamespace setVariable ["PlayersSpotted", true, true];
};
};
};
}];
} forEach _patrolGroup;
_flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];```
You can make this line simpler by using `vectorAdd` instead
Hey, can I have a script for placing arsenal to NPC? Also disable any of his movements
Please
disableAI with "PATH" (or "MOVE" if you don't want them to turn either) is a good way to stop AI from moving
Would this break if the leader of _group was dead? private _pos = getPosATL leader _group;
The leader of the group changes when the previous leader dies. There can only be no leader if there are no living units, in which case the script stops before that anyway.
Thanks but can I also have a script for arsenal?
@blissful current I have updated the code, formatting and unused vars
Even if it did pick up a dead leader somehow, it wouldn't break, because it doesn't rely on the leader being alive. It might look a bit odd that the flare appeared over the leader's dead body, but that's basically fine.
You probably want to use it in "AmmoboxInit" mode.
What is the benefit of vector add? Im looking at the wiki and dont understand.
It's faster and simpler
It's easier to read, and faster because there are less commands.
It just adds two vectors [1,1,1] vector add [1, 1, 1] becomes [2,2,2]
It seems to add numbers together. So what is it doing to the flare?
It adds the elevation
Yes
It's doing exactly the same thing as the code that was previously there with the _pos select 0 etc, but better.
It takes the position of the leader, which is a 3-element array in format [x, y, z], and adds 0 to every element except the z axis, where it adds 90.
I understand that this code grabs the leader position.
private _pos = getPosATL leader _group;
_pos = _pos vectorAdd [0, 0, 90];
But how does this also grab the leader position?
_flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];
It doesn't, that was missing before
I added private _pos = getPosATL leader _group;
In the very first version, it didn't, because the code was written with the expectation that you'd figure out _pos yourself and provide it as an argument.
Ah Okay then I get it now. vectorAdd is indeed easier to read. Thanks so much for explaining yall.
It spawns 3 white trails for a couple seconds. I see in the code it should be red though.
Is it default behavior to just be a few seconds as well?
Can playSound3D "move" so that I could mimic a whistle sound moving from the ground to 90 meters up?
Try a different vanialla class
How can I look up other classes to choose from? I can guess what might be appropriate but that seems inefficient.
You can open the Config Viewer and look in CfgAmmo (with Advanced Developer Tools loaded, ideally). Look for flare projectiles, and their submunitions if they have any.
One thing to note is that the flares are described according to their light colour. A flare that burns with a red light may not generate red smoke. Vanilla flares don't show up particularly well in the day.
Now try it at night
There is a slight glow of red. Eh, whatever, lol. On to the next thing. Can I playSound3D "move" so that I could mimic a whistle sound moving from the ground to 90 meters up?
You can attach the sound to the flare
Oh wait I'm thinking of say3D
Oh interesting. Does F_40mm_Red count as an object?
Try it and find out
Projectiles are objects
playSound3d doesn't move afaik. say3d does
Oh nvm you mean play a "move" sound, not move the sound 
How would I skip an index like this:
playSound3D [getMissionPath "sound\flarelaunch.ogg", command, false, [0, 0, 0], 5, 1, 200];
The biki says that default is [0, 0, 0] but I actually want to skip that index. If I put that in there it overrides command. I tried nil but it gave me an error that it expects 3 values.
getPosASL command
How would I select a handful of players that already have variable names in their init? (My group does ops with up to 3 zeuses, so they're z1, z2, z3)
They're also all in a squad together, if it'd be easier to just select the squad
Okay, slight change to the question. I got a hint to show up for the zeus squad, and now I'm trying to also get it to play a sound as well but I'm getting an error (screenshot attached). Here's my script right now:
{
playSound "Alarm"
};```
("zeuses" is the variable name of the squad) Do I need to define a sound in the mission files for it to play, even if it's one that's already in the game? Or am I doing this wrong
You're comparing player (object) to zeuses (group)
In the case of a group of humans. If the leader dies does leader get switched to a different player?
Yes
Try player in units zeuses
Okay I'll try that
[[leader group1, _randomMessage], "sideChat"] remoteExec ["sideChat"];
How does it determine who will get control of AI in a mix of human and AI group?
The group leader has control
Leadership inheritance is determined by the unit's rank, and then by ??? if two have the same rank (probably creation order)
So group leader always has control. So if they die then leader is switched to different unit, however they wont control AI?
Alright well the error is gone but the sound still didn't play. Do I need to define it in the mission files? I'm pretty sure it's a vanilla sfx
Try remoteExec if its MP?
No, listen: the group leader has control.
- the leader has control
- the leader dies
- a new unit becomes leader
- the leader has control
AI command is associated with group leadership, and is transferred along with it
This means that in MP that some is ALWAYS the leader. I guess unless everyone is dead. Then it would return objNull?
I don't know what happens if everyone's dead. It could return objNull, or it could return the corpse of the last leader.
Okay theoretically I got it working, thanks guys
Interesting. If I do it like this then neither client controls AI. Would that mean that leader would return the AI that took the player slot?
Yes, because they are the group leader
is it possible to use a script to make the AI automatically deploy a static weapon when the enemy is nearby, dissamble it when there are no more enemies?
Why does this play a sound:
[]spawn {
[command, "flarelaunch"] remoteExec ["say3D", 0];
};
but this doesn't, all I've added is a volume adjustment:
[]spawn {
[command, "flarelaunch", 200] remoteExec ["say3D", 0];
};
yes, it is, take a look into antistasi scripts, they have some code about assembling mortar when the mortar squad is on "idle"
did you try this code (the last line)? #arma3_scripting message
I haven't tried that one yet. I've got the flare sounds working with my groups. This is something a little different. If OPFOR enter a trigger area then it pops a flare from the group that entered the area. It all works besides the sounds. From my debugging I've narrowed it down to adding the volume adjustment.
because your remoteExec format is wrong
Remember:
_left command _right;
[_left, _right] remoteExec ["command"];```
what you have done is this:
```sqf
[_left, _rightPart1, _rightPart2] remoteExec ["command"];```
Ah I need square brackets on the right side?
[command, ["flarelaunch", 200]] remoteExec ["say3D"];
Ill try this.
Tyvm, that got it!
@blissful current if using ace, they change the settings on all flares. might want to see what they look like on vanilla.
I'm trying to set this loop to play every 5 seconds and control it with a variable. The control part doesn't work at the moment but the code within is. I thought I could just turn it on and off with missionNamespace setVariable ["speakersloop", true, true]; but I guess not?
//init.server
while {speakersloop} do {
[selectRandom ["speakers1", "speakers2", "speakers3"], [HanoiHannah]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance speakers <= 100}];
sleep 5;
};
When I get it working the sleep will actually be closer to 2 minutes cause I'm afraid of clogging network traffic. (unsure if this matters)
You can turn it off by setting the variable to false, which will cause the while loop to exit. But then the loop has exited. You need to make a mechanism to start it again. waitUntil may be what you need.
Something like this:
fox_var_radioLoop = true;
while {true} do {
waitUntil {
sleep 5;
missionNamespace getVariable ["fox_var_radioLoop",false]
};
while {missionNamespace getVariable ["fox_var_radioLoop",false]} do {
[selectRandom ["speakers1", "speakers2", "speakers3"], [HanoiHannah]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance speakers <= 100}];
sleep 5;
};
};```
(Alternatively, make the loop a function, and just spawn the function again when you want to start the loop again)
I'm looking through script stuff, what does the 0 in front of "spawn" do in this example?
It passes 0 as a parameter to the given code
It's essentially used to pass "nothing", since just doing:
spawn {
sleep 5;
hint "after (at least) 5 seconds...";
};
Would pass the value of _this to the given code
I really need to look up tutorials on the basics. All I know is that the 0 makes it work but have no idea what _this even means lmao
But thank you
Well actually from what I've seen _this looks like it's an array but still
_this is a "magic variable" that is just whatever parameters are passed to a bit of code
private _someFunction = {
_this;
};
[] call _someFunction; // _this = []
0 call _someFunction; // _this = 0
[""] call _someFunction; // _this = [""]
Some commands, notably call; spawn; and params, will use _this as a default value for the left argument if nothing is there.
For example, _this call {...}; and call {...}; are essentially the same
You can run into some issues when stuff is accidentally passed that you may (or may not) know
fnc_hintObject = {
// This function expects an object, and will use objNull if no value is passed
params [["_object", objNull, [objNull]];
hint typeOf _object;
};
fnc_paramError = {
// You might expect this to pass nothing to hintObject
// but this actually passes whatever parameters are passed to fnc_paramError
call fnc_hintObject;
};
0 call fnc_paramError; // Error: fnc_hintObject expected an object, but instead got 0
I have found a script that I've been looking for but I'm not sure how to use it.
I have created a sqf file in the mission map but whats next haha
description.ext does nothing to do with loading time
Then what did you figured out 🤔
It is about the environment, see spawn
Need some assistance, I'm putting NPC Voice lines in my game, one of the lines activates while in a moving vehicle, and I want that to play on the Group or Side Channel Radio so it's louder, does anybody know how I can do that? Here's the script for the interaction.
{
class Roadtalk_levine_Line_1
{
text = "The silence in here is... deafening.";
speech[] = { "\talk\levine-4.ogg" };
class Arguments {};
actor = "levine";
};
class Roadtalk_walker_Line_2
{
text = "Hey man, you know good and damn well we haven't seen a bunk in at least 48 hours. Do me a solid and shut the fuck up so I can take a nap.";
speech[] = { "\talk\walker-1.ogg" };
class Arguments {};
actor = "walker";
};
class Roadtalk_armstrong_Line_3
{
text = "For the love of God, please!";
speech[] = { "\talk\armstrong-1.ogg" };
class Arguments {};
actor = "armstrong";
};
class Roadtalk_lopez_Line_4
{
text = "Brother, we've got 2 minutes until we're dismounting. Your 'sleep' had better be potent, otherwise you're gonna be a walking corpse when we get there.";
speech[] = { "\talk\lopez-1.ogg" };
class Arguments {};
actor = "lopez";
};
class Roadtalk_walker_Line_5
{
text = "Shut the fuck up already!";
speech[] = { "\talk\walker-2.ogg" };
class Arguments {};
actor = "walker";
};
};
class Arguments {};
class Special {};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};```
Excuse the explicits, just more realistic Dialogue.
Thanks I'll check it out this weekend!
hi need some help with hold actions and hints. idea here is to have template for hold action + hint. Im getting an error everytime i input the object in a code. Thanks in advance 🙂
[
this,
"ACTION GOES HERE",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 2",
"_caller distance _target < 2",
{},
{},
{ "hint goes here" remoteExec ["Hint", 0, true];},
{},
[],
12,
0,
True,
False,
] remoteExec ["BIS_fnc_holdActionAdd", 0, this]
anybody knows what the locality effects are for setMagazineTurretAmmo?
it's not documented on the wiki
"hint goes here" remoteExec ["Hint", 0, true]; maybe the ordinary hint script will suffice for this to appear to everyone?
What's the error?
You're doing two different things with those two bits of code.
The first is creating an action that creates a hint, the second just creates a hint
Anyway, one error is because you have a trailing comma after False
The last element in an array should not be followed by a comma
the idea is that after the hold action a hint will appear that all players in the server will see
sorry quite new to this lmao
I know, I was explaining the differences between what you said, since you asked "maybe the ordinary hint script will suffice for this to appear to everyone?", which doesn't make sense because those do very different things
👆 ↑