#arma3_scripting

1 messages Β· Page 474 of 1

meager granite
#

Ammo as in magazine? Then no, not really, you'll need to track it all yourself.

#

Unless you mean projectile then it is "Fired"

tender fossil
#

What was the UI template pack in Workshop called?

still forum
nocturne basalt
#

@still forum remember that issue I had yesterday?
I found that attaching simple objects to my mech caused this:
every time I joined a dedicated server for the first time, some of the init scripts didnt work (I didnt get any error messages which is weird, but I printed out the attached objects and found NOID on alot of the objects). Some of these objects was used for positional Say3d sounds.. When leaving the game and rejoining, things worked fine.

after switching out simpleObjects with createVehicleLocal, the problem was fixed. Still no clue as to why this happened

tender fossil
#

@still forum RIP πŸ˜‚

#

Should've just trusted the holy grail of information

nocturne basalt
#

wasnt a call for help lol 😁 just telling about my findings

tender fossil
#

@nocturne basalt I was referring to Dedmen's reply to me πŸ˜›

nocturne basalt
#

oh sry ^^

peak plover
#

@meager granite thanks. Guessed as much 😦

unborn ether
#

@meager granite Fired EVH also has a magazine along with ammo.

meager granite
#

I think he meant creation of magazines in crates\inventory

still forum
tough abyss
#

oh I thought this could go here oh well

tender fossil
#

How do I retrieve data from listbox rows and columns? I see commands for adding data, but not for retrieving it

#

I'm adding data to a listbox like this:

params ["_commanderCandidate"];

_index = lnbAddRow [124, [format ["%1", name _commanderCandidate], "1"]];
#

Here's my loop for retrieving the selected row in the listbox:

_handle = [] spawn {
    while {!isNull (findDisplay 1500)} do {
        _commanderCandidateRow = lbCurSel 124;
        _commanderCandidateRow // ??? How do retrieve and edit data in the row?
    };
};
still forum
#

I don't know. You are mixing lnb and lb commands. That sounds wrong

austere granite
#

Generally speaking you create a global array and then use the lb Index on that to get your data

#

Alternatively Set Variable on the control

tender fossil
#

Thanks for the tips! πŸ˜ƒ

#

Urgh. I'm reading how similar dialog was implemented in Benny's Warfare, and while the code is kinda clean, it's just the UI framework that makes my brain melt.

hexed owl
#

Doesn anyone remember that drone operator station composition that was posted on the sub a while back? It had a few nice scripts I wanted to look at from what I remember and I cant seem to find it

shadow sapphire
#

Which sub?

hexed owl
#

I'm pretty sure it was on the main arma one

shadow sapphire
#

Bro... what sub? Could we get a web address?

hexed owl
shadow sapphire
#

A subreddit. Gotcha.

daring kestrel
hexed owl
#

YES

#

Cheers

exotic tinsel
#

can you have multiple tags in your functions.hpp file? looking for a way to better organize my functions.

still forum
#

sure yea

#

nothing to stop you from creating multiple classes

nocturne basalt
#

can I play a sound using say3d that is only heard from the inside of a vehicle?

winter rose
#

maaaybe, if you make the sound radius the size of the vehicle I think

#

result not guaranteed

gleaming oyster
#

Maybe local to everyone in the vehicle and not for everyone else?

meager heart
#

playSound < maybe...

inner swallow
#

interestingly, when i last tried setting the vehicle as the sound source, the sound was actually attenuated

meager heart
#

afaik all sounds which will be played not via radio channel, will be with those attenuations effects

#

