#arma3_scripting

1 messages · Page 168 of 1

empty pilot
#

just want to prevent player from clicking c

#

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

open hollow
#

player actionnow ["WeaponOnBack", player]

charred monolith
#

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)

open hollow
open hollow
empty pilot
charred monolith
open hollow
# charred monolith 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

charred monolith
open hollow
# empty pilot

maybe just
player action ["WeaponOnBack", player]

this should put the weapon in the back ( maybe the animation is needed, adn with actionnow its cancelled)

open hollow
charred monolith
#

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 !

open hollow
flint topaz
#

if so you can instead intercept it from the keypress, rather than fighting it afterwards

thin fox
#

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

tulip ridge
#

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

empty pilot
#

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

flint topaz
#

so you want them to stay in the same stance they were in before they died?

tulip ridge
empty pilot
#

that not a list for action

hot sapphire
# tulip ridge All it does it spit back out even worse code than was fed into it Not to mention...

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?

pallid palm
#

all i know is he a pro

tulip ridge
#

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.

hot sapphire
pallid palm
#

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

merry shard
#

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)

opal zephyr
#

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.

merry shard
opal zephyr
#

Yup it should, put a sleep in there though so it doesnt check every frame

merry shard
#

In this part, like how it is with the (goggles etc.) bit?

etc.```
opal zephyr
#

ya like that

merry shard
#

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

tulip ridge
#

Just add a killed event handler and destroy the effect

merry shard
#

I'll try to figure out how to do that

merry shard
#

Or should I put !alive _unit && local _unit in the params instead?

opal zephyr
#

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

merry shard
#

Oh okay, I figured it was required for addEventHandler, I'll try it without the params part

tulip ridge
#

How you sent it originally is correct

versed belfry
#

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.

merry shard
#

I think I'm just going to erase the post-process stuff and go without it

tulip ridge
#

Also you don't need to specify _this for the left side, that's the default

tulip ridge
merry shard
#

"this" like the variable?

hallow mortar
#

it's almost like that's what the error explicitly says

versed belfry
merry shard
hallow mortar
#

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

merry shard
#

k

#

Anyway should I do like this = _unit above that or something?

fair drum
#

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)

merry shard
#

Thank you

fair drum
tough abyss
#

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");```
odd kite
#

Oh man that’s awesome! I’m away for the weekend but will give it a go when I’m back for sure!

vapid scarab
tough abyss
#

ohhh okay, now i understand

#

thank you

tough abyss
#

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

warm hedge
#

Likely because _vehicle is undefined

#

It is not defined in that spawn

tough abyss
#

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)};
};
hallow mortar
#

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"
};```
tough abyss
hallow mortar
#

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.

tough abyss
warm hedge
#

_localVariableLikeThis cannot be transferred between scripts without you obviously state to do so, is the point

tough abyss
#

didnt know _this was a thing in this code.

hallow mortar
warm hedge
tough abyss
#

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

tulip ridge
#

_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

tough abyss
#

oh so there other way to use _this, but it makes something different?

#

just to make sure if i understand it correctly

tough abyss
tulip ridge
#

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
};
tough abyss
tulip ridge
#

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
};
tough abyss
#

this really did help me alot, understand somethings.

#

thank you everyone

tulip ridge
tough abyss
thin fox
vapid scarab
winter rose
vapid scarab
#

🙃 Thanks

#

Know of any way to reference the object when it is created?

warm hedge
#

Assembling is one of seriously hardcoded part of the features

#

...Because it never is created. It transforms out of the backpack

eternal spruce
#

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?

winter rose
#

maybe _vehicle doTarget (_vehicle getRelPos [0, 10, 10]) or something alike

#

well wrong command/syntax but you get the idea 😄

#

modelToWorld*

eternal spruce
#

I’ll look into it thank you

eternal spruce
#

@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.

winter rose
#

it's a UAV, so it has an AI in it
it should target that position, raising the gun (mayhaps)

eternal spruce
#

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

winter rose
#

what about the modelToWorld pos?

eternal spruce
#

is that the [x,y,z] value in the editor?

winter rose
#

wat

_vehicle doTarget (_vehicle modelToWorld [0, 10, 10])

eternal spruce
#

Sorry im not sure what that means

winter rose
#

you said

I tried using doWatch on a marker

what does it mean, where did you script what and how?

eternal spruce
#

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

winter rose
#

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!

eternal spruce
#

thank you gn

charred monolith
#

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;
        };
    };
}];
restive slate
#

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?

little raptor
# restive slate Is there any difference in resource use between a terrain baked object and an ob...

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)

wind hedge
#

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

warm hedge
#

#PostYourCode

wind hedge
warm hedge
#

Using getPos is your issue

wind hedge
wind hedge
warm hedge
#

It still is the issue, at least it seems to be

wind hedge
#

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

warm hedge
#

getPosWorld

wind hedge
#

Gives an error, while ```sqf
_pos = _pos getPos [_space,_dir];

