#arma3_scripting
1 messages · Page 168 of 1
better combat stance
i have seen some people done it in another mp sever. But i just can't find the method for this one
player actionnow ["WeaponOnBack", player]
Hi I have a quick question on the waitUntil instruction, does it stop other script as well or is it only inside the function ?
If i put a waitUntil inside an EH, it will only stop the code executed inside the EH ? Not my other scripts ? (That would be weird, but arma being arma, I want to know for sure)
also can try this, to ut the safety in the weapon on mission start
[player, currentWeapon player, true] call ace_safemode_fnc_setWeaponSafety
its like a sleep, ill stop that script if in scheduled envioroment
i have tried this before. this does the other combat stance which is CTRL not c
Got it ! thank you very much ^^
if you have
call fnc_script1
call fnc_scrpt2
the first one will block the second one (if you are in a scheduled enviroment, in this case, you will get an error anyways)
also scripts like initserver.sqf, need to be ended before the mission starts, so if you put a waituntil in there, ill stop the mission loadoing
the waitUntil will be inside the InitPlayerServer, inside an EventHandler "HandleDamage" and inside a condition.
maybe just
player action ["WeaponOnBack", player]
this should put the weapon in the back ( maybe the animation is needed, adn with actionnow its cancelled)
execution code in evenhandlers are in other scope, so there is no trouble there, but... the code inside the eh is unschuled so you will need to use spawn
Oh it's unscheduled ? I didn't know that, well that's good to know ! (I would have learn about it one time or another xD)
Thank you for your help !
You will have the "you cant suspend" error, so ill teach you fast lol
you are welcome 😄
so you are trying to stop the users from using a certain feature correct
if so you can instead intercept it from the keypress, rather than fighting it afterwards
doesn't invade & annex "safe zone" do a similar thing? putting an addaction with a shortcut key that intercepts, and the player can't fire
All it does it spit back out even worse code than was fed into it
Not to mention all the terrible and real side effects generative AI has on the planet
🤦♂️
in arma 3
when you respawn
you don't have the same combat stance
i am not removing feature. i don't want the player when he respawn he just click c and get back that combat stance
i took look into controls the action called combat pace. but i can't find any way through sqf to do this
so you want them to stay in the same stance they were in before they died?
That page is a list of things you can do with the action command
you can't
that not a list for action
this one for actions https://community.bistudio.com/wiki/Arma_3:_Actions
yes
Of course, if the person feeding them code is not a programmer, that's it. While using AI to create complex things helps especially in visual studio enterprice, with the help of AI many software in .NET C# and C++ are in production without problems. Those who copy and paste and test, waste hours to get the same result as those who write code already knowing what they will get. Don't you think Dart?
all i know is he a pro
Of course, if the person feeding them code is not a programmer, that's it.
Programmers still write bad code. Code quality is a bell curve, the overwhelmingly majority of code is going to be okay at best. Meaning an AI is going to give you something worse than this on average, which is then fed back into the model causing a feedback loop.
While using AI to create complex things helps especially in visual studio enterprice, with the help of AI many software in .NET C# and C++ are in production without problems.
Sure, with codebases that are going to inevitably unmaintainable because the person who copy/pasted it probably didn't read through it if they're using some AI program to write it for them.
Those who copy and paste and test, waste hours to get the same result as those who write code already knowing what they will get.
An AI will never give you the same level of quality that someone who actually knows what they're doing can write.
that was i told yah. perfectly right your answers!
i bet he has many years of time in thats what makes him so good
well any way i still think your great Dart
you helped me so much
and also AlaxSmarTv as well
dont worri Dart You are my ChatGPT he he
I have a bit of script that adds pp to a player in an area, I'm trying to see if I can make it terminate when the player dies, otherwise the visual effects will continue indefinitely:
{
waitUntil {sleep 0.5; _unit inArea _trg && !(goggles _unit in _GasMask)};
if (isPlayer _unit) then
{
hint parseText format["<t size='1.10' font='PuristaMedium' color='#F0133C'>BIOHAZARD DETECTED</t>"];
_unit setVariable ['radiat', ppEffectCreate ['ChromAberration', 200]];
(_unit getVariable 'radiat') ppEffectEnable true;
(_unit getVariable 'radiat') ppEffectAdjust [0.03, 0.03, true];
(_unit getVariable 'radiat') ppEffectCommit 10;
_unit setVariable ['radiat2', ppEffectCreate ['ColorInversion', 500]];
(_unit getVariable 'radiat2') ppEffectEnable true;
(_unit getVariable 'radiat2') ppEffectAdjust [0.0, 0.0, 0.2];
(_unit getVariable 'radiat2') ppEffectCommit 10;
};
...
};```
Would doing something like this remove the effect? Or is there another way?
```while {!alive _unit && local _unit} do
{
if (isPlayer _unit) then
{ppEffectDestroy ["radiat","radiat2"]};
};```
(Sorry if this is really dumb, I'm really bad at scripting/coding)
Right now you have it continuously adding the ppEffect I think, since While is a loop. I'd suggest moving that to just a waituntil and add the alive and local check to the existing if statement.
Would this work?
{ppEffectDestroy ["radiat","radiat2"]
};```
Yup it should, put a sleep in there though so it doesnt check every frame
In this part, like how it is with the (goggles etc.) bit?
etc.```
ya like that
Okay so far it isn't working but I probably just put it in the wrong place, I'll try experimenting some more, thank you
Just add a killed event handler and destroy the effect
I'll try to figure out how to do that
I think so far params is one of the things I struggle with the most, but would this work:
params ["_unit"];
ppEffectDestroy ["radiat","radiat2"];
}];```
Or should I put !alive _unit && local _unit in the params instead?
they would not go in the params. Params defines variables names, for example the killed EH passes 4 variables into itself for you to use, they are ["_unit", "_killer", "_instigator", "_useEffects"]. However without defining these values they are only accessible via _this select 0-3. That is not very convenient to read, so params is used to define them as readable values. Params in your case here are not even necessary since you arent using any of the passed values
Oh okay, I figured it was required for addEventHandler, I'll try it without the params part
You should use it, all params does is make variables out of values from an array (in this case, the parameters passed to the function)
How you sent it originally is correct
Hello, I am running into this error, the script seems to work but I still get the error. Anyone able to possibly explain it to me?
params ["_unit", "_listOfPlayers", "_vehicle", ["_altPos", false]];
_code = {
_this params ["_unit", "_listOfPlayers", "_vehicle", "altPos"];
if (_unit in _listOfPlayers) then {
if !(isNil {_vehicle}) then {
if (alive _vehicle && _vehicle emptyPositions "Cargo" > 0) then {
_unit moveInCargo _vehicle;
} else {
if (!(_altPos isEqualType false)) then {
if (_altPos isEqualType "") then {
_unit setPos (getMarkerPos _altPos);
};
if (_altPos isEqualType objNull) then {
_unit setPosATL (getPosATL _altPos);
};
};
};
} else {
if (!(_altPos isEqualType false)) then {
if (_altPos isEqualType "") then {
_unit setPos (getMarkerPos _altPos);
};
if (_altPos isEqualType objNull) then {
_unit setPosATL (getPosATL _altPos);
};
};
};
};
};
[{CBA_missionTime > 0}, _code, [_unit, _listOfPlayers, _vehicle, _altPos]] call CBA_fnc_waitUntilAndExecute;
This is the script if it helps.
I think I'm just going to erase the post-process stuff and go without it
Missing underscore in your params
Also you don't need to specify _this for the left side, that's the default
Well this isn't defined, you need to use the unit
"this" like the variable?
it's almost like that's what the error explicitly says
Ohhhhh
Alrighty, thanks
Hi I think maybe you've failed to interpret the fact that I have no fucking idea what I'm doing otherwise I would have obviously figured out that this was causing the issue and what I should do to fix it
I don't expect you to necessarily know how to fix it, but the error literally says "this is causing the issue", so I did expect you to figure that one out
No, this is a scope issue
Let me link a wiki page
Also, if you have no programming experience whatsoever, look up what parameters and arguments are on YouTube. (Applies to any language)
Thank you
Also look at https://community.bistudio.com/wiki/Magic_Variables
I was wondering, if someone can help me. I am new to this and trying to understand how to put a marker on a vehicle array that spawn on a map?
_vArray = [
"B_MRAP_01_F"
] call BIS_fnc_selectRandom;
_vArray createVehicle position player;
//===========Marker============
_marker1 = createMarker ["Marker", [0, 0]];
//"Marker" setMarkerShape "ELLIPSE";
//"Marker" setMarkerSize [50, 50];
//"Marker" setMarkerColor "ColorWhite";
"Marker" setMarkerPos (getPos "B_MRAP_01_F");```
Oh man that’s awesome! I’m away for the weekend but will give it a go when I’m back for sure!
_vehicle = _vArray createVehicle position player;
// ...
"Marker" setMarkerPos (getPos _vehicle);
Nitpicks:
I would change _vArray to _vehClass as that would be more accurate.
All but the last marker commands should be the local variant of the command
alright, let me change somethings and see if i did it right.
ohhh okay, now i understand
thank you
okay, now a new problem i dont understand why it not working. I try to do this script.
[] spawn {
while {not isnull player} do {"Marker" setMarkerPos (getPos _vehicle)};
};
now it says undefined variable, even though the name _vehicle is above the script
sorry i cant put my head around it, this is all i put together and says the same things and i just dont understand, what you mean undefined.
//======vehicle Array==========
_vehClass = [
"B_MRAP_01_F"
] call BIS_fnc_selectRandom;
_vehicle = _vehClass createVehicle position player;
//===========Marker============
_marker1 = createMarker ["Marker", [0, 0]];
"Marker" setMarkerShape "ELLIPSE";
"Marker" setMarkerSize [50, 50];
"Marker" setMarkerColor "ColorWhite";
"Marker" setMarkerPos (getPos _vehicle);
// This will make markers move with a object.
[] spawn {
while {not isnull player} do {"Marker" setMarkerPos (getPos _vehicle)};
};
spawn creates a new script scope which doesn't automatically inherit local variables from the parent scope (your main script)
You need to pass variables into the spawn scope as arguments, which will make them available in the special variable _this within the spawned scope.
Example:
private _myTestVar = "hello";
_myTestVar spawn {
systemChat _this; // "hello"
};```
when you say _this, you mean the variable that couldnt be undefined?
https://community.bistudio.com/wiki/Magic_Variables
When I say _this, I mean _this.
_this is a special variable which is automatically generated by the game. It can be overwritten, but by default, it contains whatever arguments have been passed to the script scope.
ohhh, okay i just notice it. when i looked up the spawn in wiki.
_localVariableLikeThis cannot be transferred between scripts without you obviously state to do so, is the point
didnt know _this was a thing in this code.
Hence _vehicle in this context doesn't exist, aka undefined
OMFG, Now i understand it
so like this ```
_vehicle spawn {
while {not isnull player} do {"Marker" setMarkerPos (getPos _this)};
};
_this is basically calling the _vehicle
_this is a "Magic variable" that is whatever you pass to a bit of code
For example, if you instead did [_vehicle] spawn {...};, _this would instead be an array containing _vehicle
oh so there other way to use _this, but it makes something different?
just to make sure if i understand it correctly
so it like using "call" in the end of a script?
Not really sure what you mean by that
Here are some examples though
player call {
_this // object returned by player
};
[1, 2, 3] call {
_this // an array containing 1, 2, and 3
};
any question just send me a dm
oh so _this can be another way to make it array or use it for just one variable?
It's entirely dependent on what is passed into that bit of code
If you want to be safe between passing a single value vs an array with that value, you can use params in your code
[player] call {
name _this; // error, using name on an array
};
[player] call {
params ["_unit"];
name _unit; // returns the name
};
i slightly understand, but is there any youtube videos that talks about this kind of scripting. Since I dont want to bug everyone with questions.
this really did help me alot, understand somethings.
thank you everyone
I doubt it
You can just ask though
alright ty
yes, type like "arma 3 scripting" on YouTube, there are a bunch of playlist, I've seen it all and it's useful for beginners, but you must read and practice a lot, debugging your stuff always
So I have a backpack that is assembled into static ammo box.
The Assemble EH does not call for it on this first assembly when a box is first created.
Anyone know anything that might help with this?
Video example TBD
Relevant links:
https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#assembleInfo
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Assembled
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Disassembled
I also think this might actually be bug.
Video example.
In config, I have an assembled event handler that calls code that hints some output. With a backpacks that starts on my back at mission start, its assembled object does not exist yet, and it seems that the assembled eh does not call on this first assembly.
https://steamusercontent-a.akamaihd.net/ugc/25427770453460084/E7C8736AFDA9F8D9CA8A8F023C2FB9930D1088B8/
Triggers when weapon that is moved out of the world is assembled again.
– https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Assembled
you add the event on the assembled weapon itself, not any bag or anything
Assembling is one of seriously hardcoded part of the features
...Because it never is created. It transforms out of the backpack
I’ve been looking through the config and can’t find the animationSource for this, so I’m assuming there isn’t 🤷🏾♂️
However if I want to have the turret look/stay in this direction instead of the default how would I go about this
I tried using doWatch on a marker but that’s only in 2D, so how would I get it to be like what’s show in the image above?
maybe _vehicle doTarget (_vehicle getRelPos [0, 10, 10]) or something alike
well wrong command/syntax but you get the idea 😄
modelToWorld*
I’ll look into it thank you
@winter rose I'm not getting it, I cant figure out how this will get the turret to look in a general direction, rather elevated.
it's a UAV, so it has an AI in it
it should target that position, raising the gun (mayhaps)
So I used an empty marker as a target and it looks in the direction of the target but i dont know how to raise the gun, that is the main issue
what about the modelToWorld pos?
is that the [x,y,z] value in the editor?
wat
_vehicle doTarget (_vehicle modelToWorld [0, 10, 10])
Sorry im not sure what that means
you said
I tried using doWatch on a marker
what does it mean, where did you script what and how?
OK, so i think that i articulated that incorrectly, what i meant was, I used the doWatch command in the SAM's INIT ,
I used this: SAM doWatch markerPos "Sam_Marker"; and thats how i get it to slew the turret
then use my code, replacing _vehicle with SAM (or with this, avoiding the need to name the unit)
(unfortunately I'm off to bed now, so if this does not work try this spawn { _this doTarget (_this modelToWorld [0, 10, 10]) };, and if this doesn't work, well, I cannot help more atm ^^)
cheers!
thank you gn
Hello !
I have a problem with a script that I've made. The script put the player in first person if he is "FiredNear" and if he is in third person (Doesn't include vehicle) But a thing I've noticed is, that this script cause some weird bug :
- Bug with WebKnight when you kill an AI with a melee attack the AI is attached to you (even when AI is dead)
- Player respawn on themselves, even with the custom respawn point option activated, and its random. Some times theycan respawn on a spawn point, other times they cannot.
- There is sometimes an infinite loading screen when they respawn
The script is inside initPlayerLocal.sqf :
player addEventHandler ["FiredNear", {
params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"];
if (!((vehicle player) == player)) exitWith {};
if (!(isNull getAssignedCuratorLogic player)) exitWith {};
countdownTime = time + 60;
if (alive player) then {
_unit spawn {
while { (countdownTime - time) > 0 } do {
if (cameraView == "EXTERNAL") then {
[" <t color='#FF0000'<t size='2.0'><img image='a3\ui_f_curator\data\rsccommon\rscattributebehaviour\combat_ca.paa'/></t><br/><br/>Vous êtes en combat !</t>", 5] spawn fnc_hintDisplayTexts;
player switchCamera "INTERNAL";
sleep 0.25;
};
};
[" <t color='#00FF00'<t size='2.0'><img image='a3\ui_f_curator\data\rsccommon\rscattributebehaviour\safe_ca.paa'/></t></t>", 5] spawn fnc_hintDisplayTexts;
};
};
}];
Is there any difference in resource use between a terrain baked object and an object created with createvehicle? Also, do hidden objects use memory or cpu?
Depends.
terrain supports "super super simple" objects (even simpler than what you get with createSimpleObject) which are very light weight (both in terms of mem usage and simulation), in exchange for missing functionality (e.g. no animation). but some terrain objs are almost no different than those created with createVehicle.
Hidden objects use both memory and CPU. But they might end up using less CPU than when they're visible (e.g. physx is disabled for hidden objs). They also use no GPU because they get skipped when rendering (but they do use VRAM)
Hi guys, I am recreating ACE's grenade throw GUI purely via scripting and it is working great, my only issue is that when I go up (like on a building) the visualized angle becomes biger compared to the correct one which shows perfecly on ground level
#PostYourCode
yes, posting on paste.bin as we speak, comming up in a sec
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Using getPos is your issue
These are the complementary fncs: https://pastebin.com/sBLYR3bZ
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Yeah I've tried other commands but nothing works for me so far, only getPos
It still is the issue, at least it seems to be
It seems to me too, sadly I lack experience with with other syntaxes and so I haven't been able to come up with a solution so far, I've been on this code for two days. I can setup a small demo mission if someone is willing to offer more help
getPosWorld
_pos = _pos getPosWorld [_space,_dir];
Gives an error, while ```sqf
_pos = _pos getPos [_space,_dir];
Because that's not how getPosWorld works
Just use modeltoworld for player
Or that
I can't remember if eyedir is a command or not but can also just use that and basic trigonometry
I need to add a space and direction to the modeltoworld pos for subsequent dots... basically replicate what I am achieving with _pos getPos [_space,_dir];
it is and its an ideal solution. I second this
the problem with getDir is that it won't work with aiming dead zone
eyeDirection by itself is not good either because you can freelook to behind your back
I recommend using weaponDirection, and checking if the animation supports pulling trigger (which means the weapon is most likely pointing to where you aim)
if((unitPos player)=="MIDDLE")then{_initialHeight=(_pos select 2)+1.13};
if((unitPos player)=="DOWN")then{_initialHeight=(_pos select 2)+.8};
these parts are also not good either. using unit's aimPos or a middle selection such as spine3 or neck is probably better
tho if you want your arc to be accurate, you may also want to put it where the hand releases the grenade (so you can e.g. use right shoulder selection plus a small vertical offset)
Thanks guys! You all rock!
what is the simplest way to detect if player is running a certain mod during (or before) starting a mission? I wanted to add some health-related EHs to my campaign that would not be activated if there's an armor system mod loaded already
oh and how does RHS detect if the reduced damage is on in difficulty settings?
Checking if entry exists in cfgPatches
isClass (configFile >> "cfgPatches" >> "addon_name")
and addon name is a pbo within the mod folder, rather than the folder itself right?
Is there a limit on the length of a diag_log?
Basically I'm trying to output an array, but it seems to be limiting it - wondering if there's a way around that
What is going on with this?
v1 magazinesTurret [0, false];
Alt syntax on wiki says that this should return only full magazines, see https://community.bistudio.com/wiki/magazinesTurret
But currently, it says that it expects a number in the error.
Convert to string.
Provide a number.
That returns an empty array, despite the vehicle having ammo. A number of either 0 or 1 doesn't change the outcome.
Then it looks like the command is broken.
Check your turret path
It's not
↑ you provide a number, not a turret path ↑
It's ~1044 iirc
0 is a turret path
vehicle player magazinesTurret [0, 0]; // ["200Rnd_127x99_mag_Tracer_Red","200Rnd_127x99_mag_Tracer_Red","200Rnd_127x99_mag_Tracer_Red","200Rnd_127x99_mag_Tracer_Red","SmokeLauncherMag"]
For B_MBT_01_TUSK_F
yep
but they try the alt syntax here (see the bool)
I'll add it to the examples to make it clearer
use this ↑ @true frigate
go to beeed 😄
But I could instead be confused by setVelocityTransformation (I hate physics)
Yes check wiki
Couldn’t see one on there must’ve missed it 🤨
Very bottom of the page
in patch 1.59 there is a limit of 1044 characters to be printed, no error or crash but diag_log line will simply end at character number 1044.
Ah must’ve missed it oh well
I ended up just looping what I needed any which solved it
Shuko, order all the AI to stop
@winter rose
Hey hope im not bothering with the ping.
I just wanted to ask one more time, would either yall know of any way to directly reference the newly created object from an assembled backpack?
I am about to start looking at black magic techniques, and figured i ask again as i got started and before i got too far into possible "solutions"
And would I be able to possibly make a feature request to BI about this?
Is what you looking for ^^
Apprec.
Either WeaponAssembled attached to the unit or Assembled directly to the weapon/drone
i've been writing sqf scripts for several years and only today did I discover pressing F1 opens a help dialog in the debug console
Fun fact, page up/down actually has a use with the debug console as well
not ingame afaik, could rebind something using AHK or similar tho
Hey do you guys know a good command that would allow me to select a bunch of objects in the Eden editor via the debug console or alternatively add init code to each object? I don't often utilize Eden commands and there is a bunch of em haha.
Cheers thanks :)
Usually that stops them fron wanting to regroup ;/
Wish you could do NUMBER round 1 instead of say parseNumber (NUMBER toFixed 1) or round(NUMBER * 10) / 10
Yeah that would be neat indeed.
Idk if you're available. But i tried getting it to work with say3D, playSound3D, CfgSounds. But they do not play the .ogg audio file (No errors given). CfgRadio seems to be the only thing thats working?
Also, when i tried to get the next line of subtitles working, i got a "error suspending not allowed in this context" (Update) I've got the subtitles to propagate correctly when one audio file ends, and then correctly displays when the next one is being fired. However i still got problems localizing the voice of the characters as none of the local voice calls seems to work, and i'm unsure if "Sleep" will still work when talking between two characters.
Damn, even ungrouped with unassignvehicle, leavevehicle and allowgetin false, chopper still wants to land as soon as someone is moveOuted :G
Shuko, have you tried overriding the AI pilot input via setVelocity? Maybe just giving zeros as arguments is enough to make the chopper hover
"error suspending not allowed in this context"
I assume you are calling the functions. Use spawn instead
Try using the commands inside a spawned function
Could you provide your content, how do you call and where and what
Make sure you're using the right reference to the sound file with the right commands.
say3D requires the sound to be defined as a CfgSounds class in description.ext, and you give it the classname. Note that a CfgSounds class isn't exactly the same as a CfgRadio class, it's similar but check everything.
playSound3D does not require a CfgSounds class, and you give it the file path within the mission folder (or within the game files if it's a built-in/addon sound).
Make sure the .ogg is a valid .ogg (probably is if it works with CfgRadio)
So, huh. So if we go with Say3D. I'll start out with class CfgSounds and then instead of sound[] = {"\sounds\mybrief1.ogg", db-10, 1.0}; should i put in say3D[] = {"\sounds\mybrief1.ogg", db-10, 1.0};?
no
I cant say it makes sense then. I need to play the sound followed by subtitles, and the only examples with subtitles on BI Wiki is CfgSounds and CfgRadio, if i tried using the Cfgsounds example, it didn't want to start the voiceline or text.
would class Sentences/Cfg Sentences work in a briefing setting?
perhaps, but that's stuff's complicated, I don't touch it.
If you have followed the template for the CfgSounds class correctly (remember that goes in description.ext, not the script), then for say3D in your script you need to refer to the classname you defined in the CfgSounds class.
So say you had this:
class mySound1
{ // ...```
then your `say3D` would be like this:
```sqf
_myObject say3D "mySound1";```
I need you to tell me clearly if this is, or is not, what you're doing.
wow i did not put together that together i feel so stupid....
No, that is not what i did. I replaced class CfgRadio with CfgSounds, and in the script i used the same script that i did with CfgRadio which was: unitname sideradio "mybrief.ogg"; One moment
Right, the Say3D does play the sound now originating from my character, although kind of quiet. Subtitles do not follow.
Make sure your subtitles in the config class follow the format for CfgSounds. Like I said, it's not exactly the same as CfgRadio.
True, i've tried to follow the CfgSounds example, still doesnt' seem to wanna spawn the Subtitles 🤔
Ah hangon
Gee i wonder if its because i forgot to add these as well. Maybe that's why i dont get subtitles lol
titlesFont = "LCD14"; // OFP:R - titles font family
titlesSize = 0.1; // OFP:R - titles font size
forceTitles = 1; // Arma 3 - display titles even if global show titles option is off (1) or not (0)
titlesStructured = 1; // Arma 3 - treat titles as Structured Text (1) or not (0)
Nevermind I'm dumb. it's practically identical apart from the variables i've put in for myself but still no Subtitles.
class CfgSounds
{
sounds[] = {};
class mybrief1
{
name = "Julius";
sound[] = { "\sounds\mybrief1.ogg", 4, 1, 100 };
titles = { 1, "Alright lads, here's the deal. Sa'hatra and the Iranian 4th Regiment is surrounded on all sides, yet despite the futile situation, our enemy is still very persistent in their resistance..." };
titlesFont = "LCD14";
titlesSize = 0.1;
forceTitles = 1;
titlesStructured = 1;
};
};
Well, I don't know. That looks correct to me.
i think you are missing [] from titles
Oh yeah, that's probably it.
I'll have to test it later, but i'll keep you updated.
Good day everyone! I'm needing some advice on direction here. My goal is grab the player that satisfys this condition:
allPlayers findIf {_x distance (position Pilot) < 20} > -1
This code works because the trigger area is basically the entire playable area. When the players meet the pilot a conversation happens. I could do selectRandom allPlayers or leader player but that might return a player that is on the other side of the map. So I need a way to return the player that encountered the pilot first.
(allPlayers select {(_x distance (position Pilot)) < 20}) # 0?
I could kinda cheese this if there was a way to attach a trigger area to the pilot. I could make it really small and use the above and it wouldn't matter. But the pilot moves around so I cant place a trigger in the edenEditor.
Oh and I'm now reminded that switchableUnits + playableUnits is preferable so as to not return a zeus.
you can attach the trigger to the pilot
with the command attachTo
There is actually, it's called attachTo.
That being said, the code you already have is perfectly usable. Having done that findIf, you can then use the index it returns to select the appropriate player from the array of players.
Trigger area is the whole map.
Trigger condition field:
(switchableUnits + playableUnits) findIf {_x distance (position Pilot) < 20} > -1
Activation field:
["meet", [pilot, this select 0]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance pilot <= 100}];
Well if you're going to use the attach-trigger-to-pilot method, you don't need a special condition to find if there's a player nearby, just set it to ANY PLAYER PRESENT and leave the condition as this.
player in thisList should do the trick
I dont know if you want to notify all players or just be a local thing
player in thisList is a dangerous game to play because it is evaluated separately locally, so the trigger can fire once for every player. It also doesn't work on the server.
Yes, but he can also delete the trigger
I see a have multiple paths here. I don't like the moving trigger idea as much because I would rather grab the player that encounters the pilot first instead of a random player. Unless this is also possible. What is the least complicated do you all think?
You probably meant thisList#0 rather than this select#0
after activation
This will be a server only trigger.
Then you can't use player in thisList because player returns objNull on the server
yea
Ah yes, that's why my original condition is the findIf. I remember now.
just do what nikko said
Trigger attributes: ANY PLAYER, PRESENT, server only, not repeatable (probably)
Trigger condition: this
Trigger activation: ["meet", [thisList#0], ...
Does this naturally grab the first player? What would happen if several players entered into the trigger at the same moment? Or maybe the condition is evaluated many times a second so it doesn't really matter and I'm splitting hairs at this point.
The condition check frequency is determined by the relevant trigger attribute. I think it's every 0.5s by default.
This returns the first player in the list of players in the trigger area. I don't know how that's sorted; it might not be sorted at all, essentially random. So if two players enter in the same 0.5s, it could potentially pick either of them. In my opinion, that's fine for this purpose - it's not a race, it doesn't really matter who speaks, and trying to make it more accurate is not worth the effort.
I'm torn between which method to use. As you say I can just keep my code the same. But also my option is to create a moving trigger field. Is there a clear path to which is more appropriate?
simpler is better
Personally, I would use the trigger for this. It involves fewer commands, and it's easier to set up several of them in the Editor.
The method using your existing code would mean you have to start it in a waitUntil somewhere and while that's not, like, difficult, it's just a bit annoying.
I suggest just to test it out
Okay I will test this out now as it's the most simple idea.
Hello, I am using a script I found from 2014 forums to let someone call in a lightning bolt on their laser target with an Action;
zlb_target = {
private ["_targeter","_lasertarget","_center","_group","_zlb","_pos"];
_targeter = _this select 0;
_lasertarget = laserTarget _targeter;
if (isNull _lasertarget) exitWith {hint "No target selected !"};
_pos = getPos _lasertarget;
_center = createCenter sideLogic;
_group = createGroup _center;
_list = nearestObjects [_lasertarget, ["MAN","CAR","TANK","AIR"],10];
_zlb = _group createUnit ["ModuleLightning_F",_lasertarget,[],0,""];
{
_x setDamage 1;
} forEach _list;
};
player addAction ["<t color='#FF0000'>Zeus LB Target</t>", {[[player],'zlb_target',true,false] spawn BIS_fnc_MP}, [player], 1, false, true, ""];
It works perfectly except that there is no visual or sound; wherever you target just kills the person there without a lightning bolt
Can anyone help?
Haha nevermind, I found out how!! Not that great at coding so I'm proud of myself
Basically I could scrap that whole first paragrah and input this
player addAction ["<t color='#FF0000'>Zeus LB Target</t>",
{[laserTarget player, nil, true] call BIS_fnc_moduleLightning}, [player], 1, false, true, ""];
Ah OK so if I'm understanding having a giant trigger wont work. I need to do the attachTo?
I get an error with this because of the this select 0. If I put a specific variable name in it's place then it works fine. So something to do with this select 0 that I've done improperly which I assume is tied to the waitUntil being absent?
Trigger area is the whole map.
Trigger condition field:
(switchableUnits + playableUnits) findIf {_x distance (position Pilot) < 20} > -1
Activation field:
["meet", [pilot, this select 0]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance pilot <= 100}];
No, the error with this select 0 is because you are using this when you should be using thisList. There's a reason I specified that.
Sorry, you've gone back to using the weird hybrid method of both your original code and a trigger. Don't do that, just do a small trigger attached to the pilot, like this: #arma3_scripting message
My mistake. I'll start working on attaching the trigger to the pilot.
triggers have init fields as well as all their other triggerstuff fields, right?
this attachTo [foxclub_pilot,[0,0,0]]```
Actually I dont remember. I'll check when I return from the corner store and try to implement this.
come someone tell me, where i can find this script on the wiki, I have no clue the name of it.
[name1, ["<t color='#00ff00'>" + "test", "[]; name2 = _this select 1","",1.5,false,false,"true","true",2.5]] remoteExec ["addAction", 0, true];
addAction
Thank you
No init fields unfortunately. But before I try the attachTo command I thought it prudent to test the trigger first as you have suggested. I get an error when using thisList#0. Would this be because I am using a spawn? EDIT: Yes it's cause of the spawn. I tested it without and it worked. So either there is a way to keep the spawn or I put some of this in a .sqf? The full Activation field is this:
thisList spawn
{
_firstUnit = _this#0
pilot lookAt player;
sleep 1;
pilot playmove "Acts_PercMstpSlowWrflDnon_handup2";
deletemarker "PilotArea";
deletemarker "RescuePilotText";
["meet", [pilot, _firstUnit]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance pilot <= 100}];
sleep 2;
[pilot, true] remoteExec ["allowdamage", 0, true];
[pilot, "PATH"] remoteExec ["enableai", 0, true];
};
The pilot has an init field though. This seems to work in his field:
pilot_joins_group attachTo [this,[0,0,0]]
so say i want to make a script that only allows certain players or roles to get in certain vehicles how would i do that? im trying to whitelist vehicles at the moment
Pass thisList (or thisList#0 ) into the spawn as an argument. e.g.
thisList spawn {
_firstUnit = _this#0
};```
There is an event handler GetInMan. You could use that and do a check to see if a specific unit triggered it then eject the player if not allowed.
i know it might a bit much but could you show or give me an example of that im rather new to this sorry in advance
No worries. I am new myself. Could you give more info on what you what to achieve? Be as specific as possible.
well im trying to give CAS aircraft and heavy armor to specific players while limiting transport aircraft to a certain role.
So I would try to use GetIn then. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetIn
Put it in the init field of the CAS or transport you want to filter players out of then we will do a check on the player within the EH.
Do your players have variable names?
I assume that your slots for MP would be like CAS pilot, transport pilot etc
Right so, i tested the script, and it does work with subtitles after adding the Brackets. but the problem is it now shows up in white text, and doesnt show up in side chat, which is what i'd like it to do. The font is kinda ugly as well lol
Yeah the method you wrote does subtitles like that. Similar to BIKB. What was the issue using sidechat?
So i was using CfgRadio to get the text in Side channel to work. However it came with the problem where the sound wasn't localized to the player that was speaking so i wanted to fix that.
Ah, I've never used CfgRadio but I've used sidechat a lot. What about the text wasnt working?
Well CfgRadio does work with Text/Subtitles. I just wanted the Audio to come from the player speaking, so i had to do a different script with CfgSounds and Say3D as a script in the mission. In the picture above, the text is .... yeah just terrible, and way too big for a briefing setting.
You can change the subtitle font (and size, I think) in the CfgSounds class.
I see, while that could probably work, and i'll test it, I'm gunning for having text appear in one of Channels, wether its direct or Side doesnt matter. Kind of like in the regular Arma campaign.
I think this is an actual "title" though, dont think it'd work well for conversation
The easiest is just to put the text into sidechat. Then do say3d right after.
_briefingUnit sideChat "Briefing text";
_briefingUnit say3D "briefing";
So would this go in the description.ext?
Depending on where you want it. You could put it in a trigger activation field or a .sqf. I guess it depends on how you want the mission to flow.
Yeah i'll be doing it via a trigger. Just gonna see if i can make this work
is there a command that would determine if two positions are on the same island?
Hm okay, i think it works. I just need the 2nd line of Text to appear when the next audio begins, because right now, it immediately fires both lines of text simultaneusly, and that doesnt really work lol.
Last time i tried "Sleep" it gave me an "error suspending not allowed in this context"
Idk about that but you can determine if something is in a marker area. I suppose you could do that twice and then compare the two positions against each other?
[] spawn {
_briefingUnit setRandomLip true;
_briefingUnit sideChat "Briefing text";
_briefingUnit say3D "briefing";
sleep 3;
_briefingUnit setRandomLip false;
_respondingUnit setRandomLip true;
_respondingUnit sideChat "Response text";
_respondingUnit say3D "response";
sleep 3;
_respondingUnit setRandomLip false;
etc...
};
that's what I've been doing. I have position all of these markers whenever I setup an island for my mod
I was just hoping if there was an in-engine option
I'm very new to all this. Sounds like you know much better than I. Sorry.
No problem. Thanks
That's pretty much all that was needed, cheers.
It also greatly simplified the script as well, now i just have "Name" And "Sounds"
I do apologise for practically being spoonfed, there are some scripts that i understand the logic of, and at other times i practically need it written in full for it to make sense...
Just a quick question, this should work with multiple responding player characters right? Hence the "respondingunit" variable?
No worries. I am very new myself. This will work as long as the variable names of the units match what is written in the script.
So for example a players' variable name is Unit1 then you write Unit1 sideChat "Response text";
Awsome! I found out that the 2nd voice line didn't fire if the Say3D was above the response text, even though it worked in the 1st line of script, it ceased to work on the second, although once it matched the way you wrote it there was no issues. As for making the mouth move on the speaking player. (Its rather minor at the moment, not too necessary.) Would i need to begin cooking up an entirely different script?
Did you define the say3D as you did the briefing one?
You can also use setRandomLip for your units. I updated the code above.
Yeah pretty sure i did. But hey it works now, just needed to put audio below text. 🤷♂️
Would "setrandomlip" cease when the Audio has completed? ---- Ooooh nevermind! I see it
"True & False"
Is this gonna be local btw? I looked online and apparently there's issues with it only firing locally?
Do you want this for SP or MP?
Multiplayer at the moment, yeah.
Set the trigger to Server Only then remoteExec the commands. Alternatively, put all this in a .sqf (as writen without the spawn) then remoteExec the .sqf.
Oh yeah I forgot you can do waitUntil as well instead of timing sleeps as well:
_sound = _npc say3D "intro1";
_npc sidechat "blah, blah, blah"];
_npc setRandomLip true;
waitUntil {isNull _sound};
_npc setRandomLip false;
So, Delete the script in On Activation. Paste in .sqf without spawn. remoteExec then goes on the trigger?
Server Only trigger Activation field:
["scripts\briefing.sqf"] remoteExec ["execVM"];
On Activation has that very script in it now, i've port forwarded to get an easy mp "server" up and running quickly. Does not seem to work. Would i need the { and }; at the start and end of the script or do i delete them like i did with spawn
This works great! Related topic, I have the pilot join the group via a ServerOnly trigger activation field:
[pilot] join (group player);
It seems to work but I feel like it shouldn't since player doesn't exist on the server?
no curley brackets. Also to test MP functionality it is easier to just launch a second arma 3 application then chose test in multiplayer from the editor.
Hm i see. And i went ahead and tried without curley brackets and that fixed it so yeah.
It won't work on a dedicated server or headless client.
player still exists when the server is an ordinary client, because there's still a player. So it's fine in peer-to-peer games (which Editor multiplayer testing is).
Okay I will run this mission on a dedicated server once completed. Is there a different command that would work in my case then? Or perhaps I just don't run this particular trigger on Server Only?
Don't run it not-server-only because then every machine will try to make the pilot join their player.
There is no DS-equivalent to player because...there is no player unit on the DS, and which other player would you expect it to return?
If you want to join a specific player, you have to think of a way to choose which player. I've got a feeling you have a few ways of choosing a specific player already.
I tested it on hosted server, and there wasnt any lip movement. The Script works, and it also worked in SP. just doesnt seem to wanna do that one thing. 🤔
Yeah I guess the thing that would make the most sense would be have the pilot join the player that approached him first. Now that I think about it it would be weird if the group leader had control of the pilot but was on the other side of the map. Perhaps I could use the function to assign the pilot to the speaking player!
Paste your code here.
Tried it again, Lip movement in SP. No movement when testing on a dedicated Server. Still plays audio and Text though.
zus setRandomLip true;
zus sideChat "Alright lads, here's the deal. Sa'hatra and the Iranian 4th Regiment is surrounded on all sides, yet despite the futile situation, our enemy is still very persistent in their resistance...";
zus say3D "mybrief1";
sleep 17;
zus sideChat "The Civilians are fleeing the city, and with each passing day, the Iranians are expected to run out of supplies, yet for weeks on end, there has been no official surrender of the remaining garrison. Their resolve knows no bounds... admirable, but foolish.";
zus say3D "mybrief2";
sleep 20;
zus setRandomLip false;
When you post code here do it like this:
press the tilda key 3 times: then type sqf
past code
press tilda 3 more times
the tilda key is the key just to the left of 1
try to edit the code you posted like this.
is that... backwards?
I have a danish keyboard and it looks like it's a similar situation to forward backslash, not present.
the tilda key is the key just to the left of 1
It's the one immediately left of backspace (on a Danish layout)
bottom circle
there are a lot of different keyboard layouts, they're different between countries and form factors (e.g. laptops). Mine is in the top left below ESC.
got it, had to press Shift, and the key to the left of Backspace. cheers nikko
okay zus is the only unit talking. why split up what he says into 2 sidechats? Is it too long maybe? I've never done one so long.
Yeah it would be too long, this is what it looks like atm:
Got it. Hmmm it looks good to me. Seems to be a locality issue since it works in SP. But we are remoteExecing the file so it should also be remoteexecd. Im stumped
Yup. I guess it's just Arma being arma. Then again it's fine if it doesnt work on the final product. However it just adds a little bit extra, but oh well.
You could try to mess around in testing to narrow it down. Like do a regular trigger on the dedicated server with just setrandomlip and see if that works. Idk what that would tell us but it's more info that might help diagnose it.
Well it seems like a MP issue. I tried the quick setlip with blufor present trigger in editor, works. Tried in MP. Doesnt work.
And when you remoteExec the setrandomlip in MP?
On its own, or with the rest of the script?
because said script worked fine in editor with setlip when testing. Didn't work when hosting.
I was gonna suggest on it's own. But idk why it wont work for you. It tested it on mine and it works.
quickly restarting the server, i forgot the server only when hosting. will try again.
I've tried 3 unsuccessful ways. I tried in the server only trigger:
pilot join _firstUnit;
```and
```sqf
pilot join (group _firstUnit);
And in the custom codex index of the function:
pilot join (group _this#1);
Could it be because the player who sees the pilot first is already in a group? Maybe I have to remove that player from the group first?
sir, it needs an array of units
Nop, putting in Server only didnt seem to fix it, still worked just fine in Editor 🤨
https://community.bistudio.com/wiki/join
This command requires an array of units (because it can be used on multiple units at once).
[pilot] join _firstUnit;```
Weird that it worked previously without brackets in the SP testing editor without an error.
You mean using this code? #arma3_scripting message
ugh how embarrassing. I have no idea at what point I started typing it without brackets. Like it was always without brackets in my memory which is clearly false.
Okay, so like this the pilot joins the group of the player who starts the mission as group leader. So even though _firstUnit is the player who sees the pilot first (and the player I want to have ownership of the unit) the pilot just runs over to the group leader that _firstUnit is in. Did I explain that well enough? Sorry if it's confusing.
The group leader always has control of AI in the group, and AI's default behaviour is to try to form up with their group leader.
If you want a different player to control an AI, you need to make them the leader of their own group.
The wiki mentions: To make a unit leave its current group, join it into grpNull (e.g. [MyUnit] join grpNull
Now that player has a group that pilot could join onto?
[_firstUnit] join grpNull;
[pilot] join _firstUnit;
[_firstUnit]
I would be careful with doing stuff like that, it will technically work, but if there are multiple players in that group they may be using group chat to talk to each other, DUI to keep track of each other etc., and they may find it disruptive to unexpectedly leave the group
Yeah, I was wondering about the unintended consequences of this from a gameplay perspective. I don't know yet what is worse?
To have a group leader across the map suddenly and unexpectedly now in control of a pilot. Or whatever could happen now that a player was ripped from the group.
This mission is highly scripted/curated and is meant to be played on teamspeak/discord so hopefully there isn't a need for chat.
I know players like DUI from the mods. Would doFollow work? Basically I just need this pilot to follow players around till he gets to the LZ. But now that I type it out a player needs to be in control of the pilot to put him in the LZ helicopter. Wow this a tough one..
Yeah maybe the easiest is to just give the pilot to the player leader.
doFollow shouldn't prevent the leader issuing a different order later
If I'm reading this correctly the wiki notes say this might be an issue doFollow doesn't work with player-issued commands
I'm pretty sure that means doFollow can't override player-issued commands
It should be a fairly easy thing to test, anyway.
Now the biki also says that you need two units in the group at the same time. No problem there so I do it like this:
[pilot] join _firstUnit;
sleep 1; //sleep to make sure the first happens first i guess?
pilot dofollow _firstUnit; //doesnt have to be an array
However I cant get the pilot to follow me. He just goes into formation for the group leader.
🤷
AI gonna AI
This is so true.
transparency in control images can be controlled via code or can it only be controlled by the alpha of the paa?
basically like procedurally colored images/backgrounds
ctrlSetFade?
Well, that's rather unhelpful comment, if I may say so. Problem has nothing to do with SP vs MP. It's a scripting problem, for which, I assume, this channel is meant for.
You can't fix the heli pilot AI. Give up and don't waste your time trying.
ill try, thanks 🙂
- Image itself
ctrlSetTextColorctrlSetFade+ctrlCommit
Probably can also add 1.5. ui2tex but that's for other places where transpaceny is harder to do
yeah, end3ed up using textColor. Thanks to both
anybody got a script to just create an explosion on a vehicle's location?
Do you want an effect or a full explosion?
Just spawn a projectile and trigger it
full on explosion
triggerAmmo createVehicle ["Bo_Mk82", ASLtoAGL getPosASL _veh, [], 0, "CAN_COLLIDE"];
Find another bomb or rocket if you want different explosion
Check CfgAmmo
and i'd just have to change _veh to whatever the variable of my vic is, yeah?
and where do i find that
Config Viewer
The usual advice: load Advanced Developer Tools for looking in the config viewer, you'll go insane otherwise (ADT reduces this to only partly insane)
Hello again, is addWeaponItem restricted by the weapon's compatible magazines?
because the syntax makes it seem like it shouldn't, but I can't get it to work
It can only add items that can be fitted to the gun. So it has to fit one of the specified gun's magwells or attachment slots.
Ok easy. thanks
Does anyone know any good usages of multiline drawIcon3Ds that I could look at? Im trying to draw nametags above players with multiple lines, but cant seem to get it looking right because at different distances the lines seem to intersect.
Same problem again but seems theres no easy solution
Please don't necropost. What does it mean by multiple lines. Do you mean \n?
I tried it but it does not work. It shows \n
Then make multiple drawIcon3Ds
Hmmm I guess thats the only solution. Its hard to calculate proper linespacing though
https://community.bistudio.com/wiki/screenToWorld
It's as easy enough as write one command
First you have to do worldToScreen for the first draw
The line height is what you provide for height (plus some spacing)
if (!isdedicated) then //not run on the dedicated server - client side
{
private ["_distance","_pSide"];//declaring
waituntil {!isnull player};
_distance = 100; //distance before you cannot see the name
_pSide = side player;
while {true} do
{
If ((isPlayer cursorTarget) && (side cursorTarget == _pSide) && (alive cursorTarget)) then
{
_pName = format ["%1", name cursorTarget]; //John Doe
//the no.1 infront of cuttext - says that this is the 2nd layer - 0 bieing the first - in this case the HUD display
1 cutText [_pName,"PLAIN",0];
waituntil {!alive cursorTarget || (player distance cursorTarget > _distance) || (side cursorTarget != _pSide) || (side cursorTarget == Civilian) };
1 cutText ["","PLAIN",0];
};
sleep 1;
};
}; //!isserver
I initialize variable in init.sqf like:
"myVar = false"
Then run a script in initServer.sqf, in which i have waitUntil which waits for true in this variable like:
"waitUntil { sleep 1; myVar };"
Than in local script, which is execute on client i do:
myVar = true
publicVariableServer "myVar"
But, its still false in this waitUntil.
Server is dedicated. Help
why init it in init.sqf and not initServer.sqf
according to https://community.bistudio.com/wiki/Initialisation_Order , init.sqf is executed after initServer.sqf on the server
But, its still false in this waitUntil.
How did you find out?
Whats the best way to get a sorted nearEntities? I already have an array of nearEntities but I want it sorted by distance without being too taxing. Is the nearestObjects the best way forward?
You'd have to sort it yourself if you didn't just use nearestObjects
private _units = nearEntities ...;
private _sortedUnits = _units apply { [<position> distance _x, _x] };
_sortedUnits sort false;
_units = _sortedUnits apply { _x select 1 };
Something like that
@finite bone
Which at that point could be slower than just using nearestObjects
Oh well thanks for the try 👍🏻
well im back with some more wishful thinking. does anyone know how i can trigger a script upon an admin logging in without a password? specifically i want to code to run on the server without having the user required to download a mod.
Logging in via #login? Or just logging into the server itself?
#login. although right now im looking into finding a workarround that checks every few seconds inside of onuserconnected in the server config
Its like keeping the light attachment mounted on a gun burning after the soldier wielding the gun has been killed...
Could use the HandleChatMessage checking for #login and then checking if they actually logged in after that
is there any way to cross reference with the list of admins in config_server.cfg?
I.... dont think so? Unless you can somehow read it from server, but I wouldn't recommend that
this will even make sure the admin isnt voted!
Didnt even know it existed
having an issue with publicvariableclient
the command is inside the code of missioneventhandlerOnUserAdminStateChanged
the Code:
BIS_fnc_addCommMenuItem_menu set [8,["Admin", [10], "#USER:ADMIN_MENU", -5, [], "isAdmin", "1"]];
_networkId publicVariableClient "BIS_fnc_addCommMenuItem_menu";
The Error:
22:51:16 Admin logged in, player: Full_Metal_Jacket, playerUID: 76561198161839549, IP: 10.0.0.73:2308.
22:51:16 Error in expression < -5, [], "isAdmin", "1"]];
_networkId publicVariableClient "BIS_fnc_addCommMen>
22:51:16 Error position: <publicVariableClient "BIS_fnc_addCommMen>
22:51:16 Error publicvariableclient: Type String, expected Number
this code is executed server side, and is supposed to modify an array on the cleint machine that is the admins machine.
networkID is a string, as the error says, and it should be a number
how did you get the net id?
params ["_networkId", "_loggedIn", "_votedIn"];
}];
you need the owner id, not that one
so how do i get the owner id from the network id?
_networkID getUserInfo 1
also I really don't recommend sending BIS_fnc_addCommMenuItem_menu over the network
also is isAdmin an actual commanding menu condition? I've never seen that
I hope you're not using chat gpt or sth
it would seem that whatever i put there means nothing. while back i tried setting a variable to be either 1 or 2 or 0. but none of the existing conditions worked for that purpose, so it kind of stayed there.
why would you not reccomend it?
well it's a local thing so there's just no need to send it over the network
that seems understandable.
for the use case there is nothing else writing into the menu, and i am trying to keep this in a servermod, rather than the mission file, as i have had my work plagiarized off the server and i really dont like that. so for the supports on my server, and some special features, i want to keep them away from prying eyes.
I suppose it's fine then but make sure that BIS_fnc_addCommMenuItem_menu is defined and also that you're not overwriting a Comms Menu item (e.g. CAS support) in your missions
also not sure what happens if other menu items are not defined (as in your case, since you're just defining the 9th element, BIS_fnc_addCommMenuItem_menu set [8)
as far as i can see, it cares nothing about the count in the array, but merely the content
well I mean the rest are undefined (nil)
set doesn't define other elements
you should try this locally before trying it on the server
yeah. i just didnt want a logging in admin to have the others that i am sending to be overwritten hence; set
currently in progress, but the network code unfortunately i do not know how to simulate on the client
_networkId = _networkId getUserInfo 1; is this LEGAL?
yes
is a headless client recommended for a 4 player modded anti stasi server?
Hey guys anyone ever experienced say3D command fastforwarding audio? Still cant resolve this mystery...
Did you convert it to wss?
to ogg and also tried wav
I think we also tried the wss :X
We used BIS_fnc_kbTell to play those audio files and it was working well. But we need to use say3D in some cases.
So I really dont understand where is the problem
not really
how do i easily export mods from steam launcher to local mods for a server?
IDK, but you can see #server_admins for server questions
I am trying to make a UAV (Praetorian) fire at a target. When I tell it to.
doTarget and https://community.bistudio.com/wiki/doFire makes it aim at target, but it doesn't shoot.
Notes say
A unit will not execute this command when his behaviour is set to "careless".
And yeah, unit behaviour is careless, so that's probably it. But nothing works to change it?
(group gunner _vec) setBehaviourStrong "COMBAT";
(group gunner _vec) setBehaviour "COMBAT";
(group gunner _vec) setCombatBehaviour "COMBAT";
(gunner _vec) setBehaviourStrong "COMBAT";
(gunner _vec) setBehaviour "COMBAT";
(gunner _vec) setCombatBehaviour "COMBAT";
Whatever I try, it stays in CARELESS.
Could it be that the virtual UAV gunner units cannot be set to combat mode?
If I use "doSupressiveFire" then it shoots, but it shoots over top of the target vehicle, instead of at it 😄
pra doTarget cursorObject;
pra doSuppressiveFire cursorObject;
Works somewhat, but it just keeps shooting even after target is destroyed
@still forum do u have any idea how to mass export mods from launcher to local mods?
no
so i will just have to go through each one at a time?
What does that have to do with #arma3_scripting ?
i was unsure on which channel to ask this in, and figured this would be the most fitting from each of the names
But while it works with the Praetorian, it doesn't work with missile launchers like the Spartan :/
@distant mountain see my reply here
You are asking about launcher, there is #arma3_launcher
Also don't ping random people with your questions.
pra = gunner cursorObject;
pra doTarget target1;
pra fireAtTarget [target1];
This makes the Spartan shoot.. But.. It shoots BEFORE it aims at the target 
forceWeaponFire will make it shoot blindly yeah. But I want it to actually aim and shoot at target.
I want to tell the autonomous static gun, to target and shoot a helicopter or vehicle
I actually find BIS_fnc_fire is (near to) only reliable option to shoot, at least one boolet
And lockCameraTo for force aim
ok just a guess but maybe use this to check if aiming has been done : https://community.bistudio.com/wiki/aimedAtTarget
[] spawn {
pra = gunner cursorObject;
pra doTarget target1;
waitUntil {pra aimedAtTarget [target1]};
pra fireAtTarget [target1];
}
It is aiming at the target, but aimedAtTarget returns 0 the whole time 🤣
lockCameraTo doesn't work with the Spartan, it just wobbled around a bit, even away from the target
wiki says aimedAtTarget takes "vehicle only, not unit"
I also tried vehicle pra aimedAtTarget [target1], no difference
oh
_ciws lockCameraTo [_pos,[0],true]``` every frame was the solution I took before
fireAtTarget, reliably makes it fire
doTarget reliably makes it aim at the target, even though aimedAtTarget returns 0.
[] spawn {
pra = gunner cursorObject;
pra doTarget target1;
Sleep 5;
pra fireAtTarget [target1];
}
This works for Spartan, it aims, and after 5 seconds it fires and hits.
Running the same thing on Centurion, it aims... into the air, in the OPPOSITE direction of the target. Fires, the rocket does a 180° and flies at the target, but misses and hits the ground below it.
Running same thing on Praetorian, it aims into the ground right infront of itself, and shoots into the ground 🔥
is this just cursed?
(╯°□°)╯︵ ┻━┻
hello friends, Ummm so where do i put the overview picture so it will show when i call it from the description.ext, i have the, paa in images and it always says not found
Show your config.
Using getMissionPath?
overviewPicture = __EVAL(getMissionPath "img\overview_template_ca.paa"); try
Your code worked fine to me
wtf is happening
You sure you didn't do anything with that lockCameraTo
addMissionEventHandler ["EachFrame",{pra1 lockCameraTo [target1,[0],true]}]```
Ah
and aimedAtTarget is now also 1
And anyways, we still see the wobble which is not even cool
pra = gunner cursorObject;
[] spawn {
while {alive target1} do {
vehicle pra lockCameraTo [target1,[0],true];
waitUntil {pra aimedAtTarget [target1] > 0.95};
pra fireAtTarget [target1];
};
};
This works for Praetorian.
Not for Centurion, it aims at target, but aimedAtTarget never goes beyond 0.
Same for Spartan, it gets stuck at the waitUntil
Hm indeed
alternative methods to detect if its aiming at the target 🤔
Would be neat if lockCameraTo could return true when its already on it.
https://community.bistudio.com/wiki/lockedCameraTo only gives the target, not whether its on it.
But if I make the lock temporary, as soon as the locked target goes back to nil, that means it reached its target.
Lock temporary. Every frame check if locked is nil, if yes then re-lock to keep it on it, and fire... uugh
@still forum works great thx man
_source = cursorObject;
_target = target1;
_source lockCameraTo [_target ,[0],true];
addMissionEventHandler ["EachFrame", {
_thisArgs params ["_src", "_tgt"];
if (isNil {_src lockedCameraTo []}) then {
removeMissionEventHandler ["EachFrame", _thisEventHandler];
[_src, _tgt] spawn {
params ["_src", "_tgt"];
while {alive target1} do {
_src lockCameraTo [target1,[0],true];
_src fireAtTarget [target1];
};
}
};
}, [_source, _target]];
Praetorian ✅
Centurion ✅
Spartan ✅
MIM-145 ✅
It could be so simple if only doTarget would actually DO target.
And if fireATtarget, would actually fire AT the target.
Added: targetWorks and fireWorks commands 😁
Doesn't work on a VLS..
Does work on VLS, but it takes a long time.
Uh
VLS and Mk45 Hammer shoot, but never hit
The hammer is a heavy gun, its aiming at target but not concidering bullet drop
The Praetorian probably also wouldn't consider drop if far enough away 🤔, but a kilometer is still fine
Now I just gotta combine this with a Radar where you click on target and have it be destroyed 😄
So I got something simple I keep botching. I'm trying to do a repeatable hold action on a dedicated server (in this case, for teleporting players across the map), and the teleport script itself works like a charm, but I can't seem to add the hold action to an object without the hold action either duplicating itself multiple times, not showing up, or just straight-up not working...
This is my code btw
[
boatdriver_hq, // Object the action is attached to
"Travel to Pulau Monyet", // Title of the action
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa", // Idle icon shown on screen
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa", // Progress icon shown on screen
"_this distance _target < 3", // Condition for the action to be shown
"_caller distance _target < 3", // Condition for the action to progress
{}, // Code executed when action starts
{}, // Code executed on every progress tick
{ _this execVM "scripts\teleport_monyet.sqf"}, // Code executed on completion
{}, // Code executed on interrupted
[], // Arguments passed to the scripts as _this select 3
1, // Action duration in seconds
1, // Priority
false, // Remove on completion
false // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", -2, boatdriver_hq]; // MP compatible implementation```
where are you running this code from?
-2
MP compatible implementation
not
on a dedicated server
...kinda?
designing a mission to only run on a dedicated server is bad practice
missions can be player-hosted, that's about it!
either duplicating itself multiple times, not showing up, or just straight-up not working.
seems to point to bigger issues still
[0, -2] select isDedicated can wait until those are solved, i suppose? (or whatever the idiomatic way is)
yes, was just pointing a side issue ^^
where it is run is the issue most likely
if in the init, then it remote execs as many times as there are players + server
Sounds about right. Where should I run it instead?
Or should I recode it entirely
initServer.sqf, or make it non-remoteExec
inb4 "drop the remoteExec part and run it from initPlayerLocal.sqf" or something i'm slow
Which is the best option here?
I had it as execVM in initServer.sqf before
I remember there being some issues which is why I commented it
initPlayerLocal.sqf ensures it only runs on machines with a player behind clients (HC may be included 😬)
Should I keep it remoteExec too btw?
nope
Ok thanks. What should I replace it to?
[
boatdriver_hq, // Object the action is attached to
"Travel to Pulau Monyet", // Title of the action
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa", // Idle icon shown on screen
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa", // Progress icon shown on screen
"_this distance _target < 3", // Condition for the action to be shown
"_caller distance _target < 3", // Condition for the action to progress
{}, // Code executed when action starts
{}, // Code executed on every progress tick
{ _this execVM "scripts\teleport_monyet.sqf"}, // Code executed on completion
{}, // Code executed on interrupted
[], // Arguments passed to the scripts as _this select 3
1, // Action duration in seconds
1, // Priority
false, // Remove on completion
false // Show in unconscious state
] call BIS_fnc_holdActionAdd;
VAL_fn_blockMovementkeyDown = {
params ["_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"];
private _handled = false;
private _blockedKeys = [];
{_blockedKeys = _blockedKeys + [(actionKeys _x) select 0]} foreach [
"moveBack","moveDown","moveFastForward","moveForward","moveLeft","moveRight","moveSlowForward","turbo","turnLeft","turnRight",
"commandBack","commandFast","commandForward","commandLeft","commandRight","commandSlow",
"CarFastForward","CarBack","CarForward","CarLeft","CarMovement","CarRight","CarSlowForward","CarWheelLeft","CarWheelRight"
];
if (_dikCode in _blockedKeys) then {
hint "Disabled input";
_handled = true;
};
};
VAL_fn_blockPlayerMovementAdd = {
if (isNull player) exitwith {};
waitUntil {!isNull findDisplay 46};
VAL_blockMovementEH = (findDisplay 46) displayAddEventHandler ["keyDown","_this call VAL_fnc_blockMovementkeyDown"];
}; ```
☝️ I get the hint sqf hint "Disabled input";
But the W,S,A,D movement isn't blocked
Why this:
params ["_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"];
_ctrl = _this select 0;
_dikCode = _this select 1;
_shift = _this select 2;
_ctrlKey = _this select 3;
_alt = _this select 4;
?
But the W,S,A,D movement isn't blocked
It is, because you add codes for moveXXX actions.
Yeah, those where leftovers from the old code
You are never returning the _handled variable?
You are right...
Also, the blocked keys are never changing. Make them either a macro or a global var. Use hashMap instead
Also I think you can pass the funciton name directly to the event handler.
Not sure if _this is still availble in the function, something to test
VAL_fnc_blockMovementkeyDown = {systemChat str _this};
findDisplay 46 displayAddEventHandler ["keyDown", VAL_fnc_blockMovementkeyDown];
Works
So overall you can do this with like 5 lines
Thanks, I made it work with your input! Thank you!
VAL_blockMovementEH = nil;
VAL_fn_blockMovementkeyDown = {
params ["_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"];
private _handled = false;
private _blockedKeys = [];
{_blockedKeys = _blockedKeys + [(actionKeys _x) select 0]} foreach [
"moveBack","moveDown","moveFastForward","moveForward","moveLeft","moveRight","moveSlowForward","turbo","turnLeft","turnRight",
"commandBack","commandFast","commandForward","commandLeft","commandRight","commandSlow",
"CarFastForward","CarBack","CarForward","CarLeft","CarMovement","CarRight","CarSlowForward","CarWheelLeft","CarWheelRight"
];
if (_dikCode in _blockedKeys) then {
hint "Disabled input";
_handled = true;
};
_handled
};
VAL_fn_blockPlayerMovementAdd = {
if (isNull player) exitwith {};
waitUntil {!isNull findDisplay 46};
VAL_blockMovementEH = (findDisplay 46) displayAddEventHandler ["keyDown","_this call VAL_fn_blockMovementkeyDown"];
};
VAL_fn_blockPlayerMovementRemove = {
if (isNil{VAL_blockMovementEH}) exitWith {};
findDisplay 46 displayRemoveEventHandler ["KeyDown", VAL_blockMovementEH];
VAL_blockMovementEH = nil;
};
{_blockedKeys = _blockedKeys + [(actionKeys _x) select 0]} foreach [
"moveBack","moveDown","moveFastForward","moveForward","moveLeft","moveRight","moveSlowForward","turbo","turnLeft","turnRight",
"commandBack","commandFast","commandForward","commandLeft","commandRight","commandSlow",
"CarFastForward","CarBack","CarForward","CarLeft","CarMovement","CarRight","CarSlowForward","CarWheelLeft","CarWheelRight"
];
if (_dikCode in _blockedKeys) then {
hint "Disabled input";
_handled = true;
};
Why go through the array twice?
inb4 players have two binds for their movements 🙃
Hmm, perhaps in is faster than checking value for each element and exiting early
But he only stores the first one, doesn't he?
well, ja?
private _actions =
[
"moveBack","moveDown","moveFastForward","moveForward","moveLeft","moveRight","moveSlowForward","turbo","turnLeft","turnRight",
"commandBack","commandFast","commandForward","commandLeft","commandRight","commandSlow",
"CarFastForward","CarBack","CarForward","CarLeft","CarMovement","CarRight","CarSlowForward","CarWheelLeft","CarWheelRight"
];
private _blockedKeys = flatten (_actions apply {actionKeys _x});
flatten returns a new array and doesn't work in-place afaik
I know. Was just an example
Fixed
But...doesn't actionKeys return the sum of alt + shift + <key?
and then you get kicked by SQF number precision as per wiki comment
Theoretically, the player could change their keybinds
#include "\a3\ui_f\hpp\defineResincl.inc"
#define BLOCKED_ACTIONS [\
"moveBack",\
"moveDown",\
"moveFastForward",\
"moveForward",\
"moveLeft",\
"moveRight",\
"moveSlowForward",\
"turbo",\
"turnLeft",\
"turnRight", \
"commandBack",\
"commandFast",\
"commandForward",\
"commandLeft",\
"commandRight",\
"commandSlow",\
"CarFastForward",\
"CarBack",\
"CarForward",\
"CarLeft",\
"CarMovement",\
"CarRight",\
"CarSlowForward",\
"CarWheelLeft",\
"CarWheelRight"\
]
VAL_fn_blockMovementkeyDown = compileFinal {
params ["", "_dikCode"];
_handled = (BLOCKED_ACTIONS findIf { _dikCode in (actionKeys _x) }) >= 0;
if (_handled) then {
hint "Disabled input";
};
_handled
};
VAL_fn_blockPlayerMovementAdd = compileFinal {
if (!hasInterface or { !canSuspend }) exitWith { };
_display = displayNull;
waitUntil {
_display = findDisplay IDD_MISSION;
!(isNull _display)
};
VAL_blockMovementEH = _display displayAddEventHandler [...];
};
eyyy, SQF golf
Who's next? 😁
If only all BI code was like that! Very clean and fast, thanks and also Revo as always
How would you script a directional nearestObjects with respect to the direction of another object? Say, I want to grab nearestObjects at the direction an object is looking at.
Filter found objects using select.
Yea I'm thinking if I should use getRelDir or should a simple cross comarison is enough?
Useful function: https://community.bistudio.com/wiki/BIS_fnc_isInFrontOf
depends on your definition of "nearestObjects at the direction" i suppose? The fast&dumb way would be to move the nearestObject's center position radius meters in vectorDir direction 🙃
Like for example, a searchlight that picks up all objects it is shined upon upto a certain distance. It need not exactly be a light, it could also be a camera or other entity. You get the idea. I'm more sort of looking for a 'cone' view of objects.
There are https://community.bistudio.com/wiki/lineIntersects and related commands.
I belieive thats just complicating it much further than required unless theres no other way 😅
i'd still say this for the rough first pass. And then filter out with getRelDir. I'm afraid there's no elegant solution.
Or maybe use screenToWorld in the second pass for the ultimate meme 🤣
Oh god no 
_overallfrontentities = [];
{
if (((_unit getRelDir _x > 314) && (_unit getRelDir _x < 361)) || ((_unit getRelDir _x > -1) && (_unit getRelDir _x < 46))) then {
_overallfrontentities pushBack _x;
};
} forEach _overallunits;```
I think this should work - Ill test it later and let you guys know 😅
_overallfrontentities = _overallunits select {
_direction = _unit getRelDir _x;
(_direction >= 0) && { _direction <= 60 }
};
_overallfrontentities = _overallunits select { [_unit, _x] call BIS_fnc_isInFrontOf };
How come there are EH and separate MP EH? Does this mean that the giant list of EH won't work in MP?
According to BIKI, https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Multiplayer_Event_Handlers, MP EHs can be added from any machine, unlike regular EHs.
No, it means those EHs are specialised for multiplayer use and behave differently to normal EHs, in ways that aren't important for SP. Normal EHs and mission EHs work in MP, you just need to pay attention to their locality.
Ah okay, I've been using the regular EH and it seems to work in testing during MP with a second client open. I haven't tried it on dedicated server yet though.
Multi-client on one machine isn't the same as having multiple machines in terms of locality. It's OK for testing things where you just need to be in 2 places at once, but it's no good for testing network mechanics.
hello my friends
how do i remoteExec this ----> flag2 setFlagTexture "Images\usflag.jpg";
[flag2, "Images\usflag.jpg"] remoteExec ["setFlagTexture",flag2];```
btw, I'm pretty sure the game comes with a US flag texture built in which you can use, so you don't need to include one
cool thx man
your the best m8
thats awsome
thx again friend
one more thing friend how do i remoteExec this "flag2" setMarkerColor "ColorBlue";
i tryed and failed
does AI score points for eliminating enemy units like player does? If so, how would I go about assigning those points to zeus controlling the "killing" side? And if I had to write my own framework for this, can I somehow adapt the Killed EH to check every unit rather than adding it to each one of them?
i know ai does get points but the rest i dont know m8
like you can show ai score in the debriefing
but thats all i know
ill try again to do remoteExec this "flag2" setMarkerColor "ColorBlue";
but i may fail again
woohoo i got it hell yeah
i was thinking backwords
["flag2", "ColorBlue"] remoteExec ["setMarkerColor","flag2"];
thats 3 things i got right wooohoo
lol
//so this is my flag script if im correct
if (!isServer) Exitwith {};
//"flag1" setMarkerColor "ColorBlue";
["flag1", "ColorBlue"] remoteExec ["setMarkerColor","flag1"];
//playSound
"OBJEnd" remoteExec ["playSound"];
//setFlagTexture flag_us_CO.paa
[flag1, "\A3\Data_F\Flags\flag_us_CO.paa"] remoteExec ["setFlagTexture",flag1];
i think thats correct
i hope
yes it works woohoo thx for your help Nikko
anyone has used the sqf onMouseZChanged Event Handler? When I try adding it I get an Error and also what would I be getting from sqf params [ "_scroll"] ?
Post your code
// Update Object Tilt on Mouse Scroll Wheel movement
VAL_carryMouseScrollEH = nil;
VAL_fn_carryMouseScrollEHAdd = {
if (isNull player) exitwith {};
waitUntil {!isNull findDisplay 46};
VAL_carryMouseScrollEH = (findDisplay 46) displayAddEventHandler ["onMouseZChanged","_this call VAL_fn_carryMouseScrollEH"];
};
VAL_fn_carryMouseScrollEH = {
params ["_displayOrControl", "_scroll"];
if (true) then {systemChat str _this;};
private _handled = false;
if !(isNil {player getVariable "isClimbing"}) exitWith {_handled = true; _handled};
_handled
};
VAL_fn_carryMouseScrollEHRemove = {
if (isNil{VAL_carryMouseScrollEH}) exitWith {};
findDisplay 46 displayRemoveEventHandler ["onMouseZChanged", VAL_carryMouseScrollEH];
VAL_carryMouseScrollEH = nil;
}; ```
It is only for testing, I believe that displayAddEventHandler is not the correct one for "onMouseZChanged"?
MouseZChanged, not onMouseZChanged
Made a 🤡 of myself, it is working great now, thank you!
You shouldn't need to remoteExec setMarkerColor at all, it's global effect
There's no point in defining a variable as nil (i.e. your first line)
Just do if (isNil "VAL_carryMouseScrollEH") then { ... };
if (isNil {VAL_carryMouseScrollEH}) is creating a code type, calling it, and then checking if its return value is nil. Rather than just checking if the variable is defined
Also just use CfgFunctions (https://community.bistudio.com/wiki/Arma_3:_Functions_Library) rather than just defining your functions in global namespace
Also:
VAL_carryMouseScrollEH = (findDisplay 46) displayAddEventHandler ["onMouseZChanged","_this call VAL_fn_carryMouseScrollEH"];
Why use a string? Just do:
VAL_carryMouseScrollEH = (findDisplay 46) displayAddEventHandler ["onMouseZChanged", {call VAL_fn_carryMouseScrollEH}]; // explicity passing _this isn't necessary, and has a very minor performance cost
How do you recommend me to synchronize a client configuration variable with the server? I would like to take into consideration a CBA client setting in a code that I run from the server.
You can make a CBA setting global
But in that case, I dont take into consideration the client election.
What are you trying to do?
Iam modifying the dynamicGroups, making the user decide whether to modify the insignia in 3 modes: always change it, only when they dont have a insignia or never.
Oh are you just trying to run code on the server when a client changes their setting?
ok Nikko ill check it thx and hello Dart
yes
Ive made it work with player setVariable...
but i dont know if its the best way
You can run code when a setting is changed, just create a CBA serverEvent / remoteExec code to the server
https://cbateam.github.io/CBA_A3/docs/files/settings/fnc_addSetting-sqf.html
The settingChanged code will run on every machine where the setting is used. For global settings that would be all machines, for client settings that will just be their own machine
hello Dart how are You mate
Doing fine
great
you helped me so much i dont need any help for a while lol
and others too
my friends say my missions are great, thay said how did you make this ,i said a little bird helped me he he
no i told them of you
thx again Dart your Awsome
I need help playing audio from object in editor in loop.
This works localy, but I need it in multiplayer:
nul = [this] spawn {while {true} do {(_this select 0) say3D "MosquesPrayer"; sleep 150;};};
I tried this and it error out:
nul = [this] spawn {while {true} do {(_this select 0) remoteExec say3D "MosquesPrayer"; sleep 150;};};
it seems you got it
https://community.bistudio.com/wiki/remoteExec
You have to follow the remoteExec syntax properly. Just sticking in the word remoteExec is unfortunately not enough.
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
[this] spawn {
while { true } do
{
(_this select 0) remoteExec say3D "MosquesPrayer";
sleep 150;
};
};
yeah, what NikkoJT said about remoteExec 😄
Now that Lou has made it easier to see, here's how you'd make it work properly:
this spawn {
while { true } do
{
[_this,"MosquesPrayer"] remoteExec ["say3D"];
sleep 150;
};
}; ```
However, if this is a static object that won't move, then you might prefer to use <https://community.bistudio.com/wiki/playSound3D> instead, which is Global Effect so it doesn't need to be remoteExec'd.
Does anyone know why sometimes setUserInsginia is not reflected in the players, server side (according to the logs) works perfectly.. (setUserInsignia returns true).
I have tried using different classes.
Oh yeah, if this is in an object's init field, then you need some protection ☔
Editor init fields are executed locally on every machine, either at mission start or when they join. So this code would result in every machine telling every other machine to play the sound. That's bad!
Now, you could just not remoteExec the code. Then every machine would do their own thing locally. However, the sounds wouldn't necessarily be in sync for each machine, especially ones that joined later.
What you can do instead is add a check to make sure the code only runs once, on the server. The server then is the only machine running the loop, and instructs every other machine when it's time to play the sound.
if isServer then {
// the rest of the code goes here
};```
Do you mean BIS_fnc_setUnitInsignia?
I don't think I know of any problems with it that cause that behaviour. It has some problems, just not that one, to my knowledge.
One thing to watch out for is that not all uniforms support insignia. It requires an insignia selection to be defined as part of the uniform model, and sometimes there isn't one.
It handles no insignia selection (I just went in-game to check the same thing), it returns false if missing
Also, watch out for respawns, as it's not automatically persistent across respawn, and missions are sometimes set to instantly respawn the player on mission start.
Yes, the uniform has a selection of insigia (I have been trying others). What happens is that having the same uniform to some it appears and to others not, and they are not from additional addons.
I appreciate you guys!
Are some of these players perhaps players who have joined after the insignia was set?
I have an additional button to re-set the badge. I run it client side, but according to the documentation it runs server side.
Where are you calling it from?
If you mean the function, it doesn't. It runs on the machine that executed it and then the texture / material is updated via setObjectTextureGlobal and setObjectMaterialGlobal and is synced across the network
should i run it server side?
I mean you could, but it wouldn't make any difference
and when they leave the group and join... the insignia has to be put back on, which doesn't work either (the default system..)
Ok girls and boys, need your help.
Found a script that I've been looking for, for ages. but doesnt know what to do with it haha
Its a script that places AI in windows
Have you tried to check what parameters the script accepts? Or search on internet: https://forums.bohemia.net/forums/topic/170936-release-infantry-occupy-house-script/ ?
Overview This script teleports AI units into nearby buildings at appropriate window positions. Units will stand and face the window so they can fire out of it. Units are moved to random windows every time. If there are enough units, every possible window will be covered; otherwise, you wont know ...
Yeah, thats the problem haha, I don't really understand what text to put where.
understand that the script should go in the mission folder, and then it stops
Really? You don't understand what is written clearly and understandably? That's sad...
yeah, it is sad. mostly because English isn't my first language and I have almost no knowledge in scripting and such
that's why I tried to get help in here 🙃 But it was probably wrong
What difference does it make what your primary language is? And what difference does it make how well you know scripting?
The thing is that both the script and the forum topic contain a description of the parameters being accepted, and this description is ordinary everyday text that can be translated by any translator.
Good afternoon. Tell me please. I am writing my extension and I need to understand, is it loaded into memory when the arma is launched and spinning there all the time or is it loaded every time it is called?
I need to initialize some values, preferably 1 time, and not on each call
I think the extension gets loaded when you do callExtension and it has its own memory
Translators often struggle with technical text. Often it can be translated in principle, but the meaning is distorted. That's an especially big problem if you're not familiar with the subject.
And frankly, the wiki is not truly a one-stop shop that can solve everything for you. Despite our best efforts, it's not always complete, and it's not always written in a particularly clear way.
If you've never done any scripting before, it's completely normal to need some extra help to explain things. That's fine, and it's fine to ask for that help here; that's why this channel exists.
I know it can get annoying to answer basic questions, but I mean.... you're not obligated to be here. If you don't want to do anything beyond "here's a wiki link, go figure everything out yourself, idiot", you're allowed to take a break.
I use wiki links all the time, for my reference and for others', but I will also try to explain it too, because I know when I was new I didn't really understand the wiki a lot of the time either. It's just part of giving a complete answer and helping the other person learn.
(i mean, i tend to spam wiki links because my memory is too fuzzy 🤣 )
"here's a wiki link" is fine. "Here's a wiki link and if you don't understand perfectly from that, you're stupid" is not.
Update: This works great 😄
Translators often struggle with technical text. Often it can be translated in principle, but the meaning is distorted. That's an especially big problem if you're not familiar with the subject.
Technical text? Could you provide an example, for instance, in this description:
- Array, the building(s) nearest this position is used
?
I can probably only agree with the word "array", but I'm not sure.
And BIKI is not written by some scientists, but by ordinary people for ordinary people. And English is also not my primary language, but that doesn't stop me from using a translator to understand.
And frankly, the wiki is not truly a one-stop shop that can solve everything for you. Despite our best efforts, it's not always complete, and it's not always written in a particularly clear way.
Strange, for me BIKI is the first place I go if I need to know something. And as I have written several times, BIKI contains almost all information.
If you've never done any scripting before, it's completely normal to need some extra help to explain things. That's fine, and it's fine to ask for that help here; that's why this channel exists.
Totally agree. But for me it looked like the person was too lazy to open the file and read the description. Or find the topic on the forum and read the description.
I use wiki links all the time, for my reference and for others', but I will also try to explain it too, because I know when I was new I didn't really understand the wiki a lot of the time either. It's just part of giving a complete answer and helping the other person learn.
If you prefer to do it this way, then do it, I don't mind. But I prefer to first give links to BIKI, where, as I already wrote, almost everything is described in an accessible and detailed manner, and then, if there are specific questions, I can answer.
As someone wrote here, the big problem with people simply that they don't bother to read, learn, search, etc. It seems that acting lazy is the new trend, it's easier to ask someone than to do something for you.
would anyone know how to get rid of weapon sway on a wasteland server without having to use a mod? like a script or something
you could use this
https://community.bistudio.com/wiki/setCustomAimCoef
I'm not sure if stamina would still have an impact after that
yeah i have been looking at this one but im just not sure where i should actually put the script
I'm assuming you already have a script that runs clientside like initPlayerLocal.sqf?
then you could add
player setCustomAimCoef 0.3;
player addEventHandler ["Respawn", {player setCustomAimCoef 0.3;}];
but it entirely depends on the missions setup and what you want to do
yeah i have the initplayerlocal.sqf it currently looks like this
then add it somewhere in there, I see there is some kind of scripted anticheat, that could break/detect the sway reduction btw
okay will try that now, thank you very much both of you!
yeah not sure what that scripted anticheat is, this is just a GTX wasteland server package
Or even better place: https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/blob/1a8c33999bd7de2ecfe00d9efa31a0d786ac0394/client/functions/playerSetupStart.sqf#L18
https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/blob/dev/server/antihack/payload.sqf line: 232-336
looks like you should be in the clear for CustomAimCoef
unitRecoilCoefficient will be flagged tho if you don't also set A3W_antiHackMinRecoil properly
yeah gotcha, i dont really wanna get rid of any recoil its just the sway when aiming in. stamina is off buts its almost like the character is still fatigued
so if i run with this
player setCustomAimCoef 0.3;
player addEventHandler ["Respawn", {player setCustomAimCoef 0.3;}];
can i add that anywhere in the playersetupstart.sqf or is there somewhere specific
sorry these are probably dumb questions, im still wrapping my head around this stuff
Probably don't even need the event handler if using playerSetupStart
not too familiar with wasteland code but I assume that gets called when you respawn too since fatigue/stamina are also only set once
so you can just add
_player setCustomAimCoef 0.3;
anywhere after _player = _this;
trying again 🙂
found a script that I want to start using but don't know how to set it up correctly - been reading but that didnt make me any smarter...
https://forums.bohemia.net/forums/topic/170936-release-infantry-occupy-house-script/
The only thing I understand is to place the script in the mission folder, but then it stops
Overview This script teleports AI units into nearby buildings at appropriate window positions. Units will stand and face the window so they can fire out of it. Units are moved to random windows every time. If there are enough units, every possible window will be covered; otherwise, you wont know ...
3den enhanced has this option, so... why no use that instaed
Hmm, didnt even know that haha - will check it out for sure
I have a say3d that says "Gunboat's Toast!" when this sideChat runs. But the two commands don't happen at the same time because the unit is interrupted by the vanilla chatter like "contact", "regroup", etc. Any workarounds to this behavior?
been reading the documentation but cant seem to find it, could you help me point it out?
There are https://community.bistudio.com/wiki/enableSentences, https://community.bistudio.com/wiki/disableAI and related commands.
The description contains code snippets to run the script. Have you tried any?
Does "RADIOPROTOCOL" do the same thing as enableSentences?
Don't know, check it.
gave up with that since the function was in 3den enhanced. yes, tried some of them but didnt get them to work
If you decide to use the script, it would be nice if you provided your code and error messages from RPT-file.
Good example
I noticed that the killed EH doesn't work with non-unit objects. Is there an equivalent EH for that?
it should work with structures, what type of object you have?
Usually the issue with Killed is that it only fires for local objects.
I used a sog asset. Shelter and food crate.
would I use isWeaponDeployed to check if a weapon is unholstered or?
no- what would I use? x3
Could use weaponState unless someone's got a better suggestion
Check if currentWeapon == ""
That returns true if the unit has no weapon pulled out
That may send twice, looks like my service is weird
ur good ^.^
what could possibly go wrong
do it then
If I wanted to poke around with the directx extension system does anyone know of a good starting point? I don’t exactly know its capabilities other than I can get into the render pipeline and do stuff. I’d like to try messing around with it and maybe turning the world wireframe or something just to see how it works
I know last time I inquired about this Dedmen responded by playing Doom and watching youtube inside of arma
Hello, I've got a question regarding the configurations of functions:
Having prior experience in other programming languages, the first thing I've tried to do was to make several inline functions in a single .sqf file in order to make a library, since the functions that I am writing for my scenario are very simple and did not thought that was worth making a dedicated file for each function.
But when calling the functions, the code did not execute. I thought it was not the right way to do things. I still have to understand when (or for what) I should use them and how to load them.
Then I read the "Functions Library" page with some other posts in forums and other people's code to take as examples.
So I made my cfg snippet inside description.ext, knowing that if this structure works, I can basically write anything I need:
class EVI{
class taskm{
class test{};
};
};
And then did my testing code:
//functions/taskm/fn_test.sqf
[blufor, "t_intro", ["TaskDesc", "TaskTitle", "attack"], objNull, true] call BIS_fnc_taskCreate;
Theoretically, I should be able to call it with call EVI_fnc_test; and it should appear the task notification, but it did not.
To be sure, I've also tried to search the function via the Editor's Function Viewer, but I did not found it.
- Did I miss something in the process? I read about compiling the sqf but I didn't understand if it has to do with me or the game itself.
- Would it be a bad practice to make a
.sqffull of inline functions, load it at the start of the scenario and the use the functions inside it? - Also, I keep reading about placing the CfgFunctions inside
description.extor by making a.hppdedicated file and then include the header into the.ext, which is the more modern and reliable way to do?
Thanks in advance 👋
You didn't put your function into an actual CfgFunctions class
- The game compiles your function(s), nothing else is required other than the config setup
- It's better to just create an individual file for each function
- It doesn't matter, it would be purely organizational
Blowing up the heli would also prevent it from landing, but semantics.
blowing it up will force it to "land"
To expand on Dart's answer, what you're missing is the outermost class, the one that tells the game this is CfgFunctions and not some other config type like CfgSounds or whatever.
class CfgFunctions
{
class EVI
{
class taskm
{
class test{};
};
};
};```
can i use missioneventhandlerEntityCreated in a server mod to assign EventhandlerHit & Killed to a unit?
specifically to enemy units that the server creates
Yes.
Make sure it's executed on the server.
if (isServer) then {
//Add events
};
And you could check that it's only once added .
maybe those arent destroyable at all?
Thanks both @tulip ridge and @hallow mortar, I was writing the message ad 1AM in the morning so I thought to omit the "CfgFunctions" class for space saving but it was already in the config file, my bad.
Now I'll try yo rewrite it in a new 'description' just to be sure it wasn't anything else that breaks the file.
UPDATE: Figured it out why it did not load anything.
While I was making the mission, I needed to make some variables and store them in order to use them later.
It happens that I wrote them inside the description.ext file, which broke the parse of the file.
Now with only the config options the file loads correctly, I just need to search in the wiki where I could store and use them
Heyo! I'm currently in the middle of making my own campaign.
I'm wanting an AI to talk to some players, and then lead them into a cavern with a base hidden inside, naturally Arma AI isn't very good at pathfinding that way. Is there a script I can use to manually make them walk a set path and then turn to face the player?
doMove, setDir are your best commands
How would I best use them in this context?
Like would I need to set them on a Scripted waypoint
Sorry, I'm not very well versed with scripting and the Wiki hurts my brain
I've been using Co-Pilot to do the basic scripting but anything more complicated and it has a habit of making up it's own syntaxes and commands 🤣
Basically get the XYZ coordinates of the position you want the AI to move to. For example, if I want the AI to move from one end of the altis runway to the middle of the runway with coordinates[14931.5, 16544.2, 0]; I'd execute it like this:
_campaignAI doMove [14931.5, 16544.2, 0];```
Oh sweet. So if I replace _campaignAI with the variable of the AI I want to move, that'll work?
the _campaignAI is the variable name you specify for the AI to guide the players
Gotcha
And how is that different from the Move waypoint? Does this override the AI's pathing and just force them to move in a straight line?
Because I've used move waypoints already, and while they do somewhat work, in testing there's a 25% chance for the AI to get stuck and soft lock the mission
and then you basically wait until it reaches the player and change direction, so overall it would look something like this:
_campaignAI doMove [14931.5, 16544.2, 0];
waitUntil {moveToCompleted _campaignAI};
_campaignAI setDir (180 - getDir player);
_campaignAI setFormDir (180 - getDir player);```
Gotcha. Can I chain those up too? Say, one doMove right after another?
doMove is a direct silent command/order. It will ignore the waypoints it was given before until that doMove is completed.
I was more thinking along the way of will it have the same pathing issues as the Move waypoint - as currently the AI gets stuck trying to path somewhere specific
Yes, make sure you check using waitUntil that it has moved to the previous position before using doMove again.
It entirely depends tbh. I don't know the exact specifics and nature of your scenario so cant help you with that exactly.
If you TRULY want to get the exact movement order right, you are better of chainig doMove along the entire path you want it to take (make sure you set the combat mode to careless)
I can clear it up a little bit - they're walking into a cave on Ruha where the path is quite narrow with a rockface on each side. While, for the players, it's just a straight line to walk, the AI tries so zigzag and gets stuck on the rocks occasionally
I once tried to 'cinematically' insert people via fastrope in a multiplayer game and resorted to using 30k+ positions as point of reference for helicopters to fly with simulations semi-disabed 
Absolutely useless, but hey it was fun and worked fine 
Holy damn
If its a straight line, use a loop, to increment their movements by every 5/10 meters
while (getPosATL _campaignAI != _endPosition) do {
waitUntil {moveToCompleted _campaignAI};
_campaignAI doMove [(getPosATL _campaignAI select 0) + 2, (getPosATL _campaignAI select 1) + 2, (getPosATL _campaignAI select 2)];
uiSleep 0.1;
};
_campaignAI setDir (180 - getDir player);
_campaignAI setFormDir (180 - getDir player);```
That's awesome, thank you!
Yeah I guess so. How can I tell if an asset has a damaged version too?
shoot at it 🙂
if you go to the config there should be DestructionEffects class if its destroyable and destrType = "DestructBuilding" and armor variable. stuff like that
@crisp sonnetJust a heads up, lookAt is much easier and better than setDir - forgot it existed 😅
setFormDir is the real deal though 😎
Yeah I noticed that setDir wouldn't change the formation direction so in testing they'd just turn back around again
No, its addAction and my ancient action progress script
Ohhh, I see, it looks almost the same, the new CDLC Expeditionary FOrces uses https://community.bistudio.com/wiki/BIS_fnc_keyHold @hollow thistle implemented it I believe, which is quite neat but the SPACE text that appears on the UI cannot be customized (it seems)
So it limits what it can show... and you can't set it up to be any other than the SPACE key
would be so awesome to have it expanded to include TITLE customization and KEY customization
https://community.bistudio.com/wiki/BIS_fnc_holdKey accepts key parameter
Yes but looses the progress bar UI
You can pass a custom control to it
I don't know how 😦 , it is easier to ask KK for an expansion on BIS fnc keyHold
Would benefit CDLC devs too 😉
private _display = findDisplay 46; // or whatever display you want
private _ctrl = _display ctrlCreate [...];
[_display, _key, _time, {...}, _ctrl] spawn BIS_fnc_holdKey;
That will show the same UI as the BIS fnc keyHold Progress Bar?
You need to mess with the ctrlCreate params, https://community.bistudio.com/wiki/ctrlCreate
"..." is just a placeholder
Not sure if you can get the exact same setup, I was just showing you can do something similar
I don't remember what license the functions fall under, but you could also just copy the original into your own function and add a new parameter
Hey, sorry this has probably been asked a thousand times, but i've literally been struggling to get a solution 😅
I have a cash script - but when you're in a vehicle, the hint indicates that its going to the player, but when they dismount, they dont have it.. i've tried doing a if statement to detect if they're in a vehicle.. even tried getting the variable from the vehicle to then transfer it to the player.. that probably sounds up how bad my efforts are at this
is there a way to do it?
The only person who knows how your script works is you, could you show your script?
It sounds like just some small oversight
while {true} do
{
_AIUnits = (AllUnits Select {!(isPlayer _x) && !(_x GetVariable ["HasEH", false])});
{
_x AddEventHandler ["Killed",
{
params ["_unit", "_killer", "_instigator", "_useEffects"];
_Bonus = round (_unit distance _killer);
_BonusTotal = _bonus / 3;
_TotalReward = _BonusTotal + 50;
_KillersCash = _killer getVariable ["Cash", 0];
_KillersCash = _KillersCash + _TotalReward;
_killer setVariable ["Cash", _KillersCash, true];
if !(isNull objectParent _killer) then
{
_vehiclereward = vehicle commander getvariable ["Cash" 0];
_vehicletotal = vehiclereward / 2;
_killer setvariable ["Cash", _vehicletotal, true];
};
hint format["Killer: %1 Cash %2", name _killer, _KillersCash];
}];
_x setVariable ["HasEH", true];
} forEach _AIUnits;
Sleep 25;
};
been 4 years since since i last played arma and apparently gave myself a task i have no idea on how to finish lol
_instigator will be the unit who pulled the trigger, _killer will be the vehicle if the unit used a vehicle
while {true} do
{
_AIUnits = (AllUnits Select {!(isPlayer _x) && !(_x GetVariable ["HasEH", false])});
{
_x AddEventHandler ["Killed",
{
params ["_unit", "_killer", "_instigator", "_useEffects", "_Bonus", "_BonusTotal", "_TotalReward", "_KillersCash", "_vehiclereward", "_vehicletotal"];
_Bonus = round (_unit distance _killer);
_BonusTotal = _bonus / 3;
_TotalReward = _BonusTotal + 50;
_KillersCash = _killer getVariable ["Cash", 0];
_KillersCash = _KillersCash + _TotalReward;
_instigator setVariable ["Cash", _KillersCash, true];
if !(isNull objectParent _instigator) then
{
_vehiclereward = _killer getvariable ["Cash" 0];
_vehicletotal = _vehiclereward / 2;
_instigator setvariable ["Cash", _vehicletotal, true];
};
hint format["Killer: %1 Cash %2", name _killer, _KillersCash];
}];
_x setVariable ["HasEH", true];
} forEach _AIUnits;
Sleep 25;
};
I still have the same issue but i just wanted to make sure that its sound first before continuing
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Your params is wrong, none of those variables past _useEffects are passed to the Killed event
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed
It doesn't really matter, since you're changing their values after, but they shouldn't be there
You're also still using _killer in yout hint and _vehicleReward. Is that intentional? You will also get your total money halved if you kill a unit while in a vehicle with that logic
it was to kind of balance it out so sitting on a hill wont rack up huge sums of money fast
Also why not just use the EntityKilled mission event handler? So that you don't have to add the event handler to every single unit?
yeah because its running on ALiVE
What does that change
i dont do scripting, i'm doing the best with what i've got tbh - so i know most of it doesnt make sense
atm it all runs absolutely fine, I just cant get players in vehicles to get their cash unfortunately
i know how to put pieces together but thats about it sorry
I was just asking what alive changes that means you couldn't use the mission EH?
I've never touched it, so I don't know why it wouldn't work
Wasn't trying to be sarcastic, if it came off that way
no no not at all
basically my idea was because ALiVE more or less despawns units until they're near by - i really like the system and didnt know how to do it, so i used that event handler - i seen it used on another mission and it basically did everything i needed
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityKilled is added to the mission itself, and runs whenever any unit dies
So you could just use that, and exit if the unit that died is a player
But anyways, I'm guessing your issue is because you're still using _killer when you really want _instigator. Currently, you're still checking the cash variable on the vehicle (if the killer is in one)
yeah the money is basically racking up then you check the ATM and it says Player Wallet 0 lol
this makes alot more sense this entitykilled
Pretty sure you can just do something like this
addMissionEventHandler ["EntityKilled", {
params ["_unit", "", "_instigator"];
private _bonus = round (_unit distance _killer);
private _totalReward = (_bonus / 3) + 50;
// Global variables should always be prefixed with a unique "tag"
// This should be something unique to you, the mission, etc. e.g. SKA as an example
private _killersCash = _instigator getVariable ["TAG_cash", 0];
// Halve reward if _killer used a vehicle
if !(isNull objectParent _instigator) then {
_totalReward = _totalReward / 2;
};
_killersCash = _killersCach + _totalReward;
_instigator setVariable ["TAG_cash", _killersCash, true];
hint format["Killer: %1 Cash %2", name _instigator, _killersCash];
}];
Note I did change your formula for vehicle stuff, you can take it or leave it
Because I assume you don't people to lose money by using a vehicle
cheers man i really appreicate it, you didnt have to do that
I have this event handler in the server init, am i supposed to have it somewhere else?
No, it should be run on the server
Add a systemChat typeOf _instigator; line somewhere in there to make sure it's actually a unit
i'm getting Scalar Nan for the message and the instigator is b_soldier_repair_f
which i think i know why the the scarlar nan
b_soldier_repair_f is obviously the classname of the soldier i am
hello again Arma 3 friends , if i use a Respawn Madule on the map, what should i put in the Description.ext to use this Respawn Madule
i always did it the old school way
probably a better way, but i use this mate
// Respawn
respawnOnStart = 1;
respawnTemplatesWest[] = {"MenuInventory","MenuPosition"};
i havent personally used the respawn module
obviously remove that inventory one
copy that m8 ill try it thx you
Oh so then it's probably just a wrong variable being use somewhere
no i got it fixed mate
Oh I see it, or at least one
The params should be params ["_unit", "_killer", "_instigator"];, I forgot the killer
Oh missed your message lol
no dont be daft mate your fine
you not helping me with it made me actually learn shit man
i basically just changed the if !(isNull objectParent _instigator) to _killer
and it started printing that money out for the player
I really appreicate your time, fixing the script and putting up with my shit lol
I need help finding this script on wiki.
valuableName = [
[70, "Name", "Arma_Assets_Name", 90, 5, true],
[70, "Name", "Arma_Assets_Name", 90, 5, true],
[70, "Name", "Arma_Assets_Name", 90, 5, true]
];
oh
What exactly are you looking for?
Hello, is anyone able help me create a very specific init where certain objects (like trenches) are hidden, unless a player walks up to it and is holding a specific item in their inventory?
I am trying to figure what the [90, 5, true] are?
it was in the description.ext
It's really hard to say.
This is just setting up a variable containing that information. It doesn't do anything on its own, it just stores data for some other script to use.
Although if it really was in description.ext, it probably wasn't working properly, because that's SQF and description.ext is Config
oh wait, they left a comment on it. I didnt realize it. It says:
Display Name - Class Name - Rotation When Bought - Object Radius (meters) *prevents AI glitching through object - Has AI true/false (for objects with AI like autonomous turrests
Hi, how can I reload scripts I changed without restarting Arma all the time?
Judging by that, it's probably meant for some system for buying placeable items. Systems like that are custom-scripted, not part of the basic game, so you'll need to find which system uses it and refer to their documentation.
Again though, very probably not implemented correctly, because the way it's formatted is not appropriate for description.ext
oh sorry it not in descrition, it on it own sqf file.
sorry for wrong misinformation
Functions should be recompiled on restarting the mission or save/load in Editor. If this isn't happening, check the Editor settings to make sure recompiling is turned on.
Non-function scripts (init.sqf, execVMs etc) are compiled whenever they're executed and don't need a game restart under any circumstances.
If you're making a mod then it's more complicated.
I am indeed making a mod.
where can i figure out the system and doc. Can i find it in the wiki?
Well, like I said, it's a custom-scripted thing. Someone other than BI made it. That sort of stuff isn't on the wiki, because the wiki is primarily for documenting the game's standard features.
You'll need to look through the mission's scripts to find something that looks like it fits the description, and look for comments that explain it or provide helpful links. Or, if you know who made the mission, ask them.
I think the usual thing is to turn on the -filepatching startup parameter and then work with loose files rather than PBOs. Then recompiling with uhhh BIS_fnc_recompile should™ work.
I personally just make a mission and put the mod folder in there and just include stuff in description.ext
Or use hemtt. It will take care of file patching and you can define a mission which will automatically be loaded when you build the mod and start the game.
okay i figure it out, they were using lbAdd covert into format while using %1 and %2. foreach item that was in the list.
I'm having some issues actually getting this to work
It's telling me the variable 'martinez' is undefined
But the ai I want to move is literally called martinez in his variable name
Wait does it need the '_'
ah it does
Okay new error
"Wait until returned nil, true or false expected."
Judging from your script, is _campaignAI defined?
I would assume that moveToCompleted _campaignAI is returning nil
As the error states, you need a boolean return inside. ensure its waitUntil {moveToCompleted _martinez};
You mean....
waitUntil {moveToCompleted _martinez};
_martinez setDir (180 - getDir player);
_martinez setFormDir (180 - getDir player);```
OH
Shut up I didn't spell martinez incorrectly on the first line
No evidence
Shush

Funny thing
Same error
Use martinez instead of _martinez
Is the doMove working? If not then the variable name might be the problem
I tried both
I think the variable name is the issue
It's specifically on line 2 though
_Martinez is a local variable which aint defined, so nil.
As such your code is doing:
waitUntil {moveToCompleted nil};
nil setDir (180 - getDir player);
nil setFormDir (180 - getDir player);```
If you put martinez into variable name of a character in editor, then its a global variable martinez without _.
Check if your variable name is actually martinez. Also dont put _martinez into var name, editor should stop you anyhow
NikkoJT stated "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." If I start wth a map position, how can I calculate the center position of the closest triangle/cell or vertex?
I am using setTerrainHeight to create a hole at s safe position, and I want to decorate the hole. But since the center of the hole created is not the same position as my starting position, it's hard to place objects correctly in that hole. How do I use the data provided by getTerrainInfo to calculate center terrain cell nearest input position?
I suck at math, so help would be greatly appreciated.
Math required would be something like round location to nearest multiple of terrainGridWidth
Probably easiest to implement by something like closestGridLocation = terrainGridWidth * ( round( location/terrainGridWidth ))
Needs to be done for both X and Y of the input location
Not sqf code though, just pseudocode, but the logic and math is the same anyways
Variable name is Martinez
Tried to remove the capital, reverts to capital. Says it isn't case sensitive
Thanks much dude, I'm gonna try that out now.
It isnt case sensitive. I wasnt talking about capital letter
I know, you were talking about wether it was named _martinez or Martinez. As far as I'm aware the names are correct, and I get the same error whether I use _martinez in the script or just martinez
Do you have a pointer to that tool?
If variable is correct, your script looks correct. Therefore it shouldnt error
I'd assume that to be the case but the specific error is still saying it's an undefined variable - the problem is that it's on line 2 the error occurs. The unit begins to move just fine, but the waitUntil errors out with the undefined variable
Wiki: https://hemtt.dev/installation/index.html
Read it well
Everything you need to build Arma 3 mods with HEMTT
By far the best build tool there is currently
I think mine rivals it 😁
is the snippet you've posted the whole script, or is there more to it?
That's the whole script
how are you runnin it?
Executing it from an SQF because waitUntil doesn't work any other way in experience
Same thing as sleep
it works, you need to spawn it
[] spawn {
martinez doMove [8019.5, 7767.5, 0];
waitUntil {moveToCompleted martinez};
martinez setDir (180 - getDir player);
martinez setFormDir (180 - getDir player);
}``` like so
do you have debug console?
also are you trying to run this while in eden editor or when playing the mission?
I'm running from Eden using the "Play in Multiplayer" button
I do have debug yee
yeah, try writing martinez in watch field of the debug console
Gotcha. Well Martinez is the name of the unit btw and the unit is pre-placed (not spawned by another script) if that helps
thats okay, also martinez is its "Variable Name" right?
martinez should be okay, what does the watch field return tho?
I'm not at my PC to test it at the moment and probably won't be until tomorrow
Ah, welp, if the field doesnt return anything, variable name is wrong, if it returns not an object, something overwrote it, if it returns objNull, something happend to martinez
Oh no what happened to Martinez I hope he's okay
In any case, what you could try next, is look at said unit, up close and personal, then type martinez = cursorObject in debug console (not watch field) and hit Local exec.
Watch field should then start printing out the object
Lemme see if my laptop can at least get into the editor
Then paste code above in debug console and hit local exec again. See if ... events ... unfold
All of above must be done when playing, not while in editor
My laptop is typically able to do mission making and testing with relatively small light modpacks but I've never tested one of this size
It's only a 4th gen i7 and a GT 840M bless it's heart
Just waiting for OneDrive to sync the mission folder
You should be really careful about having your Arma profile or installation in folders controlled by OneDrive. It has a bad habit of interfering with things Arma needs to run, which can result in corrupted profiles or the game crashing.
I need it setup like this for a reason
That being said, 5,000 hours of Arma and I'm yet to encounter a OneDrive issue