(when you're inside)

nocturne basalt
#

ok gonna try a few things

#

thanks

nocturne basalt
#

I ended up using soundEngineOnInt guys

nocturne basalt
#

I dont understand this addCamShake function.. it seems to shake my screen no matter how far I am from the source

queen cargo
#

and that has nothing to do with range

#
duration: Number - Duration in seconds (how long the effect will last)
frequency: Number - Frequency of shake, practical range is 0 to 100 (how will be the rhythm).``` are what is expected @nocturne basalt
#

reason why your screen always shakes is because you use the command wrong

#

if you want some proper distance calculation, you need to do it yourself πŸ˜›

nocturne basalt
#

so you cant set the range? kinda thought it was build into power..
when using it like this>
addCamShake [10, 1, 10]; shakes no matter what

#

since it said range is 0 to 20

queen cargo
#

yes, "range" is the power

#

either 0 power

#

or max 20

nocturne basalt
#

but no matter what power I set, I feel the shake even if Im 200m away

queen cargo
#

mhh ... what about the frequency?

#

have you also changed that?

nocturne basalt
#

yeah tried 10

#

so frequency is the range? Im confused

#

I swear I felt the shake much further away than 10m

queen cargo
#

param 1 has nothing to do with actual range

strong shard
#

@nocturne basalt addCamShake doesn’t have any source

#

@nocturne basalt range mean min and max value of parameter

nocturne basalt
#

ok thanks. pretty useless function then if you ask me

strong shard
#

@nocturne basalt it is very useful function

nocturne basalt
#

why do you ever want to add camshake for everyone on the entire map_

#

?

#

unless its armageddon

strong shard
#

@nocturne basalt because player has only one camera

nocturne basalt
#

I dont follow

strong shard
#

@nocturne basalt what you need? Shake depended on distance from source? 5 sec

nocturne basalt
#

yeah I just want the cam to shake if youre close enough to the source

#

its enough that it shakes for 1 sec if youre 10m or closer

strong shard
#

@nocturne basalt just wait, i am running game...

nocturne basalt
#

kk

torn jungle
#

What does _i refer to? when used in things like "for _i from 0 to 3 do { "

nocturne basalt
#

local int

#

_i is the number that increases on each iteration

strong shard
#

@nocturne basalt enableCamShake false; enableCamShake true; onEachFrame { addCamShake [ linearConversion [50, 0, player distance source, 0, 4], linearConversion [50, 0, player distance source, 0, 1], linearConversion [50, 0, player distance source, 0, 10] ]; };

nocturne basalt
#

oh wow thanks alot @strong shard

torn jungle
#

Is it like _x? (sorry can you explain further? I only recently understood what _x was used for so i completely understand it now, but not _i)

nocturne basalt
#

you can set anything. _i is just a variable name

#

many use _i for and increasing number

#

in that for loop, _i is set to start at 0

torn jungle
#

Oh. So its the traditional variable name used for increasing numbers?

strong shard
#

@torn jungle for "var" from "begin" to "end" do "code" it is built-in implementation of ```var = begin
while (var < end) do {
code;
var = var + 1;
};

halcyon ivy
#

@still forum thanks for your answer up there

torn jungle
#

@strong shard @nocturne basalt Ahhh seems clear to me now thanks to you guys. Thanks!

versed steppe
#

so worldName returns the "displayname" if I am correct..

#

is there any way to find the "class name" of the current world?

#

nvm, seems worldname gives the classname, carry on :p

compact maple
#

yep

astral dawn
#

How do I check if a remote client is a dedicated server or headless client from a server-running script?

#

I'd like to filter out these entities in addMissionEventHandler ["PlayerConnected", {}];

unborn ether
#

@astral dawn If that is a server, you will have no entity, if that is headless client - AFAIK you will not have any entity too, since HC usually occupies logics, not units, they are not counted as entities.

astral dawn
#

So there is no proper command for that? 🀦 ? What the...
Also in allPlayers wiki page it says that we can find headless clients with entities "HeadlessClient_F", so I assume they have entities

still forum
#

logics are entities too

unborn ether
#

πŸ€” well exclude them for your purpose with what you just stated: entities "HeadlessClient_F"

#
allPlayers select {!(_x in (entities "HeadlessClient_F"))}

Not sure if thats what you seek exactly.

astral dawn
#

Is entities initialized by the time PlayerConnected mission EH is executed?

unborn ether
#

Entities are if to be correct, but PlayerConnected triggers before the connected occupy some object, so you only have UID and owner

#

You can exclude that by UID, since HC has UID looking like "HCblahblah"

astral dawn
#

Hmm... interesting... then I also need to exclude the dedicated server somehow. I guess I will just do remoteExec and retrieve hasInterface this way 🀦

unborn ether
#

Server UID also has "__SERVER__" or just "SERVER" by the way

#

You basically can filter out server with just its always 2 as an owner

astral dawn
#

But if it's a client-run server? Then it also has owner=2

unborn ether
#

Im pretty sure it is.

#

@astral dawn Just thought of kinkiest workaround - parseNumber on incoming UID. Since parsing a string with a first letter will return 0 - means thats not what you looking for :D:

addMissionEventHandler ["PlayerConnected", {
    params ["_id", "_uid", "_name", "_jip", "_owner"];
    if ((parseNumber _uid) isEqualTo 0) exitWith {}; // Definitely not a player
}];
astral dawn
#

Thanks... I would rather rely on hasInterface

#

My dirty solution

params ["_id", "_uid", "_name", "_jip", "_owner", "_hasInterface"];

diag_log format ["[TFE] Info: Player connecting: %1", _this];

if (isNil "_hasInterface") then {
    // Call owner to report if it has interface (WTF! Why can't I just remotely check if it has interface??)
    [[_id, _uid, _name, _jip, _owner], { (_this + [hasInterface]) remoteExecCall ["TFE_fnc_onPlayerConnected", 2]; }] remoteExecCall ["call", _owner];
} else {
   // Now we finally know it it has interface
};
unborn ether
#

oh btw from wiki That happens only for GUI clients, if HC client connects first, EH does not fire for server.

#

So it doesn't even fire for a server

astral dawn
#

Well it fired for a server for me:
2018/07/19, 16:29:32 "[TFE] Info: Player connected: [2,"""",""__SERVER__"",false,2]"

#

When I as an admin player have joined the server and pressed the start button

meager heart
#

πŸ€”

quasi rover
#

silly question,

a.sqf:
abc_list = ["aaa", "bbb", "ccc"];
b.sqf:
_veh = abc_list;
_veh append ["ddd"];

then hint str abc_list ?
I thought abc_list is still ["aaa", "bbb", "ccc"]. But wrong, why ["aaa", "bbb", "ccc", "ddd"] ?

still forum
#

because append modifies the existing array

#

and you are not copying the array

#

Every value in SQF is passed around by reference. So if you don't want to modify the array by reference. You have to copy it like _veh = +abc_list

rancid ruin
#

i for int
i'm pretty sure i is meant to stand for index in loops

tough abyss
#

So i for int is actually more correct than index especially considering it is the loop counter register being referred to. It doesn't matter really, it is just what is used so you have to get used to it as its a historical limit. Most languages today don't limit it to a single character or a fixed variable so we ought to use what we want but you still see i and j everywhere.

astral dawn
#

I thought that it came from algebra, because they use i and j for matrix indices everywhere

tough abyss
#

Could be why Fortran tied i/j/k to the integer type certainly.

rancid ruin
#

that wiki section doesn't seem very sure about the topic lol

#

i guess it doesn't really matter though

#

maybe it stands for increment, and j stands for jncrement? πŸ€”

tough abyss
#

I did see a video some years back explaining the origins of it but alas my old and useless brain is not giving me good recall on what and where. Might come to me at some point. But as far as I know in computing it all ties back to Fortran and Algol and how they used single letters for variables and tied to type. But those type mappings probably tied to the conventions from mathematics since it was mathematicians designing and writing the early programs.

meager heart
#

maybe just index> _i πŸ˜ƒ

#

'm pretty sure i is meant to stand for index in loops
that ^

rancid ruin
#

i did think that, but i'm leaning toward "increment" now lol

#

because the variable increments every loop. that'd make more sense to me

#

same shit different name though

tough abyss
#

the register in use is usually called the loop counter which is why some languages have used count or counter in the past

peak plover
#

What if

#

We started giving params via {code}

#

nice for big functiosn with a lot of optional params

#
_fnc_test ={
    private _a = 1;
    private _b = 1;
    private _c = 1;
    (_this param [0,[],[[]]]) call (_this param [1,{},[{}]]);

    // return
    (_a + _b + _c)
};
_number = 5;
[[_number],{_c = _this#0;}]call _fnc_test;```
#

Ez params πŸ˜„

tough abyss
#

array based maps that can be read either in order or as maps for key->value mappings is basically how a lot of languages sort of do it providing both as a possibility.

peak plover
#

sqf doesn't have keys for arrays

queen cargo
#

@peak plover becuase that is horribly inefficient

vernal mural
inner swallow
#

probably tweaked it

#

you'll find more like that

hollow thistle
#

CBA has a more functions that do similar/same things that are available through BIS functions / commands. Mostly because a lot of them is a little bit wonky πŸ˜„

astral dawn
#

So if I am converting my code from mission to addon, I need to convert all the file paths from "folder\file.sqf" to "addon\folder'\file.sqf"? Is there an better way?

strong shard
#

@astral dawn yes if you are use absolute path (Started with β€œ/β€œ)

astral dawn
#

Then it is relative to arma folder, right?

#

Is it possible to specify the paths so that they could run both from an addon and a mission?

strong shard
#

@astral dawn use relative path (Not started with β€œ/β€œ)

#

@astral dawn *\

#

@astral dawn and not started with Drive Name

astral dawn
#

Like this? _handle = [] execVM "SubFolder\test.sqf";

strong shard
#

@astral dawn yes it is relative path

inner swallow
#

(do you really have to mention him in every sentence?)

astral dawn
#

From wiki: it will search in:

.\arma2\missions\CurrentMission.CurrentWorld\SubFolder\test.sqf
.\arma2\scripts\SubFolder\test.sqf
.\arma2\SubFolder\test.sqf

So in case of mission it will find the proper file, in case of addon it will not

strong shard
#

@astral dawn β€œ\folder1\folder2” and β€œC:\User\MyUser” - absolute

hollow thistle
#

Why not use functions library and do _handle = [] spawn tag_script; ?

#

Functions library can be easily setup in both addons and missions doesnt it ?

#

(I might be horribly wrong as so far I have done missions only.)

astral dawn
#

You are right but I dynamically create some functions... damn I think there is no way than

hollow thistle
#

" I dynamically create some functions." πŸ‘€

astral dawn
#

well with things like myFnc = compile pre...;
because I have made some macros and they rely on this thing...

strong shard
#

@astral dawn you can use cfgFunction in mission without β€œfile” param, and for add-on just add β€œfile” for category or tag class

#

@astral dawn sorry it rule (absolute\relative path) for preprocessor

astral dawn
#

Thx, I know about the cfgFunctions, but I needed that for things like myFnc = compile preprocessFileLineNumbers "..."

hollow thistle
#

but cfg functions does exactly that.

#

it finds the file and compiles it into variable πŸ˜„

strong shard
#

@astral dawn it is same

#

@astral dawn but cfgFunctions have more:

  • _fnc_scriptName and _fnc_scriptNameParent
  • function name = TAG_fnc_NAME
  • shows this function in "function viewer"
astral dawn
#

This is for the weird macros I have which does 'exactly that' plus some more things, so cfgFunctions is not an option. Thanks for the help guys.

strong shard
#

@astral dawn for macro you can use preprocessor

astral dawn
#

Hmm actually you are right... I could check for a flag if it's an addon or a mission, then add addon prefix. Brilliant!

hollow thistle
#

If you're using macros I guess you could define some define (:D) with correct path prefix when used in addon.

astral dawn
#

But I assumed such a thing already exists somewhere in arma... or in the pbo packing software

#

Because, like, isn't a mission a kind of an addon... then why do they use different path structures 😫

quasi rover
#

Thx, Dedmen. πŸ˜… @still forum

still forum
#

@vernal mural the wiki version numbers aren't always correct. I think Arma 1.0 might be the default value. Lots of CBA stuff has also been there before Arma had it in vanilla. But just compare the code of the CBA function with the BIS function and you'll see what the difference is.

vernal mural
#

Good to know, thanks !

forest ore
#
{
_unit = group player createUnit [_classname, [(getPos player select 0) + 75 - random 10,(getPos player select 1) + 10 - random 20,0], [], 0, "FORM"];
} else {
_vehicle = _classname createVehicle (player modelToWorld [0,8,0]), [], 0, "NONE";
};```
That there works nicely when testing through A3 editor but not in dedicated server environment, how come?
still forum
#

it's missing a }; that shouldn't work at all

strong shard
#

@forest ore player is undefined on dedicated server

still forum
#

also the _unit variable is useless and _classname might be nil.
Oh yeah.. ^ that too

forest ore
#

Apologies, the missing }; is on me

still forum
#

I always start with the complicated things duh..

forest ore
#

almost figured it was because of the player but can't figure out how to turn it to anything else. Thus came here to seek help

still forum
#

well player references the local player

#

referencing the local player on a server doesn't make any logical sense

#

so.. You want to reference a player. Which player?

forest ore
#

should be any

still forum
#

you want to place a vehicle at the position of any player?

#

Even the one standing 5km outside of the map and zeusing?

#

If so
_player = selectRandom allPlayers

#

and then use _player instead of player

forest ore
#

every player has a sort of "buy" menu available for them and they can get stuff from the menu. The above code I pasted either spawns an AI soldier about 75m away from the player and the other spawns a vehicle 8 meters away from the player

still forum
#

so you want THE PLAYER not ANY PLAYER

#

the player that used the menu

forest ore
#

YES

#

πŸ˜ƒ

still forum
#

But you said you want any player

#

why are you saying wrong things

#

just execute the code you posted above on the players machine instead of the server

forest ore
#

slight difficulties to word myself properly, apologies

still forum
#

there player will work

forest ore
#

ahh, well ok I might even understand that. But what if I wanted the server to do the spawning?

#

can I just use _player?

still forum
#

pass the player along as argument

#

I guess you are using remoteExec or smth

forest ore
#

not in this case...I guess..

still forum
#

Ah okey.

#

Interesting

#

Now... what?

forest ore
#

heh well πŸ˜ƒ

#

so guess one could ask that how to tell the server that it needs to spawn this stuff to that player who invoked the command

still forum
#

Yes

#

depends on how you tell the server to do anything though

#

You apparently don't want to tell me what you are using but it's apparently not remoteExec

strong shard
#

@forest ore pls, select one:

  1. remoteExec/remoteExecCall
  2. setVariable/getVariable
  3. publicVariable/addPublicVariableEventHandler
    πŸ˜ƒ
astral dawn
#

I would pick the first one

forest ore
#

does remoteExec work with player or does that need changing?

astral dawn
#

If your targeted code is running on a player then it can use the player command

still forum
#

that question isn't.. like.. I don't know what to answer

#

yes. You remoteExec is a thing that works

forest ore
#

Dedmen, so far I'm not using remoteExec since testing the code from the editor worked just fine. But I'm all in using remoteExec or what ever would suit best

still forum
#

yes it also works if you execute it. Which is what you are supposed to do with it

#

yes you can also execute it if you are you.. aka player

#

well tell me what you are using right now that doesn't work

#

how do you execute on the server

#

Stop letting me pull everything out of your nose

#

just tell me what you are trying to do exactly.

forest ore
#

I am not using, that's why it doesn't work on the server

still forum
#

no that's wrong

#

If you use "nothing" that menas

forest ore
#

(that means) it doesn't work πŸ™‚

strong shard
#

@forest ore simple example:
on client:

[player, typeof player] remoteExec ["MyFunc", 2, false];

on server:

MyFunc = {
    params ["_player", "_classname"];
    private _unit = group _player createUnit [_classname, position _player, [], 0, "FORM"];
};
still forum
#

that means it's executed locally

#

meaning player works and is not your problem

#

That is why i want you to tell me what you are doing FFS

forest ore
#

most of the problem is that I don't understand how to remoteExec anything.

still forum
#

you don't really need remoteExec for this

#

so you want to know how to remoteExec that?

#

Why don't you just say that?

forest ore
#

I did not have the slightest idea that I needed to remoteExec that

still forum
#

you don't

#

createUnit on the server is actually a kinda bad idea. Because it will create the unit on the server and then have to move it back to the player's machine

forest ore
#

so it actually moves it to the player's machine and doesn't stay on the server?

still forum
#

yes

#

AI units are always on the machine of the groups leader

#

you are adding it to the players group

strong shard
forest ore
#

well then I might not want to remoteExec the script if such happens

#

how about the vehicle that a player spawns, is it on the server if the script is remoteExec'd?

still forum
#

yes

#

and it will switch as soon as anyone get's into the driver seat

forest ore
#

aghh

vernal mural
#

anyone familiar with ACE explosives ? I wonder if being a specialist prevent the random detonation when the setting "explode on defuse" is activated

vernal mural
#

mh, good catch

still forum
#

nah. just google and knowing what to look for

shadow sapphire
#

Alright. Today I'm trying to get the total count of all units in several specific groups, and as that count drops, I want to ramp up the chance of an event.

So, if they have thirty units to start, and they lose ten, the event should begin having a chance to trigger. By the time they have lost twenty units, the chance of the event should be at or nearing one hundred percent.

Any pointers?

strong shard
#

@shadow sapphire

(random 1.0) >= (linearConversion [_aliveBegin, _aliveEnd, _aliveCurr, 0.8, 0.0])
#

@shadow sapphire aliveCurr >= aliveBegin = 20%; aliveCurr <= aliveEnd = 100%; aliveBegin > aliveEnd; and chance changed between begin and end from 20% to 100% linearly

meager heart
#

btw linearConversion [_aliveBegin, _aliveEnd, _aliveCurr, 0.8, 0.0] -> _aliveCurr * 0.8 / _aliveEnd πŸ˜ƒ

shadow sapphire
#

Wow. That is FAR less complicated than I thought it would be.

Could I get a lesson in application?

What do _alivebegin, _alivecurr, and _aliveend mean? Do I need to define them? How do I pull group information into that?

strong shard
#

@shadow sapphire just 3 variable, aliveBegin - how much alive units on start, aliveEnd - when chance is 100%, aliveCurr - current number of alive units

shadow sapphire
#

Right, but do I need to define them or are they in the game already? How do I tell it which units to monitor in the count?

strong shard
#

@shadow sapphire you define

shadow sapphire
#

Ah, okay, gotcha. Hmmm... Okay, I think I'm getting it.

#

So,

_fullstrength = count groups on spawn.
_currentstrength = current number in groups.
_understrength = count groups/2

strong shard
#

@meager heart ((0.8 - 0.0)/(begin-end))*(curr - end) πŸ˜ƒ

shadow sapphire
#

@meager heart, what are you explaining there?

strong shard
#

@shadow sapphire he say that linearConversion is syntax sugar for linear equation πŸ˜ƒ

shadow sapphire
#

Haha, okay. Sounds good.

#

How do I indicate which groups should be totalled and then plugged into this?

strong shard
#

@shadow sapphire variable name in edit dialog of group in 3den

shadow sapphire
#

That's not going to work. My groups are being created via scripts...

strong shard
#

@shadow sapphire then var = createGroup...

shadow sapphire
#

I know that. Haha, you're not understanding the question I'm asking. That's fine, you've been plenty of help, I'll try to pick away at this a while. It'll do me some good.

#
If (!isServer) exitwith {};
Params ["_trigger"];
_Base = (getmarkerpos "Origin");
_HQ = [_Base, INDEPENDENT, ["I_officer_F","I_medic_F","I_officer_F","I_soldier_UAV_F"],[],["LIEUTENANT","PRIVATE","SERGEANT","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G1 = [_Base, INDEPENDENT, ["I_Soldier_TL_F","I_Soldier_AR_F","I_soldier_F","I_soldier_F"],[],["CORPORAL","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G2 = [_Base, INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_M_F","I_Soldier_AR_F","I_soldier_F"],[],["SERGEANT","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G3 = [_Base, INDEPENDENT, ["I_Soldier_TL_F","I_soldier_F","I_Soldier_AR_F","I_soldier_F"],[],["CORPORAL","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G4 = [_Base, INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_GL_F","I_Soldier_AR_F","I_soldier_F"],[],["SERGEANT","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G5 = [_Base, INDEPENDENT, ["I_Soldier_TL_F","I_Soldier_AR_F","I_soldier_F","I_soldier_F"],[],["CORPORAL","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G6 = [_Base, INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_AR_F","I_Soldier_GL_F","I_soldier_F"],[],["SERGEANT","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;

{
    {
        _gearhandle = _x execvm "Gear\AAF.sqf";
        waitUntil {scriptDone _gearhandle};

        if ((_x getunittrait "medic") && {"Medikit" in items _x}) then {
            [_x, IndiCasualties] execVM "Combat Medic.sqf";
        };

        _x addeventhandler ["Handledamage",{
            if (_this select 2 > 0.8) then {
                _unit = _this select 0;
                _unit setunconscious true;
                IndiCasualties pushbackunique _unit;
            };
        }];
    } foreach units _x;
    _x deletegroupwhenempty true;
} foreach [_HQ, _G1, _G2, _G3, _G4, _G5, _G6];
unborn ether
#

Thats a bit excessive ^

sharp grotto
#

Is there a way to remove objects only from roads ? I try to clean the chernarus 2035 map, and there are like thousands wrecks on the road, and it just looks stupid and it's not good for gameplay. I tried some cleaning scripts for the whole map, but it's to much. So if you park a vehicle somewhere where a wreck was and the server restarts, your car will explode after restart because the server is not fast enough with deleting all this wrecks.

edgy dune
#

U might have to edit the map it self, or I think theres a thing in eden that removes stuff on a map

sharp grotto
#

yea hide object module, but i think it's not the smartest way to place 1000 of the modules for every collection of wrecks on the road

edgy dune
#

delay respawning the vehicles? that sounds like a bad idea.

sharp grotto
#

It's a Exile server, so things are a bit different than usual

fair drum
#

i have a bunch of buildings i want to destroy. how would i go about doing it? connecting them all to the trigger?

peak plover
#

What buildings

#

map objects?

#

Anyone have experience using deleted eh?

still forum
#

yeah

#

Place a unit via Zeus and the deletedEH is called. When you place things

#

But.. Even though deleted is called. The things still exist a couple frames later

#

so if you want to really make sure that something was deleted you need to wait a couple frames and check if it's really gone

peak plover
#

    _ied addEventHandler ['deleted',{systemChat str _this}];
#

didn't work

#

Do I have to wait before I can add it?

#

Am I doing it wrong?

#

ohh lmnao

#

it doesn't work on mines

#

That's why haha

#

ohh

#

This kind of sucks

compact maple
#

Hello guys, quick question, if i write an inline function inside another function which is declared in Functions.hpp, should i declare the inline one too ?

peak plover
#

What's a inline function?

compact maple
#

i read it on the wiki, sec

#

this :

my_fnc = {
    a = 1;
    b = 2;
    c = a + b;
    c //<- fine
}
peak plover
#

aah

compact maple
#

its about client calling server, then server calling back the client with that inline function

peak plover
#

function is just a variable which is a code block

compact maple
#

oh okay

peak plover
#

code blocks can be executed using call and others like it

compact maple
#

ok thanks you

peak plover
#

setRandomLip needs to be remoteExecuted_

queen cargo
#

at best you check first who actually can see it

#

so you do not clutter the net fully

surreal peak
#

_weight = loadAbs scout; 
//should get weight of the "scout" playable unit (has the variable name "scout")

while {true} do
  {
  //The While Loop works
    if (_weight < 26) then
      {
        //But this doesnt doesn't activate
        hintSilent "This should work";
     //trying to debug - this doesnt activate

        scout setAnimSpeedCoef 10; 
    //should make scout really fast -also doesnt activate

      };
  }; ``` I tried using this to make it when the "scout" player has less than 26kg of weight it makes him faster but it doesnt work and I dont understand why. TBH it is probably something simple but I dont see it
ruby breach
#

_weight will never change within the scope of the loop

surreal peak
#

sorry, im a bit new to scripting, how would I do it so it would change?

#

would I have to make it not a private variable?

ruby breach
#

Define it inside of the loop perhaps?

surreal peak
#

kk will try

#

Doesn't work

still forum
#

what did you do?

surreal peak
#

put the _weight = loadAbs scout; inside of the loop

still forum
#

how?

surreal peak
#
  {
  _weight = loadAbs scout;
 //should get weight of the "scout" playable unit (has the variable name "scout")

    if (_weight < 26) then
      {
        //But this doesnt doesn't activate
        hintSilent "This should work";
     //trying to debug - this doesnt activate

        scout setAnimSpeedCoef 0.1; 
    //should make scout really fast -also doesnt activate
      };
  };```
#

forgot I changed it to not private variable

still forum
#

So you didn't put the _weight = loadAbs scout; inside of the loop at all

#

you for whatever reason removed the underscore

surreal peak
#

IK, was testing taht

#

that*

#

the defining of _weight is in the while loop

#

in the example above

still forum
#

Are you sure that 26 is correct? 26 is a soldier with map,radio,compass,watch and rangefinder

#

Did you check what the actual weight is via the debug console?

surreal peak
#

I was basing the weight on what it told me on the player menu

still forum
#

the player menu?

#

which player menu

surreal peak
#

ah sorry, ill send screenshot, im also using ACE which I should have mentioed

#

mentioned

still forum
#

Well as I said 26 is a soldier with map,radio,compass,watch and rangefinder does that match your loadout?

#

Ah you mean the KG weight display in the inventory?

surreal peak
#

yeah

still forum
#

Arma mass isn't measured in KG

#

ACE converts it for convenience

surreal peak
#

oh

#

what is the script to find the mass in the debug console?

still forum
#

really?

surreal peak
#

nvm

#

found it

still forum
#

you are using that right there in your script already

surreal peak
#

yeah... im not smart sometimes

digital fern
#

Sup guys, I will start helping out here a lot from now on, I love the idea of this discord. I just have a quick question, does anyone have a script for changing skins on arma 2? Wherever I look I just find DayZ scripts.

#

this is what I have so far: _plrInit = _plrInit + format["this setObjectTexture %1;", (_x select 2)];
respawnSkin = (_x select 2);

#

Iknow I have to use the setobjecttexture

still forum
#

setObjectTexture yeah.. But what is that format stuff there?

digital fern
#

its from a mission im working on

#

do I need to add in a setSide to the script?

tiny wadi
still forum
#

What does setSide have to do with setIObjectTexture?

#

i don't understand what your problem is

tiny wadi
#

The bounding box seems to be infront of where the car actually is, what I gathered on the forums is that the physx simulation is ahead of the rendering part

digital fern
#

All I need is a basic change skin (unit) script really

still forum
#

You already posted that above though

digital fern
#

hmm will just have to play around with it until arma wants to cooperate

#

thanks though πŸ˜„

still forum
#

We might be able to help you if you'd tell us what your actual problem is ^^

#

I guess it doesn't work for you for whatever reason

digital fern
#

We have a clothing shop system, that's why the format stuff were there

still forum
#

Clothing shop sounds like you want to change the uniform not the texture

digital fern
#

yeah Id like to change the unit

still forum
#

Huh?

#

what now.
Skin/unit/uniform are all different things

digital fern
#

im talking about arma 2 here πŸ˜›

inner swallow
#

i suspect that doesn't matter

still forum
#

Yeah. I know

#

Or couldn't you change uniform in A2?

digital fern
#

nope

#

only unit

still forum
digital fern
#

well what isn't complicated :p

still forum
#

But I dunno why setObjectTexture doesn't work

digital fern
#

well the shops work

#

but I want to be able to execute my own script to use a unit not available on the server

still forum
#

not available on the server? :u That sounds weird...

#

Where is it then if not on the server?

digital fern
#

its not available for the public no

#

but all the units are there unused still

#

gosh im stupid

#

this setObjectTexture US_Soldier_TL_EP1;

#

its probably as simple as this

still forum
#

no

#

it's not

#

setObjectTexture takes the path to the texture

#

you are giving it a undefined variable

#

you can get the path by spawning the unit and using getObjectTexture

digital fern
#

_newUnit = _grp createUnit [(_x select 1), _pos, [], 0, "NONE"];
addSwitchableUnit _newUnit;
and then just delete the old unit right?

tough abyss
#

Hey I'm a relatively newbie scripter and am trying to throw something together quick

#

I need to add an "Eject' action to a plane that is mission that button so that my guys can parachute out. Will need to be dedicated compatible. I was thinking I'd add an add action the plane and have it use the GetOut action on the player who presses it

#

But how do I set it to run server side, and how do I set it to only eject whoever presses the button

digital fern
#

So you want to eject all passengers with a scroll option?

tough abyss
#

No I want each person to be able to individually eject themselves with a scroll option

digital fern
#

isnt eject already a game function?

#

ohhhhhhh arma 3

tough abyss
#

Lol it is a game function

#

But not for this specific plane

digital fern
#

you want them to spawn in with a parachute even if they dont have one

tough abyss
#

No I gave them parachutes in a gear script

#

They just need to have the option to actually get out of the plane

digital fern
#

okey gimme 2 sec

tough abyss
#

It's a modded plane where the modders took away the eject option and replaced it with their own script which is buggy

#

So I'm just trying to add the eject option back in so we can use the vanilla system

digital fern
#

just add an event handler for getting out

tough abyss
#

put that in the init of the C-47?

digital fern
#

2 sec more

tough abyss
#

I'm not sure that's what I'm looking for. I need to add the eject action back into the scroll menu

digital fern
#

ohhhhhh

#

okey lemme check

tough abyss
#

Yeah, basically I need to add someone like this

digital fern
#

waituntil {!(IsNull (findDisplay 46))}; _keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == 57) then {
if (!(isTouchingGround player) and (vehicle player == player)) then {
[] spawn {player switchCamera 'EXTERNAL';Player SwitchMove 'AswmPercMrunSnonWnonDf_AswmPercMstpSnonWnonDnon';addCamShake [4, 2, 20];sleep 0.7;playSound3D ['@SCS\Sound\Parachute.ogg', Player, false, GetPosASL Player,5, 1, 250];titleText ['', 'White IN', 0.6];addCamShake [2, 2, 10];chute = createVehicle ['Steerable_Parachute_F', position Player, [], 0, 'Fly'];chute setPos position player;player moveIndriver chute; chute allowDamage false;};
};
}"];

#

put this in the init.sqf

#

and try it, migh tnot work

#

nononon

#

thats wrong

#

_heli = vehicle player;
_Offset = [10,10,0];
_worldPos = _heli modelToWorld _Offset;

_heli setVelocity [0,0,50];

unassignvehicle vehicle player;
player action ["eject",vehicle player];

sleep 0.5;

_para = "nonSteerable_Parachute_F" createVehicle _worldPos; //--- Parachute classnames --- "nonSteerable_Parachute_F" or "Steerable_Parachute_F"
_para setPos _worldPos;

player moveIndriver _para;
waitUntil {((visiblePositionASL player select 2) < 5)};

sleep 1;

MoveOut player;
deleteVehicle _para;

#

this is what you want

tough abyss
#

Ok, where do I put this?

digital fern
#

make a .sqf file in your main mission folder and name it like eject.sqf

#

then add this to the init: [] execVM "eject.sqf";

tough abyss
#

Ok, wait why can't I just make a script that says caller = this_select 1;

#

_this select 1;*

digital fern
#

there is tonnes of ways to do it

#

_player action ["Eject", vehicle _player];

#

can be as simple as that

tough abyss
#

caller action ["getOut", vehicle caller];

digital fern
#

just make it a scroll option

tough abyss
#

and then in the C-47 init

digital fern
#

no you dont init to a vehicle

#

you need to make a scroll option which runs this script: _player action ["Eject", vehicle _player];

tough abyss
#

ah ok

digital fern
#

remember this will just make them fall out of the sky so make sure you have some parachutes :p

tough abyss
#

They do :p

digital fern
#

heh nice

#

do you need help setting up the scroll option

tough abyss
#

I'm trying to make my own script to get better, if I do I'll let you know give me a sec :p

digital fern
#

yeye np

tough abyss
#

I will probably need help making it MP compatible

#

Whoohoo! My little script works in SP

#

Now could you tell me how to make an AddAction work on a dedicated server? Appreciate it

digital fern
#

do you have an actions.sqf in your mission

noble pond
#

if the action is just an individual player getting kicked out of the plane then there is nothing ot change to make it work in mp

#

the action only should run on the client and nobody else needs to do the same action when he does it

#

if you send that command to everybody then it will eject every single player in the game out of their vehicle

#

or if you send the scroll action for whatever reason, there would be an action on each person's screen for every player in the match, so if you had 30 people ingame, each person would end up with 30 scroll actions for 'Eject' :p

#

@tough abyss

tough abyss
#

Thanks @noble pond

#

That would be pretty funny to do in a meme mission though, give 1 player the ability to throw everyone out of a vehicle πŸ˜›

noble pond
#

sending lots of data like that would probably wreck the connection and make everyone rubberband too until the server clears the massive backlog of data to transmit

tough abyss
#

Lol sounds about like my unit's typical mission

shadow sapphire
#

Why does this:

character say "a3\dubbing_f_beta\showcase_combined_arms\15_Insertion_Complete\showcase_combined_arms_15_insertion_complete_BHQ_0.ogg";```

Throw an error saying no .ogg file found or whatever? This is a vanilla file. Must I rip and reupload or classify this somehow to make it work?
inner swallow
#

can't you just use the file directly, without the whole path?

still forum
#

Must I rip and reupload or classify this That is the worst idea ever

#

I would recommend to use your eyes to read

shadow sapphire
#

I've read it several times. I still don't understand the issue.

#

I'm not a coder. This knowledge isn't innate or obvious.

inner swallow
#

sound: String - classname of the sound to be played. Defined in CfgSounds including Description.ext

#

you'll have to put the sound in descriptions.ext

#

and then the string is the classname, not the path

#

the path goes into descriptions.ext

shadow sapphire
#

Dedmen just said classifying it is the worst idea he's ever heard. So, unless he's never heard of the holocaust, to me that means there's a major bad no no here.

#

Okay, so I DO need to classify it?

inner swallow
shadow sapphire
#

Easy enough. Thank you much.

inner swallow
#

you don't need to rip it out

#

i think that's what he meant

shadow sapphire
#

That's fine. I didn't anticipate I did, but was just asking if I had to do that OR classify it.

#

Thank you much for explaining.

inner swallow
#

no problem πŸ˜„

#

(btw, i didn't understand what you meant by classify... i was thinking in terms of categorizing/classification πŸ˜„ )

shadow sapphire
#

Okay, create a class for it.

#

Sounds good. Thanks, again.

inner swallow
#

🍻

still forum
#

classifying to me means finding a category for something so you can... classify it..

meager heart
#

just get yourself comfy... in b4 tho πŸ˜„

nocturne basalt
#

how can I lock vehicles for AI? lock seems to work only for human players

inner swallow
#

if you're running without mods, then AI should not be able to access a locked vehicle

nocturne basalt
#

hmm dont seem to work. Im trying to lock the vehicle but the AI keeps getting in

#

it says it for players
"Lock vehicle (disable mounting / dismounting) for player. Similar to setVehicleLock when number is used as param."

inner swallow
#

lockstate: Number - 0 - Unlocked; 1 - Default; 2 - Locked; 3 - Locked for player;

#

i think you need 2

nocturne basalt
#

yeah tried that already. also tried setVehicleLock "LOCKED"

inner swallow
#

and you're not running any mods?

nocturne basalt
#

non other than my own

#

the one I currently want to lock

#

a vehicle

meager heart
#

πŸ€”

#

setVehicleLock < works...

nocturne basalt
#

hmmm.. well I can certainly not getin. AI walks straight up

#

weird

#

maybe I have to script my way around it....

inner swallow
#

try locking from the editor too and see if that makes a difference

meager heart
#

maybe some locality issues

nocturne basalt
#

Im using an eject script to force the AI out, then I lock it

meager heart
#

if you're locking vehicle just to make ai do not get in after eject... there is few better options...

nocturne basalt
#

move away getin mempoints?

#

put new crew inside?

meager heart
#

allowGetIn <

#
{
    [_x] allowGetIn false; 
    _x action ["GetOut", vehicle _x];
} forEach _unitsCargo;
#

done

nocturne basalt
#

thanks ^^

meager heart
#

imo GetOut < looks better... but it will work with eject too

nocturne basalt
#

it worked ty

#

I was only ejecting the gunner. driver was still inside, and the gunner got back in when using lock. didnt it work because the driver was still inside?

#

is the vehicle unlocked again with allied crew inside maybe? πŸ€”

meager heart
#

hmm... idk, never tried it that way ^

nocturne basalt
#

hmm cant really use allowGetIn. it keeps them from entering any vehicle. I just want to lock this perticular vehicle

meager heart
#

set it back

nocturne basalt
#

but then they get back in xD

meager heart
#

Β―_(ツ)_/Β―

nocturne basalt
#

xD

meager heart
#

btw to get them in, better will be orderGetIn

#

but you will have to assign the roles b4

#

something like that assignAsCargo > orderGetIn

nocturne basalt
#

@meager heart wokring now.
_v lockDriver true;
_v lockTurret [[0,0], true];

#

he tries to get in, but i rejected

#

then he dont try again

meager heart
#

no idea what you're doing there, but if that works for you πŸ‘Œ πŸ˜ƒ

nocturne basalt
#

☺

young current
#

you might need to unassign the vehicle from the ejected guy

#

this stuff could be interfering

astral tendon
#

Is there a event handle to check if some opem a door?

strong shard
#

@astral tendon no, you need create this event manualy

tender fossil
#

Why doesn't the for loop add any players to the list even though I'm on the server ingame when the function is executed? (The function is executed on server)

// Array format: 0: player index, 1: player name, 2: number of votes
CNC_arr_commVotePlayerList = [0, "No commander", 0];

// Note: "No commander" has index 0 (see above), starting from index 1
_i = 1;
{
    CNC_arr_commVotePlayerList pushBack [_i, name _x, 0];
    _i = _i + 1;
// Exclude headless clients from vote
} forEach allPlayers - entities "HeadlessClient_F";
#

The content of the list after executing these lines of code is:

 "[CNC (DEBUG)] [frame: 1747 | ticktime: 50.336 | fps: 45.4545] CNC_FNC_InitCommVote: Content of CNC_arr_comVotePlayerList: [0,""No commander"",0]"
strong shard
#

@tender fossil where it is executing (meaning script/event...)

peak plover
#

If a unit joins a group local to player1
does the unit locality transfer over to player1?

tender fossil
#

@strong shard The script is being triggered manually by other scripts

nocturne basalt
#

hi guys. can someone confirm that damage isnt synced perfectly across the network?
in my script I did some checks on damage level, and couldnt for the love of god figure out why it sometimes only triggered on one client..

so I printed out the damage and I see now the are not the same!
see printscreen:
https://www.dropbox.com/s/r4103sbdqirwk25/Untitled.png?dl=0

knotty mantle
#

Is there an "easy" way to get a classname when you only have the displayname at your hand?

still forum
#

no

tender fossil
#

@peak plover Yes (AFAIK)

#

AIs in group are controlled by the machine/client of player leader

knotty mantle
#

Thx

peak plover
#

leader is not player @tender fossil

#

But group and ai were created on the client

still forum
#

groups locality is where the leader is

#

AI locality is where the group is

peak plover
#

createGroup effects global

#

But I assume where it runs it's local

still forum
#

it creates a local group empty group

#

but as soon as someone joines the group. He is the leader

peak plover
#

aah okay

#

thanks

strong shard
#

@nocturne basalt try getAllHitPointsDamage, it must be more accurate, β€œdamage” command is magic πŸ˜ƒ

nocturne basalt
#

Ah thanks gonna check it out

strong shard
#

@tender fossil first you need insert β€œinit value” in array, because now you will get [0, β€œNo commander, 0, [1, β€œPlyaer #1”, 0], [2, β€œPlayer #2”, 0]...]

#

@tender fossil second: in debug name of variable is correct? Mb typo in name, but idk how you create this text

tender fossil
#

@strong shard How to insert that init value correctly? I'm confused πŸ˜›

strong shard
#

@tender fossil myVar = [[0, β€œNo commander”, 0]] if you need array of arrays

tender fossil
#

Here's how I check the variable

["CNC_FNC_InitCommVote: Content of CNC_arr_comVotePlayerList: %1", CNC_arr_commVotePlayerList], 1] call CNC_FNC_LogContent;
#

Ah, true that. Thanks πŸ˜ƒ

strong shard
#

@tender fossil what mean 2nd parameter?

tender fossil
#

It's syntactic sugar, logging level for filtering out unnecessary information

#
CNC_FNC_LogContent = {

params ["_logType", "_logContent", ["_logLevel", 0]];

if (_logLevel >= CNC_LogLevel) then {
    diag_log format ["[CNC (%1)] [frame: %2 | ticktime: %3 | fps: %4] %5", _logType, diag_frameno, diag_tickTime, diag_fps, _logContent];
};

};
strong shard
#

@tender fossil you can also print allPlayers command result with out any filter and classname of each player?

tender fossil
#

Gimme sec, doing that now

strong shard
#

@tender fossil diag_log allPlayers; diag_log (allPlayers apply { typeof _x; });

#

@tender fossil print it between array initialize and forEach loop

tender fossil
#

Both are just []

strong shard
#

@tender fossil all this code executed from any type of β€œinit” code?

tender fossil
#

Nope, it's remote executed on server by client after 10 seconds sleep

#

from mission start

#

The execution chain starts from initPlayerLocal.sqf, where this: script is execVM'ed:

sleep 10;

call CNC_FNC_InitCommVoteClient;
CNC_FNC_InitCommVoteClient = {

[player] remoteExecCall ["CNC_FNC_InitCommVote", 2];

};
#

On server:

CNC_FNC_InitCommVote = {

params ["_voteStartClient"];

// Array format: 0: player index, 1: player name, 2: number of votes
CNC_arr_commVotePlayerList = [[0, "No commander", 0]];

// Note: "No commander" has index 0 (see above), starting from index 1
_i = 1;
{
    CNC_arr_commVotePlayerList pushBack [_i, name _x, 0];
    _i = _i + 1;
// Exclude headless clients from vote
} forEach allPlayers - entities "HeadlessClient_F";

["DEBUG", format ["CNC_FNC_InitCommVote: Content of CNC_arr_comVotePlayerList: %1", CNC_arr_commVotePlayerList], 1] call CNC_FNC_LogContent;

[] remoteExecCall ["CNC_FNC_CreateCommVoteDialog", -2];

publicVariable "CNC_arr_commVotePlayerList";

["INFORMATION", format ["Commander vote has been started by %1", name _voteStartClient]] call CNC_FNC_LogContent;

};
strong shard
#

@tender fossil magic πŸ˜„ idk why player is not initialized on server

tender fossil
#

I also tried with BIS_fnc_listPlayers, same result πŸ˜„

strong shard
#

@tender fossil print frameNo and time when this script is executed on server, and in β€œPlayerConnected” EH, and create on server infinity loop with print of allPlayers each 0.5-1.0 second

still forum
#
_i = 1;
{
    CNC_arr_commVotePlayerList pushBack [_i, name _x, 0];
    _i = _i + 1;
// Exclude headless clients from vote
} forEach allPlayers - entities "HeadlessClient_F";

->

{
    CNC_arr_commVotePlayerList pushBack [_forEachIndex + 1, name _x, 0];
// Exclude headless clients from vote
} forEach allPlayers - entities "HeadlessClient_F";
tender fossil
#

Fixed, thanks @still forum

#

@strong shard Interesting... From the allPlayers monitor loop:

16:00:52 "[CNC (DEBUG)] [frame: 2120 | ticktime: 60.39 | fps: 44.3213] allPlayers on server: []"
16:00:55 "[CNC (DEBUG)] [frame: 2253 | ticktime: 63.407 | fps: 43.3604] allPlayers on server: [B Alpha 1-1:1 (Ezcoo) REMOTE]"
16:00:58 "[CNC (DEBUG)] [frame: 2384 | ticktime: 66.415 | fps: 45.4545] allPlayers on server: [B Alpha 1-1:1 (Ezcoo) REMOTE]"
16:01:01 "[CNC (DEBUG)] [frame: 2520 | ticktime: 69.422 | fps: 45.4545] allPlayers on server: [B Alpha 1-1:1 (Ezcoo) REMOTE]"
#

It takes over 20 seconds for allPlayers to get initialized

meager heart
#

up to xx minutes sometimes...

#
#define ALL_PLAYERS ((allUnits + allDeadMen) select {isPlayer _x})

BIS_fnc_listPlayers v2.0 ^

tender fossil
#

How to check whether a Number type variable exists? With isNull ?

#

Thanks @meager heart, testing it now

still forum
#

!isNil

#

same as for any other variable type

astral tendon
#

The hit event handle is supouse to not work on placed objects like Dirthump_1_F (Dirt)?

still forum
#

I don't think it works on statics

astral tendon
#

So, how can I check if the player shoots at a particulary target?

nocturne basalt
#

Together with the fired eventhandler

quartz coyote
still forum
#

what is "the script"?

quartz coyote
#

any script, just exit the script without playing whats next

#

would this work ?

inGameUISetEventHandler ["Action", "if (true) exitWith {};"];```
still forum
#

that would do absolutely nothing

quartz coyote
#

mmeh

noble pond
#

fail

still forum
#

you want to kill any script when he uses the action menu?

#

so just grab a random script from somewhere and kill it?

quartz coyote
#

nah, kill the script in witch the inGameUISetEventHandler is

noble pond
#

he wants his specific script to exit when he uses the action

still forum
#

use a variable

#

I guess your "script" has a while true loop now?

#

make it check a variable and set it to false in the eventhandler

quartz coyote
#
inGameUISetEventHandler ["Action", "exitThisShit = true;"];
if (exitThisShit) exitWith {};```
#
inGameUISetEventHandler ["Action", "exitThisShit = true;"];
if (exitThisShit) exitWith {exitThisShit = false};```
still forum
#

that wouldn't do anything

#

after adding the eventhandler it will continue the script

#

run past that before the variable can possibly be set

#

and then not check again

noble pond
#

exitwith line needs to be in a loop

still forum
#

Well. then it would exit that loop

quartz coyote
#

what do you mean ? @noble pond

still forum
#

and not the script above it

quartz coyote
#

thats what I thought lol

still forum
#

Show me "the script" and I'll tell you where to put it

noble pond
#

could use waitUntil, it really depends on what you are doing and where this code is going :p

#

need more context to tell you more

tender fossil
#

Why does this script add votes to new UID but doesn't remove them from the old one? There's some minor glitch in this script (apparently), but I'm suffering from being braindead after learning to script the whole day so I'm unable to spot it :D

CNC_FNC_RegisterCommVote = {

params ["_oldClientVoteUID", "_newClientVoteUID"];

if (isServer) then {

    if (!(_oldClientVoteUID isEqualTo _newClientVoteUID)) then {

        {
            if (_x select 2 isEqualTo _oldClientVoteUID) exitWith {
                _numberOfVotesOldTarget = CNC_arr_commVotePlayerList select _forEachIndex select 3;
                CNC_arr_commVotePlayerList select _forEachIndex set [3, (_numberOfVotesOldTarget - 1)];
            };
        } forEach CNC_arr_commVotePlayerList;


        {
            if (_x select 2 isEqualTo _newClientVoteUID) exitWith {
                _numberOfVotesNewTarget = CNC_arr_commVotePlayerList select _forEachIndex select 3;
                CNC_arr_commVotePlayerList select _forEachIndex set [3, (_numberOfVotesNewTarget + 1)];
            };
        } forEach CNC_arr_commVotePlayerList;

        CNC_var_oldCommVoteUID = _newClientVoteUID;

        publicVariable "CNC_arr_commVotePlayerList";

    };

};

};
#

So I guess the error lies in this part of the script:

        {
            if (_x select 2 isEqualTo _oldClientVoteUID) exitWith {
                _numberOfVotesOldTarget = CNC_arr_commVotePlayerList select _forEachIndex select 3;
                CNC_arr_commVotePlayerList select _forEachIndex set [3, (_numberOfVotesOldTarget - 1)];
            };
        } forEach CNC_arr_commVotePlayerList;
still forum
#

CNC_arr_commVotePlayerList select _forEachIndex wtf?

#

that's what _x already is

#

just use _x

tender fossil
#

Oh lol πŸ˜„

still forum
#

also each UID can only have one vote?

tender fossil
#

Yes

still forum
#

why are you looping through everyone if you only want that one guy?

tender fossil
#
        {
            if (_x select 2 isEqualTo _oldClientVoteUID) exitWith {
                _numberOfVotesOldTarget = _x select 3;
                _x set [3, (_numberOfVotesOldTarget - 1)];
            };
        } forEach CNC_arr_commVotePlayerList;
#

Because the vote can change

still forum
#

use findIf to find the element of that guy.

tender fossil
#

This function is being called repeatedly (each time player presses "vote comm" button)

still forum
#

Yeah. But you are iterating over all elements even though you only want a single one

#

that's 99% waste.

tender fossil
#

Can I use find if I need to find match for a string in array?

#

Oh, FINDIF

still forum
tender fossil
#

Nvm

#

Yeah

still forum
#

CNC_arr_commVotePlayerList findIf {_x select 2 isEqualTo _oldClientVoteUID} will return you the index of it

#

then you can

if (_index == -1) then no old vote found.. 
private _element = CNC_arr_commVotePlayerList select _index;
_element set [3, (_element select 3)- 1];
#

Also you can make your script alot easier to read if you turn your if (isServer) then { into a if (!isServer) exitWith
get's rid of alot of the indentation and makes it easier to read.

#

in generall making your script smaller and splitting it up will make it alot easier to understand.
Just make a tiny inline function called _addVote = {} you call it with the clientVoteUID and the number of votes. In your case 1 or -1

#

get's rid of that duplicate code and reduces the surface for errors

meager heart
#
private _currentUID = [_newClientVoteUID, _oldClientVoteUID] select {
    CNC_arr_commVotePlayerList findIf {_x select 2 isEqualTo _oldClientVoteUID} != -1
};
```πŸ‘€
coral wraith
#

Hi, my Drone operator wishes something that shows where on the map the drone is looking at. I saw in some of @gilded rampart videos (e.g. https://youtu.be/KY9fJggGiZM?t=9m14s) that they have something to see where the helo camera is looking at, I thought this would be perfect. Is this a mod/script that is somewhere available?

still forum
#

you can attach a marker to the drone

#

but that cone thing is probably way more complicated to implement.

quartz coyote
#

Is there a way to lower armor value of a vehicle without touching its cfg file ?

coral wraith
#

if I attach a marker to the drone I would get the drone position, would't I?

still forum
#

yeah

#

you could see where it is on the map

coral wraith
#

the drone terminal already shows where the drone is but not where the gunner camera is looking at, which is what he wants/needs. as an alternative could we show on the uav terminal map what point he is lasing?

meager heart
#
private _id = findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
    params ["_control"];
    _control drawTriangle [
        [
            player getRelPos [-150, 0],
            player getRelPos [50, -50],
            player getRelPos [50, 50]
        ],
        [1,0,0,1],
        "", 
        false        
    ];
}];
``` that way maybe ^
coral wraith
#

oh thats nice I will fiddle around with that for a bit

umbral oyster
#

Maybe, anyone know, why HC trying join to the game, automatically kicked to lobby? And how exclude from onPlayerConnected event heandler HC? I add this "if (_uid in ["", "SERVER", "HEADLESS", "HC"]) exitWith" but, its not work 😦

still forum
#

@umbral oyster #rules no cross-positng.

umbral oyster
#

sorry(

#

I'm just at a dead end, I can not understand why it does not work ...

inner swallow
#

should be exitWith {}

#

but that's just a syntax error, don't know about the rest

umbral oyster
#

oh really?

inner swallow
#

i can't tell if you're being sassy with me πŸ˜„

coral wraith
#

I use that for HC if !(isServer || hasInterface) exitWith {};

#

In words, if it is not a server or has no interface (it should be a headless client) just exit

umbral oyster
#

@coral wraith onPlayerConnected server side

coral wraith
#

no client side

#

actually every side

#

or even better just use the PlayerConnected EH

#

it only fires for GUI clients

#

there is also stated that _uid of an HC will contain the PID so your if clause will not match because of the added pid

umbral oyster
#

Hm, i not see PlayerConnected... Thanks. But, why he kicked to lobby??

west grove
#

oi people.

#

i'm trying to spawn a backpack on a very exact position (and rotation). obviously it doesn't work due to collision.

#

anyone got any clues on how / if this is somehow solvable?

#

i've already tried to spawn one with CAN_COLLIDE, but it didn't changed anything. then i tried attachTo but it wasn't having any effect either

#

found a solution. "groundweaponholder" to the rescue. i should post more in here.

still forum
#

"Rubber Duck Debugging"

west grove
#

damnit, still doesn't really work, though.

#

first it did work and i attached the backpack to an object and then adjusted the attachto coordinates + setvectorup ... but now i can't get it to work anymore

#

also now i can't pick it up anymore. ehw.

#

i hate this vector crap. so much try&error

still forum
#

what about weapon holder (non ground) and just setPos?

west grove
#

i have to rotate the object, not just simple direction

#

i've fiddled with it a lot now and got it to work mostly right.

#

wish this kind of stuff would be a default 3den feature

chilly wigeon
#

Is there any way to detect a trigger via SQF?

#

I know if you create one using createTrigger you get back an object

#

but I want to detect unnamed eden placed ones

#

My best guess was entities "EmptyDetector" but that doesn't seem to work

meager heart
#
0 spawn {
    private _holder = "GroundWeaponHolder" createVehicle (player modelToWorld [0, 2, 1]);
    _holder addBackpackCargoGlobal ["B_Kitbag_rgr", 1];
    _holder setVectorDirAndUp [[0, 0, -1], [0, 1, 0]];
};

and here is almost the same ^ with couple more adjustments > https://gyazo.com/5bb48f8c931dc1f5a32f5700d131ef65 πŸ˜ƒ

coral wraith
#

Operators connected Drone Laser Postion on his map, ok it's not as fancy as I wanted it but at least it works πŸ˜€ https://youtu.be/dJE08YVnIkQ

gleaming oyster
#

@coral wraith Modify it to indicate the start to destination with a line maybe. Position of UAV to laser pos

strong shard
#

@chilly wigeon ```
allMissionObjects "EmptyDetector";

earnest path
#

Hey guys is there a way to set AI to recognize wrecks on the road ? Or a mod that enable them to do so

coral wraith
#

@gleaming oyster now the code looks a little more "professional" and it draws a line

((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ['Draw', "
    private ['_connectedUav', '_intersects', '_laserPos', '_validLaserPos'];

    _connectedUav = getConnectedUAV player;
    _intersects = (lineIntersects [getPosASL _connectedUav, getPosASL laserTarget _connectedUav] || terrainIntersectASL [getPosASL _connectedUav, getPosASL laserTarget _connectedUav]);
    _laserPos = position laserTarget _connectedUav;
    _validLaserPos = !(_laserPos isEqualTo [0,0,0]);

    if (_intersects && _validLaserPos) then {
        _this select 0 drawIcon ['a3\ui_f\data\igui\cfg\islandmap\iconplayer_ca.paa',[1,0,0,1], _laserPos, 24, 24, 0, '', 1, 0.03, 'TahomaB', 'center'];
        _this select 0 drawLine [ _connectedUav, _laserPos, [1,0,0,0.5]];
    };
"];
strong shard
coral wraith
#

I want to take it a step further and change the icon if the laser is locked on (ctrl+t) a positon/object is there a way to get that information

shadow sapphire
#

So this;

class CfgSounds
{
    sounds[] = {};
    class roger
    {
        name = "roger";
        sound[] = {"a3\dubbing_f_beta\showcase_combined_arms\15_Insertion_Complete\showcase_combined_arms_15_insertion_complete_BHQ_0.ogg", 1, 1, 1};
        titles[] = {1, "Testing."};
    };
};```

Executed from console with this;
```SQF
C_1 say "roger";

Gives a subtitle, but nothing else.

Does anyone know why off the top of their head?

inner swallow
#

@shadow sapphire you've set the distance to 1m

#

{"a3\dubbing_f_beta\showcase_combined_arms\15_Insertion_Complete\showcase_combined_arms_15_insertion_complete_BHQ_0.ogg", 1, 1} try this

shadow sapphire
#

Ah, I know what happened. The distance was set to 100, then I deleted the distance completely since it was optional, then I added back a test value, it didn't work, then I ended up fixing it and forgot to change that test value. It's almost always some stupidity. Thanks a ton.

inner swallow
#

no problem πŸ˜„

shadow sapphire
#

@inner swallow, it still isn't working. I loaded a different mission in editor, then loaded back in to my test mission to try to make sure the new description.ext was loaded, not sure if that's necessary or if it doesn't go far enough, either way, still not working.

inner swallow
#

hmm. maybe try without a3 at the start of the path, or just the filename without the path?

shadow sapphire
#

Hokay! Good tips. Will try both and report back.

inner swallow
#

btw did you see this?:

#

NOTE: Since Arma 3 v1.49.131710 it is possible to define AddOn sounds in mission config. In order to make engine look for the sound in AddOn, the sound path must start with @ (instead of \) for example:

#
class CfgSounds
{
    sounds[] = {};
    class addonsound1
    {
        name        = "sound from addon";
        // start path to sound file in AddOn with @
        sound[]        = { "@a3\Ui_F_Curator\Data\Sound\CfgSound\visionMode", 0.8, 1, 100 };
        titles[]    = { 0, "" };
    };
};```
shadow sapphire
#

I did. This is a vanilla sound, though.

#

Is it still relevant?

inner swallow
#

might be

#

worth a shot if the other stuff doesn't work

shadow sapphire
#

Roger that.

#

@inner swallow, adding @ fixed it.

inner swallow
#

πŸ‘πŸ½

austere hawk
#

is switch applying lazy eval - as in stopping checking with the first true statement? Or is it checking for all cases regardless?

shadow sapphire
#

Switch checks all cases defined.

austere hawk
#

so i'm actually better of nesting of if statements than using case? lame

shadow sapphire
#

Don't know. My knowledge is limited. Switch as it is has been useful for many a gear script, so I wouldn't put it down, myself, haha.

austere hawk
#

it looks tidier, but if it checks all cases regardless of a match already found it's potentially wastefull

inner swallow
#

If a case has no code block, the code of the next case will automatically be executed. This makes it possible to formulate a logical "or" for cases which otherwise would contain the exact same code. (See example 4 below)
The default block will be executed only if no case matches, no matter at which position inside the switch it is. It is not a case, and will never be entered by fallthrough.

switch returns whatever the return value of the executed case block is. If the condition is not matched by any case and there is no default, it returns true.```
#

always worth checking the wiki πŸ˜›

shadow sapphire
#

Did I mislead him, @inner swallow?

inner swallow
#

yeah (partially) πŸ˜„ wiki suggests it stops checking other cases, if there is a code block present

shadow sapphire
#

Ah, I see.

austere hawk
tough abyss
#

How can I make it so I can process multiple drugs in one drug processing (atlis life) class uranium { MaterialsReq[] = {{"uranium_unrefined",1}}; MaterialsGive[] = {{"uranium_refined",1}}; Text = "STR_Process_Uranium"; //ScrollText = "Refine Uranium"; NoLicenseCost = 10000; }; example coding

earnest path
#

@strong shard Thank you i will try it

neon python
#

i noticed that there is a mod for survivable crashes on the workshop

#

but i dont know how to make it function

coral wraith
#

why is that working in the debug console but not in postInit

_uavHelper = [] spawn {
    disableSerialization;
    _ehUavHelperMap = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["draw", "_this call qipTPL_fnc_uavHelper"];
    _ehUavHelperTerm = ((findDisplay 160) displayCtrl 51) ctrlAddEventHandler ["draw", "_this call qipTPL_fnc_uavHelper"];
};
meager heart
#

probably there are no displays yet... you can add waitUntil {!isNull ((findDisplay 160) displayCtrl 51)}; also ctrlAddEventHandler does support { } < script code

#

@coral wraith

coral wraith
#

i'll give it a shot thx

#

works! πŸ˜€

meager heart
#

nice, also you can remove disableSerialization

coral wraith
#

ok at least the map works the uav terminal doesn't work at all , did thay change the display idd?

meager heart
#
private _idd = uiNamespace getVariable "RscDisplayAVTerminal";
coral wraith
#

I guess I would then have to use it like this?
_idd ctrlAddEventHandler ["draw", "_this call qipTPL_fnc_uavHelper"];

strong shard
#

@meager heart it is not good to remove disableSerialization in any script that working with UI

meager heart
#

lol

still forum
#

in spawn it's actually needed tho... I think?
It's not needed inside the eventhandler

meager heart
#

when you do not store UI elements you not need it at all and if you will store them, you will need disableSerialization but only in scheduled

strong shard
#

@meager heart disableSerialization not only about storing UI types to variable

still forum
#

oh.. yeah. stopped reading at displayCtrl. But can't scheduled suspend mid-expression? πŸ€”

strong shard
#

@meager heart it is about saving script to save file

#

@meager heart UI not saving to save-file. UI need reinitialize after load. If any UI script saved in middle - after loading save, this script make undefined behavior

still forum
#

this script make undefined behavior
Well the UI variables would be null. displayNull/ctrlNull

#

actually quite well defined.

strong shard
#

@still forum if command not need variables, or this script do something else (Not UI)?

still forum
#

Don't understand

meager heart
#

btw maybe good topic for the sqf blog ^ πŸ€”

still forum
#

I can grab all the technicalities if anyone wants πŸ˜„
That's more something for ITE which is my format anyway

#

i have free time this week. Maybe.

meager heart
#

up2u man, imo that topic is needed, also will be easier to just paste links rather than fight with letters in chat πŸ˜„

inner swallow
#

One more note on using UI handlers. This is the best way of handling UI. You do not need to use disableSerialization in any of the functions that are called from UI event handler. It is only if you are planning on storing UI variables and then reusing them later you might get complains from the engine and consider using disableSerialization. Even storing your UI variables in uiNamespace might not be enough in this case. - KK

#

(not something i know anything about, saw the discussion here and randomly googled for stuff)

queen cargo
#

@still forum why should mid-expression evaluation result in issues?
the command evaluation has nothing to do with variable saving πŸ˜…

waxen tide
#

I want to check if a compass bearing is roughly equal to another compass bearing (say, +/-20 degrees). I have no clue how to go about this. I figure there must be a simple trick i just don't see right now.

still forum
#

@queen cargo because you might have a control/display on the stack when the script get's serialized. And they can't be serialized.

#

@inner swallow I already said that above. It's not needed inside the eventhandler πŸ˜„ That's basically all that big text in... shorter.

#

@waxen tide abs (_dir1 - _dir2) < 20
Simple math

waxen tide
#

@still forum too simple. Thanks. I'll fetch more β˜•

inner swallow
#

@still forum aye, it was meant more as a third party citation of the same :p

radiant needle
#

I'm trying to make vehicle guns shoot faster but
_Unit = vehicle player;
_Unit addEventHandler ["Fired", {
_Unit setWeaponReloadingTime [(_this select 7), (_this select 2), 0.1];
}];

#

doesn't seem to work

still forum
#

you cannot shoot faster than your FPS if that's what you are trying to do

#

reload time can be minimum one frame

radiant needle
#

No this is for the MG251

#

the USS Liberty gun

#

It currently has like 6 seconds between each shell

#

Trying to make it more inline with a bushmaster or something

still forum
#

did you check if the gunner and muzzle are correct in the eventhandler?

radiant needle
#

Yeah so it seems weird, if I do _Unit = (vehicle player) and then _Unit addEventhandler

#

it wont work

#

but if I do (vehicle player) addEventHandler

#

it works

#

nevermind, worked for the artillery piece, but not for the drone piece

still forum
#

yeah. you are not "in" the vehicle if you are controlling a drone

radiant needle
#

yeah but even "this" or "vehicle this" in the init wont owkr

#

I systemChatted the event handler variables and they look fine

still forum
#

Meh serialization is too boring for a full blog post. If you call disableSerialization the whole script VM will get serialization disabled which means it's not saved to the save file meaning the full script will be gone after load.
Important detail. If a script calls disableSerialization all it's parents will also get it disabled. So if your spawned while true loop calls some other script that calls some other script that disables serialization. Your while true loop won't be running after a savegame load

errant jasper
#

Wow, really? Thought it only applied to the scope it was in. Should really be a unary command taking code on the right to which it applies in....

queen cargo
#

Hah πŸ˜‚πŸ˜‚ funny
@still forum did you also checked if Dialog command chains can error out if saved?

still forum
#

check*

#

No. I didn't check if it can suspend mid-expression

#

but I hope not

ornate quail
#

Hello, I want to check if a variable is either Nil or false, this is my code: if ({isNil "kka3_inSuicideAction"} || {!kka3_inSuicideAction}) then
But it says generic error in expression. I know that the Syntax is wrong, but I'm not sure what exactly

queen cargo
#

it better does not ... whole reason i never used variables in such scripts was because i feared those problems

still forum
#

@ornate quail {} || {} doesn't exist

#

bool || bool and bool || {} exist.

ornate quail
#

oh, aight. Gonna try this

still forum
#

but why not use getVariable with a default value of true?

#
if (isNil "kka3_inSuicideAction" || {!kka3_inSuicideAction}) then

is the same as

if !(missionNamespace getVariable ["kka3_inSuicideAction", true]) then
ornate quail
#

It doesn't seem to work when the var is nil, that's why I tried the above.

still forum
#

it returns the default value when the var is nil.

ornate quail
#

It doesn't work lol I don't know what I'm doing wrong

still forum
#

check value in debug console

ornate quail
#

okay

#

one sec

still forum
#

if (isNil "kka3_inSuicideAction" || {!kka3_inSuicideAction}) then yeah.. Didn't even see. That can't work

#

it only checks it's value if it is nil. But if it's nil it can't check the value cuz it's nil

ornate quail
#

if (isNil "kka3_inSuicideAction" || {!kka3_inSuicideAction}) then
Works fine, thanks for your help πŸ˜› Is there a wiki to look up correct Syntax? I feel like it's my main issue besides of actual experience

still forum
#

Ah. Forget what I said. Brain broken again

ornate quail
#

^^

shadow sapphire
#

Who was it that linked me how to distribute waypoints in a circle before? Where is that web page? Anyone know?

meager heart
still forum
#

Probably that communist

hollow thistle
#

rip

shadow sapphire
#

I tried searching for it here, I know it was in this channel, but I can’t remember what to search the than β€œcircle” or maybe β€œdistribution.”

I do think that’s the site, @meager heartc. It was a dot ovh site that whoever linked. It might have been you that linked it originally, anyway.

#

Dammit. That link is giving me 404.

meager heart
#

πŸ€”

still forum
#

works for me.

#

alternatively just http://sqf.ovh and click the post manually

winter rose
mortal nacelle
#

oh crap, sorry lol

inner swallow
#

those are nice posts, dedmen!

still forum
#

I made one of them

winter rose
#

@mortal nacelle np, it's for you πŸ˜‰ if you want faster/better answers

inner swallow
#

ah

waxen tide
#

I read quite a bit about the topic, but i am still wondering why you get so much fps drops and stuttering when you execute heavy scripts. I mean shouldn't the whole point of the scheduler be to avoid that? I also noticed that scripts that run forever but do not spawn anything but just fetch lots of data and calculate things don't really mess with the games performance, but as soon as you spawn something, you have issues. So i figure the functions we have to spawn things do not consider performance at all and just overload the game loop while spawning all the stuff. Assuming that i wonder if chopping up spawning things into smaller bits with breaks intbetween especially in MP to sync stuff would help. But i've not really seen anyone do that.

meager granite
#

It all depends on what scripts you're running. Scheduler executes scripts by pieces but single heavy scripting command execution cannot be split into pieces, it has to execute right here and right now. Heavy stuff includes nearestObjects, allMissionObjects and others.

tulip cloud
#

How can heal a player to full when ACE has someone unconscious?

snow pecan
#

@@waxen tide Many spawn systems optimize for spawn stutter. In ALIVE we can easily spawn 200+ AI in under 2 seconds without inducing any noticeable spawning - related lag

#

For the most part you can stuff a few empty frames in between each spawn to get a smoother result.

winter rose
#

@hardy flax no. @drowsy skiff @open vigil @graceful pewter

waxen tide
#

Thx for input Sa-Matra.
@snow pecan I wonder a bit how to stuff in a few empty frames reliably?

snow pecan
#

Keep an array of units that should spawn, then have a separate loop iterate per frame and pick off X units to spawn each frame

#

From there you can spawn once every X frames, or once every X seconds etc

#

By array of units, I mean data needed to create that unit

waxen tide
#

Do you know from the top of your head how to iterate per frame?

snow pecan
#

I believe you can add a perFrame event handler with 'addMissionEventhandler', but I'm on mobile so you'll have to consult the wiki to confirm

#

CBA also has has some solutions if you have that running

waxen tide
#

Oh yes ofc, event handler. Thanks. I would never have thought about doing things this way, i would have figured it just creates needless overhead.

peak plover
#

class Extended_FiredBIS_EventHandlers {
    class AllVehicles {
        class ADDON {
            clientFiredBIS = QUOTE(_this call FUNC(fired));
        };
    };
};

#

Can anyone explain what is clientFiredBIS?

#

I looked on the cba wiki

#

but it doesn't really say anything

#

just says that firedBIS is differenet from fired

tough abyss
#

I was looking into the antistasi performance issue this morning and it turns out the real killer is actually onFrameEventHandlers and playerEH's. The scheduled environment hits a maximum and doesn't go past it but those unscheduled event handlers are what takes the frame rate down from something reasonable (60+) into the 40s most of the time in the game mode. It isn't antistasi directly however, it doesn't use CBA and these are CBA events, so probably ACE since it is a heavy user of custom events.

#

I was actually really wanting a bit more information than the profiler build gives me, because it tells me where the time is going but alas it is at the gsEva; 2.22161; 4.13762;"call cba_common_fnc_onFrame" level and doesn't give me any more to go on, so from that point it is a guess as to whom is likely using the CBA stuff that gets called from onFrame.

still forum
tough abyss
#

Cool I shall have a look at it and find the culprit.

errant jasper
#

@peak plover What is missing from the XEH wiki https://github.com/CBATeam/CBA_A3/wiki/Extended-Event-Handlers-(new) , it even gives a description of why? XEH's Fired originally added the projectile parameter to the event. But when BIS added magazine parameter in Arma 1 instead, projectile and magazine now had overlapping positions. The recommendation to use FiredBIS rather than Fired is probably it has the parameters exactly like they are given (like all the other events), and the original Fired is there for backwards-compatibility.

The client prefix in clientFiredBIS makes it only run on machines that acts as clients (not on dedicated). The latter part does not have to match, e.g. could have been clientFarkleBloom instead.

peak plover
#

aah

#

Thanks

#
 
["AllVehicles", "FiredBIS", {systemChat str _this}] call CBA_fnc_addClassEventHandler;
#

Returns false

#

I guess it only supports configs

peak plover
#

haha, I just found that just now

#

That's funny, because they also say not to use fired

#

and then they say to use fired

#

πŸ€”

#

I guess I'll use description.ext

edgy dune
#

lol?

still forum
#

@drowsy skiff witten.
He posted same on YLands/Folk ARPS too

drowsy skiff
#

@rugged token please remove that link from here

still forum
#

Fer... It's Witten. He won't

#

He already got banned from Ylands/DayZ/TFAR

drowsy skiff
#

puts the Makarov back in the drawer

jade abyss
#

@still forum Also CUP, IFA and several others

still forum
#

Witten yes. But that message above no. Only Ylands/DayZ/Vigor/Folk ARPS/TFAR/ALiVE

jade abyss
#

In the end, doesn't rly matter... simply ignoring and insta-banning that "person" is the only way to deal with him.

snow pecan
#

Sad state of affairs when your life is composed of spamming discord servers for months :/

still forum
#

It's been half a year now

tough abyss
#

So I put intercept host @intercept in the mod string as well as @tough abyssScriptProfiler and I am running profilerCaptureFrame; from the debug block as admin and just nothing. I have missed a step I presume.

still forum
#

Works only without battleye. And read the latest forum post for the last-gen stuff. The ingame profilerCaptureFrame is not as advanced as the new stuff

tough abyss
#

Not running battle eye

still forum
#

should get a error message in main menu about dummycert not found.
Where did you get Intercept from? The latest build of the profiler has intercept inside it. Not in @intercept

#

Ah you probably used the intercept thingy linked in the thread? That's very outdated. I'll remove that link.
Just take this build: https://github.com/dedmen/ArmaScriptProfiler/releases/tag/RC6 it has everything in one package.
You might want to remove sqf-assembly.dll because that add's a F-ton of data to your profiling.

tough abyss
#

OK Installed that and restarted, same thing running profilerCaptureFrame and nothing is happening, no error in the RPT.

#

Looks healthy from the log entries - "15:25:32 Initializing Intercept
15:25:32 CallExtension loaded: intercept (c:\a3mods_dev@armascriptprofiler\intercept_x64.dll) [к£]

15:25:32 Intercept initialization part 1/3: 1
15:25:32 Intercept initialization part 2/3: true
15:25:32 Intercept Loading Plugin: SQF-Assembly
15:25:32 Intercept Loading Plugin: ArmaScriptProfiler
15:25:32 Intercept initialization part 3/3: -1"

still forum
#

I didn't test out the old stuff since I started working on integrating the brofiler UI

#

But I thought I didn't touch it πŸ€”

#

I would really recommend to go for brofiler. It also shows you arguments passed to functions. And I didn't test the ingame display stuff since I started with brofiler.

sand pivot
#

is there an easier way to search a GUI Tree than doing a manual recursive search through all items?

tough abyss
#

OK brofiler does something, I hit the start, click the game, capture 20-50 events before I get back to it and hit stop and then I click back on the game and I see some ms counts, game freezes for a bit until brofiler crashes.

still forum
#

probably because of too much data because of the sqf-assembly thing that I told you that you might want to remove because of the F-ton of data :D
Not sure why it crashes though.
Sorry. The profiler is a very nieche and experimental thing. Not the most user friendly thing I made πŸ˜„

tough abyss
#

I'll remove it and try again.

#

"<unknown> 5.1ms" - sigh. None the wiser unfortunately. 48ms frames and its not unscheduled, well 5ms of it is but no idea what it is.

still forum
#

right click -> show source

#

I think in bottom left. Might also work on the flame graph in the middle.

#

It shows all scripts that were compile/compileFinal'ed and run in unscheduled. Scripts that were made like MyFunc = {code} or direct engine eventhandler or config scripts aren't shown.

tough abyss
#

Time is all spent in the CBA onFrameHandler code, that certainly showed me something

still forum
#

and if it doesn't show any lower code then it was either added via [{codehere}] call cba addEH
or mycode = {code}; [mycode] call cba addeh sorry for crude. Gotta catch bus

#

you can manually add _blalsdbsdbsbds = createprofilerscopethingy to these scripts. Not the correct command. again in hurry.

tough abyss
#

So there is definitely a problem in CBA there that is consuming a lot of time, the sub calls just don't add up although acre is a prominent contributor

nocturne basalt
#

hi guys. has anyone written a nice way to get all items in a container and equip them to a player?

I find it a little challenging since methods for equipping items differs for itemtype.
For example:
_pilot linkItem "G_Diving";
_pilot addVest "V_RebreatherB";
_pilot addHeadgear "H_HelmetB";

#

do I have to identify each itemtype, then use the correct method for equipping them?

still forum
#

Thanks @tough abyss You gave me an idea on the bus how I can show scripts that were defined inside scripts and not directly via compile

#

You can zoom in in the flame graph with CTRL+Scroll

#

to see the exact timing of stuff

#

okey it crashes and I know why. But not what causes it

cosmic lichen
#

Is there a way to delete or overwrite a class completely in order to replace it?

still forum
#

@nocturne basalt you can use BIS_fnc_itemType to identify them

#

if you re-add each entry you will overwrite it completelty

#

and there is also the delete keyword to delete a class yes.

#

but some packers have problems with deleting/redefining in same config

cosmic lichen
#

Is that one the wiki somewhere?

nocturne basalt
#

@still forum thanks

still forum
#

probably soooomewhere

#
delete myClass;

will delete it. That simple

cosmic lichen
#

Yes, that works.

still forum
#

need to make sure your requiredAddons is correct

cosmic lichen
#

Interestingly, if I delete the class and add the same class again it say member already defined

still forum
#

yeah.

#

but some packers have problems with deleting/redefining in same config

cosmic lichen
#

I see.

#

No new function viewer then

still forum
#

make 2 configs

#

one delete. second readd

#

or use CBA display EH to catch when it opens and open your own one instead

cosmic lichen
#

Nah, way too much work πŸ˜ƒ

still forum
#

Okey I take it back. I don't know why the profiler crashes. It did crash once for me. But after I rebuilt brofiler and the profiler plugin everything works πŸ€”

#

🀦 the last release is missing a very important bugfix.. wtf

waxen tide
#

I just figured out my general approach. I write code, and then i try to find out what it does.

#

Sometimes what it does is what i wanted to do, in that case i keep the code.

vernal mural
#

sounds like a pro, @waxen tide

waxen tide
#

Don't worry, one day you may ascend to my level.

peak plover
#

How do you write code and not know what it does?

#

Can you even write words you don't know?

still forum
#

Brazibblugrub

still forum
#

@tough abyss added a new feature. Now also displays scripts that just exist inside a file that's compiled so stuff like [{code}] call CBA_fnc_addEventHandler
https://s.sqf.ovh/2018-07-24_22-26-32.png It displays the line number if you enable that button.
Will be RC7 that I upload in a couple minutes. That should show you now what scripts are running in that PFH
Also it doesn't crash for me with sqf-assembly. But that could be luck

tough abyss
#

You legend! We just finished for the evening but I should get the opportunity to run it in tomorrow and I'll see what it gives me.

meager heart
#

Will be RC7 that I upload in a couple minutes
πŸ‘

#

(got it already πŸ˜ƒ)

nocturne basalt
#

can I disable error/warning messages on a single function and not the rest of the script? in php I can do that with @functionName

hollow thistle
#

no.

#

btw: doing this in PHP is a bad practice.

still forum
#

@nocturne basalt no.

#

Just fix your errors and you won't get errors

nocturne basalt
#

yeah I know I dont usually do, but I have a function that prints an error message only when my vehicle dies

#

and I cant figure out why

hollow thistle
#

then you are not handling something properly.

#

I guess nil is the "problem".

nocturne basalt
#

it telling me the variable is a string and expecting a number, but it is a number .---

still forum
#

add logging to it and check what it really is

#

You have an error in your script. Disabling the warnings won't fix the problem

nocturne basalt
#

ok ty. gonna try to find it

meager granite
#

diag_log [_var, typeName _var]; to see what it really is

waxen tide
#

I'm trying to write a script that finds realistic spots for roadblocks around a city. So far i'm generating a circle of positions around the city, check for nearestroad on each, use that as my start position and then search the road network following each branch i find for 50 steps. Result looks like this: https://i.imgur.com/nINefxP.jpg
First, this is really slow already (figures) secondly i'm not even done yet identifying the strand that leads to the city to look for a suitable position on it for a roadblock.
Does anyone have a genius idea for a smarter approach?

astral dawn
#

Well if you define a suitable position as the one lying in the middle between two cities, then something like...
For each city find its neighbouring cities (like 2...3 closest ones within 1km range)
For every pair of 'this city' an 'neighbour city' find a midpoint
Search roads around this midpoint with radius equal to like 0.3 of the distance between the cities, then select the road segment which has the lowest module of difference between the distances to the city centers
To make it fast use the array select {} command instead of custom for loops

#

Guys I have a weird problem with my script. I have added a mission event handler "PlayerConnected", inside it I do something trivial like:
if (condition) then { [{ systemChat "You are detected!"; }] remoteExecCall ["call", _owner]; diag_log "Player detected!"; }
I see in the .rpt of the server that it gets triggered nicely, but on the client's side it only displays the text in systemChat on a clean mission start but not in JIP O_O Am I missing something? Like maybe I need to wait until the player spawns or his mission display appears or ...?

waxen tide
#

The issue with that would be that you'll potentially just find a road that runs inbetween two cities, too

astral dawn
#

Yeah you can also check the reoad direction

#

like it must be within +-20 degrees range of the line between the two cities

waxen tide
#

tried stuff like that

#

if you have a road with a tight bend it will throw it out

#

despite it being a good spot for roadblock

astral dawn
#

Well... maybe you could form a 'goodness' metric for your position based both on angle criteria and 'distance from midpoint' criteria?

#

Then sort them by this value πŸ‘

waxen tide
#

i just had an idea

#

i can easily detect branching, then cache whatever i find while i follow a branch, and at the end of the branch i check how close it is to the city. if it is too far, i throw away all branch data.

#

this way i only keep one branch, the one that leads to the city for sure

#

and i only need a handful of distance checks, not 9001

astral dawn
#

When you start detecting these branches it will get slow, I guess, but surely you can try

#

My idea was use the select or apply commands as much as possible to accelerate it

waxen tide
#

i already follow all branches? and i can detect them by counting the roadsConnectedTo array

#

cheap check

#

it just counts an array with 2 or 3 elements

#

I think i did not understand your idea to the fullest extend.

astral dawn
#

You didn't understand the... geometric part of the idea or...?

waxen tide
#

I didn't understand how array select would be useful

#

But i am also quite certain that your approach will fail at certain spots due to map weirdness.

#

you could easily find a road that is not connected to either city

#

yet the direction and position would indicate that it does

#

hence why i did the roadsConnectedTo madness

#

like some damn pieces of runway count as road. some random bits of concrete in a military base connected to nothing do

astral dawn
#

Oh allright I get what you mean now

#

Indeed there must be a check if this piece of road has a path from itself to both cities

#

I suggested at the forum to open their engine's built-in path finding algorythm, because everything else made in sqf fill be obviously slower