warm hedge
#

Because that's not how getPosWorld works

sullen sigil
#

Just use modeltoworld for player

warm hedge
#

Or that

sullen sigil
#

I can't remember if eyedir is a command or not but can also just use that and basic trigonometry

wind hedge
kindred zephyr
little raptor
#

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)

wind hedge
#

Thanks guys! You all rock!

jade acorn
#

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?

little raptor
jade acorn
#

and addon name is a pbo within the mod folder, rather than the folder itself right?

sullen sigil
#

It's class for cfgpatches

#

It's usually same as pbo name but not always

little phoenix
#

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

true frigate
true frigate
#

That returns an empty array, despite the vehicle having ammo. A number of either 0 or 1 doesn't change the outcome.

faint burrow
#

Then it looks like the command is broken.

tulip ridge
#

Check your turret path

tulip ridge
winter rose
tulip ridge
tulip ridge
winter rose
#

isn't it [0] ?

#

[[0], false]

tulip ridge
#
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

winter rose
#

yep
but they try the alt syntax here (see the bool)

#

I'll add it to the examples to make it clearer

winter rose
tulip ridge
#

Oh yeah I see what you mean now

#

It's too early here 🫠

winter rose
#

go to beeed 😄

tulip ridge
#

But I could instead be confused by setVelocityTransformation (I hate physics)

still forum
little phoenix
faint burrow
tulip ridge
little phoenix
#

Ah must’ve missed it oh well

#

I ended up just looping what I needed any which solved it

nocturne bluff
#

Shuko, order all the AI to stop

vapid scarab
# warm hedge ...Because it never is created. It transforms out of the backpack

@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?

vapid scarab
#

Apprec.

tough geode
#

Either WeaponAssembled attached to the unit or Assembled directly to the weapon/drone

open fractal
#

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

dusk gust
#

not ingame afaik, could rebind something using AHK or similar tho

old owl
#

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.

old owl
maiden raven
#

No change

#

Maybe I just have to ungroup them for a moment

nocturne bluff
#

Usually that stops them fron wanting to regroup ;/

meager granite
#

Wish you could do NUMBER round 1 instead of say parseNumber (NUMBER toFixed 1) or round(NUMBER * 10) / 10

cosmic lichen
#

Yeah that would be neat indeed.

tardy osprey
#

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.

maiden raven
#

Damn, even ungrouped with unassignvehicle, leavevehicle and allowgetin false, chopper still wants to land as soon as someone is moveOuted :G

round scroll
#

Shuko, have you tried overriding the AI pilot input via setVelocity? Maybe just giving zeros as arguments is enough to make the chopper hover

vapid scarab
#

"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

stable dune
hallow mortar
# tardy osprey Idk if you're available. But i tried getting it to work with say3D, playSound3D,...

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)

tardy osprey
hallow mortar
#

no

tardy osprey
# hallow mortar 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?

hallow mortar
hallow mortar
# tardy osprey I cant say it makes sense then. I need to play the sound followed by subtitles, ...

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.
tardy osprey
tardy osprey
hallow mortar
#

Make sure your subtitles in the config class follow the format for CfgSounds. Like I said, it's not exactly the same as CfgRadio.

tardy osprey
#

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)
tardy osprey
# hallow mortar Make sure your subtitles in the config class follow the format for `CfgSounds`. ...

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;
};

};

