#arma3_scripting

1 messages · Page 154 of 1

raw vapor
#

How do I prevent it from blasting aircraft? I know there's a way to check for it. I don't want to blow someone up flying over in like a helicopter or jet, unless they land.

tulip ridge
#

isNull objectParent <_unit> would return false if the unit is in a vehicle.

If you want to specifically check for aircraft, (typeOf objectParent <_unit>) isKindOf "Air"

#

Also it'd be better to check the vehicle before the waitAndExecute, that way you're not creating unnecessary waitAndExecutes, and it's not likely that someone would go into the area, leave, hop in an air vic and then fly back

raw vapor
#

Appreciated

#

I should be able to figure out the rest

timber bough
#

Thanks!

#

ah I just saw this one is you'd need to add custom pathing yourself, looks incredibly amazing tho!

wind sapphire
#

Looking for tips as to why AI generated on Side EAST start shooting at each other. I wondered if it could be because some units have a uniform, vest, helmet etc for which modelSides[] is set to a side that is an Enemy of EAST. Any help would be greately appreciated.

flat sluice
#

Okay, weird one here. So I need to block the 'TacticalPing' input action. I have it working by adding a display event handler on display 46, however some players are able to get around it via display 129 (diary). Anyone have ideas on other ways to block input actions that aren't linked to the display? Unfortunately, it seems like the userActionEventHandler command doesn't utilize the return value like the display handler

warm hedge
#

That EH has no way to interrupt a key input for multiple reasons and intentionally... I guess you want to disable it through Difficulties, if that satisfies the goal

flat sluice
#

Yeah I would do that if it wern't for the fact that we want to allow some players (SL's) to use it, but block a bunch of randoms from trying to recreate beethoven's first symphony

warm hedge
#

I see so some can some can't is the situation you want?

flat sluice
#

Yeah, basically I just need to get the onKeyDown event to block consitently when display 129 is open

#

Managed to get it. I just need to constantly wait until display 129 is opened, add the event handler, then repeat incase they close it and open it again

little raptor
#

The units must be from the east side in config too

#

e.g. this is wrong createGroup east createUnit ["B_soldier_F",...] because B_soldier_F is a blufor soldier

#

You can change the uniform, loadout, face, etc. later but initially you must create an opfor soldier

little raptor
# flat sluice Managed to get it. I just need to constantly wait until display 129 is opened, a...

Are you sure you need to constantly loop? Most BI displays are initialized using the BIS_fnc_initDisplay function which iirc triggers a scripted event handler
Also there's "DisplayCreated" UI event handler. If you know the parent display of display 129 (which is most likely 46 or 0) you can add that EH to it and watch for opened displays
Looks like there's no such EH. Weird I thought it was added

flat sluice
# little raptor Are you sure you need to constantly loop? Most BI displays are initialized using...

I ended up doing a loop with some waitUntils that works. its running in I&A apex so while I could make it event based, this is fast enough considering I can tell you about 15 other places in the mission file that are at least 100x slower to compute.

[] spawn {
    while {true} do {
        // Wait until display is opened
        waitUntil {!isNull findDisplay 129};
        // Add event handlers to block actions
        (findDisplay 129) displayAddEventHandler ['KeyDown', {_this call (missionNamespace getVariable 'QS_fnc_clientEventKeyDown')}];
        (findDisplay 129) displayAddEventHandler ['KeyUp', {_this call (missionNamespace getVariable 'QS_fnc_clientEventKeyUp')}];
        // Wait until display is closed
        waitUntil {isNull findDisplay 129};
    };
};
pallid palm
#

wow nice

#

what the heck is hashmaps ?

#

is that a map that smoked Hash

little raptor
#

And this code is considered bad. Look into the initDisplay stuff I said

flat sluice
#

I mean, it would constantly add the event handlers then, which wouldn't be very performative

little raptor
#

And check that variable

#

If a var doesn't exist it's a new display

flat sluice
#

Theres a thousand ways to slice this. I don't have CBA or anything like that to make this easier on myself and frankly I don't feel like spending an extra 3 hours to solve this when I can spend those three hours removing a couple thousand lines from one of the probably 5 or 6 10k line long step 0 loops

pallid palm
#

agreed

little raptor
#

¯_(ツ)_/¯

flat sluice
# pallid palm what the heck is hashmaps ?

They are complex but basically the tl;dr is that they are an object which stores data in key / value pairs. So instead of storing stuff in an array and needing a way to convert a string or whatever to an index, you can instead just directly look it up by the string (or whatever the key is).

pallid palm
#

ahhh thx Mjc4

#

now i understand

#

i do the instead already

#

thx for your clear explantion thx you so much

#

ArmA 3 is awsome i have 8,000 hrs now woohoo ArmA 3 yeah

wind sapphire
#

Leopard20, the code is:

#

private _unit = _group createUnit[GMSCore_unitType, _pos, [], 5, "NONE"];

#

where GMSCore_unitType is set to "O_Soldier_lite_F"

#

and _group is created as:

#

_group = createGroup [_side,true];

#

where _side is passed as a parameter and is EAST for Exile servers

#

I will test if _side is being corrupted for some reason - I have not double checked that

tulip ridge
hallow mortar
#

Vanilla server, presumably

tulip ridge
#

I honestly forgot people hosted vanilla servers

#

Even just CBA for utilities I feel would be the bare minimum, but granted I've never run an arma server specifically

hallow mortar
#

It's not that hard to get by without it

#

A fair number of people play on the official servers, too, and I'm pretty sure those don't require CBA

tulip ridge
#

I know, I've just gotten so used to working with it. Easy settings/keybinds, being able to run unscheduled really easily, etc.

#

Custom events too

flat sluice
#

Yeah normally I'm writing mods where I have access to CBA, HEMTT, etc. Dealing with an almost pure vanilla mission file for a server (we have server mods and some extensions) with a code base originally written by someone who isn't a programmer is definitely a change.

candid narwhal
#

So I am trying to overwrite a Vehicle config for a Mission(file) to add more magazines to the main gun.
My approach of doing it similarly to SOGs MF crate overwrite is essentially:
(The original only has 1 x CUP_340Rnd_TE1_Green_Tracer_30mmHEIF_2A42_M)

class CfgVehicles 
{
    class CUP_O_BMP2_TKA 
    {
        class Turrets 
        {
            class MainTurret
            {
                magazines[]=
                {
                    "CUP_340Rnd_TE1_Green_Tracer_30mmHEIF_2A42_M",
                    "CUP_340Rnd_TE1_Green_Tracer_30mmHEIF_2A42_M",
                    "CUP_160Rnd_TE1_Green_Tracer_30mmAPBC_2A42_M",
                    "CUP_160Rnd_TE1_Green_Tracer_30mmAPBC_2A42_M",
                    "CUP_8Rnd_AT5_BMP2_M",
                    "CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
                    "CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
                    "CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
                    "CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
                    "CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
                    "CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
                    "CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
                    "CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M"
                };
            };
        };
    };
};

This does however not function. What am I missing and what should be added to my thought process? I need to learn.

stable dune
ivory lake
#

you also can't overwrite a vehicle config from a mission description ext

candid narwhal
hallow mortar
#

Fortunately you don't need a config change to do this. You can use addMagazineTurret, using an entityCreated EH to target the class (or a CBA class event handler if you have a CBA dependency), or just in the vehicle init/whatever script if you only care about one specific one rather than all of them

candid narwhal
wind flax
#

Does anyone know how I could snap a player into switchCamera "GUNNER" without the animation delay? I'd want it to be near instant

real tartan
#

is there a way to get respawn template set in editor via SQF ?
equivalent of

"Tickets" in getMissionConfigValue ["respawnTemplates", []]
keen drum
#

idk where to ask this but is there a table of the a3 soundtrack ive discovered the jukebox utility and i would jus like to be able to play soundtrack music as i wait for things like helis or jus during drives

#

nvm found

meager granite
real tartan
meager granite
#

I don't deal much with editor to advise more

#

GIB sqmConfigFile

#

Bet its somewhere in the memory during gameplay anyway

faint burrow
meager granite
#

Eden Editor scenario attribute

#

not sure if this includes that custom attribute

hallow mortar
candid narwhal
#

Greetings, me again:
When I provide the following function (snippet) with my in editor markers like this:
[_MarkerTop, _MarkerBottom] call TAG_fnc_markers; (assigned with _MarkerTop = "MarkerTop";)
and
["MarkerTop", "MarkerBottom"] call TAG_fnc_markers;
produces the same result.

params [
    ["_firstMarker", "Marker_1"],
    ["_secondMarker", "Marker_2"]
];
_firstMarkerLocation = markerPos "_firstMarker";
_secondMarkerLocation = getMarkerPos "_secondMarker";

hint format ["M1 is at: %1 & M2 is AT %2", _firstMarker, _secondMarkerLocation];

It seems to not realize that I am giving it markers but just strings.
"%1", _firstMarker" does display the correct string "_MarkerTop" but the position is always hinted as 0,0,0

faint burrow
#

Markers "_firstMarker" and "_secondMarker" don't exist.

candid narwhal
#

How come? I´m trying to have markers as a function input

#

I guess i am just giving it random strings atm?

faint burrow
candid narwhal
tulip ridge
#

The single private _varName for each variable is a lot faster

#

i.e.

private _firstMarkerLocation = markerPos "_firstMarker";
private _secondMarkerLocation = getMarkerPos "_secondMarker";
faint burrow
faint burrow
tulip ridge
#

No it's not

candid narwhal
candid narwhal
tulip ridge
# candid narwhal Do you have an article that compares? I always like reading up on this stuff

You don't need an article for it, just run some tests and see how long they take to execute.
This here is from drofresh in the ace discord:

"It's slow

Code:

private _a = 1;
private _b = 2;
private _c = 3;
private _d = 4;
private _e = 5;
private _f = 6;
private _g = 7;

Result:
0.00178426 ms

Code:

private ["_a", "_b", "_c", "_d", "_e", "_f", "_g"];

_a = 1;
_b = 2;
_c = 3;
_d = 4;
_e = 5;
_f = 6;
_g = 7;

Result:
0.00286985 ms"

tulip ridge
candid narwhal
tulip ridge
#

That and it's annoying to have to go back to the top of a file (or wherever you'd private them) whenever you add a new variable to a function

meager granite
#

private ARRAY / private STRING is just old way of doing it, that's why there is so much of it in many scripts

candid narwhal
#

What I am doing is very small, so the "going up" part isnt annoying to me atm.

meager granite
#

Better learn good habits right away

candid narwhal
#

If you guys good any "good practice" headers for me to get better / make it look better i am always glad to hear it

meager granite
#

There are still uses for it when you need several variables in lower scope

#
private ["_var1", "_var2"];
if(complexHeavyFunctionCalledHere) then {
    _var1 = 123;
    _var2 = 321;
} else {
    _var1 = 111;
    _var2 = 333;
};
#

Personally I try to avoid structuring my scripts to lead to this

#

inline private assignment ❤️

candid narwhal
#

So you are saying "Declare on use" is a better practice?
...
Like inline assignment yeah

tulip ridge
#

Yea

#

To use Sa-Matra's example,

private _var1 = 111;
private _var2 = 333;
if(complexHeavyFunctionCalledHere) then {
    _var1 = 123;
    _var2 = 321;
};
meager granite
#

Yeah, but what if 111 is another heavy function call

tulip ridge
#

Then yeah you'd use a different setup
The one you gave was just numbers