hallow mortar
#

Well, I don't know. That looks correct to me.

proven charm
#

i think you are missing [] from titles

tardy osprey
#

I'll have to test it later, but i'll keep you updated.

blissful current
#

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.

thin fox
#

(allPlayers select {(_x distance (position Pilot)) < 20}) # 0?

blissful current
#

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.

thin fox
#

with the command attachTo

hallow mortar
blissful current
#

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}];

hallow mortar
#

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.

thin fox
#

player in thisList should do the trick

#

I dont know if you want to notify all players or just be a local thing

hallow mortar
#

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.

thin fox
blissful current
#

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?

hallow mortar
thin fox
#

after activation

blissful current
hallow mortar
#

Then you can't use player in thisList because player returns objNull on the server

thin fox
#

yea

blissful current
#

Ah yes, that's why my original condition is the findIf. I remember now.

thin fox
#

just do what nikko said

hallow mortar
#

Trigger attributes: ANY PLAYER, PRESENT, server only, not repeatable (probably)
Trigger condition: this
Trigger activation: ["meet", [thisList#0], ...

blissful current
hallow mortar
#

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.

blissful current
thin fox
#

simpler is better

hallow mortar
#

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.

thin fox
#

I suggest just to test it out

blissful current
thick hatch
#

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, ""]; 
blissful current
# hallow mortar Personally, I would use the trigger for this. It involves fewer commands, and it...

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}];

hallow mortar
blissful current
#

My mistake. I'll start working on attaching the trigger to the pilot.

hallow mortar
#

triggers have init fields as well as all their other triggerstuff fields, right?

this attachTo [foxclub_pilot,[0,0,0]]```
blissful current
tough abyss
#

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];
tough abyss
blissful current
# hallow mortar triggers have init fields as well as all their other triggerstuff fields, right?...

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]]
twin basin
#

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

hallow mortar
blissful current
twin basin
blissful current
twin basin
#

well im trying to give CAS aircraft and heavy armor to specific players while limiting transport aircraft to a certain role.

blissful current
#

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

tardy osprey
blissful current
tardy osprey
blissful current
#

Ah, I've never used CfgRadio but I've used sidechat a lot. What about the text wasnt working?

tardy osprey
#

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.

hallow mortar
tardy osprey
#

I think this is an actual "title" though, dont think it'd work well for conversation

blissful current
#

The easiest is just to put the text into sidechat. Then do say3d right after.

_briefingUnit sideChat "Briefing text";
_briefingUnit say3D "briefing";
tardy osprey
blissful current
#

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.

tardy osprey
runic delta
#

is there a command that would determine if two positions are on the same island?

tardy osprey
#

Last time i tried "Sleep" it gave me an "error suspending not allowed in this context"

blissful current
blissful current
runic delta
#

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

blissful current
#

I'm very new to all this. Sounds like you know much better than I. Sorry.

runic delta
#

No problem. Thanks

tardy osprey
#

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?

blissful current
#

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";

tardy osprey
# blissful current So for example a players' variable name is Unit1 then you write `Unit1 sideChat ...

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?

blissful current
#

You can also use setRandomLip for your units. I updated the code above.

tardy osprey
tardy osprey
#

"True & False"

#

Is this gonna be local btw? I looked online and apparently there's issues with it only firing locally?

blissful current
#

Do you want this for SP or MP?

tardy osprey
#

Multiplayer at the moment, yeah.

blissful current
#

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;
tardy osprey
blissful current
tardy osprey
blissful current
blissful current
tardy osprey
hallow mortar
blissful current
hallow mortar
#

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.

tardy osprey
blissful current
tardy osprey
#

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;
blissful current
#

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.

tardy osprey
#

is that... backwards?

#

I have a danish keyboard and it looks like it's a similar situation to forward backslash, not present.

blissful current
#

the tilda key is the key just to the left of 1

tardy osprey
#

yeah the tilde key gives me ½½½

#

I dont have that symbol on it lol

blissful current
hallow mortar
#

It's the one immediately left of backspace (on a Danish layout)

blissful current
#

bottom circle

hallow mortar
# blissful current 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.

tardy osprey
#

got it, had to press Shift, and the key to the left of Backspace. cheers nikko

blissful current
#

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.

tardy osprey
blissful current
#

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

tardy osprey
#

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.

blissful current
#

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.

tardy osprey
blissful current
#

And when you remoteExec the setrandomlip in MP?

tardy osprey
#

because said script worked fine in editor with setlip when testing. Didn't work when hosting.

blissful current
#

I was gonna suggest on it's own. But idk why it wont work for you. It tested it on mine and it works.

tardy osprey
#

quickly restarting the server, i forgot the server only when hosting. will try again.

blissful current
fair drum
#

sir, it needs an array of units

tardy osprey
hallow mortar
blissful current
#

Weird that it worked previously without brackets in the SP testing editor without an error.

hallow mortar
blissful current
#

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.

blissful current
hallow mortar
#

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.

blissful current
#

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;
hallow mortar
#

[_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

blissful current
#

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.

hallow mortar
blissful current
hallow mortar
#

I'm pretty sure that means doFollow can't override player-issued commands

#

It should be a fairly easy thing to test, anyway.

blissful current
#

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.

hallow mortar
#

🤷
AI gonna AI

blissful current
#

This is so true.

kindred zephyr
#

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

hallow mortar
#

ctrlSetFade?

tough abyss
#

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.

kindred zephyr
meager granite
#

Probably can also add 1.5. ui2tex but that's for other places where transpaceny is harder to do

kindred zephyr
mortal pelican
#

anybody got a script to just create an explosion on a vehicle's location?

meager granite
#

Do you want an effect or a full explosion?

#

Just spawn a projectile and trigger it

mortal pelican
#

full on explosion

meager granite
#
triggerAmmo createVehicle ["Bo_Mk82", ASLtoAGL getPosASL _veh, [], 0, "CAN_COLLIDE"];
#

Find another bomb or rocket if you want different explosion

#

Check CfgAmmo

mortal pelican
#

and i'd just have to change _veh to whatever the variable of my vic is, yeah?

mortal pelican
meager granite
#

Config Viewer

hallow mortar
#

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)

thick hatch
#

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

hallow mortar
#

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.

thick hatch
#

Ok easy. thanks

oblique lagoon
#

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

warm hedge
#

Please don't necropost. What does it mean by multiple lines. Do you mean \n?

oblique lagoon
#

I tried it but it does not work. It shows \n

warm hedge
#

Then make multiple drawIcon3Ds

oblique lagoon
#

Hmmm I guess thats the only solution. Its hard to calculate proper linespacing though

warm hedge
little raptor
#

First you have to do worldToScreen for the first draw
The line height is what you provide for height (plus some spacing)

pallid palm
#
 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
delicate hedge
#

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

winter rose
faint burrow
#

But, its still false in this waitUntil.
How did you find out?

finite bone
#

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?

tulip ridge
#

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

finite bone
#

Oh well thanks for the try 👍🏻

grim cliff
#

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.

dusk gust
grim cliff
keen stream
#

Its like keeping the light attachment mounted on a gun burning after the soldier wielding the gun has been killed...

dusk gust
grim cliff
#

is there any way to cross reference with the list of admins in config_server.cfg?

dusk gust
#

I.... dont think so? Unless you can somehow read it from server, but I wouldn't recommend that

dusk gust
#

Didnt even know it existed

grim cliff
#

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.

little raptor
#

how did you get the net id?

grim cliff
little raptor
#

you need the owner id, not that one

grim cliff
#

so how do i get the owner id from the network id?

little raptor
#

_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

grim cliff
little raptor
grim cliff
little raptor
#

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)

grim cliff
little raptor
#

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

grim cliff
#

yeah. i just didnt want a logging in admin to have the others that i am sending to be overwritten hence; set

grim cliff
grim cliff
little raptor
#

yes

grim cliff
#

it worked!

#

thank you @little raptor !

distant mountain
#

is a headless client recommended for a 4 player modded anti stasi server?

ancient kayak
#

Hey guys anyone ever experienced say3D command fastforwarding audio? Still cant resolve this mystery...

little raptor
#

Did you convert it to wss?

ancient kayak
#

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