meager granite
#
if(complexHeavyFunctionCalledHere) then {
    private _var1 = 123;
    private _var2 = 321;
    call secondPartOfTheFunction;
} else {
    private _var1 = 111;
    private _var2 = 333;
    call secondPartOfTheFunction;
};
```One of ways to get out of this
#
if(complexHeavyFunctionCalledHere) then {
    [123, 321]
} else {
    [111, 333]
} params ["_var1", "_var2"];
```![crazyLaugh](https://cdn.discordapp.com/emojis/440489443795795969.webp?size=128 "crazyLaugh")
meager granite
granite sky
#

It's kinda beautiful though :P

#

<- is weird

candid narwhal
meager granite
#
private _condition = complexHeavyFunctionCalledHere;
private _var1 = if(_condition) then {123} else {111};
private _var2 = if(_condition) then {321} else {333};
```How I usually end up solving it
#

Not the best performance wise but that column of privates pleases me

candid narwhal
granite sky
#

[123, 111] select _condition :P

#

well, other way around

meager granite
granite sky
#

now that's just silly

candid narwhal
#

I feel like I started a battle of funny coding paradigms

meager granite
hallow mortar
candid narwhal
#

Okay that one just hurts my soul (leading comma)

tulip ridge
hallow mortar
tulip ridge
#

Just wrap everything in parenthesis to make it more readable kappa

candid narwhal
hallow mortar
meager granite
#

Thought it would be some kind of else type similar to if

candid narwhal
tulip ridge
#

Yeah

meager granite
#
[
     diag_codePerformance [{
        if(false) then {1} else {2};
    }]
    ,diag_codePerformance [{
        if(false) then [{1}, {2}];
    }]
    ,diag_codePerformance [{
        [2, 1] select false;
    }]
]
``` => `[[0.000582414,100000],[0.000559752,100000],[0.000411131,100000]]`
hallow mortar
meager granite
#

Interesting, so ARRAY select BOOL is better than if-else in some cases 🤔

tulip ridge
candid narwhal
hallow mortar
tulip ridge
#

The config viewer alone is amazing compared to the vanilla one
You don't have a loading screen just from switching between root classes

meager granite
# meager granite ```sqf private _condition = complexHeavyFunctionCalledHere; private _var1 = if(_...
complexHeavyFunctionCalledHere = true;
[
     diag_codePerformance [{
        private _condition = complexHeavyFunctionCalledHere;
        private _var1 = if(_condition) then {123} else {111};
        private _var2 = if(_condition) then {321} else {333};
    }]
    ,diag_codePerformance [{
        private _condition = complexHeavyFunctionCalledHere;
        private _var1 = [123, 111] select _condition;
        private _var2 = [333, 321] select _condition;
    }]
]
``` => `[[0.00134022,100000],[0.00100242,100000]]`
#

oh wait, nil

#

Useful if you have a static value for if and else

#

bad idea if you're calling something or using a function

hallow mortar
meager granite
#
complexHeavyFunctionCalledHere = true;
[
     diag_codePerformance [{
        private _condition = complexHeavyFunctionCalledHere;
        private _var1 = if(_condition) then {123} else {111};
        private _var2 = if(_condition) then {321} else {333};
    }]
    ,diag_codePerformance [{
        private _condition = complexHeavyFunctionCalledHere;
        private _var1 = call([{123}, {111}] select _condition);
        private _var2 = call([{333}, {321}] select _condition);
    }]
]
``` => `[[0.00134632,100000],[0.00125972,100000]]`
#

still better than if-else

granite sky
#

Caveat is that it evaluates the whole array, so if the possible values are complex then if/then/else is better.

#

Although that makes the call method interesting :P

#

probably too much horror for a minor optimisation.

meager granite
cosmic lichen
#

What about alt syntax of if else

meager granite
#

Looks atrocious though

tulip ridge
#

Clearly the ideal solution is to use the nice looking syntax in source, and then use regex to replace it with the more performant version on build

vagrant skiff
#

I'm trying to make a script that automatically ace heals a player that gets inside of a vehicle. I found this script online but when put into the init field of the vehicle it only displays the hint but doesn't heal the player

[
    "GetIn", 
    {
        params ["_vehicle", "_role", "_unit", "_turret"];

            [_vehicle, _unit] call ace_medical_fnc_treatmentAdvanced_fullHealLocal;

            hint "You were healed!";
    }
];```
tulip ridge
vagrant skiff
tulip ridge
#

Add a systemChat format ["%1 (%2)", _unit, typeOf _unit] to your code

#

Just to see if maybe _unit isn't what you're expecting it to be

vagrant skiff
#

adding that seemed to cause it to list some medical details, but also showed an error relating to "cardiac output"

frozen seal
#

Hi all! I feel like I'm missing a small thing but I can not figure out what

playSound3D [getMissionPath "pdr_dnb.ogg", partySpeaker]; // This works
playSound3D ["pdrdnb", partySpeaker]; // This does not work

My Description.ext:

class CfgSounds
{
    sounds[] = {}; // OFP required it filled, now it can be empty or absent depending on the game's version

    class pdrdnb
    {
        name = "PDR DNB"; // display name
        sound[] = { "pdr_dnb.ogg", 1, 1, 100 };    // file, volume, pitch, maxDistance
        titles[] = { 0, "" }; // subtitles
    };
};

What am I doing wrong?

warm hedge
#

playSound3D does not take CfgSounds

#

Why you need to workaround a working way?

frozen seal
#

good question, honestly I have this notion from somewhere that having sounds described in Description.ext is the "right" way to do things, but idk maybe I'm wrong

warm hedge
#

playSound etc

formal grail
#

I'm having some trouble with deleteVehicle. It doesn't seems to delete UAVs correctly, even if I've emptied the UAV of crew, if I'm still connected to the UAV.

#

Added actions remain, and if I have the "awareness marker" on in difficulty settings, I can still see it where it was last.

granite sky
#

Actions you added yourself or what?

still forum
formal grail
#

But it seems like deleteVehicle doesn't work reliably for the UAV.

#

And by UAV, I meant an autonomous centurion, my bad.

#

When I call the "remove vehicle" action a second time, this is what it's turned into:
2add32c2040# 1814732: sam_system_02_f.p3d

candid scroll
#

is there a way to get the group object from its name? or some identifier that can be stored to then retrieve the object without looping them all?

granite sky
#

@formal grail If it's UAVs then it's probably an Arma bug, but maybe kick the player out of it before you run the deleteVehicle?

granite sky
candid scroll
#

Yeah. Unfortunately im in a context where its evaluating script from string to do group work

#

thought there'd be an engine function to fetch by id/name, all good though, i'll work around it!

formal grail
candid scroll
#

@warm hedge I have a webpage connected to an Arma 3 server via websocket and im evaluating sqf code sent from the site, result is sent back to the site for processing

#

I think I'll just do what john mentioned and create a variable of a hashmap that is just updated with groups by name every 2 seconds

#

And reference that

warm hedge
#

That's not what I wanted to ask. How it will be run in Arma side? Why you can be sure you have no access to the group but Identifier?

candid scroll
#

The call is being initiated from a component that only has the group's name as an identifier

#

It will be run as call compile "sqf code" Arma side

warm hedge
#

Okay so, you have literally zero arguments to refer in the code?

candid scroll
#

That's right. Following John's suggestion I realised I could access a variable in the way I mentioned above

warm hedge
#

Also by "Id" mean... setGroupId?

candid scroll
#

Either group id or the group name / string (str _groupObject)

warm hedge
#

Why you can't put Identifier into that script?

candid scroll
#

I am passing the group identifier into the script, I was hoping there was a function that returned the group object from the identifier

#

But it doesn't seem there is

#

So to avoid running a loop on allGroups every request I'll store allGroups into a hashmap variable that the script that's being evaluated can access

#

I think

warm hedge
#

Okay what it does mean group object

candid scroll
#

The object type found in the allGroups array result

#

The "Group" object type

warm hedge
#

...I'm confused

#

A group is not an object. Also in your situation, do you have an identifier that points the group or not?

candid scroll
#

The group type instance then if not object

tulip ridge
#

Do you just mean the group itself

candid scroll
#

Yeah

warm hedge
#

What about my second question

candid scroll
#

I have the groups name as an identifier

#

Yes

warm hedge
#

Then why you just don't use

_yourGroup = thatIdentifier;```
candid scroll
#

Because the identifier is just a string, and any group functions fail to evaluate because it expects 'object' not a string

warm hedge
#
missionNamespace getVariable ["YourString",grpNull];```
candid scroll
#

Yeah, that's what I thought about trying following John's advice

#

After thinking about it more

tulip ridge
tulip ridge
warm hedge
#

Because any variable can be stored into Identifier?

tulip ridge
#

Oh were you telling them to just save it themselves?

warm hedge
#
yourIdentifier = 0;```is identical with```sqf
missionNamespace setVariable ["yourIdentifier",0];```also same with```sqf
with missionNamespace do {
  yourIdentifier = 0;
};```which means `getVariable` is also a thing
tulip ridge
#

I'm aware, I just didn't get that you were just telling them to save the str to mission namespace. With just seeing:

missionNamespace getVariable ["YourString",grpNull];

Made it seem like all groups were just saved to mission namespace

warm hedge
#

That's what I assumed in that situation

#

I don't know what exactly is the context so

distant venture
#

Hi All, I am trying to setup a trigger that in the activation does something to the player and only that player that activates the trigger. I can't find anything for this though, any clues?

distant venture
#

{[_x] joinSilent(createGroup blufor)} forEach (thisList);

This script above keeps setting my civ to opfor, I have tried to set it to independet and as you can see west and blufor. Any thoughts on why?

warm hedge
#

I cannot really understand both questions.
What is the actual question about the first question, a trigger?
What is it does mean by setting my civ to opfor?

distant venture
#

Sorry, lets go the second one. That script above does not set the group side to west or blufor. It always setes it to east or opfor. Even though the script states for west

distant venture
warm hedge
#

Then you are running a wrong script/trigger I guess

distant venture
#

This is my trigger for it

warm hedge
#

Are you 100% sure that trigger is the only trigger that is running

distant venture
#

Eh 99% sure

#

will look into it

round scroll
#

in SP it will work, in MP not so much as addAction only adds it locally

sage trout
#

How to get vehicle camo name for new class in CfgVehicles which will override standart camo?

tulip ridge
bold comet
#

@zealous solstice "everything run in one Thread guys" not exactly true with sqf

zealous solstice
#

of cause

last cave
#

map object == objnull
lol

warm hedge
#

Nothing said it's a null?

tulip ridge
#

Yes, an object is the same type as the null value for objects

last cave
#

it big house isEqualType objnull... oh it obj == obj...
My error in logic is due to null

tulip ridge
#

isEqualType only checks the type of two things.

objNull isEqualType objNull; // true
objNull isEqualType 0; // false

If you want to check if something is null, you can use isNull, like you have there.

tulip ridge
warm hedge
#

isNull clearly says it's not null?

meager granite
slim trout
#

Hi guys. I have a custom post processing settings.

_hndl = ppEffectCreate ["colorCorrections", 1501];
_hndl ppEffectEnable true;
_hndl ppEffectAdjust [ 0.6 , 0.6, 0, [1.01, -2.46, -1.23, 0],[2.11, 1.6, 0.71, 0.8],[1.43, 0.56, 3.69, 0.31]];
_hndl ppEffectCommit 1;

Im having issues disabling it. Tried with "ppeffectDestroy _hndl"; and "_hndl ppEffectEnable false; Both didnt work. Any ideas?

proven charm
#

the _isPlayerMessage variable means AI "sent" the message to the player in HandleChatMessage? 🤔

sullen sigil
proven charm
#

what kind of server msgs?

sullen sigil
#

🤷

bold comet
#

i have some ppeffect code that looks slightly different (and works)

#

"filmGrain" ppEffectAdjust [0.3, 2, 4, 0.5, 0.5, true];
"filmGrain" ppEffectCommit 0;
"filmGrain" ppEffectEnable TRUE;

#

then

#

"filmGrain" ppEffectEnable FALSE;

#

dunno if it has anything to do with your private variable

real tartan
#

where can I find 2.18 release date ?

little raptor
#

There is no release date yet but I think in 3-4 weeks

#

Once an RC build is released you can normally expect a release within a couple of weeks

slim trout
#

Perfect. Got it working. Adjusted to your script. Now it looks like that

#

"colorCorrections" ppEffectAdjust [ 0.6 , 0.6, 0, [1.01, -2.46, -1.23, 0],[2.11, 1.6, 0.71, 0.8],[1.43, 0.56, 3.69, 0.31]];
"colorCorrections" ppEffectCommit 0;
"colorCorrections" ppEffectEnable true;

bold comet
#

neat

#

maybe that should work with the variable though

slim trout
#

Im working on a small addon and some custom PP effects is something i'd like to include in it.

hallow mortar
#

Does the target unit actually have a squad selected?

proven charm
#

maybe it works better in initPlayerServer.sqf , since its too early for onUserSelectedPlayer

real tartan
#

2.18 should fix it, by postpone event triggering after player is assigned.
I suspect, that depending on server connection, I need to wait until unit is transferred to player

fleet sand
#

Try geting the Info before removing EH myb it will work that way as well ?

hallow mortar
#

Removing the EH just prevents it from firing again in the future. It doesn't have any influence on the current instance.

delicate hedge
#

Is it possible to add buttons to diary record?

faint burrow
proven charm
#

it would be cool to be able to create clickable images as buttons to the vanilla diary system but i havent got that working

vestal bison
#

youre actually a blessing...
This should of been way easier for me to find.
-# Hopefully this works out for me

still forum
#

Someone should make a ubiquitous go-to http extension 😄

#

Many have tried over the years

delicate hedge
faint burrow
#

Remove URLs and add event handlers.

candid narwhal
#

which EventHandler would I use for a vehicle having blown up? Such as a Helicopter?

candid narwhal
#

Ah So killed goes for that aswell, thx!

raw vapor
#

Are there any good animations for a cheering civilian?

keen drum
#

is there a script i can put in the debug console to enter zeus bc the mission im playing doesnt have zeus set rn and i need to get ai into a ghost hawk

#

its multiplayer scenario but im playing alone

#

or did they remove that

keen drum
#

thx

keen drum
jade acorn
#

if you're playing alone and are a host too then it doesn't matter I think

keen drum
#

huh then i might be doing smth wrong it doesnt do much exept freeze the game for a second

opal zephyr
#

For some reason a number of vanilla models don't include .p3d at the end of their model string in the config, which isnt a problem for loading the model, however it means that the command fileExists returns false on them because it expects the file extension.... oof

tulip ridge
opal zephyr
#

I am doing that, but its annoying lol

keen drum
tulip ridge
jade acorn
vestal bison
raw vapor
#

Is it possible to make a trigger reference units that are synced to it?

For example, say I have a trigger that makes someone salute. The way I would do it right now is dude_1 playActionNow "Salute"; dude_2 playActionNow "Salute"; dude_3 playActionNow "Salute"; (...) and that's insanity. Now I could also do a for loop but that's still tedious and annoying and you see I'm an idiot and will inevitably miss somebody or misspell their var and ruin it.

What I wanna know is if I can do something like this and have everyone synced to the trigger get the same command that the trigger wants to do. This will make my life way easier for future things.

warm hedge
#

synchronizedObjects or similar name AFAIK

keen drum
jade acorn
#

yes, CheatCurator is an existing zeus module by default

#

if it doesnt work then idk, ask the mission maker if they removed the module or blocked you from using zeus in any way

vapid scarab
#

If I use allowFunctionsRecompile = 1;, am I able to override bis functions?
Im trying to modify bis_fnc_getRespawnPositions...

meager granite
#

Yes

#

Speaking of which, wish you could selectively overwrite functions just for your mission

#

allowFunctionsRecompile[] = {"BIS_fnc_getRespawnPositions", "BIS_fnc_somethingElse"};

vapid scarab
#
// In description.ext
class CfgFunctions {
  class BIS {
    class Respawn {
      class getRespawnPositions { file = "mission\path\to\function.sqf"; };
    };
  };
};

This should work, right?

meager granite
#

Hmm, can you overwrite it like that? 🤔

#

Try it

vapid scarab
#

Doesnt seem to work.

#

What other way would you override it?

#

Only way I see so far is to set the variable to my custom function after startup... which works, but not "clean"

// in postinit function
bis_fnc_getRespawnPositions = { /* custom function */ };

🤷‍♂️

tulip ridge
#

Well yeah, missionConfig and configFile (mod config) are different

#

You can't overwrite a class in mod config from mission config, and vice versa

meager granite
#

I was expecting maybe CfgFunctions compiling script checks if there is overwriting function inside the mission config

vapid scarab
fair drum
#

@little raptor would you consider adding lint support to ADT for _self when using hashmapObjects?

meager granite
#

Why though?

#

Weird choice

vapid scarab
#

lmao....

#

Kay. im not insane

tulip ridge
vapid scarab
#

So functions library is just an configed way of compile final a list of scripts... yeah? Doesnt CBA use compileFinal?

tulip ridge
#

Yeah, but there's still other differences

meager granite
#

a3/functions_f/initFunctions.sqf

opal zephyr
#

Can someone give me a hand? I'm trying to use find to locate an array(position) within an array, however it keeps returning -1, if I type out the array in plain text though then it can find it no problem... am I doing something wrong?

Ex:

this works
["configFile / ""CfgWeapons"" / ""ACE_Banana""",[[0,0.208496,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.209215,0.0536224],[[0,1,0],[0,0,1]]] find [-0.00115322,0.209215,0.0536224];

this doesnt
((player getVariable ["Barbie_activeOutfit", []]) select 0) find [-0.00115322,0.209215,0.0536224];
warm hedge
#

Share your code, as always

opal zephyr
#

Just added it to the msg

#

The working code was pasted from console when printing the selected variable (so im sure theyre the same)

meager granite
#

Sure its print from select 0?

#

Also diag_log it

warm hedge
#

Probably a floating point

opal zephyr
#

In console select 0 on that variable gives exactly it

["configFile / ""CfgWeapons"" / ""ACE_Banana""",[[0,0.208496,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.209215,0.0536224],[[0,1,0],[0,0,1]]]
meager granite
#

Oh, so you copied the number from console and then decided to find it

meager granite
opal zephyr
opal zephyr
meager granite
opal zephyr
#

Doing it without hardcoding seems to work, silly console

#

Thankyou for your assistance everyone :)

warm hedge
#

No it is nothing's fault

#

Not even console

meager granite
#

GIB isAlmostEqualTo hmmyes

warm hedge
#

The real question is, why you need this execution anyways? It does seem to be unreasonable enough to me. You have that seriously exact position then why you need to find something out of it?

meager granite
#

POSITION isCloseEnough POSITION

warm hedge
#

distance angery

meager granite
#

is dum-dum

opal zephyr
#

Is there a much better way to do this? Since im already finding this convoluted haha

warm hedge
#

If that still is the way, use distance to compare. I still can't figure out why it is the way

meager granite
opal zephyr
#

This is an example array:

[["configFile / ""CfgWeapons"" / ""ACE_Banana""",[[0,0.208496,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.209215,0.0536224],[[0,1,0],[0,0,1]]],["configFile / ""CfgMagazines"" / ""acex_intelitems_notepad""",[[0,0.209473,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.210192,0.0536224],[[0,1,0],[0,0,1]]],["configFile / ""CfgWeapons"" / ""ACE_Banana""",[[0,0.208496,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.209215,0.0536224],[[0,1,0],[0,0,1]]]]

I am taking a location from it (index 4 in the sub) and then seeing if any of the other locations are super close. But then I need to go back and get more info from the one thats close and the original, so I need to be able to get their index's within the master array from just their positions

meager granite
#
private _lotsa_stuff = [...];
private _sort = _lotsa_stuff apply {[_x select 4 distance player, _x]};
_sort sort true;
private _closest_stuff = _sort select 0 select 1;
opal zephyr
vapid scarab
# meager granite Actually looking more at the script I'm not sure if this really disabled overwri...

Reading it a bit in depth, essentialy any functions that does not come from a path that starts with \a3, it sets filepath to nothing...
And then the compile function _fncCompile which is passed to the script may somehow decide whether or not to compile it base don the _itemMeta which includes the path....

_itemMeta = [_itemPath,_itemExt,_itemHeader,_itemPreInit > 0,_itemPostInit > 0,_itemRecompile> 0,_tag,_categoryName,_itemName];
_itemCompile = if (_itemCheatsEnabled == 0 || (_itemCheatsEnabled > 0 && cheatsEnabled)) then {
    [_itemVar,_itemMeta,_itemHeader,_compileFinal] call _fncCompile;
} else {
    compilefinal "false" //--- Function not available in retail version
};

But based on the condition and the comment that you shared, setting _itemPath = "" disables recompile.....

meager granite
#

If I read that right (and I didn't read it thouroughly enough)

meager granite
opal zephyr
vapid scarab
#

Thanks for the insight!

meager granite
opal zephyr
#

I want any number of items that are closer than x meters to eachother

meager granite
#

All of them?

#

Or any first match?

opal zephyr
#

The array I used as an example had 3 items that were all close, so all 3 should be returned. There might be many more though

meager granite
#

What is considered "close"? Having at least 1 nearby?

#
private _close_stuff = _lotsa_stuff select {
    private _stuff_pos = _x select 4;
    _lotsa_stuff findIf {_x select 4 distance _stuff_pos < 1} >= 0;
};
#

Actually no, checks itself

#

Where is my _selectIndex magic variable 😡

#

And _findIfIndex too

indigo snow
#

_handle is a local variable, are you sure it still exists where you terminate it?

warm hedge
#

_applyIndex

meager granite
#

^ That too

opal zephyr
#

Close in terms of distance, like if object 1 is close to object 2 then I want them both returned, if object 2 is also close to 3 then return 3 as well. I don't want duplicates returned though, if 1 was also close to 3 as well then I dont need 1 and 3 returned again

granite sky
#

You're not doing this very often, I hope.

opal zephyr
#

No

meager granite
#
private _close_stuff = [];
{
    private _stuff_index = _forEachIndex;
    private _stuff_pos = _x select 4;
    private _stuff = _x;
    {
        if(_forEachIndex != _stuff_index && {_x select 4 distance _stuff_pos < 1}) exitWith {
            _close_stuff pushBack _stuff;
        };
    } forEach _lotsa_stuff;
} forEach _lotsa_stuff;
```Like this then?
#

fixed ^

opal zephyr
#

Yes pretty much that, I need to be able to go back now with the locations and get the index that they came from. That was my original issue

meager granite
#

Well you have entire array as result instead of just position now

#

No need to find anything

opal zephyr
#

hmm good point

#

I have a couple other search parameters needed, ill try adding them on as well

#

Thanks for the in depth help by the way sa-matra

south swan
#

inb4 inArrayOfAreasArray blobcloseenjoy

granite sky
#

there is actually a semi-cute way of doing this with inAreaArrayIndexes

#

but it's let down by bad methods of inserting a batch of dataless keys into a hashmap.

#

otherwise you can do it with a single loop.

meager granite
#

Hmm, using inArea* command could speed this up quite a bit indeed

#

I just ran this code for 718 items and it froze the game for few seconds 😬

granite sky
#

hence my point :P

#

Doing n-squared stuff in SQF is super sketchy

south swan
#

inb4 "do it by part in scheduled, fire a custom event on done"

granite sky
#

nah, you write it in a fancy-ass way that gets it somewhere near nlogn :P

south swan
#

yaay, now it hangs for 1.5 seconds instead of 4!

granite sky
#

but yeah, don't do that stuff in unscheduled.

opal zephyr
#

Its in scheduled and is likely to only happen a couple times or so a minute, but I will definitely be looking for ways to improve it

granite sky
#

Antistasi had an approx n-cubed routine that looked for possible convoy routes. It was ok on Altis and then blew up on CamLaoNam

meager granite
#

forEachReversed + deleteAt/resize? 🤔

south swan
#

still roughly quadratic, though

meager granite
#

Thought about it more and it wont work how I wanted it

south swan
#

would work for "find the stuff that's not near marked positions"

meager granite
# meager granite ```sqf private _close_stuff = []; { private _stuff_index = _forEachIndex; ...
private _lotsa_stuff = nearestTerrainObjects [player, ["Tree", "Bush"], 200] apply {[_x, 1, 2, 3, getPosATL _x]};
private _close_stuff = []; 
{ 
    private _stuff_index = _forEachIndex; 
    private _stuff_pos = _x select 4; 
    private _stuff = _x; 
    { 
        if(_forEachIndex != _stuff_index && {_x select 4 distance _stuff_pos < 5}) exitWith { 
            _close_stuff pushBack _stuff; 
        }; 
    } forEach _lotsa_stuff; 
} forEach _lotsa_stuff; 
 
{deleteMarkerLocal _x} forEach marks; marks = [];
{
    private _mark = createMarkerLocal [str random 1e6, _x select 4];
    _mark setMarkerTypeLocal "mil_dot";
    _mark setMarkerColorLocal "ColorRed";
    marks pushBack _mark;
} forEach _close_stuff;
south swan
#

why no select/findIf, though? sqf _positionsToCheck select { private _currentPosition = _x#4; (_markedPositions findIf {_x distance _currentPosition < 1}) > -1 };

meager granite
#

Checks itself so distance will be 0

granite sky
#

with inAreaArrayIndexes you can just check if the output count is >1

meager granite
#

Yeah, or also iterate through it if you want other conditions

#

still less iterations than the whole array

south swan
#

or filter out the element with isEqualRef in findIf's condition. Should be decently fast, i think

granite sky
#

Basically halves the speed of the code :P

south swan
#

which may or may not be comparable to count inAreaArray > 1 not exiting early blobdoggoshruggoogly

granite sky
#

nah, amortized, the findIf is gonna check about half of them. inAreaArray over the whole thing will be much faster, especially on stable.

south swan
#

yaaay, microbenchmarks

granite sky
#

But in a lot of cases that's still nowhere near good enough and you'd need to subdivide.

#

Depends on size of cloud vs distance check.

meager granite
# granite sky with inAreaArrayIndexes you can just check if the output count is >1
private _lotsa_stuff = nearestTerrainObjects [player, ["Tree", "Bush"], 200] apply {[_x, 1, 2, 3, getPosATL _x]};

private _positions = _lotsa_stuff apply {_x select 4};
private _close_stuff = _lotsa_stuff select {count(_positions inAreaArrayIndexes [_x select 4, 5, 5]) > 1}; 
 
{deleteMarkerLocal _x} forEach marks; marks = [];
{
    private _mark = createMarkerLocal [str random 1e6, _x select 4];
    _mark setMarkerTypeLocal "mil_dot";
    _mark setMarkerColorLocal "ColorRed";
    marks pushBack _mark;
} forEach _close_stuff;
```Much faster
granite sky
#

For your case that's probably better than avoiding the double-checks.

#

That is essentially checking everything twice, A vs B and B vs A

#

Depends on cloud size vs distance check again.

#

If distance is relatively small you're better off just double-checking.

south swan
#

i'd argue that at all conditions checking twice in C++ would be faster than any SQF to avoid double checking

meager granite
#

Yeah, the less scripting commands the better

granite sky
#

Not universally. Sometimes the bar is high enough.

meager granite
#

Having no indexes in other iterator commands makes its all so complicated

granite sky
#

As a kinda-relevant example, if you're trying to find the nearest point to something in SQF, it's often best to run through a bunch of appropriate-chosen inAreaArrays first in the hope of narrowing down the list of precision checks.

#

Because for some reason there is no nearestPoint command

meager granite
#

Yeah, inArea* commands are a game changer, so many uses

#

I updated my map icon drawing code to do inAreaArrayIndexes before drawing units and players, this improved the FPS quite a lot when you have GPS open as it usually only displays a bunch of units

#

Before that, running any kinds of border checks was more expensive than just feeding the game drawIcon regardless

granite sky
#

Did you ever see my scam for doing inAreaArrayIndexes before it existed :P

meager granite
#

Setting index to Z?

granite sky
#

yeah

meager granite
#

I did that by your example before it was added

meager granite
granite sky
#

There is, oddly enough, a nearestLocation

#

but I don't think there's a sensible way to use it without heavy pre-prep.

meager granite
#

Hmm, maxDistance is recent addition there, I bet it simply checks against location center and not its shape borders

little raptor
harsh bloom
#

Took a lot of fuckery but i got a script that makes NPCs use tickets on death unless they are controlled by a player.```
this addEventHandler ["Killed", {
params ["_unit"];
if !(isPlayer _unit) then {
[east, -1] call BIS_fnc_respawnTickets;
};
}];

#

And for vehicles```
this addEventHandler ["Killed", {
[east, -15] call BIS_fnc_respawnTickets;
}];

harsh bloom
#

Anyone know the event i could check on sectors to see if they have been captured? I thought something like "ownerChanged" would work but it says foreign.

harsh bloom
#

Nevermind i kind of got what i was trying to do.
On a sector if you put the following code into the expression then whoever captures the sector will be awarded 60 tickets.```
params ["_module", "_ownerSide", "_previousOwnerSide"]; [_ownerSide, 60] call BIS_fnc_respawnTickets;

acoustic abyss
#

is there anyway to hide code in function viewer tool?

meager granite
#

Can selectionPosition somehow return NaN? 🤔

#

Or NaN as one of coordinates

#
    private _used_offset = if(client_revive_bodyCameraTargetIsMan) then {_target selectionPosition "pelvis"} else {[0,0,0]};
    private _body_pos = AGLtoASL(_target modelToWorldVisual _used_offset);
20:27:54   Error position: <AGLtoASL(_target modelToWorldVisual _used_offset>
20:27:54   Error Type Not a Number, expected Number
```happened on live server for some player
#

Or modelToWorldVisual

#

AGLtoASL errored out, so its modelToWorldVisual thonk

lone glade
#

once the scope is destroyed it goes with it, unless privatized and the scope isn't the script / function itself.

meager granite
#

I guess it has to do with visual? I know that entities that were just created return funky values in render scope commands

#

like they zoom from [0,0,0] to sim scope position for few frames

#

Visual position interpolation fucked up?

#

It kept erroring out for 16 seconds though

#

Also f16 Overflow right after errors stopped

#

This error each 10 seconds in RPT actually

meager granite
#

Added logging to see what's going on

harsh bloom
#

I am so confused. For some reason this trigger is only working once then never again no matter what i do.

proven charm
meager granite
#

The error is for NaN though, so one of the position numbers was messed

harsh bloom
#

BRUH

proven charm
meager granite
#

I can't either, but here it is, happening on live

little raptor
meager granite
pure hawk
#

Hi guys. a quick question pls
I want to doArtilleryFire on specific marker and I want Ai to fire a round every 10s for example I could get that "gun_1G doArtilleryFire [getmarkerpos"marker_0", "8Rnd_82mm_Mo_shells", 2]; " but I could combine that with do sleep 10.

stable dune
pure hawk
#

thx

proven charm
#

still wondering whats the story behind the _isPlayerMessage variable in HandleChatMessage. when is it true?

ornate whale
#

Do you know why AIs refuse to follow waypoints when they enter a vehicle assigned to them (CUP vehicles)?

#

Like if the driver werent sitting in the driver's seat.

#

I am really clueless since there is not much I can do about it apart from separating the crew.

proven charm
#

are all the AIs in same group?

ornate whale
#

Yes.

proven charm
#

humm

#

you actually assigned some one as the driver and not just moved them all in? that might be required for the AI

ornate whale
#

I just assigned the vehicle to the group, and gave them a waypoint, they got in on their own, but refused to move.

proven charm
#

ic

#
(driver TheVehicle) assignAsDriver TheVehicle;
``` you could try that, just guessing here
ornate whale
#

I have to add that it happens if I manually place them inside via Eden; or if I let them get in on their own when they have two vehicles. If they have only one vehicle, they get in and move correctly.

proven charm
#

try single veh? 🤔

ornate whale
#

With a single it works.

proven charm
#

the moving?

ornate whale
#

Yes.

proven charm
#

oh

still forum
proven charm
#

but thats editor-MP maybe it only works in dedi environment

sacred turret
#

how to create backpacks with special actions when droppen in the ground (e.g. mounted weapons)? event handlers for when the player drops a backpack or is there any special command for this?

candid narwhal
#

Greetings, ya boi, me again.

I was wondering if this:

_id1 = addMissionEventHandler ["EntityKilled",{
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if (_this#0 isKindOf "B_Heli_Light_01_dynamicLoadout_F") then{
        [_this#0] spawn {sleep 360; deleteVehicle _this;};
    };
}];

_id2 = addMissionEventHandler ["EntityKilled",{
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if (_this#0 isKindOf "B_Heli_Attack_01_dynamicLoadout_F") then{
        [_this#0] spawn {sleep 360; deleteVehicle _this;};
    };
}];

would work?

#

the goal is to delete a Vehicle of a specific class some time after it was destroyed

meager granite
#

Better have it inside one event handler

#

also you need deleteVehicle (_this#0); since you send array into spawn

#

But technically you can have several EHs

candid narwhal
#

(kind of || other kind of) is guess

#

so the Event should work? I´ll get to testing then

#
_id = addMissionEventHandler ["EntityKilled",{
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if ((_this#0 isKindOf "B_Heli_Light_01_dynamicLoadout_F")||(_this#0 isKindOf "B_Heli_Attack_01_dynamicLoadout_F")) then{
        [_this#0] spawn {sleep 360; deleteVehicle (_this#0);};
    };
}];
#

What if i were to use an array of like 12 classnames btw? How would I go about adding all those into 1 MEH?
My mind can´t wrap a {_x ...}forEach _Array anywhere it would fit.

faint burrow
candid narwhal
#

Never seen findIf before, gotta read

#

I am not sure how to use the findIf. Since it does not return true/false but "first match in array".

faint burrow
#

You can compare the returned index with 0, as shown in the examples.

candid narwhal
#
...
_array findIf {isKindOf _this#0} == 0;
...

Or something like that?

#

i think i need to remove the iskindof

faint burrow
#
(_array findIf _predicate) >= 0 // found

or

(_array findIf _predicate) < 0 // not found
candid narwhal
#

so:

(_array findIf {isKindOf _this#0}) >= 0; // "someClassInArray" at index isKindOf "what just died"
faint burrow
candid narwhal
#

or:

(_array findIf {_x isKindOf _this#0}) >= 0; // "someClassInArray" at index isKindOf "what just died"

?

candid narwhal
acoustic flax
#

hello chat anyone know how to turn surface texture into something edible by set object texture?

candid narwhal
#

Are you saying I can´t use it cuz it return boolean ?

faint burrow
#
_vehicle = _this # 0;

(_classNames findIf { _vehicle isKindOf _x }) >= 0
candid narwhal
#

ahhh I see!
But couldn´t I:

(_classNames findIf {_this#0 isKindOf _x}) >= 0;

Or is _this#0 not available like that anymore ?

faint burrow
#

It's available, but why do this few times (choosing array element using #) if it's better to do this once?

#

Moreover, you already have such a variable, _unit.

candid narwhal
#

Don´t both our approaches do it once?
MEH(Entity dead) -> Check if(one of these classes) -> do or don´t
----------------both times just one Entity to check against array--------
Or am I missing a piece of the puzzle here?

Also:

(_classNames findIf {_unit isKindOf _x}) >= 0;

Kinda just like using the # with EHs, always done so and it tickles my brain.

#
_id = addMissionEventHandler ["EntityKilled",{
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if ((_classNames findIf {_unit isKindOf _x}) >= 0) then{
        [_unit] spawn {sleep 360; deleteVehicle (_unit);};
    };
}];

Is what i´d have then. I guess not using "this select first element" but straight to _unit is faster

faint burrow
#

My approach:

_vehicle = _this # 0;

(_classNames findIf { _vehicle isKindOf _x }) >= 0

The first element reference in _this is obtained and assigned to _vehicle, once.
Your approach:

(_classNames findIf {_this#0 isKindOf _x}) >= 0;

The reference is obtained at least once, in worst case it is obtained as many times as there are elements in _classNames.

candid narwhal
#

Ah because it isn´t "stored" somewhere. Got it, thx!

faint burrow
#

And,

_unit spawn {
    sleep 360;

    deleteVehicle _this;
};

_unit is undefined inside spawned code.

candid narwhal
#

I would have missed that and be confused, thx again xD

tulip ridge
#

You should always avoid the scheduler when possible. All scheduled scripts have to share scheduler time with each other, so your code is not guaranteed to run when you think it will.

covert oak
#

I'm pretty sure I saw and used this many years ago, but is there a script/set of functions that can be used to check if a player takes a specific item from a specific dead enemy?
For example (my use case) when an enemy squad leader's body is searched, he'll have a map in his map slot. When the player takes that map, the script would trigger a taskCreate (or similar)

If it matters, my actual plan is to have it call Drongo's MP task generator, but the idea is the same.

#

Might have found the answer to my own question. I should be able to use a "take" event.

tulip ridge
#

Yea

candid narwhal
tulip ridge
#

No, CBA's functions don't exist unless it's loaded

candid narwhal
#

How about having a call to a custom function of my own instead?

tulip ridge
#

You could technically re-upload CBA's functions, but it's not worth it. Especially if you don't understand how they work internally

candid narwhal
#

_unit call My_fnc_deleteStuff;
deleteStuff = sleep 360....
?

tulip ridge
#

That would either

  1. Do the exact same thing as what you have currently if it's being run from a scheduled environment
  2. Fail because you can't use sleep in an unscheduled environment
candid narwhal
#

I´m using this in a mission I want to keep vanilla. So noone has to dl any mods.

#

I guess CBA can be made as an optional mod and people wouldn´t have to load it?

tulip ridge
#

CBA is 4 megabytes, it's not going to strain people's download speed.

candid narwhal
#

True, but I don´t want anyone to DL any mods for this atm

tulip ridge
tulip ridge
candid narwhal
#

Can CBA be there as a Server Mod and my mission use its functions ?

tulip ridge
#

No

#

The vast majority of mods are required to be on both server and client

candid narwhal
#

event cba for (in this case) one MEH?
No fancy DB like setup that patches in a function?

tulip ridge
#

What?

candid narwhal
#

like instead of loading a variable from something like extDB, loading a function in? Or use file patching or something?

tulip ridge
#

Why would you need to do that
You can check if a mod is loaded, and do different behavior based on whether it is or isn't

#

CBA isn't really the kind of mod you write optional support for. CBA has 2.8 million subscribers, your players will likely already have it downloaded anyway.

CBA allows you to write much better code and do things you simply can't do in vanilla.

candid narwhal
#

Because that way I can get the better performance, without clogged scheduler, and noone would have to load mods.

#

True, just want to avoid all mods for the sqm tho.

tulip ridge
candid narwhal
#

hm sad

covert oak
#

If getting people to dl CBA is an issue, like your playing with your geat uncle who isn't tech savvy enough to deal with the steam workshop or w/e, you can create and export a launcher preset to load just CBA and have them use the preset.
You can send a screenshot or two to show then how to load the preset in the launcher.

candid narwhal
#

No issue, just want it 100% vanilla for now

last cave
#

interesting moment
I just remembered that "if" is the type. And "then" "exitwith" takes the "if" type, which means "if" can be saved to a variable.

#

JavaScript web developers have received a flashback

dusk gust
#

This pains me to look at honestly

granite sky
#

This is of course much more expensive than the spawn method :P

candid narwhal
candid narwhal
granite sky
#

Dedmen even optimised the scheduler for spawn-spam recently, but one spawn per kill is negligible cost anyway.

candid narwhal
#

and it should only spawn on a list of specific entities. The creation of which I control

queen cargo
#

@slim trout @bold comet HELL ... use fucking markdown ...
code blocks require 3x ` in front and end

bold comet
#

if it annoys you that much then i'll keep doing it on purpose

still forum
#

#Markdown (╯°□°)╯︵ ┻━┻

sacred turret
#

does setVariable with public true JIP gets removed once the varspace (e.g. an object) is destroyed? like remoteExec with an object as JIP argument

granite sky
#

You mean at a technical level? No-one's gonna know that as there wouldn't be any practical effects.

dusk gust
#

Though I would assume it would work like remoteExec, you never know with legacy Arma code ¯_(ツ)_/¯

granite sky
#

Last time I used exportJIPMessages it didn't give that sort of level of detail.

#

hmm, although it'll give you the count of setVariables at least, so maybe if you spammed a bunch and then compared before & after deleting the object.

#

My notes say that type 382 is public setVariable and type 284 is setVariable on logic objects (wat)

#

there were about 20 types that I failed to generate at all with SQF code so I may have been doing it wrong.

dusk gust
#

Public set var as in publicVariable or with the true flag? Kinda strange they'd be two different types unless its because one is technically a "entity" and one is an "object"? I dont know honestly

lone glade
#

Discord doesn't even support proper markdown

granite sky
#

publicVariable is type 10.

dusk gust
#

Ah

harsh bloom
#

is it possible to have a script run the second the "mission failed" popup appears?

#

I got a script working that makes all bots on the map shoot eachother and i want them to do that when the mission ends lmao

warm hedge
#

Yes

warm hedge
#

Isn't it an EH to detect a mission end, not its effect

granite sky
#

No idea. It claims to include BIS_fnc_endMission as a trigger but I'd guess that this is because it calls endMission after showing the UI.

#

Otherwise I guess you'd need to dismantle BIS_fnc_endMission and see whether there's any other effects to trigger off.

#

Also not sure how editor mission termination works.

harsh bloom
#

i tried ```
addMissionEventHandler ["Ended", {
[] execVM "endMissionChaos.sqf";
}];

granite sky
#

Unless someone's done it before you'd probably need to reverse engineer some BI code.

warm hedge
#

Or your exact situation you see

harsh bloom
#

I am far too dumb to do this

warm hedge
#

That fact tells us nothing

harsh bloom
#

i dont know what to do!

dusk gust
#

Could probably utilize this inside BIS_fnc_endMission

    if ((!isNil {BIS_fnc_dbg_reminder_value}) && {!isNil {BIS_fnc_dbg_reminder}}) then {
        [] call BIS_fnc_dbg_reminder;
    };

#

Not sure If Im allowed to post that

#

Set the reminder_value to something, then set the reminder to the code you want to exec

#

I dont see any other potential trigges you could use for that file

harsh bloom
#

Im probably just implementing it wrong but thats not working either. Everything i see online says that just having an EH should do it.

#

Well i got something similar working for me, but wont work in most other cases.
Since the round ends when you run out of tickets i did this```
sleep 5; // Wait 5 seconds before starting the checks to avoid reading null

while {true} do {
// Get the current tickets for BLUFOR
_westTickets = [west] call BIS_fnc_respawnTickets;

// Check if tickets are valid and less than 1
if (_westTickets >= 0 && _westTickets < 1) then {
    [] execVM "endMissionChaos.sqf"; // Run the chaos script
    break;
};

sleep 1; // Check every second

};

dusk gust
#

That's the "proper" way to do it if there's no event handler

tulip ridge
warm hedge
#

There is no real reason to struggle to understand ChatGPT

harsh bloom
#

just before you asked

harsh bloom
#

Its that or dont get anything

#

The biggest problem is it likes to make shit up and pretend its fact

tulip ridge
#

Yeah, because that's how AI works

#

Don't use an AI for programming, especially if you don't know whether it's correct or not.

harsh bloom
#

Its trial and error, for simple things it often works. Idk why be so dead set on dont ever use it ever

south swan
#

probably because people here are kinda tired of "Help, CGPT gave me this code and it doesn't work the way i imagined" blobdoggoshruggoogly

dusk gust
#

Easier to make code from scratch than fix a broken mess ChatGPT made

harsh bloom
#

I dont know how to code from scratch at all. Im just asking for things that cant be solved at all.

tulip ridge
harsh bloom
#

Its better than nothing at all, which is what i would be able to do on my own.

tulip ridge
#

You are in a discord for learning modding.

south swan
#

it's worse than nothing at all when you bring it to help channel blobdoggoshruggoogly

harsh bloom
#

When i first started modding the game Barotrauma which has almost no documentation at all i could only make things work by stealing other people's code and modifying it. And years later now i know how to mod it fully. But here i genuinly have no base to start from. So figuring out why bad code isnt working is a better start than nothing.

tulip ridge
#

So why is your solution to start with the bad habits that learning through an AI will teach you

harsh bloom
#

How is it particularly a bad habit? Its creating very basic code and im learning by making it work.

harsh bloom
warm hedge
#

If the code writer doesn't know how to debug, that means the writer cannot write a proper code

harsh bloom
#

Well i am debuging things as i go. Probably not well. But for example i put a hint to read out the value of _westTickets and i found out it was reading it before the game had actually assigned the value, so i have to put a delay on it

#

If you have a more effective method for figuring things out im open. But from what ive tried so far making then fixing AI code has taught me the most so far.

#

This all just kind of comes off as "grr, AI evil!"

warm hedge
#

Basically yes. The only way we always prefer is, just learn by yourself

harsh bloom
#

But i am
What other method would you recommend.

warm hedge
#

just learn by yourself

harsh bloom
#

as in...

harsh bloom
#

Thats an ok resource but it doesnt help me from scratch really. I could do like youtube tutorials for the bare basics but for A3 they are rather lacking.
I have very little proper coding experience and am just trying to make a game mode for my friends.

dusk gust
still forum
# proven charm hmm when I send chat message it's false

Something seems F'ed here.
Comment on function is //! Sends chat message by player
content of function isPlayerMessage = false, whut?

It is set for radio messages, if the sender equals the currently focused unit.
So if you yourself, report someone going unconscious, its playerMessage == true.
Also if a player joins into a group, the message being sent from the "group" ? leader? to the player, is also a player message
Seems its only for radio messages, a bit confusing

proven charm
#

idk if its possible to detect if chat message came from player typing it or from the globalchat command? (In the chat EH)

still forum
#

just diag_log _this in the eventhandler.
run a globalChat command
And manually write something into chat.
And compare what gets logged to RPT

#

the forceDisplay parameter miiight help.

#

Atleast that is set to true, in actually player sent messages.
But probably there will be other places where that's true too, so you're doomed

#

It seems all the radio messages set forceDisplay to false, so that might work

#

its the bool before the isPlayerMessage one

proven charm
#

seems like _forcedDisplay is always true

tight cloak
#

looking for abit of advice here,
trying to get a series of turrets to mimic the actions of a player controlled turret, including aiming and firing. been messing around with it and i cant find a simple way without the animate functions. I dont want the turrets to look at the same target, just look in the same direction and azimuth (eg like a broadside)

#

i can return and setdir but cant do that for azimuth (based on what ive found on the wiki) and a firing eh is simple enough

hallow mortar
#

There isn't really a simple way. We don't have that kind of direct control over turrets.
One way would be to do some maths to work out a relative position based on where the player is aiming, and then apply that relative position to the other turrets and use lockCameraTo to aim at it. It would have the effect you're after, because it's a translated relative position rather than the same world position, but it'd be a bit of work to get the calculations right.

tight cloak
#

i just want them to look at the direction and azimuth not an exact pinpoint

#

eseentially going for like an old naval ships broadside effect

hallow mortar
#

Yes, I understand, that's what I'm talking about

#

You can't use animation commands to control live turrets. Those animation sources are normally controlled by the engine - they can only be controlled by scripting on simple objects.

tight cloak
#

bugger

hallow mortar
#

You can use various means to find out the vector of the player's turret's aim. Use that to extrapolate a point, say, 10 metres in that direction, as a relative position. Because it's a relative position, not a world position, if you transfer it to another turret you'll get exactly the effect you want: parallel aiming, not convergent.

tight cloak
#

hmmm
i was originally thinking something like animationSourcePhase or and animateSource

queen cargo
#

so what? @lone glade
excuses nothing

tight cloak
hallow mortar
#
  • does it in fact work?
  • because the animation is controlled by the engine aiming system
tight cloak
#

i mean the example seems to

tight cloak
#

idk if its the turret im using as its modded and poorly made or if its me

#

im suprised there is no way to simply return and set what im looking for. weapon direction doesnt seem to work for this turret

#

so i tried getting the beginning and ending of the gun with some math and draw lines between them for my own clarity, apparently i can only fetch turret and the gun with this turret.

south swan
tight cloak
#

so i got it to work in the end, poorly made turret is to blame

little raptor
tight cloak
#

so:

onEachFrame {
    _gunB = port_3 modelToWorld (port_3 selectionPosition "gun");
    _gunE = port_3 modelToWorld (port_3 selectionPosition "gunEnd");
    drawLine3D [_gunB, _gunE, [1,1,1,1]];
};

gets me a nice point to point on elevation which also functions as a direction

#

ig all i gotta do is extrapolate ma point now

hallow mortar
#

vectorFromTo and vectorMultiply may be helpful

tight cloak
#

yeah, just gonna have to figure this out

#

i can make an a3 carrier fly but relativity will still make me scratch my head

meager granite
granite sky
#

I assume you can still read the animation state correctly?

meager granite
#
ugv = "B_UGV_01_rcws_F" createVehicle (player getRelPos [5, 0]);
ugv addAction ["Show Turret",
{
    ugv animateSource ["Turret", 0];
    ugv animateSource ["MainTurret", rad 0, true];
    ugv animateSource ["MainGun", rad 0, true];
}];
ugv addAction ["Hide Turret",    { ugv animateSource ["Turret", 1] }];
ugv addAction ["Turret Left",    { ugv animateSource ["MainTurret",     rad 90] }];
ugv addAction ["Turret Right",    { ugv animateSource ["MainTurret",    -rad 90] }];
ugv addAction ["Turret Up",        { ugv animateSource ["MainGun",         rad 30] }];
ugv addAction ["Turret Down",    { ugv animateSource ["MainGun",        -rad 20] }];
```Turret rotation doesn't work
meager granite
granite sky
#

oh, you can't set rotation even if it doesn't have crew?

meager granite
#

Yes

granite sky
#

Sounds like a bug.

meager granite
tight cloak
granite sky
#

Yeah, works fine?

meager granite
#

Only Hide/Show work

granite sky
#

huh. vanilla?

#

checks MP

#

works fine here, both SP and MP.

tight cloak
#

mine jitters

#

and its not a performance issue

granite sky
#

what the hell :P

warm coral
#

is there a way to manually respawn players through script even though the spectator option is enabled?

tight cloak
#

Keep increasing the respawn time, then drop it to respawn them manually if it's via script or Zeus module

#

That's how I've usually done it when I want manual respawn waves

tight cloak
#

Date of purchase of A3 changes function performance ahh code

granite sky
#

Wiki: "You should use animateSource because it works properly in MP"
Reality: animateSource does completely random shit.

tight cloak
#

AnimateSource would have been an easier fix to my solution yet here I am with my goofy ahh vector math code

tight cloak
#

I know they have been broken down or rebuilt into other syntax now but it's still funny to me to think I've found a saving grace only for it to perform in the strangest manner

granite sky
#

I can't really help because it works for me :P

tight cloak
#

Hittin us with the "works on my machine"

granite sky
#

If you cap to 60fps, does it still jitter?

tight cloak
#

I'll give it a go when I'm home N report back, I was running around 109fps

#

But that's because of my un optimised prototype scripts 🫠

formal grail
#

Is there some kind of special case handling for when there is low framerate? For example, if I artificially lower my client's framerate to 1 frame per second, my projectiles (like from a Titan AT) travel much slower over time.

#

(I would expect that projectile travel speed is not dependent on my framerate, and at higher fps that seems to be true.)

#

This is relevant, because I'm debugging an active protection system, and I want to calculate the radius I would have to intercept a projectile at a low framerate.

candid narwhal
#

Greetings, rooky question:

private _spawnLocation = selectRandom [
            {[_cornerTopLeft, _cornerTopRight] call ADALIB_fnc_randLocation;},
            {[_cornerTopRight, _cornerBotRight] call ADALIB_fnc_randLocation;}
        ];

This makes _spawnLocation hold the "code" [...]call function; but I want it to hold the return value of my function instead.

#

is it the "{}" ?

#

or is it selectRandom ?

#

or both 🤖

tulip ridge
#

By wrapping it in braces, you're making a new code block, and storing that in the array

#

Also those parameters would be undefined because it'd be a new scope (with the braces)

candid narwhal
#

so:

private _spawnLocation = selectRandom [
            [_cornerTopLeft, _cornerTopRight] call ADALIB_fnc_randLocation;,
            [_cornerTopRight, _cornerBotRight] call ADALIB_fnc_randLocation;
        ];

Would give expected results?
or:

private _spawnLocation = selectRandom [
            ([_cornerTopLeft, _cornerTopRight] call ADALIB_fnc_randLocation),
            ([_cornerTopRight, _cornerBotRight] call ADALIB_fnc_randLocation)
        ];
tulip ridge
#

The parenthesis are redundant, and the semicolons after each call will end the line in your first example and cause an error

candid narwhal
#

copy and thx

tulip ridge
#

Also, you can just select the arguments at random, and then only call the function once

#

With your current setup, you're calling the function twice, and then selecting one result at random

candid narwhal
#

makes sence, goot to know

ornate whale
#

Is this syntax with not before brackets OK? if not (false) then {true}; //returns true Thank you.

warm hedge
#

Should be. if actually takes a boolean so bracket itself is not required

tough abyss
#

Qusetion

#

wrong chat sry

warm hedge
#

What

ornate whale
#

Can I trigger a respawn point (activate it) by two triggers wich would be in a logical OR relation, where one is enough to activate it? Just with modules.

fair drum
#

yes

teal estuary
#

hi guys working on an ai guided kamikaze drone for missions i want to make, dont really have any idea what im doing lol. went through a few iterations with AI and lots of caveman thinking and have a pretty basic model that's OK, had a previous version with some -z velocity to simulate the final strike but had some bad version control and lost it lol. tried working on stepping back to previous altitudes and velocity if the target was getting away but keep running into issues and AI only gets you so far. any tips or suggestions are welcome and if youd like to repurpose any of this garbo feel free 🙂

warm hedge
#

Please stop to post and delete if you can't figure out something to post it correctly. If you want to share the code, post the file

teal estuary
#

ive never used markdown in discord and it was posting weird and people in other modding discords cry about downloading files from discord. no need to be rude it doesnt affect you 👍

fair drum
#

the truth in the sentence is we still need to see the code. post in pastebin/github if its long.

teal estuary
#

and im working on it

warm hedge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
teal estuary
#

i wanted to hide it, it really doesnt matter im working on it.

warm hedge
#

This too, also you have a edit functionality to edit your post

teal estuary
#

does it matter?

warm hedge
#

If you want to edit the markdown, yes

teal estuary
#

nevermind guys thanks

pallid palm
#

["end1"] remoteExec ["BIS_fnc_endMission"];
"end1" call BIS_fnc_endMissionServer;

fair drum
#

oh i see what the issue is now. its because you posted without any real question. you used your post more as a showcase when that belongs more in #1056183794979328120 or #1056183665706668032, instead of the help channel.

teal estuary
#

what is with the passive aggressiveness in this discord? dear god

#

'discussion about anything related to scirpt creation and usage within game'

#

i was in the middle of trying to post it marked up but hidden so i wasnt blocking the entire channel with the code.

fair drum
#

I'm just trying to interpret

pallid palm
#

what's passive aggressiveness

teal estuary
#

i never did it and was deleting my mistakes, what is the issue in here?

#

why would i showcase something someone knowledgable could do in 20 minutes i was asking for a review of my garbage code and thoughts. you people are not conducive to the hobby.

fair drum
pallid palm
#

is passive aggressiveness like a football QB

#

no sir thats what i use to win end my missions

fair drum
fair drum
pallid palm
#

really ok cool

#

is that for DED and other server types

fair drum
#

when you don't provide the second argument, it treats it as if you put 0 which is remoting to all machines. that includes dedi

ornate whale
# fair drum yes

But how do I do the OR? Usually all synced triggers behave as AND.

pallid palm
#

copy that

#

and or =||

fair drum
warm hedge
pallid palm
#

yeah PolPox helped me alot hes good

teal estuary
#

sorry polpox ill follow your prescribed format next time i post about something i dont see on the workshop i didnt realize there was a format bossman

#

rude for no reason man

fair drum
fair drum
pallid palm
#

no one is rude they r just trying to help

teal estuary
fair drum
pallid palm
#

huh i see

#

i didnt know really

#

i was thinking it was like a football QB passing aggressively

fair drum
pallid palm
#

omg iv been doing this for 15 years and i still have so much to learn omg

fair drum
#

doing what? life?

pallid palm
#

yeah that to but no i mean C++

#

ArmA 3 1st life 2ed he he

#

so i have a ?

#

if i have this code how would i add more chats to the line Enemy Down

#

addMissionEventHandler ["EntityKilled",{

params ["_killed", "_killer", "_instigator"];

if (isPlayer _instigator && side group _killed isEqualTo EAST) then
{
Player GroupChat "Eneny Down";
};}];

fair drum
#

remember what we just talked about above:

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
fair drum
#

where are you adding this event handler?

#

added to the server? to a client? in the initPlayerLocal?

#

okay, so player on a local hosted server is that particular player, and on a dedi, its undefined

#

wait... are you using Player as a variable?

#

ok lets rewrite this then:

#

do you need to use groupChat then? vs just sending out a systemChat message?

#

you want it to say the name of the unit killed and by whom?

#

oh ok I see now what you want

teal estuary
# teal estuary hi guys working on an ai guided kamikaze drone for missions i want to make, dont...

||https://pastebin.com/r5KLJcbf

lots of ai and while loops, not sure if everything i have is even necessary might be really redundant, tried remaking it with arrays and indexing 'flight profiles' together, 400m, 20m/s, flyInHeight 7 | 200m, 16m/s, flyInHeight 5, so on and so on but had issues with it. if this is poor practice how can i step the drone down gradually/where would i begin looking into how to make it so it strikes the target without all these loops? if its no big deal to do it like this, how can i have the drone repeat the loops so if the target is outside its current 'profile' it runs through them until the distance/knows about enemy is satisfied (drone closes to within 15 meters but the target manages to escape to 50m, smoke canister, etc. i guess code review and and general tips are appreciated as ill keep trying to remake or alter this so it guides on the move better & can disengage and reacquire lost targets. feedback to any of these points or others are appreciated. its functional for the scenarios im making on ai targets but id like to integrate them into the RTS mod eventually so targeting players on the move needs massive work, thanks for the time. insert to ar-2 darter/uav unit init||

fair drum
#

what team is your player group

#

@pallid palm

if (isServer) then {
    addMissionEventHandler ["EntityKilled",{
        params ["_unit", "_killer", "_instigator", "_useEffects"];
        
        if (isPlayer _instigator &&
            side group _instigator isEqualTo west &&
            side group _unit isNotEqualTo west) then {
                private _group = group _instigator;

                [_instigator, "Enemy Down"] remoteExec ["groupChat", _group];
                [_instigator, "My Second Message Here"] remoteExec ["groupChat", _group];
        };
    }];
};
granite sky
teal estuary
fair drum
teal estuary
#

My main gripes are final guidance is pretty bad and too slow compared to irl FPV. if I speed it up it often overflies it terribly and add in the deflection of a moving player and it looks very poor, and if it loses its target it basically removes that fpv style dive and just flys straight into slowly at like 1m high lol. Blowing in a radius would probably work but the way it works now is ok for vehicles since it smacks into them most of the time

teal estuary
#

I tried using planes but I can’t really find anything that lets players be targeted by AI drones it’s all stuff like crocus that you fly unless I’m missing something so gonna frustrate myself on this for a while

#

https://youtu.be/DSV6dkdykXg?si=Z2FpnTeivZVTmHrH

Best example I’ve found in arma but it’s not public/published might just try the transformation when it’s in strike range with optional deflection for inaccuracy.

From my upcoming Fire Support mod, showing off some of the drone attacks it can perform. The drones come from FPV Drone Crocus.
A lot of the mod dev was streamed live here: https://www.twitch.tv/rimmy

AI can autonomously deploy and call these attacks in, however for this demonstration the attacks were triggered by script.

MY...

▶ Play video
warm hedge
#

Agreed with John, I'd write a (bunch of) setVelocity etc to move quad more aggressively. Since helicopter AI does have its rule to avoid collision etc, they wanted to fly safely and there is really no way to alter without having such workaround
Is "explode" a function you wrote BTW?

teal estuary
#

No I was doing set damage on a variety of mines which would work sometimes and other times not, was trying to figure out why when copilot suggested I use the explode paired with that specific ‘explosive’ and I was having less issues with this version. I was using the regular setvelocity to give it -6 Z when it was within like 7 meters and if it had a full attack run it would typically target fine but had issues with the target moving and the velocity forcing the drone to continue on a poor trajectory, there was a version that targeted much more aggressively but I think I changed it out trying to get the velocity to be applied in the relative direction of _target for guidance but it looked unnatural at least the way I implemented it, I didn’t add anything along the Y

#

Sorry for typing a book! main thing is I’d like to improve final targeting/speed & it to have a behavior for no target, basically go from the ‘dive’ back to the chase if the target evades(might skip if transforming is the way forward). Will likely be back in here with specific questions but was just curious if anything in there was bad practice like all those loops and sleeps

warm hedge
#

My preference actually is running them each frame TBH. I dislike while with sleeps for, after my experience years ago, especially if you have multiple instance of spawns
Regarded to moving target, I'd make a coefficient so the quad does move to the position + (targetVelocity * distance till the target * maybe some number to tweak) yeah psuedo code but my idea is this

teal estuary
#

I saw in the wiki about each frame was just worried about performance impacts, like I said very noob not sure what’s acceptable. Cheating with AI and looking at some examples incorporating your suggestion I think I’m going to scrap the old version with these tips in mind. Thanks people anything else you’d like to share in the future I’m all ears. will likely be back with questions/progress

granite sky
#

If you're just moving a few air vehicles around for a limited period then eachFrame is acceptable.

teal estuary
#

sounds great thank you

#

gonna rework this, started it for a pack of scenarios im finishing up and possibly zeus wargame if i can make my brain work on this, thx

harsh bloom
#

Can anyone think of a way i could modify the "Infantry Cost" on a sector?
My goal is to have sectors unable to be captured until the previous one has been neutralised. I feel like the easiest method would be having the cost on all be 0 until the previous has been captured.

#

i tried ```
Sector_4 setVariable ["costInfantry", 1, true];

proven charm
harsh bloom
#

Method i came up with was setting a value in this case Sector_4_Cost = 0; and then just have Sector_5 update it to 1 when captured. But it almost seems like after spawning in the sector doesnt check what its infantry cost is.
Ive confirmed that Sector_4_Cost is being changed to 1 but it still remains unable to be captured.

harsh bloom
proven charm
harsh bloom
#
Delete or disable the sector module to 'finalize' the sector. Once done, capturing will be disabled and the last owner will retain the control forever.
```Im not sure what exactly this means
proven charm
#

me neither 😄

harsh bloom
#

Hmm, i was able to do "Sector enableSimulation false;" which made it translucent and popped up "task cancelled" But then i cant re enable them. Its just permanently dead.

warm hedge
#

Sector enableSimulation false; doesn't do a toggle but disable it. To enable it, try enableSimulation true;

harsh bloom
#

I did, it cant be enabled again

#

I tried simulationEnabled as well

#

Well one JANK solution i know i can do is just have all Sectos set their pos to 0,0,0 then teleport them into position when its time to cap them

proven charm
#

or create sector modules by script

pallid palm
#

or just use EOS Awsome

frozen seal
#

is there a way to check via sqf what graphics settings the player is using?

frozen seal
harsh bloom
proven charm
#

ya it requires bit of scripting skills. easier to apply your script on new maps though

harsh bloom
#

I got another question. I got the sector setting the value "Sector_5_Owner" to whatever team owns it. But for some reason i just cant get it to do anything when east is true.
I stripped it down to just these two sectors for simplicity.

[] spawn {
    while {true} do {
        if (Sector_5_Owner == east) then {
            Sector_4 setPos Sector_4_Pos;
        };
        sleep 1;
    };
};
```I tested *"Sector_4 setPos Sector_4_Pos"* on its own and it all works as intended.
#

If i could just directly check the owner of sector 5 that would be easiest but i had problems with that in the past.

tight cloak
kindred zephyr
# teal estuary sounds great thank you

as Jhon said, EachFrame is the way to go as long as they wont be permanent nor 20+ of them at the same time. Other mods might already be using frame loops and check and could drag the performance on the long run, but let say, if 2 or 3 vehicles/missiles/etc are active at once for small periods you should be more than fine.

proven charm
tight cloak
# tight cloak having some issues projecting the point for each gun
_turretArray = [port_1,port_2,port_3,port_4] - [port_3];
_handler = addMissionEventHandler ["EachFrame", 
{
    {
        _gunB = port_3 selectionPosition "gun";
        _gunE = port_3 selectionPosition "gunEnd";
        _gunDir = ASLToATL (_x modelToWorldWorld (_gunB vectorAdd [10,0,0]));
        _x lockCameraTo [_gunDir, [0]];
        private _vehicle = "VR_3DSelector_01_exit_F" createVehicle _gunDir;
        systemChat format ["%1", _x];
    } forEach (_thisArgs select 0);
},[_turretArray]];

having issues with the aforementioned projected point

#

the createvehicle is there for my own visualisation

#

ignore selection names, this turrets config is uhhh... something

harsh bloom
#

Is there a way to declare a particular team the winner? I can just subtract all their tickets but i would rather have that visible at the end.

tough abyss
#

How come in a sector module, Wheeled vehicles cost, tracked vehicles cost, naval cost, and aircraft cost is at 0, but infantry and players cost is at 1. Yet when I drive into a sector, it starts capturing anyway...

#

Even tried -1 with no effect.

ornate whale
tight cloak
#
_turretArray = [port_1,port_2,port_3,port_4] - [port_3];
_handler = addMissionEventHandler ["EachFrame", 
{
    {
        _gunB = port_3 selectionPosition "gun";
        _gunE = port_3 selectionPosition "gunEnd";
        _gunDiff = vectorNormalized (_gunE vectorDiff _gunB);
        _gunProject = _gunDiff vectorMultiply 10;
        _gunDir = _gunB vectorAdd _gunProject;
        _debug = AGLToASL (_x modelToWorld _gunDir);
        _x lockCameraTo [_debug, [0]];
        private _vehicle = "VR_3DSelector_01_exit_F" createVehicle _debug;
        systemChat format ["%1", _x];
    } forEach (_thisArgs select 0);
},[_turretArray]];
``` how its going.... lockcamerato doesnt work so im assuming its at a point it cant see and the createvehicle spawns the markers on the floor
#

rather than at the elevated point

#

otherwise, tracks the barrel at its projected point

#

just not in its elevation

#

any assists?

hallow mortar
# tight cloak ```sqf _turretArray = [port_1,port_2,port_3,port_4] - [port_3]; _handler = addMi...

Try this:

_turretArray = [port_1,port_2,port_3,port_4] - [port_3];
// store a debug visualiser for later instead of creating a new one every frame (awful)
{
    private _debug = "VR_3DSelector_01_exit_F" createVehicle [0,0,0];
    _x setVariable ["debug_target",_debug];
} forEach _turretArray;

_handler = addMissionEventHandler ["EachFrame", 
{
    // all this will be the same every frame so only do it once per frame, not once per turret
    // model space position of gun base
    private _gunB = port_3 selectionPosition "gun";
    private _gunE = port_3 selectionPosition "gunEnd";
    // 3D direction of gun determined by direction from its base to its end, extended by ~10 metres (NOT in model space, just a relative vector)
    private _gunDirection = _gunB vectorFromTo _gunE;
    private _gunProject = _gunDirection vectorMultiply 10;
    // add the extension vector on to the base position to get the extended position in model space
    private _gunProjectModel = _gunB vectorAdd _gunProject;
    // now we can transfer the model space position to all the other turrets' model space (assuming they're facing the same way anyway; if they're not then further maths needed to compensate for that....)
    {
        private _target = _x modelToWorldWorld _gunProjectModel;
        // syntax 1 only works with position-stabilised turrets, so we use syntax 2
        _x lockCameraTo [_target, [0], false];
        private _debug = _x getVariable ["debug_target",objNull];
        _debug setPosASL _target;
    } forEach (_thisArgs select 0);
},[_turretArray]];```
tight cloak
#

however - elevation still isnt accounted

#

just rotation

#

could i use - deg (port_3 animationSourcePhase "gun");

tough abyss
#

@restive bay

tight cloak
#

and move the target up n down based on that?

hallow mortar
#

Elevation should be accounted for; this is based on the 3D (not 2D) direction between the base of the gun and its end - 3D meaning it includes the vertical.

tight cloak
hallow mortar
#

Try increasing the direction multiplier, that may be too close for the turret to track properly since it's so large

#

Also, as another debug indicator, try attaching objects to the gun base and end memory points on the original turret. It's possible those aren't actually used with its animations.

tough abyss
#

Even tried .1 to get a slowed effect, but no change in the speed...

tight cloak
#

bear with, my a3 likes to keep crashing suddenly

#

mission file corrupted nootlikethis

#

increasing the private _gunProject = _gunDirection vectorMultiply 10; has strange efffects

#

wait.... might be the way around you put the "gun" and "gunend"

#

as for some reason "gun" is the actual end, and gunend is the start (i dont even know how with this turret it works)

#

only reason i can explain why increasing it inverts it

#

the lower the multiplier... the further out it goes

#

what

hallow mortar
#

Yes, if gunEnd is actually the base of the gun then reverse them.
I'd definitely suggest doing something to visualise where these memory points actually are and how they move (e.g. attaching indicators to them) rather than just guessing

tight cloak
#

alright

#

just waiting on arma 3 to fix itself, keeps crashing when returning to editor

#

it works

tight cloak
onyx wasp
#

i don't know if it is the correct location to ask this, but on the server i have some problems. Whenever somebody joins the server everybody who is already on it loses their armour and helmet. Does anybody know why this is happening?

ornate whale
#

How long respawn time do you find reasonable for a 20-40 minutes long, small scale coop mission (4 players) with respawn on the leader? I am thinking about a minute.

indigo snow
#

localityyyyy

#

do you use gear scripts?

#

in the unit init fields?

#

or called from init(Player).sqf?

#

because what's happening is these are re-ran when someone JIPs in

tight cloak
#

so this is probably just some silly scope / failure to pass variables around. but it throws an error now on lockcamera to.. 0 elements provided 3 expected

#

heres the relevant snippets from the function

#
_turretArray = _turretArray - [_controlTurret];
// store a debug visualiser for later instead of creating a new one every frame (awful)
{
    private _debug = "VR_3DSelector_01_exit_F" createVehicle [0,0,0];
    _x setVariable ["debug_target",_debug];
} forEach _turretArray;



_handler = addMissionEventHandler ["EachFrame", 
{
    // all this will be the same every frame so only do it once per frame, not once per turret
    // model space position of gun base
    private _gunB = (_thisArgs select 1) selectionPosition "gun";
    private _gunE = (_thisArgs select 1) selectionPosition "gunEnd";
    // 3D direction of gun determined by direction from its base to its end, extended by ~10 metres (NOT in model space, just a relative vector)
    private _gunDirection = _gunB vectorFromTo _gunE;
    private _gunProject = _gunDirection vectorMultiply 30;
    // add the extension vector on to the base position to get the extended position in model space
    private _gunProjectModel = _gunB vectorAdd _gunProject;
    // now we can transfer the model space position to all the other turrets' model space (assuming they're facing the same way anyway; if they're not then further maths needed to compensate for that....)
    {
        private _target = _x modelToWorldWorld _gunProjectModel;
        // syntax 1 only works with position-stabilised turrets, so we use syntax 2
        _x lockCameraTo [_target, [0], false];
        private _debug = _x getVariable ["debug_target",objNull];
        _debug setPosASL _target;
    } forEach (_thisArgs select 0);
},[_turretArray,_controlTurret]];
#

the error being the _x lockCameraTo [_target, [0], false];
line

fair drum
tight cloak
#

so im not sure why of all things its the lockCameraTo that breaks

granite sky
#

It looks like _x is a turret index here, not a vehicle?

#

ah never mind, it's probably just misnamed.

hallow mortar
#

"0 elements provided, 3 expected" sounds like the position variable (_target) is empty (because it's expecting a 3D position array, [x, y, z]). I think lockCameraTo isn't what's broken, it's just the first place where the breakage causes an error.
There are no scope issues here; it's all in the same scope within the EH.
I think probably _turretArray or _controlTurret is undefined, empty, etc. before being passed into the EH.

hallow mortar
tight cloak
#

well im calling the function via:
[[port_1,port_2,port_3,port_4],port_3] call CBB_fnc_carrier_Guns;
and inside the func its:
params [
["_turretArray", [objNull], [[], objNull]],
["_controlTurret", objNull, [objNull]]
];

#

so they should be getting passed in just fine

#

heres the whole thing

#

It's only run on the server too

granite sky
#

It looks plausible. Add a bunch more logging.

#

diag_log is your (only) friend in Arma.

tight cloak
#

I guess so, just stumped me is all as it all looks correct.

hallow mortar
#

Not related to your problem, but you can save a tiny bit of performance in your Fired EH by not having the params line, since you don't actually use any of those variables

spring stone
#

No gear scripts...

granite sky
#

I'm not sure "gun" and "gunEnd" selections are guaranteed to exist, but I imagine you tested that already.

tight cloak
#

wanted to get it to work on this setup first for an op. then was going to expand it to allow them to be entered manually so all turrets can be used

slow kestrel
#

can someone helop

#

pls

#

thx

tight cloak
#

currently validating my files as ive been getting nonstop status violations, which hasnt ever happened to me before

#

might be a cursed file

slow kestrel
#

i downloaded the hell heli map and it ended up uninstalling all my mods vro (not related to my current issue)

tough abyss
#

Search your mission file for removeHeadgear, that would give you a couple possible locations to look at

indigo snow
#

Does it happen when any player JIPs, or is it a specific player?

spring stone
#

Any

indigo snow
#

Then it definitively sounds like a dress-up script going haywire

#

Are you using any mods?

ornate whale
#

Is there an easy way how to reverse the order of waypoints?

tame bison
#

Hi, tell me please.
If I enter the zone for 1 second and exit, then after 15 seconds a message will come.
I trying to do if the player is in the zone then execute my code, if he is not in the zone then do nothing

[] spawn { 
while {true} do {
private _WaitTime = time + 15;
private _in = player call ExileClient_util_world_isInTraderZone; 
    if (_in) then {
        waitUntil {time > _WaitTime};
        ["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
        };
        sleep 1;          
    };
};

if I do sleep 15; then everything works, but it turns out the time increases to 30 sec

tulip ridge
tame bison
faint burrow
#

Code?

tame bison
# faint burrow Code?
[] spawn { 
while {true} do {
private _WaitTime = time + 15;
private _in = player call ExileClient_util_world_isInTraderZone; 
    if (_in) then {
        waitUntil {time > _WaitTime};
        if (_in) then {
        ["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
        };
        };
        sleep 1;          
    };
};

or

[] spawn { 
while {true} do {
private _WaitTime = time + 15;
private _in = player call ExileClient_util_world_isInTraderZone; 
private _inz = false;
    if (_in) then 
    {
        _inz = true;
        waitUntil {time > _WaitTime};
            if (_inz) then {
            ["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
            };
        };
        sleep 1;          
    };
};
faint burrow
#

Of course it won't work -- _in has outdated info, _inz is meaningless.

tulip ridge
tame bison
#

if only I knew how to do all this😞

faint burrow
#
while { true } do {
    _in = player call ExileClient_util_world_isInTraderZone;

    if (!_in) then {
        sleep 1;

        continue;
    };

    _WaitTime = time + 15;

    waitUntil {
        sleep 1;

        _in = player call ExileClient_util_world_isInTraderZone;

        !_in or { time >= _WaitTime }
    };

    if (_in) then {
        ["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
    };
};
tulip ridge
#
[] spawn { 
while {true} do {
private _WaitTime = time + 15;
private _in = player call ExileClient_util_world_isInTraderZone; 
    if (_in) then {
        waitUntil {time > _WaitTime};
            if (player call ExileClient_util_world_isInTraderZone) then {
            ["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
            };
        };
        sleep 1;          
    };
};
frigid spade
#

is there a function or perhaps even a script someone has made, to check if a waypoint is "valid"
e.g. If you have a boat with randomly generated waypoints, assume these waypoints are guaranteed to be in water, but it could be a lake the boat can't actually reach or a river with a bridge that's too low for the boat.

#

i guess what I'm asking is if there's a way to check for AI pathing correctness

#

same idea, but perhaps its a car on an island and the random waypoint is on a different island with no bridge connection, something that will check to see if the waypoint can actually be reached

tame bison
#

@faint burrow@tulip ridge thank you very much friends

proven charm
frigid spade
#

hmm, that's a useful EH, it does mention paths are calculated in segments, i wonder how long those segments are

#

it is a start though, thank you!

proven charm
frigid spade
#

there's also the calculatePath function, but it returns the object used to calculate the path, not a boolean or array of waypoints/segments

#

nothing i could really use in a script to determine if a path is possible

proven charm
#

yeah

hallow mortar
lavish dagger
#

Is there a script to cause an item to blow up when it’s inventory is accessed but not when picked up by ace?

hallow mortar
#

Not specifically for that purpose, but you could pretty easily make one using an inventoryOpened event handler

proven charm
#

you can also test with that (calculatePath) if the path if possible before trying to make the AI move

lavish dagger
#

Okay makes sense, just need to find the explosion then

hallow mortar
#

The traditional method is to spawn a Mk 82 with createVehicle

#

There are other, more cowardly options available depending on how many people you want to kill

proven charm
#

setDamage leaves no traces

onyx wasp
#

yes @ace
@ALiVE
@cba_a3
@cTab
@EUROFORCE
@mcc_sandbox
@staf_misc
@task_force_radio
@xla_fixedarsenal

indigo snow
#

does it happen immediately when the player jips, or later on?

pallid palm
#

lol

#

more cowardly lol

frigid spade
#
if(calculatePath ["boat","CARELESS",_boatWaypoint,_spawnPos] isEqualTo "") then {break};

this did the trick it seems, thank you both! nevermind, it did not work lmao

frigid spade
#

yeah i know i just wasn't sure how to check if the function returned nothing when the return is an object

#

maybe isNil?

#

nah, isNil also wants a string

#

whats the best way to see if calculatePath returns nothing? or does it just always return the agent used to calculate the path?

#

if so thats sort of a useless function on its own lol

faint burrow
#

Read command description.

tulip ridge
frigid spade
#

yeah i realize that

hallow mortar
# frigid spade whats the best way to see if calculatePath returns nothing? or does it just alwa...

calculatePath always returns the agent. There's no way to return the result directly; you'd have to add the pathCalculated EH as shown in the orangebox on calculatePath's wiki page, and have the EH trigger "part 2" of whatever you needed the result for.
The command isn't useless - without it it would be difficult to get the pathCalculated EH to return what you want. It probably doesn't return a value directly because it's a retrofitted way of accessing engine-level stuff that isn't designed to be accessed like this. For example, AI pathfinding might not be fast enough (or guaranteed to be fast enough) for a direct return to work. If the path might not be generated until the next frame, it can't be returned inline.

frigid spade
#

just throwing shit at the wall right now

granite sky
#

AI pathfinding is definitely not fast enough for the direct return :P

#

Think seconds rather than frames.

ornate whale
#

How am I supposed to setDir on individual units in a group? Even when I use doStop, they still turn somewhere else.

hallow mortar
#

setFormDir, I think

covert oak
#

Is there any way (like an event handler) to know when an AI squad leader is giving orders? I know they give orders to their subordinates because you can hear them speak, so I'd like to have a script that would make them play animations like pointing.
It'd be fun as a sniper to see officers pointing and otherwise obviously being officers.

granite sky
lone glade
#

@mcc_sandbox it's the worst piece of code I've ever laid my eyes upon, wouldn't surprise me if it was involved...

frigid spade
high marsh
#

https://community.bistudio.com/wiki/setDetailMapBlendPars really worth adjusting? pepeshrug I want to, as the idea with this particular scenario is to be acessible and extremely performant.

meager granite
#

Check how it affects the FPS

high marsh
# meager granite Check how it affects the FPS

I think my question regards the lowest common denominator as far as performance goes. I can't notice any difference between 120 and 125 fps until par is so low that it shoots up to something ridiculous like 300 or 500

#

which, you're right if that's desired effect = then yes.
But I don't know if it has the same drastic difference on a layman pc

#

I just think it's almost as subjective as simul weather layers ( if that even still applies ) but I want to make it feel eazy breezy beautiful for all