distant mountain
winter rose
still forum
#

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

distant mountain
#

@still forum do u have any idea how to mass export mods from launcher to local mods?

still forum
#

no

distant mountain
#

so i will just have to go through each one at a time?

still forum
distant mountain
#

i was unsure on which channel to ask this in, and figured this would be the most fitting from each of the names

still forum
winter rose
still forum
still forum
still forum
#

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

warm hedge
#

I actually find BIS_fnc_fire is (near to) only reliable option to shoot, at least one boolet

#

And lockCameraTo for force aim

proven charm
still forum
#
[] 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

warm hedge
#

It worked finely to me

#

Wobble is still a thing tho

proven charm
#

wiki says aimedAtTarget takes "vehicle only, not unit"

still forum
#

I also tried vehicle pra aimedAtTarget [target1], no difference

proven charm
#

oh

warm hedge
#
_ciws lockCameraTo [_pos,[0],true]``` every frame was the solution I took before
still forum
#

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 🔥

pallid palm
#

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

still forum
pallid palm
#

k

#

overviewPicture = "img\overview_template_ca.paa";

still forum
#

overviewPicture = __EVAL(getMissionPath "img\overview_template_ca.paa"); try

pallid palm
#

ah ok

#

thx m8

warm hedge
still forum
#

wtf is happening

warm hedge
#

You sure you didn't do anything with that lockCameraTo

#
addMissionEventHandler ["EachFrame",{pra1 lockCameraTo [target1,[0],true]}]```
still forum
#

duh

#

vehicle, not gunner

#

Yes that works!

warm hedge
#

Ah

still forum
#

and aimedAtTarget is now also 1

warm hedge
#

And anyways, we still see the wobble which is not even cool

still forum
#
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

warm hedge
#

Hm indeed

still forum
#

alternative methods to detect if its aiming at the target 🤔
Would be neat if lockCameraTo could return true when its already 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

pallid palm
#

@still forum works great thx man

still forum
#
_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.

winter rose
#

Added: targetWorks and fireWorks commands 😁

still forum
#

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

haughty timber
#

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```
south swan
#

where are you running this code from?

winter rose
#

-2

MP compatible implementation

not

south swan
#

on a dedicated server
...kinda?

winter rose
#

designing a mission to only run on a dedicated server is bad practice

#

missions can be player-hosted, that's about it!

south swan
#

either duplicating itself multiple times, not showing up, or just straight-up not working.
seems to point to bigger issues still blobcloseenjoy

#

[0, -2] select isDedicated can wait until those are solved, i suppose? (or whatever the idiomatic way is)

winter rose
winter rose
haughty timber
#

Sounds about right. Where should I run it instead?

#

Or should I recode it entirely

winter rose
#

initServer.sqf, or make it non-remoteExec

south swan
#

inb4 "drop the remoteExec part and run it from initPlayerLocal.sqf" or something i'm slow

haughty timber
#

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

winter rose
#

initPlayerLocal.sqf ensures it only runs on machines with a player behind clients (HC may be included 😬)

haughty timber
#

Should I keep it remoteExec too btw?

winter rose
#

nope

haughty timber
#

Ok thanks. What should I replace it to?

winter rose
#
[
    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;
haughty timber
#

Oh right, just a call

#

Thanks!

#

Let's see if it works

wind hedge
#
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

faint burrow
#

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.

wind hedge
cosmic lichen
#

You are never returning the _handled variable?

wind hedge
cosmic lichen
#

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

wind hedge
# cosmic lichen ```sqf VAL_fnc_blockMovementkeyDown = {systemChat str _this}; findDisplay 46 di...

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;
};
cosmic lichen
#
    {_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?

south swan
#

inb4 players have two binds for their movements 🙃

cosmic lichen
#

Hmm, perhaps in is faster than checking value for each element and exiting early

cosmic lichen
south swan
#

well, ja?

cosmic lichen
#
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});
south swan
#

flatten returns a new array and doesn't work in-place afaik

cosmic lichen
#

I know. Was just an example

#

Fixed

#

But...doesn't actionKeys return the sum of alt + shift + <key?

south swan
#

and then you get kicked by SQF number precision as per wiki comment

hallow mortar
faint burrow
#
#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 [...];
};
south swan
#

eyyy, SQF golf

faint burrow
#

Who's next? 😁

wind hedge
finite bone
#

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.

faint burrow
#

Filter found objects using select.

finite bone
#

Yea I'm thinking if I should use getRelDir or should a simple cross comarison is enough?

faint burrow
south swan
#

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 🙃

finite bone
#

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.

faint burrow
finite bone
#

I belieive thats just complicating it much further than required unless theres no other way 😅

south swan
finite bone
#

Oh god no meowsweats

#
_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 😅
faint burrow
#
_overallfrontentities = _overallunits select {
    _direction = _unit getRelDir _x;

    (_direction >= 0) && { _direction <= 60 }
};
#
_overallfrontentities = _overallunits select { [_unit, _x] call BIS_fnc_isInFrontOf };
blissful current
#

How come there are EH and separate MP EH? Does this mean that the giant list of EH won't work in MP?

faint burrow
hallow mortar
blissful current
#

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.

hallow mortar
#

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.

pallid palm
#

hello my friends
how do i remoteExec this ----> flag2 setFlagTexture "Images\usflag.jpg";

hallow mortar
#
[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
pallid palm
#

ok

#

nice thx m8

#

how do i find that flag in the game

hallow mortar
pallid palm
#

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

jade acorn
#

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?

pallid palm
#

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

wind hedge
#

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"] ?

warm hedge
#

Post your code

wind hedge
# warm hedge 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"?

warm hedge
#

MouseZChanged, not onMouseZChanged

wind hedge
hallow mortar
tulip ridge
tulip ridge
thorn charm
#

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.

tulip ridge
thorn charm
tulip ridge
#

What are you trying to do?

thorn charm
#

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.

tulip ridge
#

Oh are you just trying to run code on the server when a client changes their setting?

pallid palm
#

ok Nikko ill check it thx and hello Dart

thorn charm
#

Ive made it work with player setVariable...

#

but i dont know if its the best way

tulip ridge
#

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

thorn charm
#

Ok, I will do it

#

thx

pallid palm
#

hello Dart how are You mate

tulip ridge
#

Doing fine

pallid palm
#

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

unborn rivet
#

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;};};

winter rose
#

it seems you got it

hallow mortar
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
winter rose
#
[this] spawn {
  while { true } do
  {
    (_this select 0) remoteExec say3D "MosquesPrayer";
    sleep 150;
  };
}; 
#

yeah, what NikkoJT said about remoteExec 😄

hallow mortar
#

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.
thorn charm
#

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.

hallow mortar
# hallow mortar Now that Lou has made it easier to see, here's how you'd make it work properly: ...

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
};```
hallow mortar
tulip ridge
#

It handles no insignia selection (I just went in-game to check the same thing), it returns false if missing

hallow mortar
#

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.

thorn charm
hallow mortar
thorn charm
#

I have an additional button to re-set the badge. I run it client side, but according to the documentation it runs server side.

tulip ridge
tulip ridge
thorn charm
#

should i run it server side?

hallow mortar
#

I mean you could, but it wouldn't make any difference

thorn charm
#

and when they leave the group and join... the insignia has to be put back on, which doesn't work either (the default system..)

tough abyss
#

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

faint burrow
#

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/ ?

tough abyss
#

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

faint burrow
#

Really? You don't understand what is written clearly and understandably? That's sad...

tough abyss
#

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

faint burrow
#

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.

modern osprey
#

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

proven charm
hallow mortar
# faint burrow What difference does it make what your primary language is? And what difference ...

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.

south swan
#

(i mean, i tend to spam wiki links because my memory is too fuzzy 🤣 )

hallow mortar
#

"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.

finite bone
faint burrow
# hallow mortar Translators often struggle with technical text. Often it can be translated in pr...

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:

  1. 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.

faint burrow
# hallow mortar I know it can get annoying to answer basic questions, but I mean.... you're not ...

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.

odd kite
#

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

fiery gull
odd kite
fiery gull
odd kite
#

yeah i have the initplayerlocal.sqf it currently looks like this

fiery gull
faint burrow
odd kite
#

okay will try that now, thank you very much both of you!

odd kite
faint burrow
fiery gull
odd kite
#

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

fiery gull
#

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;

odd kite
#

okay testing now, thanks for the help

#

that worked!

tough abyss
#

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

open hollow
tough abyss
blissful current
#

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?

tough abyss
faint burrow
blissful current
faint burrow
#

Don't know, check it.

tough abyss
faint burrow
#

If you decide to use the script, it would be nice if you provided your code and error messages from RPT-file.

tough abyss
#

Good example

blissful current
#

I noticed that the killed EH doesn't work with non-unit objects. Is there an equivalent EH for that?

proven charm
granite sky
#

Usually the issue with Killed is that it only fires for local objects.

blissful current
astral bone
#

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

tulip ridge
#

That returns true if the unit has no weapon pulled out

#

That may send twice, looks like my service is weird

astral bone
#

ur good ^.^

indigo snow
#

Pfeh, attachTo the helicopter to a floating invisible non physX object

#

Solved

tough abyss
#

what could possibly go wrong

indigo snow
#

nothing

#

its basically flawless

tough abyss
#

will it work though?

#

; )

indigo snow
#

it would certainly prevent the heli from landing

#

which was the original question

tough abyss
#

do it then

ocean folio
#

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

coral grail
#

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 .sqf full 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.ext or by making a .hpp dedicated file and then include the header into the .ext, which is the more modern and reliable way to do?

Thanks in advance 👋

tulip ridge
#
  1. The game compiles your function(s), nothing else is required other than the config setup
  2. It's better to just create an individual file for each function
  3. It doesn't matter, it would be purely organizational
gleaming rivet
#

Blowing up the heli would also prevent it from landing, but semantics.

tough abyss
#

blowing it up will force it to "land"

hallow mortar
grim cliff
#

can i use missioneventhandlerEntityCreated in a server mod to assign EventhandlerHit & Killed to a unit?

grim cliff
stable dune
proven charm
coral grail
#

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

crisp sonnet
#

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?

finite bone
crisp sonnet
#

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 🤣

finite bone
#

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];```
crisp sonnet
finite bone
#

the _campaignAI is the variable name you specify for the AI to guide the players

crisp sonnet
#

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

finite bone
#

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);```
crisp sonnet
finite bone
crisp sonnet
finite bone
#

Yes, make sure you check using waitUntil that it has moved to the previous position before using doMove again.

finite bone
#

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)

crisp sonnet
finite bone
#

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 kmao

#

Absolutely useless, but hey it was fun and worked fine high

finite bone
#
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);```
blissful current
proven charm
#

if you go to the config there should be DestructionEffects class if its destroyable and destrType = "DestructBuilding" and armor variable. stuff like that

finite bone
#

@crisp sonnetJust a heads up, lookAt is much easier and better than setDir - forgot it existed 😅

winter rose
#

setFormDir is the real deal though 😎

crisp sonnet
meager granite
wind hedge
#

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

tulip ridge
wind hedge
tulip ridge
#

You can pass a custom control to it

wind hedge
#

Would benefit CDLC devs too 😉

tulip ridge
#
private _display = findDisplay 46; // or whatever display you want
private _ctrl = _display ctrlCreate [...];
[_display, _key, _time, {...}, _ctrl] spawn BIS_fnc_holdKey;
wind hedge
tulip ridge
#

"..." 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

regal kraken
#

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?

tulip ridge
#

The only person who knows how your script works is you, could you show your script?
It sounds like just some small oversight

regal kraken
#

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

tulip ridge
#

_instigator will be the unit who pulled the trigger, _killer will be the vehicle if the unit used a vehicle

regal kraken
#

oh

#

so it should be just _instigator

tulip ridge
#

Yeah

#

Also reminder to prefix your public variables

regal kraken
#

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

tender fossil
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
tulip ridge
#

It doesn't really matter, since you're changing their values after, but they shouldn't be there

tulip ridge
regal kraken
#

it was to kind of balance it out so sitting on a hill wont rack up huge sums of money fast

tulip ridge
#

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?

regal kraken
#

yeah because its running on ALiVE

tulip ridge
#

What does that change

regal kraken
#

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

tulip ridge
#

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

regal kraken
#

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

tulip ridge
#

So you could just use that, and exit if the unit that died is a player

regal kraken
#

sorry i was just reading it

#

i'll use that

tulip ridge
#

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)

regal kraken
#

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

tulip ridge
#

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

regal kraken
#

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?

tulip ridge
#

No, it should be run on the server

regal kraken
#

I think i have something else interfering with it

#

i'm still having the same issue

tulip ridge
#

Add a systemChat typeOf _instigator; line somewhere in there to make sure it's actually a unit

regal kraken
#

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

pallid palm
#

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

regal kraken
#

Holy shit i got it Dart

#

Thank you so much

regal kraken
#

// Respawn
respawnOnStart = 1;
respawnTemplatesWest[] = {"MenuInventory","MenuPosition"};

#

i havent personally used the respawn module

#

obviously remove that inventory one

pallid palm
#

copy that m8 ill try it thx you

tulip ridge
regal kraken
#

no i got it fixed mate

tulip ridge
#

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

regal kraken
#

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

tough abyss
#

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]

];
tulip ridge
#

That's not a script

#

That's just an array

tough abyss
#

oh

tulip ridge
#

What exactly are you looking for?

uneven birch
#

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?

tough abyss
#

it was in the description.ext

hallow mortar
#

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

tough abyss
#

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

thorny osprey
#

Hi, how can I reload scripts I changed without restarting Arma all the time?

hallow mortar
tough abyss
#

oh sorry it not in descrition, it on it own sqf file.

#

sorry for wrong misinformation

hallow mortar
thorny osprey
#

I am indeed making a mod.

tough abyss
hallow mortar
# tough abyss 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.

tough abyss
#

alright

#

thank you for the help

hallow mortar
# thorny osprey I am indeed making a mod.

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.

little raptor
#

I personally just make a mission and put the mod folder in there and just include stuff in description.ext

cosmic lichen
#

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.

tough abyss
crisp sonnet
#

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."

dusk gust
finite bone
#

As the error states, you need a boolean return inside. ensure its waitUntil {moveToCompleted _martinez};

crisp sonnet
#

OH

#

Shut up I didn't spell martinez incorrectly on the first line

#

No evidence

#

Shush

finite bone
crisp sonnet
stark fjord
#

Use martinez instead of _martinez

finite bone
crisp sonnet
#

I think the variable name is the issue

#

It's specifically on line 2 though

stark fjord
#

_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

foggy stratus
#

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.

dusty steppe
# foggy stratus 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

crisp sonnet
#

Tried to remove the capital, reverts to capital. Says it isn't case sensitive

foggy stratus
stark fjord
crisp sonnet
thorny osprey
stark fjord
crisp sonnet
vapid scarab
tulip ridge
#

By far the best build tool there is currently

vapid scarab
#

I think mine rivals it 😁

stark fjord
crisp sonnet
stark fjord
#

how are you runnin it?

crisp sonnet
#

Executing it from an SQF because waitUntil doesn't work any other way in experience

#

Same thing as sleep

stark fjord
#

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?

crisp sonnet
crisp sonnet
stark fjord
#

yeah, try writing martinez in watch field of the debug console

crisp sonnet
#

Gotcha. Well Martinez is the name of the unit btw and the unit is pre-placed (not spawned by another script) if that helps

stark fjord
#

thats okay, also martinez is its "Variable Name" right?

crisp sonnet
#

Yes

#

I can try another variable name, like ruhaCommander if that helps too

stark fjord
#

martinez should be okay, what does the watch field return tho?

crisp sonnet
#

I'm not at my PC to test it at the moment and probably won't be until tomorrow

stark fjord
#

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

crisp sonnet
#

Oh no what happened to Martinez I hope he's okay

stark fjord
#

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

crisp sonnet
#

Lemme see if my laptop can at least get into the editor

stark fjord
#

All of above must be done when playing, not while in editor

crisp sonnet
#

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

hallow mortar
#

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.

crisp sonnet
#

That being said, 5,000 hours of Arma and I'm yet to encounter a OneDrive issue