#arma3_scripting

1 messages · Page 551 of 1

abstract idol
#

//myCode.sqf
private _myName = _this select 0;

private _returnMe = "FAIL";

if (_myName == "Test") then {
_returnMe = "PASS";
};
_returnMe

winter rose
#

use:
```sqf
-your code-
```

#

it declare _myName variable with the content of the first argument passed to your code. @abstract idol

abstract idol
#

this applies to _this select 0

#

Why 0

queen cargo
#

https://community.bistudio.com/wiki/select
_this has to be an array
select then is a command to pick one element from the array
0 is the index you choose (aka: the first element of the array in the variable _this)

abstract idol
#

Oh, now it’s clear, I didn’t even think that this refers to an array

queen cargo
#

well ... it will only ever if you do it like this:

yourcode = {...};
["foo"] call yourcode;``` 😛
#

the yourcode assignment though, may also be handled automatically by CfgFunctions

tough abyss
#

_this is what you make it to be when you pass arguments to function. You normally make it an array if you have multiple arguments

#

@queen cargo does your switch implementation make ___switch variable?

queen cargo
#

Yes of course zoltanLUL

calm bloom
winter rose
#

canAdd @calm bloom

calm bloom
#

tnx

vernal jay
#

Helo guys id like to change the appearance of markers and crosshair on the screen with a trigger, is there any way to make it happen? or it cannot be changed mid game?

still forum
#

crosshair no

#

markers.. you can delete then and spawn other markers in same place

exotic flax
#

For the crosshair you could disable it from the difficulty settings (to remove it), and add a custom UI layer with a custom crosshair image. However this will be a static image instead of a dynamic one (which changes size or position based on recoil and fatigue)

vernal jay
#

oh dang it, well down the trash the idea of making a cyborg scenario 😦

exotic flax
#

I have seen mods where the full UI was hidden and a custom UI got implemented, but that requires a lot of work 😉

astral dawn
#

You can still make pretty advanced UIs in arma, although you can't change the cross (or maybe you can change the cross, I don't know)

vernal jay
#

i know ive tried and it doesnt work, maybe if i change the overall level of difficulty to "regular" from Veteran mid game all thhat stuff should pop out?

dusk badger
#

Does anyone knows a initscript to make all passengers from a vehicle when bullets start flying?

winter rose
#

@dusk badger jump* from a vehicle?

dusk badger
#

Dismount

winter rose
#

yes

#

😄

#

I would say a combination of waitUntil, behaviour, allowGetIn would do the job

dusk badger
#

Ok I tried setUnloadInCombat but it doesnt work

#

@winter rose

winter rose
#

that's for vehicle crew. what is your setup? a group for vehicle crew, a group in cargo?

dusk badger
#

A convoy its ambushed the fist to push across then de last one stops and dismounts to supress the attackers

#

First two* not fist to

winter rose
#

yes maybe, but regarding the groups, crews, etc?

dusk badger
#

One driver, and a unit of 3 on one vehicle

#

So 4 should dismount

crystal rune
#

Does anyone have any ideas/advice on why my event handler breaks after one "Killed" event?

[2019-09-19 / 23:33:19] B Zero:1 (Maj. N. Home), B Zero:1 (Maj. N. Home), <NULL-object>
[2019-09-19 / 23:36:16] bis_o2_1026, bis_o2_1026, <NULL-object>

init.sqf

{
    _x addEventHandler ["Killed", {

        _unit = _this select 0;
        _killer = _this select 1;
        _instigator = _this select 2;

        details = format ["%1, %2, %3", _unit, _killer, _instigator];
        [details] remoteExecCall ["A3Log", 2];
    }];
} forEach playableUnits;
#

Been driving me up the wall. Can't find anything on what the hell "bis_o2_xxxx" is either 😦

exotic flax
#

bis_o2_xxxx is the name of the unit when no real person is playing it.

winter rose
#

heh, didn't know that

restive leaf
#

Not on my server... they are named O Bravo 1-1:2 etc

#

Never seen the bis_o2_xxxx ...

#

Or maybe not noticed...

winter rose
#

oh wait. that's maybe the unit names in BI official missions

crystal rune
#

@exotic flax Does the EventHandler not stick to a player/unit? Do i need to reapply it after it's been used to prevent this?

burnt cobalt
#

hi there - i am trying to make icons that I draw with drawIcon3D clickable while a dialog is active. I have added a MouseButton Eventhandler to the dialog that picks up the x- and y-pos of the click. However I can not figure out to return if I click on the icon of which I know the screenPosition and x/z sizes.
I have this bit that picks up clicked icons on the map - I tried adapting that from ctrlMapWorldToScreen to worldToScreen but can not pick anything up. This is the bit that works for the map, might be useful for some folks:

#
_iconAtPositionFound = false;
_iconsAtPosition = [];
_iconsNotAtPosition = [];

{
    _x params [_iconTargetObject,_iconSizeArray,_iconWorldPosition]; //-- icon data format
    _iconMapPosition = (findDisplay 12 displayCtrl 51) ctrlMapWorldToScreen _iconWorldPosition;
    _iconMapPositionX = _iconMapPosition select 0;
    _iconMapPositionY = _iconMapPosition select 1;
    _iconMapDimensions = _x select 1;
    _iconIndex = if (count _x > 3) then {_x select 3} else {-1};
    _iconMapWidth = safeZoneWAbs * ( (_iconMapDimensions select 0) / (getResolution select 0));
    _iconMapHeight = safeZoneH * ( (_iconMapDimensions select 1) / (getResolution select 1)); 
    if(_iconAtPositionFound) then {
        _iconsNotAtPosition pushBack _x;
    } else {        
        if( (_mapPositionX < _iconMapPositionX + (_iconMapWidth/2)) && (_mapPositionX > _iconMapPositionX - (_iconMapWidth/2)) && (_mapPositionY < _iconMapPositionY + (_iconMapHeight/2)) && (_mapPositionY > _iconMapPositionY - (_iconMapHeight/2)) ) then {
            _iconsAtPosition pushBack _x;
            _iconAtPositionFound = true;
        } else {
            _iconsNotAtPosition pushBack _x;
        };
    };
} forEach my_icon_array; //-- defined array of icons
_iconsAtPosition 
real tartan
#

@burnt cobalt use lazy evaluation
if ( (a) && (b) && (c) ) rewrite to if ( a && {b} && {c} )

velvet merlin
#

@real tartan your approach is not the best usually

real tartan
#

it is matter of ordering conditions. in most cases if first condition return false, others will skip and save you whole bunch of processing

velvet merlin
#

its a mix of complexity of condition, relation of true-false, and to some extent frequency of condition checks

still forum
#

_iconAtPositionFound = true; that variable is useless. Youcan just check whether the array is not empty

tough abyss
#

_iconMapDimensions = _x select 1; why? why use params and then select with select anyway

still forum
#

_iconIndex = if (count _x > 3) then {_x select 3} else {-1};
you know params can take care of that for you?

tough abyss
#

_iconIndex = if (count _x > 3) then {_x select 3} else {-1};
could be done in params
_x params ["_iconTargetObject","_iconSizeArray","_iconWorldPosition",["_iconIndex", -1]];

which brings me to another question how this
_x params [_iconTargetObject,_iconSizeArray,_iconWorldPosition];
even work and not giving you the error? The array values are supposed to be STRINGS, the names for variables not the variables! "_iconTargetObject" NOT _iconTargetObject

still forum
#

you pass nil's, I think params uses nil arguments to say "skip this argument" just as "" as argument

tough abyss
#

then the rest to the code will go mad

#

This is the bit that works for the map
works

#

From BIKI All variables names must start with underscore and be enclosed in quotes: params ["_myVar1", "_myVar2"];
I keep sayin, no one reads BIKI and you all keep telling me that I am wrong

#

why not spend like extra millisecond checking unknown command in wiki instead of mindlessly copy pasting someone else's script?

#
  • Oh noes, READING! Ruuuuuuuun
#

@still forum It gives you error, only empty string is accepted to skip arg:
9:26:16 Error in expression <[] params [_iconTargetObject,_iconSizeArray> 9:26:16 Error position: <params [_iconTargetObject,_iconSizeArray> 9:26:16 Error Type Any, expected Array,String

#

This is the bit that works for the map
🤦

still forum
#

It gives you error, only empty string is accepted to skip arg
welp, that's what I get for trusting a human when he says "it works"
And that while I so often say that I trust logfiles more than humans

tough abyss
#

I know someone else here that would willingly take people's word for it, oui mon amie?

still forum
#

Well granted. Maybe he didn't include this part of the script in his copy paste:

_iconTargetObject = "_iconTargetObject";
_iconSizeArray = "_iconSizeArray";
_iconWorldPosition = "_iconWorldPosition";
tough abyss
#

yeah sure 🙄

winter rose
#

ami*, Freund

tough abyss
#

tell this to google

winter rose
#

as for the nil thing, it is what is used in maaany things to get default values in BIS_fnc so there's something wrong here

tough abyss
#

Bis_fnc != script command

still forum
#

yeah having nil as "ignore me" seems sensible.
But atleast this way people will be screamed at, instead of falling into a silent trap

winter rose
#

Bis_fnc != script command
we are talking about params, right?

tough abyss
#

which for all intends and purposes is a script command

winter rose
#

I mean nil as _this argument, then passed through params to get the default value for this argument's index

tough abyss
#

what what?

winter rose
#
[nil] params [["_test", 0, [1, "", []]]]``` shouldn't throw error but have _test = 0
tough abyss
#

yeah, we are not talking about that

#

we are talking about nil in the right array

winter rose
#

as default value?

tough abyss
#

no as variable name

still forum
#

🤔
Never tried. nil is ANY type. What if you put nil in the allowed types array in the param array 🤔

#

is nil really any? isn't it nothing 🤔

winter rose
#

I just got what was going. yes, don't forget quotes around varnames.

tough abyss
#

isEqualParams will allow it

winter rose
#

isEqualTypeParams*

tough abyss
#

yeah, params too

#

[nil] params [["_test", nil]]; isNil "_test" true

winter rose
#

so… what's the issue here beside placing your varname between quotes, I don't follow anymore 😁

tough abyss
#

he didnt use variable name he used undefined variable which is == params [nil, nil, nil]

winter rose
#

yes, so he just has to set "_varname"

empty string to skip the var, IDK if it is written on the wiki

tough abyss
#

there is an example but there is no explicit mention

#

maybe needs a note

winter rose
#

one could add that…

tough abyss
#

un

winter rose
#

(just so you know btw, Google wasn't "wrong"; ami is ♂ and amie is ♀)

tough abyss
#

why google would assume female by default?

winter rose
#

maybe thought "my friend" as "here's my (girl)friend"

tough abyss
#

that makes no sense

winter rose
#

¯_(ツ)_/¯

winter rose
#

@tough abyss ask Dwarden a Wiki account 😄

tough abyss
#

Already did

astral dawn
#

Can I change the message in the JIP queue without actually remote executing it globally right now?

#

If not, is it very hard to tweak it to work like that? 🙃 (through an additional parameter)

winter rose
#

you can delete a message with the JIP parameter and remoteExec

astral dawn
#

no you don't get it, so I have something like [0, 1, 2], "myFuncName" in the queue right now, and I just want to change it to [123, 1, 2], "myFuncName" without broadcasting it to everyone now

winter rose
#

no can do. why would you need that?

astral dawn
#

I want to send partial updates of my objects

#

Like update only one variable

#

But for new clients, I want them to have all the actual data

winter rose
#

then set an onplayerconnected EH maybe

astral dawn
#

yeah basicly I would have to reinvent the JIP queue 🤷 and add this functionality to it

winter rose
#

if you just use remoteExec, all the previous remoteExec will be applied to JIP, what do you want more?

#

they will have all the updates if you set the JIP param to true

astral dawn
#

I want to change the data in the JIP queue but not broadcast a hell of an array right now with variables every time I make a tiny change in the array
I want JIP clients to get the full array, to sync object data to them

errant jasper
#

Hmm, if you update the data independently, then might want to use independent variables.

winter rose
#

or simply set your variables on an object with setVariable from the server, that gets sync too

#

what is the situation needing it?

errant jasper
#

^^^exactly, but you still need to tear apart the array

astral dawn
#

or simply set your variables on an object with setVariable from the server, that gets sync too
Yes but I can't run my code along passing data

#

what is the situation needing it?
Ugh, synchronization of OOP objects

#

So that when I change variable "pos" on something, I don't have to retransmit all object's variables, but only "pos"

errant jasper
#

But why are those particular OOP objects "copied" on multiple machines?

astral dawn
#

Well, client must have this object on his machine because ... the scenario demands it 🤷

#

Think of these as if they are just namespaces with variables and values, for this conversation

winter rose
#

when you remoteExec, why not set the JIP var to true? it will reapply all the changes

errant jasper
#

Yeah, I get that they are namespaces. But, you are presumably sharing the data, because you want them to perform the same kind of computation. But if the changes all server originate for instance, then let the server do the computation and send the result.

#

@winter rose that will be even worse than using a JIP "key", since then you do array transmission even more times

winter rose
#

yep, but it works

errant jasper
#

I mean yeah, but for some reason this array is large or something and he does not want to do that

winter rose
#

if you don't want to do that and want a separate sync on player's connection, use an on player connection event to broadcast the data 🤷

tough abyss
#

if not, exitWith {}

astral dawn
#

let the server do the computation and send the result
Sure that's what I do, however I would like to execute some SQF code along with passing of the variable for clients who are already there, and just change the full large array in the JIP queue for the clients who will be joining

#

That's how object property sync should work IMO 🤔 if I could only change the values in the JIP queue

errant jasper
#

Hmmm, can you do a remoteExec only on the originating machine with the JIP flag?

#

Maybe that will only work on the server though?

astral dawn
#

@tough abyss It will still broadcast data though

tough abyss
#

yeah, but it wont execute

errant jasper
#
[newData] remoteExec ["updateData", 2, "KEY_LatestData"];
[newDelta] remoteExec ["updateDelta", -2];
tough abyss
#

if you gonna have an array you will still have to publicVariable it every time

astral dawn
#
[newData] remoteExec ["updateData", 2, "KEY_LatestData", true]; // Please run it for JIP only
[newDelta] remoteExec ["updateDelta", -2]; // Please run it for everyone who is already connected

Ideally I'd like to have smth like this

tough abyss
#

[newData] remoteExec ["updateData", 2, "KEY_LatestData", true];
you cant

astral dawn
#

I know! I recall Dedmen asking for ideas for new SQF functions or changing existing functions or something of this kind, maybe he would like to assist

still forum
#

no

#

kthxbye

tough abyss
#

you cant because this is illegal syntax

astral dawn
#

It seems like a good idea to change the JIP queue without remote-executing the command right now

tough abyss
#

why you worry about extra broadcast?

#

are you going to spam it? then you should rethink the whole design

astral dawn
#

Well it seems natural to me to worry about that, in UE as I know they send only changed properties too

#

Anyway let's not talk about my situation, just in general, being able to change JIP queue without sending data immediately, I think it could be useful, no?

errant jasper
#

Then maybe copy CBA jip system

#

and tweak it

tough abyss
#

dunno, you are not explaining what you want to do so ¯_(ツ)_/¯

astral dawn
#

Well I've just explained, change data in the JIP queue with a given JIP ID, but don't send data to clients now

errant jasper
#

He wants to perform updates to small parts of an array for connected clients, but still have JIPs getting everything / the latest

tough abyss
#

changing for the sake of changing? I havent seen anyone else asking for it so curious why do you need it so much you want to go to the extend of manipulating the guts of the remote exec system, not to mention that it would probably never happen

winter rose
#

OOP objects

tough abyss
#

He wants to perform updates to small parts of an array for connected client
Dont think this is what he wants

winter rose
#

Fun fact: OOP in French is… you guessed it, in reverse order

errant jasper
#

"Sparker Today at 11:46
I want to send partial updates of my objects
Like update only one variable
But for new clients, I want them to have all the actual data
"

tough abyss
#

that sounds like remoteexec all with JIP false

#

then all existing clients will be updated but JIP will get old data

errant jasper
tough abyss
#

You see my dilemma, lots of confusion

astral dawn
#

that sounds like remoteexec all with JIP false
for the small delta-update, yes
Then I need to make sure JIPs get the full proper data, so I'd like to modify data in the JIP queue, but not send the whole huge array to existing clients

tough abyss
#

what is full proper data?

#

the initial data + the updates you've made?

astral dawn
#

yes

tough abyss
#

[staticData, staticData, dynamicData]?

#

dynamic data could be a public variable

#

if you broadcast it for updates then jip will get the last broadcast

astral dawn
#

...but I want the remoteExec functionality of actually running my sqf code with data passed to it, instead of chaning a missionNamespace variable in the middle of client's code execution, so that I can sync it up properly, etc

#

Anyway where can I suggest this additional param to be added? I believe it shouldn't be hard, just disable the actual remote execution with an optional param. I see them still working on SQF commands for arma 3, so who knows 🙄

still forum
#

"shouldn't be hard" heh

astral dawn
#

Thanks @errant jasper I will look into how they've done it, I didn't know that CBA has some JIP features

tough abyss
#

Open file
Type
Save
...
Was this hard?

astral dawn
#

Doing networking is hard, what's hard is there in not doing networking? 🤣

#

Anyway IDK what's inside so I just assume things

tough abyss
#

Is JIP queue encrypted?

errant jasper
#

"enscripted"? you mean encrypted?

#

ah that enscript, had forgotten about that

young current
#

conscripted?

astral dawn
#

Like each element in the queue? Why? I have no idea, but then we can already change data and function name in the JIP queue by passing a JIP_ID

errant jasper
#

@astral dawn Just relooked. Fair warning, looks like CBA uses allVariables to run the JIP events, so they are not likely to happen in the sent order. But that is sort of irrelevant if you implement your own.

burnt cobalt
#

hey guys, sorry for being sloppy. I tried to cut out the relevant bits of the script to avoid confusion but made dumb mistakes instead. Here's a working working version of the map bit, just run the code from anywhere and click on the two dots it created. I am trying to get the same result for icons drawn with drawIcon3D but rewriting the code (which I did not create btw) using worldToScreen instead of ctrlWorldToScreen did not cut it

#

also I appreciate the performance tips, I am not really a coding expert as you can tell

young current
#

whats the question/problem exactly?

burnt cobalt
#

i am trying to do the same thing with icons drawn in 3d-space - while a dialog is open so you can click on the icons with a cursor

#

i tried adapting that code but my results are completely off.

still forum
#

_iconsAtPosition pushBack _x;
All that stuff can be replaced by a select

royal abyss
#

is there a way to make a volume like a trigger box that doesnt tick ?

tough abyss
#

Huh?

royal abyss
#

i want to make a script that can check if people are in a zone but noch only X/y but also limited to Z so i would need a trigger box but triggers tick by default arent they?

winter rose
#

triggers can be limited in height @royal abyss

royal abyss
#

i know

#

but they tick by default arent they?

winter rose
#

what do you mean, "they tick"?

royal abyss
#

so the more i place the worse is the performance

finite dirge
#

All loops, yes.

winter rose
#

they tick every 0.5s; if this frequency is good to you, use a trigger

royal abyss
#

i dont want them to tick at all

winter rose
#

(@tough abyss ☝ ☝ ☝ I did it!)

finite dirge
#

So you want a trigger that doesn't do anything?

winter rose
#

you just want a single check?

#

you can use these commands:
distance, for 3D distance, or distance2D + getPosATL select 2

royal abyss
#

a "volume" like a trigger box that a script can check if im inside or not when client is executing a script

winter rose
#

a sphere? distance

royal abyss
#

🤔

#

but that is unlimited in Z right?

#

unless i make a player height check

winter rose
#
if (player distance _myPoint < _distance) then { ... };```
#

distance is distance in straight line

royal abyss
#

yeah but if the objective is wider then high

finite dirge
#

Then yes, you'd have to check height and distance2d for a radius.

royal abyss
#

and what if the objective is a rectangle ?

tough abyss
#

You can use inArea command and some English lessons

royal abyss
#

im not a native eng. speaker 😅

tough abyss
#

Me too, what’s your point?

winter rose
#

Me neither*

royal abyss
#

i dont get what your problem is @tough abyss but yeah

finite dirge
tough abyss
#

No problem, just don’t see the point asking questions no one can answer

winter rose
#

OK now that's just mean 🙄

royal abyss
#

yup was looking in to "InArea" seems to be what i was searching for

tough abyss
#

Sometimes I’m good but when I’m bad I’m even better @winter rose

thorn saffron
#

How do you get bounding box of a geometry LOD of a projectile? I used
(2 boundingBoxReal _projectile)
with I think should give me the geometry LOD size, but it still returned the LOD1 size

quasi gyro
#

is there anyone that would be willing to look over a block of code for a mission with me and help me understand why its not working?

still forum
#

just post it and see if someone reacts

quasi gyro
#

im not sure why this isnt executing when ran against execVM

#
/*
  Developed by specCon18 and [NFG]Draycos
  © All Fucks Reserved
  specCon18@skdevstudios.com
  Map clearing code
*/

_locations=[[5789.38,10383.6],[5724.87,10404.2],[5793.5,10421.4],[5759.32,10444.9],[5798.47,10468.9],[6895.849,7453.282],[6895.849,7453.282],[5822.715,10783.907],[5830.870,10187.938],[5845.938,10223.338],[5840.145,10143.083],[5876.150,10186.08],[5878.213,10210.816],[4985.84,11373.3],[4961.61,11323.8],[5755.97,10696.4],[5755.66,10717],[5755.51,10731.1],[5479.933,9977.303],[5469.477,9947.218],[5761.33,10628.7],[5730.21,10625.1],[4676.46,9315.29],[3875.18,9667.09],[5836.25,10830.8],[5938.71,10645.7],[5835.59,10545.3],[5805.89,10579.7],[4634.15,9265.12],[4712.04,9263.93],[4054.704,9105.791],[9877.941,13536.048],[4048.31,8318.89],[4073.25,8294.63],[6921.5,7584.5],[8262.4,11990.3],[8356.62,11957.9],[5935.47,11051.4],[5948.38,10987.6],[5922.09,10983.3],[5922.09,10983.3],[5918.39,10993.2],[5918.39,10993.2],[5763.97,10586],[5756,10567.3]];

_radi=[50,20,30,50,20,20,20,30,30,30,10,20,8,50,20,20,20,20,5,10,20,20,50,99,15,40,50,20,35,25,100,20,50,50,100,100,50,50,25,10,5,5,45];

_locElementCount = count _locations
_locRadiusCount = count _radi

if(_locElementCount == _locRadiusCount) then
{
  _locationIop = 0;
  for [{private _locationIop = 0}, {_locationIop < 43}, {_locationIop = _locationIop + 1}] do
  {
    _lat = ((_locations select _locationIop) select 0;
    _lon = ((_locations select _locationIop) select 1;
    _location = [_lat,_lon]
    _radius = (_radi select _locationIop);
    _terrainobjects=nearestTerrainObjects [_location,[],_radius]; {hideObjectGlobal _x} foreach _terrainobjects;
  };
}
else
{
  hint "invalid grid"
}
#

and execVM "Modules\MapEdits\clearmap.sqf"; in initServer.sqf

still forum
#

for [{private _locationI looks very much like that can be replaced with a forEach

#

don't see a reason why execVM would break that 🤔

finite dirge
#

_lat and _lon missing )

#

_location missing ;

still forum
#

🤔

#

where are my glasses

#

tha doesn't make sense

#

first you have an array, then you take the first and second element out of the array.
Then you create a new array and put the first and second elements back

#

why?

#
/*
  Developed by specCon18 and [NFG]Draycos
  © All Fucks Reserved
  specCon18@skdevstudios.com
  Map clearing code
*/

private  _locations=[[5789.38,10383.6],[5724.87,10404.2],[5793.5,10421.4],[5759.32,10444.9],[5798.47,10468.9],[6895.849,7453.282],[6895.849,7453.282],[5822.715,10783.907],[5830.870,10187.938],[5845.938,10223.338],[5840.145,10143.083],[5876.150,10186.08],[5878.213,10210.816],[4985.84,11373.3],[4961.61,11323.8],[5755.97,10696.4],[5755.66,10717],[5755.51,10731.1],[5479.933,9977.303],[5469.477,9947.218],[5761.33,10628.7],[5730.21,10625.1],[4676.46,9315.29],[3875.18,9667.09],[5836.25,10830.8],[5938.71,10645.7],[5835.59,10545.3],[5805.89,10579.7],[4634.15,9265.12],[4712.04,9263.93],[4054.704,9105.791],[9877.941,13536.048],[4048.31,8318.89],[4073.25,8294.63],[6921.5,7584.5],[8262.4,11990.3],[8356.62,11957.9],[5935.47,11051.4],[5948.38,10987.6],[5922.09,10983.3],[5922.09,10983.3],[5918.39,10993.2],[5918.39,10993.2],[5763.97,10586],[5756,10567.3]];

private _radi=[50,20,30,50,20,20,20,30,30,30,10,20,8,50,20,20,20,20,5,10,20,20,50,99,15,40,50,20,35,25,100,20,50,50,100,100,50,50,25,10,5,5,45];

if (count _locations != count _radi) exitWith { hint "invalid grid" };

{
    private _location = _x;
    private _radius = (_radi select _forEachIndex);

    {hideObjectGlobal _x} forEach (nearestTerrainObjects [_location,[],_radius]);
} forEach _locations;
quasi gyro
#

your right i wasnt even paying attention to that in my sleep deprived state. should the edits you made work?

still forum
#

looks working to me. But I tend to make mistakes

quasi gyro
#

okay ill test it thanks for your assistance. people in this discord are so helpful

tough abyss
#
_worldRadius = worldSize / 2;
_worldCenter = [_worldRadius,_worldRadius,0];
_atmObjects = [];
{ 
   if (str _x find ": atm_" > -1) then { 
       _x addAction ["Hint Hello!", { hint format ["Hello %1!", name player] }];
       _atmObjects pushback _x
   };
} forEach (nearestObjects [(position player), [], 50]);

hint format ["Test: %1", _atmObjects];```
#

Anyone know why this isn't adding the action to all the ATMs in the array?

hot kernel
#

This script is supposed to make a character smoothly switch weapons from primary to handgun. It is necessary to remove the primary ammo else the character will immediately switch back to primary when targets are acquired. Adding 1 round (or an arbitrary amount) plus an ammo EH doesn't seem to work.

SWO_fnc_weaponSelector=
{
selectWeap = currentWeapon _this;

if (selectWeap== "arifle_mk20_f") exitWith {
    _this setAmmo [handgunWeapon _this, 1];
    _this selectWeapon "hgun_pistol_heavy_01_f";
    _this setAmmo [primaryWeapon _this, 0];
_this addeventhandler ["Fired",{(_this select 0) setvehicleammo 1;}];
    };

if (selectWeap== "hgun_pistol_heavy_01_f") exitWith {
    _this setAmmo [primaryWeapon _this, 1];
    _this selectWeapon "arifle_mK20_f";
    _this setAmmo [handgunWeapon _this, 0];
_this addeventhandler ["Fired",{(_this select 0) setvehicleammo 1;}];
    };
};
hot kernel
#

This is maybe a bit nicer to look at but still doesn't replenish ammo,

SWO_fnc_weaponSelector=
{
selectWeap = currentWeapon _this;

if (selectWeap == "arifle_mK20_f") exitWith {
    _this setAmmo [primaryWeapon _this, 0];
    _this setAmmo [handgunWeapon _this, 1];
    _this selectWeapon "hgun_pistol_heavy_01_f";
    };

if (selectWeap == "hgun_pistol_heavy_01_f") exitWith {
    _this setAmmo [primaryWeapon _this, 1];
    _this setAmmo [handgunWeapon _this, 0];
    _this selectWeapon "arifle_mK20_f";
    };
ammoEH=_this addeventhandler ["Fired",{(_this select 0) setvehicleammo 1;}];
};
#

is it because the function is called and the EH needs to be spawned?

frozen knoll
#

@tough abyss because _x isnt player

#

_x addAction

tough abyss
#

@frozen knoll I'm wanting to add it to the atm thing

#

So players can walk up to it and select that

#

_x is an the atm object

#

So it should be adding the action to it

#

At least I think

#

@hot kernel I think you can make a player switch weapons without changing their ammo

#

Maybe force them into an animation I'm not to sure

hot kernel
#

@tough abyss , if you want to disambiguate your script function try it in a VR map-- what happens with 3 atm's sitting next to one another with nothing but the player present?

frozen knoll
#

yeh tru but could return more than one also

tough abyss
#

@hot kernel ... Then the three atms would be in the array and the same thing should happen

hot kernel
#

@tough abyss , yes, you can switch weapons easily. The character will immediately switch back when contact is engaged

tough abyss
#

Ah

hot kernel
#

should...

#

try it and systemchat your variables

tough abyss
#

Alright

hot kernel
#

atmCount= count "atms";
systemChat format ["%1", atmCount];

tough abyss
#

It works

#

WTf

#

It works in VR

#

But not in the Altis map

#

AHH

#

I found the issue

hot kernel
#

so that's good news!

tough abyss
#

No clue how to fix it but still found the issue

#

Lol

#

It only works on ATMs I put on the map but not ones that are there by default

hot kernel
#

ah-ha!

tough abyss
#

Why does that happen lmao wtf

hot kernel
#

@tough abyss ,I don't know. I would have wrote it like you did and then probably been here asking the same things 😄

tough abyss
#

Lmao

hot kernel
tough abyss
#

Gonna keep looking into it

#

Ty

frozen knoll
#

its a map object (p3d) so wouldnt it be best to add the action to player with a condition checking if its a atm?

hot kernel
outer fjord
#

So back like 2 years ago when I played Exile. Some one had some sort of script that basically allowed you to tune into enemy NPC comms. Not as a tactic thing, more like a warning system as you got closer. It was just a bunch of audio ques and text that would appear, only if you had a radio. Does anybody possibly know what that script is called? I tried googling enemy radio script with not to much luck.

tough abyss
#

Ty @hot kernel

frozen knoll
#

@outer fjord i believe that was a feature in @a3xai

outer fjord
#

Ah thank you

#

Wasn't sure if it was part of a bigger script or seperate

hot kernel
#

the event handler is unnecessary, the character already has an EH for this. At first I thought the EH was being removed when I set the ammo count to zero (see above if this isn't making sense). But I took my own advice from (also above) and system chatted the EH and regardless of which weapon/when/whatever the initial EH still fired-- all good.

the character's initial magazine count was zero and this caused the EH to fail. That common ammo EH we all use requires a unit must have more than 1 magazine (ie 1 in INV and 1 in weapon). That said, this works great,

SWO_fnc_weaponSelector=
{
selectWeap = currentWeapon _this;

if (selectWeap == "arifle_mK20_f") exitWith {
    _this setAmmo [primaryWeapon _this, 0];
    _this removeMagazines "30Rnd_556x45_STANAG";
    _this addMagazines ["11Rnd_45ACP_Mag", 2];
    _this selectWeapon "hgun_pistol_heavy_01_f";
    };

if (selectWeap == "hgun_pistol_heavy_01_f") exitWith {
    _this setAmmo [handGunWeapon _this, 0];
    _this removeMagazines "11Rnd_45ACP_Mag";
    _this addMagazines ["30Rnd_556x45_STANAG", 2];
    _this selectWeapon "arifle_mK20_f";
    };
};

With the added cinematic effect of weapon reloads which the EH usually prevents.

tough abyss
#

I want that the player get damage, when he arrives an trigger and he hav´nt an gas mask!

#
while{Alive player} do {
    if (headgear player in [""]) then {

        player setDamage 0.2;
        sleep 5;
        player setDamage 0.2;
        sleep 5;
        player setDamage 0.2;
        sleep 5;
        player setDamage 0.2;
        sleep 5;
        player setDamage 0.2;
        };

   
    if (headgear player in ["U_B_CBRN_Suit_01_Wdl_F"]) then {

        player setDamage "";
        };
};        
#

The script looks correctly, but the player get 1x damage when he go in the trigger with gas mask! Did someone know an other script or can write it correcly for me?

young current
#

You are setting the same 0.2 damage all the time.

#

It does not add up like that.

#

But also if player already had 0.6 damage you would be healing him.

#

You'll have to first get the players current damage and add to that.

tough abyss
#

The player should get damage every 5 sec, when he did´nt use the gas mask, in the trigger zone!

dreamy kestrel
#

Q: re: adding AI crew to turrets. I have found that that AI tend to pick up where players leave off in terms of engaging enemy combatants at will. This in spite of my disabling all of the AI behaviors. Is there a way for that to stick? Or would I need to watch for player releasing and/or disconnecting and instruct the AI once again?

dreamy kestrel
#

If I am unable to persuade the AI to stand down, and remain stood down, it would not be the worst thing for us to forego the AI in the turrets and simply expect players are in proximity of the turrets in order to use them.

cosmic lichen
#

@tough abyss Try while {alive player} do { if !(headgear player in ["U_B_CBRN_Suit_01_Wdl_F"]) then { player setDamage (damage player - 0.2); sleep 5; }; };

tawny badger
#

Could someone please tell me if it's possible to script flight paths at certain altitudes ?

#

I need a low flying spitfire path

cosmic lichen
#

is it always the same path?

winter rose
#

@tawny badger see flyInHeight; it seems flyInHeightASL doesn't work (or not as intended)

tawny badger
#

Yes same path

#

Thanks Lou

errant patio
#
//Starts up the loop for saving the player
params ["_player"];

[_player, 
        {
            if (alive _this) then {
                _handle = _this spawn {
                    ["loadPlayer", _this] call pdw;
                    ["loadInventory", [name _this, _this]] call pdw;
                }
                
            };
            
            waitUntil {scriptDone _handle; false};
            
            while {true} do {
                if (alive _this) then {
                    ["savePlayer", _this] call pdw;
                    ["saveInventory", [name _this, _this]] call pdw;
                };
                sleep 15;
            };
        }
] remoteExec ["spawn", 2];

can someone tell me why _handle is undefined? I'm guessing it's because this is inside a remoteExec :/

astral dawn
#

Maybe try this?

//Starts up the loop for saving the player
params ["_player"];

[_player, 
        {
    // Look here Pritchard, we create a variable before we enter another scope
            private _handle = scriptNull;
            if (alive _this) then {
                _handle = _this spawn {
                    ["loadPlayer", _this] call pdw;
                    ["loadInventory", [name _this, _this]] call pdw;
                }
                
            };
            
            waitUntil {scriptDone _handle; false};
            
            while {true} do {
                if (alive _this) then {
                    ["savePlayer", _this] call pdw;
                    ["saveInventory", [name _this, _this]] call pdw;
                };
                sleep 15;
            };
        }
] remoteExec ["spawn", 2];
errant patio
#

no dice :( just never gets around to starting the save loop

astral dawn
#

So you're spawning a new script for each player 🙄

#

The usual conversation which must start right now, is why spawn is bad 🤔

#

like... player can disconnect right in the middle of the call of ["savePlayer", _this] call pdw;function

#

although probability of it is pretty low... maybe one of 10^3 players would experience loss of his inventory, IDK

#

wait WHAT
waitUntil {scriptDone _handle; false};

errant patio
#

waitUntil is my bane but the wiki says it should always return something

#

so when it was saying "_handle is nil" i was like "ok :/"

astral dawn
#

waitUntil blocks until the code on the right of it returns true

#

but you are returning false all the time

errant patio
#
// bad
waitUntil { if (!alive player) exitWith {}; _time = _time + 1 };
// good
waitUntil { if (!alive player) exitWith { true }; _time = _time + 1; false };```
#

?

astral dawn
#

Anyway, unless I know something else, just looks like a strange design
Why would you spawn a code and wait until it's done if you can just call your code? Making 'threads' for the sake of making 'threads'?

errant patio
#

Hmm. I probably should call it. I guess i'm paranoid about the file operations locking the game up noticeably whenever a player joins

#

but.. they probably still will anyway :/

astral dawn
#

scheduled code still runs in the main thread

#

so it's no difference

#

you are just bringing asynchronousity into your design for no reason or benefit right now

still forum
#

_handle was nil because it was only defined inside the if statement

#

local variables are local afterall

errant patio
#

yeah, i think i'll change it to call

astral dawn
#

if file ops need to be accelerated, probably the extension which performs them must have multithreaded design

still forum
#

call in remoteExec will make it unscheduled. which means no waitUntil for you
Me no read all the chat :U

errant patio
#

okay i crashed the game lol

#

try that again...

astral dawn
#

New achievement unlocked: ⭐ Developer lvl II. ⭐

errant patio
#

lol i've crashed the game plenty before now. thankfully this mission is actually decently stable now

#

it used to produce a LOT of RPT errors and now it's 👌

astral dawn
#

honestly I'd suggest you to rethink about how scheduler works, and move such things as you are doing right now into unscheduled env.

#

Such as...
replace remoteExec with remoteExecCall at least
Instead of spawning stuff, add some CBA thing to run every 15 seconds (probably other ppl will correct me, I don't know the exact function name)
in this cba run-every-15-seconds thing, delete the thing if player has disconnected, otherwise save his data

#

If you still feel like spawning something, wrapping code into isNil makes it unscheduled

errant patio
#

i thought about the CBA thing. (PerFrameHandler) but i wasn't sure if it's actually more performant?

#

Hmm. Using remoteExecCall seems to be the cause of the game locking up

#

:/

astral dawn
#

It's not about the performance, but the issue is, as I've said, I assume you are getting player's loadouts and whatever other things in a scheduled script, that script can get interrupted at any time, and player's state might have changed by a lot (or he has even left the server) by the next time your script continues to run

errant patio
#

I forget. If you run call within a spawned script, it's actually just unscheduled too isn't it?

astral dawn
#

it's scheduled

#

still

#

so inside this call you can suspend

errant patio
#

ah :/

still forum
#

replace remoteExec with remoteExecCall at least only makes a difference when exec'ing script functions, not commands.

errant patio
#

calling the load functions has undesired results :/

#

idk why but it just. really hates loading the inventory. It moves the player correctly but they have no loadout.

#

Thanks for the advice on the scriptDone waitUntil. I'll probably leave this how it is for now (which is definitely not perfect) and revisit if any data loss issues appear in the future

#

Though unless the game writes corrupt data I imagine that it won't be a big issue.

astral dawn
#

IDK, maybe the database functions are meant to be called from scheduled env? It would make no sense IMO, but who knows 🤔

#

I guess you are using some database addon extension?

errant patio
#

inidb2, and the only reason i can imagine is that i use setUnitLoadout to restore the loadout

astral dawn
#

inidbi2 should work in a fine synchronous way I would imagine

errant patio
#

¯_(ツ)_/¯

tough abyss
#

Hmm. Using remoteExecCall seems to be the cause of the game locking up
Daim! You really have to try to make it happen

errant patio
#

lol. more specifically it was using sqf remoteExec ["call", 2]; or sqf remoteExecCall ["call", 2];

#

using "spawn" worked but yeah remoteExecCall-ing "spawn" is pretty pointless from what i understand?

tough abyss
#

Remote executing call or spawn is not a good design, you lose ability to control what should and should not be executed in mp and by whom. Having a function that you remoteExec or remoteExecCall is way better and more flexible

errant patio
#

mm. good point. i will rework this :o

queen cargo
#

Tbh... Dedmens DB plugin for intercept is one of the biggest pros for Serverside intercept right now

sleek token
#

it really is, just don't push too much data through one connection or you will be covered with errors

#

okay i have to add i am talking 10.000 statments/h

queen cargo
#

Uhm... No
The rule of thumb is: do not use crappy extension interface

still forum
#

Uhm.. yes.

#

Theres some bug in there

queen cargo
#
private _arr = [   ["assertEqual",     { for "_i" from 1 to 10 do { _i }; }, 10],
    ["assertEqual",     { private _arr = []; for "_i" from 1 to 3 do { _arr pushBack _i; }; _arr }, [1, 2, 3]],
    ["assertEqual",     { private _arr = []; for "_i" from 0 to 5 step 2 do { _arr pushBack _i; }; _arr }, [0, 2, 4]],
    ["assertEqual",     { for "_i" from -1 to -10 step -1 do { _i }; }, -10],
    ["assertEqual",     { private _arr = []; for "_i" from (-1) to (-3) step -1 do { _arr pushBack _i; }; _arr }, [-1, -2, -3]],
    ["assertEqual",     { private _arr = []; for "_i" from 0 to (-5) step (-2) do { _arr pushBack _i; }; _arr }, [0, -2, -4]]
];

{
    private _res = [] call (_x select 1);
    if !((_x select 2) isEqualTo _res) then {systemChat ("invalid test: " + str (_x select 1));};
}foreach _arr```
could one double-check?
expected output is none
still forum
#

output none

#

in debug console

queen cargo
#

so test-cases work as expected

#

neat

#

SQF-VM now again, is bugfree according to the tested range

#

now ... back to my math 😦

#

Just to note for those who do not know what i am talking about (and why i am in need of correctness checks for basic SQF code): SQF-VM is a project, that "emulates" the arma scripting language

west grove
#

question: is it possible to get the contact map layout into a3? just talking about the map - not the task system

tough abyss
#

Why hold in because of scanConfig? @queen cargo

queen cargo
#

in is on hold because stuff like locations are not yet existing
the fnc_scanConfig should actually fully be working using sqf-vm right now

#

to be more precise:

position in location
unit in vehicle``` are not implemented in sqf-vm
tough abyss
#

Haven’t seen any references to locations in scanConfig

queen cargo
#

the scanConfig was the reason, why i wanted it to be implemented

#

the hold reason can be seen when hovering above the HOLD

dreamy kestrel
#

anyone at all with insight into the turrets AI issue? I basically want them to remain dormant and/or stood down no matter what, but still allowing for players to connect via their UAV Terminals. what I have found is that upon Release or Disconnect, the AI goes right back to being active again. worst case I forego my AI goals and expect players to be in proximity to man the assets, I suppose.

dreamy kestrel
#

when you have the addAction can you tell the typeOf _caller, is that "man" ? whether or not that is also isPlayer, possibly. thanks!

winter rose
#

you have the "action bearer" in the code parameters @dreamy kestrel

dreamy kestrel
winter rose
#

"target" in scripts parameters

#

"caller" being "who used the action"

#

Oh, wait - you want to filter who has access to this action? @dreamy kestrel

winter rose
#

@dreamy kestrel isKindOf "CAManBase" and isPlayer

dreamy kestrel
#

@winter rose re: addAction not so much filter, but determine whether that was a player, in either client/server, presumably in our scenario, running on server side.

smoky verge
#

http://www.armaholic.com/page.php?id=24859
I've been trying for 4 hours to understand how this works exactly
I can make it work but I can only follow the template
I'd like to be able to change the dialog tree according to the scenario but to do that I need to understand how the system works
I know its a really timespending thing to do but can anyone help me decipher how this works?
I'm sure it can be useful for other people too.
Or even better if you knew a better way to simulate rpg-like dialog trees ingame could you tell me?

fringe yoke
#

Does anyone know how to create a marker and set it's variable name in the editor? Right now I am trying

myMarker = create3DENEntity ["Marker", "Empty", [0,0,0]];
myMarker set3DENAttribute ["name", "respawn_west"];

That creates the marker but the name does not change

exotic tinsel
#

how can move a player to the surface of the water via script?

fringe yoke
#
_unit setPosASL ((getPosASL _unit) set [2,0])
exotic tinsel
#

@fringe yoke
is this what your looking for? With out all my stuff?

//add mission marker 
_tempMissionMarker = createMarker ["mission_marker_" + _missionname, getmarkerpos _missionMarkerName];
_tempMissionMarker setMarkerShape "ICON";
_tempMissionMarker setMarkerType "mil_dot";
_tempMissionMarker setmarkersize [1,1];
_tempMissionMarker setmarkercolor "colorOPFOR";
_tempMissionMarker setmarkertext _squadname + "-Squad Mission";    
fringe yoke
#

Nope, I'm trying to do it in the editor, not in game

exotic tinsel
#

via script?

fringe yoke
#

Yes

exotic tinsel
#

sorry mate, never done that before. thx for the code though. ill test it out now.

exotic tinsel
exotic tinsel
#

When someone logs on our server they get popups for all the completed tasks for all the missions before they logged on. Is there a way to disable or prevent that?

exotic tinsel
#

anyone know why this doesnt work on the server? i have confirmed that the AI varname is the same on the server as it is on the clients.

private _AI = missionNamespace getVariable [_ai_varname, objNull];    
winter rose
#

@compact wyvern no crossposting, please delete your message here and wait for an answer in #arma3_editor

fringe yoke
#

Ah great, thanks

tough abyss
#

@compact wyvern you are not supposed to edit sqm

west grove
#

anyone can tell me how the glowing lights are attached to the drones in contact? BIN_fnc_initUAV / UGV; does that to them, but i can't find in the actual script where it is done.. so i'm assuming something else does it somewhere else

astral dawn
#

So what is there inside this BIN_fnc_initUAV?

#

Maybe paste it here so others can find the line of code that does that?

west grove
#

sure, as soon as pastebin is back on

#

but i'm pretty sure there is nothing in it that does it. my guess is that contact has some other script running that fetches these initiated critters and does stuff then

#

ok, found it now in initaidrone

still forum
#

!issuewarning @compact wyvern crossposting x2

lyric schoonerBOT
#

Done.

runic quest
still forum
#

yes sure

#

not sure how your code is supposed to be related to that tho

#

your code is 3 statements with 0 getvar

runic quest
#

https://sqfbin.com/udoneriquwizavobapiv Sorry, I'm wrong. I mean whether setVariable can be used in the same statement. _ isfed is a variable of the door, and I want to lock it automatically 30 seconds after prying it open, so I write this

#

@still forum

still forum
#

your code just looks like a confusing mess

#

what do you mean with "same statement"

runic quest
#

In the same sentence

#

sorry,I mean, could i use two setVariables after "then"?

still forum
#

sentence?
Sure you can

#

you can do however much stuff you want after "then"

runic quest
#

Okay, please forgive my English level. Thank you very much. @still forum

dark ocean
#

hi, I need to lower this to the trunk

#

drawicon3d in tree

still forum
#

just do -2m on the height?

dark ocean
#

I am going to try

runic quest
#

@still forum Do you know how to add a button to a door of a building so that the player can have an option of a roller for the door of the building? Thank you

still forum
#

no

exotic tinsel
#

Can someone tell me why this isnt working. i have confirmed the AI varname to match what im passing in to the function. but it doesnt get the AI's object

params ["_ai_varname", ["_player_steam_id", ""]]; 
private _AI = missionNamespace getVariable [_ai_varname, objNull];    
#

@runic quest do you mean an action in the action menu?

runic quest
#

I mean something like player Addaction. For example, there are seven doors in a building. I want to add a button (mouse wheel) to the third door.

#

@exotic tinsel

exotic tinsel
#

@runic quest give me a min to find the script i have

still forum
#

can you show how you call the script function?

exotic tinsel
#

@still forum

[vehicleVarName _AI, getPlayerUID _caller] remoteExec ["feature_5_fnc_state_3_apply", 2];    
still forum
#

checked that vehicleVarName returns what you expect?

exotic tinsel
#

@still forum from an actionmenu item

still forum
#

Wiki says

Since it is possible to setVehicleVarName individually on each PC, the value of vehicleVarName returned will be local to the PC on which command is executed.
so maybi?

exotic tinsel
#

na, i checked that what i sent was the same as on the server.

runic quest
#

😊

exotic tinsel
#

@still forum so that code should work though right. its prolly im doing something wrong somewhere? but none the less that is the proper way to get an object by string var name?

still forum
#

yeah

#

looks right to me

exotic tinsel
#

ok. ill keep testing, thx

still forum
#

but

#

why don't you just pass the object directly

tough abyss
#

Why not refer to AI by direct reference to the object?

exotic tinsel
#

well, i was thinking that it would be better for performance to pass a string from clients to server. lots of scripts, lots of players.

still forum
#

no it's actually worse

exotic tinsel
#

vs?

#

passing a whole object?

still forum
#

sending objects in remoteExec requires less network traffic

#

the object is a single integer

#

4 bytes

tough abyss
#

Whole lol

#

Object is just a reference

exotic tinsel
#

good to know, noob here remember. thx guys.

broken snow
#

Anyone know what I need to do to retain a custom loadout after death? Not just what they die with but what they start the mission with?

exotic tinsel
#

@broken snow you can do something like this on each client when you trigger a mission. Dont do it from the server, it isnt very reliable.
v_playerLoadout = getUnitLoadout player;
I added eventhandlers for when they close inventory and arsenal and save their load out.

broken snow
#

@exotic tinsel where would I put that code?

#

Never mind Im dumb its already in 3eden mod

dark ocean
#
_nTrees = nearestTerrainObjects [(visiblePosition player), ["TREE"], 10];
{
    if (_x distance player > 10) exitWith {};
    if ([_x, "VIEW", player] checkVisibility [eyePos _x, eyePos player] < 0.3) exitWith {};

    drawIcon3D [ //--- Title
        "\a3\Data_f\clear_empty.paa", 
        [0.051,0.447,0.784,1], 
        visiblePosition _x, 
        0, 
        -2, 
        0, 
        "Arbol", 
        1.8, 
        0.042, 
        "RobotoCondensed", 
        "center",
        false
    ];
} forEach _nTrees;
#

the same thing still happens to me

faint oasis
#

hi, i have created an extension on arma 3 in c++ but the "if,else,else if" statement doesn't work and i have nothing in .rpt and it work when i put the code in c++ console project so it's not my code but why arma 3 doesn't recognize the if,else,else if statement ? my code : https://pastebin.com/6fJF1ETS so anyone know how to solve it ?

runic quest
#

@faint oasis As far as I know, else if is not applicable in arma3 grammar

faint oasis
#

yes but it's only in c++ because in c# it work

#

@runic quest so if the "if,else" is not available how to use it ? or an alternative

runic quest
#

@faint oasis if () then {
/* code /
} else {
if() then {
/
code /
} else {
/
code */
}
}

faint oasis
#

oh ok

#

it's only the "else if" ?

#

ok i understand because when you have say "else if" i think "if,else and else if"

#

ok i will test it

#

but in c++ you don't have then

runic quest
#

You can ask others that my grammar level is not very good.😅

faint oasis
#

ok but no problem

#

@runic quest thx but it doesn't work

#
void __stdcall RVExtension(char *output, int outputSize, const char *function)
{
    if (function == "test1") {
        std::strncpy(output, "test2", outputSize - 1);
    }
    else {
        if (function == "test2") {
            std::strncpy(output, "test1", outputSize - 1);
        }
    }
}
runic quest
faint oasis
#

yes that is .sqf not c++ but don't worry

exotic flax
#

if you have multiple if...else statements, then it also might be an idea to use switch instead:

switch (true) {
    case (function == "test1") :
        std::strncpy(output, "test1", outputSize - 1);
        break;
    case (function == "test2") :
        std::strncpy(output, "test2", outputSize - 1);
        break;
}
tough abyss
queen cargo
#

@faint oasis is the extension actually loaded correctly?
And what exactly is the issue? Are you not getting any results?

#

@exotic flax that ain't how switch works in c++ 😉😉

tough abyss
#

@queen cargo it is obvious what the problem is function == "test1"

winter rose
#

does switch (true) work in c++ though? 🤔

tough abyss
winter rose
#

so I take it works!

tough abyss
#

Well not exactly like in sqf

queen cargo
#

More like not at All like in sqf 😂

faint oasis
#

ok but when i use the switch (true) do it doesn't work because he say i need a const expression

dusk sage
#

The compiler should optimise out the false cases in C++ (gcc/clang, probably not with msvc) - you should get a warning for using a boolean in the switch though @winter rose @tough abyss

faint oasis
#

@dusk sage do you know how to use switch (true) with the function ? because he say i can't because i don't have an constexpr

#

and i don't know how to convert the function string to an constexpr

dusk sage
#

What's your aversion to using if/else?

#

But to answer the question, the cases and condition are expecting integral/enum types, not expressions (minus init statements in C++17 - doesn't help you), needs to be compile time

#

So, you cannot

tough abyss
#

@faint oasis once again, your problem is not if else if, but comparing what you think is both strings which are not

queen cargo
#

@dusk sage that is not fully true.. Sorta... Theoretically, one could use a constant expression to create a hashvalue from a string and compare the hash of the input against that

dusk sage
#

If your string is available at compile time, which it's not in this case

queen cargo
#

It is available (test1, test2)

dusk sage
#

function is not

tough abyss
#

They are not strings though

dusk sage
#

if you insert type here is available

queen cargo
#

Reread what I wrote zoltanLUL @dusk sage
the hash of the input

dusk sage
#

the input being?

queen cargo
#

Function

#

I am on my mobile phone 😅😅 correctness is hard here

tough abyss
#

Welcome to my world

dusk sage
#

You're still doing conditional execution at runtime in the switch, unless you wanted to make a case for every hash?

#

Can you write some mobile phone pseudo code 🙂 ?

queen cargo
#

I will just Boot up the PC.. 😂
And lay down afterwards again

tough abyss
#

Das boot!

queen cargo
dusk sage
#

Where's the switch(true) 🙃 ?

queen cargo
#

never was talking about the switch true 😅

#

just "prooved" that in a hacky way, strings can be switched too

dusk sage
#

👍 That's what I was yapping on about

faint oasis
#

@tough abyss yes but both is not string ? because it work in c#

dusk sage
#

Sorry, could you explain?

queen cargo
#

he means: switch(System.String) works in C#

#

which is also not fully true ... as this is rather a compiler trick

faint oasis
#

@tough abyss say both is not string sothe problem is not the "if,else" but the comparation

queen cargo
#

it gets converted to a simple if (...) else if (...) else ... chain or at some point may even get transpiled into some dictionary (that then again uses a hash-lookup)

dark ocean
#

@still forum I'm still with the problem

faint oasis
#

ok thx but how to use "if,else" then ?

queen cargo
#

by just using it ....

#

there is no trick in c/c++/c#/...

#

only thing is:

#

c/c++ knows no "string" type persé

#

aka: "foo" => const char*

#

not std::string

#

thus you cannot compare some pointer with another

tough abyss
#

because it work in c#
you write in c++?

queen cargo
#

as you are essentially just checking wether instance a is the same as instance b

#

(which is simplified here, you actually compare addresses)

faint oasis
#

because in c# i can't use all of system because he crash

#

and in c++ not

#

so i want to use c++

tough abyss
#

then write in c++

faint oasis
#

@queen cargo my if is " if (function == "test1") {"

#

that doesn't work

dusk sage
queen cargo
#

i will tell you the same thing that i tell all people who ask me about programming things:
resolve the types, and you will notice that you are not comparing string literals but rather the addresses where those strings are physically in the RAM

tough abyss
#

@faint oasis the function is pointer

#

you want string

faint oasis
#

yes i know

tough abyss
#

so make it a string

faint oasis
#

but how ?

tough abyss
#

std::string functionstr(function);

faint oasis
#

thx

tough abyss
#

i gave you link to callextension page Y U NO READ?

queen cargo
#

or simplified:

const char* something = "bar"; // stored at 0x0001
const char* someOtherThing = "foobar" + 3; //"bar" - stored at 0x004

return something != someOtherThing; // True```
faint oasis
#

if but the link can't resolve my problem but thx

tough abyss
#

it has the example of extension you ripped off and it shows how to compare input

faint oasis
#

seriousdly ?

#

i will see it

tough abyss
#

Y U NO READ?

faint oasis
#

strcmp

#

yes it's true

#

and i will test it

#

thx

tough abyss
#

you can also compare strings if you convert function to string

faint oasis
#

how ?

tough abyss
#

seriousdly ?

faint oasis
#

@tough abyss i'm new in c++

#

sorry

tough abyss
#

std::string functionstr(function);

faint oasis
#

yes

#

ok but htx

#

and bye

tough abyss
#

Let me know if you want me to copy paste my answers more

faint oasis
#

no

#

but i think when you say that it's to convert the function void to const char

#

yes i have see your comment don't worry

dusk sage
#

What about this @queen cargo 🙃 ?

const char* something = "bar";
const char* someOtherThing = "bar";

return something != someOtherThing;

Oh compiler joy

queen cargo
#

yup 😛

#

though ... my example may get optimized away tooo

astral dawn
#

Yeah I think it won't even care to actually compare anything at run time

dusk sage
#

With any optimisation level (-OX) it won't

#

With gcc at least, it'll reuse the loc, with no optimisation

astral dawn
dusk sage
#

A quick goto error

still forum
#

If you don't know C++ basics, you shouldn't try writing Arma extensions in c++

wispy cave
#

Can I make unbreakable ropes using the ropeAttach EH? As in, if I disable the damage for those ropes, will they not break?

winter rose
#

try and thy shalt see!

wispy cave
#

I would but the reason I'm working on my project is because this class is particularly boring

winter rose
#

@ work, can't (easily) try =)

winter rose
#

that too iirc. what can be dammaged:

  • rope
  • cargo
  • carrier
  • carrier's hitpoint
grave stratus
#

can i use alive with faction to check if there is no enemy anymore?

spawn {
    waitUntil { !alive east };
    ["Task_001", "Succeeded"] call BIS_fnc_taskSetState;
};
still forum
#

no

tough abyss
#

It is simple

  1. open page with alive
  2. note what type of argument it takes
  3. open page with east
  4. note what type it returns
  5. compare them and get answer to your question
grave stratus
#

ah okay, i thought it wouldnt work just making sure.

still forum
#

points compass eastwards
There is no page opening 🤔

grave stratus
#

i am currently lost on trying to check if the enemy is still alive

#

can anyone point me to the right direction?

winter rose
#
private _eastUnits = allUnits select { side _x == east };```
grave stratus
#

ahh

tough abyss
winter rose
#
// (checks that all units are dead)
waitUntil { sleep 1; _eastUnits findIf { alive _x } == -1 };```
#
// or
waitUntil { sleep 1 ; east countSide allUnits == 0 }; // maybe a bit more perf hit```
grave stratus
#

oh

winter rose
#

beware of captive though

tough abyss
#

// maybe a bit more perf hit
explain?

grave stratus
#

thank you @winter rose and @tough abyss . never use countside before. thanks again for the guide

still forum
#

count side always iterates through all units

#

== more perf hit than just searching the first alive one

tough abyss
#

and this doesnt? private _eastUnits = allUnits select { side _x == east };

still forum
#

Look at lous code

#

that code isn't part of the waitUntil

tough abyss
#

it has to be or it is useless

still forum
#

only if new units spawn

#

which, in prebuilt missions is rarely the case

tough abyss
#

you make no sense

still forum
#

k

tough abyss
#

you can precache for countside in the same way

grave stratus
#

well in my case, enemy spawn in waves, only stop after ticket == 0

still forum
#

you can precache for countside in the same way
Yeah, still counts all of them, doesn't stop at first

#

does countSide check alive? wiki doesn't say anything about that

tough abyss
#

dunno lemmie try

still forum
#

some dead units might switch over to civilian side, but that's not really equal.
wouldn't work if you wanna check alive civs

grave stratus
#

can i do it like this?

waitUntil { 
    sleep 1 ; 
    [EAST] call BIS_fnc_respawnTickets == 0;
    east countSide allUnits == 0;
    };
 ["Task_001", "Succeeded"] call BIS_fnc_taskSetState;
still forum
#

yes

#

but your respawnTickets check will be useless

#

you probably want to check tickets AND alive?

#

then you also need to write down the "and" part

grave stratus
#

in my spawn script there is already a ticket checker to stop the spawn

#

waht i am trying to figure out is to make sure the enemy left in the mission is dead before succeding the task

#

which is in another script outside of the spawn script

#

but your respawnTickets check will be useless
if want the script to check if the side is all dead after the ticket turns 0

#

isnt my approach correct?

exotic flax
#

but the script sees now:

waitUntil {
    sleep 1;
    true;
    true;
};
// do something
grave stratus
#

@exotic flax yes i know that, i want it both to be true before "do something"

#

because event after the ticket turns 0, there will still be enemy left in the mission

exotic flax
#

so, like Dedmen said, use && to check both

waitUntil { 
    sleep 1 ; 
    ([EAST] call BIS_fnc_respawnTickets == 0 && east countSide allUnits == 0);
};
 ["Task_001", "Succeeded"] call BIS_fnc_taskSetState;
winter rose
#
private _eastUnits = allUnits select { side _x == east };
waitUntil { sleep 1; _eastUnits findIf { alive _x } == -1 };```↑ best

```sqf
waitUntil { sleep 1 ; east countSide allUnits == 0 };``` ↑ same as ↓```sqf
waitUntil { sleep 1 ; { alive _x } count _eastUnits 
== 0 };``` and no findIf here to save perfs @tough abyss
grave stratus
#

ahhh so i need to use it like using If

exotic flax
#

my example already solves it 😉

#

... guess it's a bit hard when multiple people give reactions to different issues 😉

winter rose
#

yeah that too 😛

grave stratus
#

yeah 😅

tough abyss
#

@still forum no it doesnt skip dead units

winter rose
#

argh

grave stratus
#

well thanks everyone, learns something new today

tough abyss
#

↑ best
what stops you from doing the same with countside? east countSide _eastUnits = 0?

winter rose
#

the alive part

tough abyss
#

countside will not count dead units because they will be civilian

winter rose
#

yet it will count all of units, whereas with findIf you can stop your count, e.g sqf allUnits findIf { side _x == east && alive _x } == -1 findIf stops as soon as it finds a result, countSide doesn't

#

(btw, I don't think countSide is an OFP command, but I might be wrong)

tough abyss
#

countside doesnt have to evaluate expression each iteration

winter rose
#

perf tests should be made

grave stratus
#
allUnits findIf { side _x == east && alive _x } == -1

why is it -1 instead of zero? can it count below zero?

tough abyss
#

seriously you can open biki page

#

it is there in black and white

winter rose
#

@grave stratus it returns -1 if it doesn't find anything

errant jasper
#

The real question is, why BI did not just make find overload....

tough abyss
#

Return Value: Number - Zero-based position of the first array element for which the code evaluate to true, -1 if not found

winter rose
#

now it's white on black

exotic flax
#

so use

allUnits findIf { side _x == east && alive _x } < 1
grave stratus
#

@tough abyss not that i dont want to, im learning as i go. i never learn any programming language so i am not sure where to find somes commands/functions.
i can read every command there is but i would not remember it anyway

exotic flax
#

welcome to the world of programmers, where Google is your best friend 😉

grave stratus
#

heck i didnt even know how to use an array properly

tough abyss
#

so use
and if you get fist element match?

winter rose
#

< 0 @exotic flax 😉

exotic flax
#

but < 0 only returns TRUE on -1, not on 0 😉

winter rose
#

yes, and 0 means it found something

errant jasper
#

exactly

grave stratus
#

@exotic flax i tried it everytime before coming over here 🙂

exotic flax
#

ah ok... it returns the array pos, in that case -1 makes sense

grave stratus
#

yes, and 0 means it found something
now this make sense

winter rose
#

0..n = found something / -1 = found nothing, aka no array index

tough abyss
#

what do you think Zero-based position of the first array element means?

exotic flax
#

it means that I didn't read

winter rose
#

@tough abyss
what do you think

i never learn any programming language
means?

tough abyss
#

thats ok, no one reads biki anyway

grave stratus
#

i do for the commands that i wanted to use, but sometimes it contains some fancy terms i dont understand 😅

errant jasper
#

Well, I think the ultimate lesson here for any learner is, that if one encounter something unfamiliar like "Zero-based position" then one should inquire to its meaning.

#

Bad assumptions are the devil... Or at least I assume so.

exotic flax
#

trial and error also work fine, as long as you know how to debug 😉

grave stratus
#

I usually goes with trial and error, thats how i normally learn anything. Except when i hit a stump, i'll seek help

winter rose
#

that's what this channel is for @grave stratus

tough abyss
#

Anyway, back to all east eliminated problem - a simple NOT PRESENT trigger side OPFOR will do

winter rose
#

now that will trigger me 😄

tough abyss
#

most optimal solution, why are you against good code?

winter rose
#

2× more expensive than a 1s delay,
and the big area trigger issue if this hasn't been fixed

#

so… not optimal 😊

tough abyss
#

there is no big area trigger issue and it doent run any condition apart from this which is just a boolean so mega cheap

winter rose
#

perf tests should be made ¯_(ツ)_/¯

grave stratus
#

Just making sure, the underscore before a variable like _variable means it can only can be call in thay script correct?

still forum
#

it means it's local

#

it's only accessible in current scope (everything between { and }) and below (deeper nested scopes, not below in terms of line number)

grave stratus
#

ah now i get it. thanks

dull drum
#

Hi, guys! Are there any details on the group creation that one need to know, except limited amount of groups? It looks like when I spawn groups of units as waves sometimes createGroup doesn't work even though the script sleeps for 1 second after the command is invoked.

#

And I do clean the empty groups for previous waves, so the overall number of groups usually is no more then 82.

astral dawn
#

How do you define 'does not work'

#

Be careful when moving units between groups, as when the group becomes empty it is auto deleted regardless of the delete when empty flag

#

even though the script sleeps for 1 second after the command is invoked.

How would sleeping affect anything :/

still forum
#

might affect negatively

astral dawn
#

Is it like, "if something doesn't work, try to sleep"?

still forum
#

one second time for the game to notice that there is a empty group that could be deleted

#

I can certainly recommend that

#

coding while tired is stupid

tough abyss
#

Is it like, "if something doesn't work, try to sleep"?
No, remoteExec

astral dawn
#

or put it into description.ext and try to execVM it 🤔

dull drum
#

The code wasn't mine actually so I thought that sleep was an OK move.

#

The idea that sleep actually kills an empty group is fascinating, @still forum

#

Is it like, "if something doesn't work, try to sleep"?
That part of code actually worked. But sometimes a while loop that run it gave me a null group, @astral dawn . Probably that sleep actually killed the group sometimes, I'll investigate it tomorrow. @tough abyss , nice one with remoteexec and so true lol.

astral dawn
#

code or it didn't happen

dull drum
#

ezpz

astral dawn
#

this switchmove 'AmovPercMstpSnonWnonDnon_SaluteOut'
what is this? Is the code being put into an object's init field or something?

dull drum
#

It is the script within the Init indeed.

astral dawn
#
_grp = creategroup _Team;
    sleep 1;
    if !(isnull _grp) then

Makes no sense

dull drum
#

My first thought on that one was that Ryan tried to be sure that group was 100% created or something.

astral dawn
winter rose
#

or not using -showScriptErrors

astral dawn
#

are you even showing us the whole code

dull drum
#

Not me, it's the Ryan mod's code. But the Init works okay until it generates pauses and in the end stops spawning zombies.

astral dawn
#
_grp = creategroup _Team;
    sleep 1;
    if !(isnull _grp) then
    {
 // Do something
        sleep _Frequency; // I am so tired, let me sleep before leaving this scope
    };
dull drum
#

It's a while's sleep

astral dawn
#

There is no while in that code though
Allright sorry for these uncomfortable questions 🙄 about the code made by not you

dull drum
#

Sorry, I made a wrong mouse move, my mistake,

#

There should we a while line above

#

and couple of exitWith's

#

But it doesn't really matter. The mod code works ok-ish for the first 3 to 5 waves of spawns. And then starts failing this awkward !(isnull _grp) condition.

astral dawn
#

Allright, another question, where does _Team variable come from

#

Or is it a magic variable ...

still forum
#

no it isnt magic

dull drum
#

From the pre-while set of global to local vars.

still forum
#

why not shown in your code?

#

afaik you cannot have a while true loop in a init script

#

that doesn't really make sense

astral dawn
#

I kind of like it, guessing code context from existing code
"hey there is a missing variable here, there must be something missing"
"hey you can't sleep here, it must be spawned"
"hey this variable must refer to something, I guess it's an init field'

dull drum
#

Because I've traced the hell out of everything there and everything is legit. Because the only awkward thing that I wasn't sure about was a sleep after a group creation.

There is no loop inside an Init.
It's outside. There is a unit creation within the loop that gets an Init field as a part of ARMA scripting command "alternative" syntax that Ryan uses: https://community.bistudio.com/wiki/createUnit

still forum
#

"There is no loop inside an Init." there is a while true
"It's outside" can't be, you are using this which is only valid in init

#

welp besides that part

dull drum
#

I'm not using anything, this is a Ryan's mod code 🙂

still forum
#

As I said, coding while tired is bad, same about reading code

#

this setposATL [(getposATL this select 0) + random _density - random _density, (getposATL this select 1) + random _density - random _density, (getPosATL this select 2)];
vectorAdd.

dull drum
#

this is inside the Init that starts at the line 21

astral dawn
#

oh fuck this whole thing is an init field

dull drum
#

you can see how he creates unit, giving the position parameter, then the group and then there is an open " symbol after which he scripts the Init insides, using this also

#

Not the whole, but the major part of the listing, yes.

astral dawn
#

I thought first that you have copy-pasted something wrong xD

#

And the prize for the longest createUnit init field goes to...

dull drum
#

Ryan's Zombies & Demons mode 🙂

#

I have actually couple of more bugs fixed there, probably I need to find this guy if he is still interested in supporting his work. Which is actually very good. But sometimes awkward.

#

As in my favorite part:

_Activation = _logic getVariable ["Activation",1];
if (_Activation == 1) then {_Activation = 0.9;};
if (_Activation == 2) then {_Activation = 0.7;};
if (_Activation == 3) then {_Activation = 0.5;};
if (_Activation == 4) then {_Activation = 0.3;};
if (_Activation == 5) then {_Activation = 0.1;};
still forum
#

🤦 someone never heard of linearInterpolate

#

atleast that looks pretty linear to me

astral dawn
#

Maybe he wants 0.3, not some 0.299999999 (although it would be 0.29999 anyway)

dull drum
#

I didn't find anything in code that supports the idea of this even was needed.

#

It's just taking the ints from config, then converting them into short doubles and then a column of if statements like if _Activation == 0.9 then do this code

#

There was no math, they are just flags for activation type like "this will activate first wave of zombies and that is for the second"

#
if ((_Type3 == 13) OR (_Type3 == 0.45)) then {_array = _array + _a13;};
#

WHY

still forum
#

append he also doesn't know

#

welp.. every big-ish framework type of code is usually about 5 years out of date and not being maintained properly

#

thats just normal

astral dawn
#

I mean just look at this init field of createUnit I am still shocked 😮

dull drum
#

Well I hope no one will see my own code, it's just a shitpile of junk 🙂

#

I pray that I will have some time to refactor EVERYTHING

#

Also

Is it like, "if something doesn't work, try to sleep"?
still sounds as a bulletproof advice.

vapid wadi
#

Is there a way to display a player's name with no Spaces? Like if a players name is Jason Smith, can you make it display as JasonSmith?

finite dirge
#

Display where?

vapid wadi
#

on a UI, im trying to make a twitter type of display, and I would like the players RP Name to appear as like @FirstLast(RandomNum)

finite dirge
#
name _unit splitString " " joinString "";
#

Should do it.

vapid wadi
#

thank you very much

low birch
#

Hi. Have someone a simple suggestion to restrict some userprofile names to join the game? I saw the such system in Invade & Annex (Apex Framework from QuickSilver). But it is a deep integrated in it and using it's own Robocop system to manage the restrictions.

exotic flax
#
// initPlayerServer.sqf

private _list_with_names = [
   "NAME A", "NAME B", "SOME WEIRD NAME" // all uppercase
];
if (toUpper profileName in _list_with_names) then {
    serverCommand format ['#kick %1', name player];
};

probably something like this

#

however I would suggest using their STEAM ID instead, because it's easy to change your name

low birch
#

That is great. I want to restrict using exactly the prohibited names.

#

Some like Admin, User etc

exotic flax
#

in that case it would also be nice to first tell the person the reason why they got kicked 😉

low birch
#

Yes, sure, but in this case it would not be a so simple suggestion. Isn't it?

#

🙂

exotic flax
#
if (toUpper profileName in _list_with_names) then {
    titleText ["Your name is not allowed at this server, please rename it or play somewhere else", "BLACK", -1, true];
    player enablesimulation false; // prevent player to do anything
    sleep 30; // wait 30 seconds
    serverCommand format ['#kick %1', name player]; // kick from server
};
#

btw... I'm not 100% sure about the serverCommand line, since I never used it, but according to the biki it's how it works

low birch
#

Greatest thanks! I'm administrating the Linux server over the year, but still the nerd in Arma scripting... 😕

exotic flax
#

server management has nothing to do with programming 😉 mistake I also made (just the other way around)

low birch
#

👍

tame lion
#

not sure if I need to ask this here or in config, but does anyone know of a scripted way I can close the front door on Land_Hangar_F? I've looked in its config for animationSources but it doesn't have any defined for some reason but I know I've seen it closed before

exotic flax
#

well... the default object doesn't has any doors which can be opened/closed at all

#

Land_Airport_01_hangar_F on the other hand does have doors which can be opened/closed/locked

#

but perhaps it was a mod which enabled it in some way

swift lynx
#

hi, for a prophunt game mode how would you punish players for shooting at the wrong objects? like in garry's mod if a hunter shoots at a barrel thats not on the enemy team they loose a bit of health.

tough abyss
#

setDamage to the shooter

winter rose
#
// Rocketmaaan
_badShooter setPosATL (getPosATL _badShooter vectorAdd [0,0,10]);
_badShooter setVelocity [0,0,300];```
lavish hamlet
#

I could use a hint in the right direction :)

i can get this to work when i have the UID of ppl in the same file but when i try to have a server side file contaning the uid's it stop working

_Uniform = uniform player;
_Ui = getPlayerUID player;
_donate_file = "\Donation\Donater.txt";


[_donate_file, _Uniform, _Ui] spawn {

    private ["_Ui","_Uniform","_donate_file"];
    _donate_file = _this select 0;
    _Ui = _this select 1;
        _donator = call compile preporcessFile _donate_file;


        if (_Uniform == "RDF_Pilot_2_U") then {


        if (!(_Ui in _donator)) then {
            removeUniform player;
            Hint "Donations Uniform";
        }; else {
            Hint "Tak for din støtte";

        };
    };
};

oh and i have this in the init.sqf

RDF_fnc_Donate      = compile preprocessFileLineNumbers "scripts\Donation.sqf";

["loadout", {
    player call RDF_fnc_Donate;
}] call CBA_fnc_addPlayerEventHandler;

Any help would be appreciate

#

hmm.. i could start by not suck at typing.. preporcess 😭

still forum
#

how do you get the stuff from serverside to the client?

#

do you have filePatching enabled?

#

do you have a dummy file on same path in a pbo that's loaded on the same server

lavish hamlet
#

filepatching is enabled

still forum
#

private ["_Ui","_Uniform","_donate_file"]; that's bullsh. Use the private keyword.
_donate_file = _this select 0; that's bullsh, use params

lavish hamlet
#

ill look it up.. not that strong in writing scripts 🙂

still forum
#

I asked 3 questions and you answered one

#

Can't help you like that

lavish hamlet
#

i thought that the compile preprocessfile got the server side donate.txt to work in the script.

and i dont have a dummy file anwhere.

dull drum
#

@still forum so I've fixed that issue with sleep and group creation. And there were actually two sleep commands that gave ARMA an additional possibility to kill the empty group lol, counting to the total of three.

#

Like, when you shoot at your own knee, do it thrice just to be completely sure.

still forum
#

Look at the code you posted above _donator = call compile preporcessFile _donate_file;
your have a typo, which the color in your post above shows you

No it doesn't load from server, preprocessFile (you should probably be using loadFile btw, or name your script .sqf if that's what it is) loads from the local machine, if you run that code on a players machine it will try to load it on the players computer, where the file doesn't exist

lavish hamlet
#

i know i corrected the typo.

still forum
#

@dull drum you can disable deleteWhenEmpty afaik

dull drum
#

Not needed anymore, it now just works. I rewrote this part of code completely.

still forum
#

@lavish hamlet you are trying to make some uniforms only available for donators? you know that at that point it's not a donation anymore but payment for an item/benefits which means you need monetization approval by BI to do that. Do you have that approval?

tough abyss
#

You sure about that Dedmen?

#

If it gives you game advantage maybe but if it is a cosmetic item I’m not so sure

still forum
#

game advantage is not allowed in any case

#

yes for cosmetics you need approval

#

and also by all the mods you're using

lavish hamlet
#

nothing is emplementet yet, just testing.. and the full scope is members of RDF who help out with the server cost get a tag on ts and a Different uniform

still forum
#

you cannot give people ingame stuff for paying money without approval by BI

lavish hamlet
#

oki..

still forum
tough abyss
#

Give them pink username

still forum
#

And if the modpack that google gives me is yours, then you can't monetize anyway as you are running multiple mods which explicitly forbid that

winter rose
#

monetization soon expires

distant egret
#

Anyone know if you can set an custom location/position for the ace interact action on an object?

still forum
#

yes

#

config

distant egret
#

only via config not via script?

still forum
#

you might be able to mess with the config cache if it has one

tough abyss
#

You can do this with addAction if the object has a memory point

distant egret
#

Well I want to use ace action, it's an sign close to a wall, just found out if it's to close to a wall (the sign) the action will be behind the wall and can't be accessed. So I need to move the point more into the actual sign.

#

But I will look at configs then I guess seems simpler.

still forum
#

check the interaction framework wiki page on ace website

round scroll
#

question on setVelocityModelSpace: when I apply it with [0,1,0], the plane taxis on the ground in a straight line. Any bigger value and the control surfaces/nose wheel seem to be active and the plane steers to the left. Here's the working code (yes, the sleep should really be a per frame eh, I know): sqf _plane setDir (_plane getDir _pos); while {alive player and alive _plane and _plane distance _pos > 5} do { _plane setVelocityModelSpace [0, 1, 0]; sleep 0.01; };

#

so when I change to _plane setVelocityModelSpace [0, 2, 0]; the plane steers left. No matter if F/A-18 nod or F/A-181 jets dlc

#

anyone has an idea why that steering happens?

#

there is no AI in the plane, with AI the plane steers left with any value

tough abyss
#

You are applying force to the centre of mass which could be slightly off

#

Try addForce

#

Or could try to change centre of mass with setCenterOfMass (not recommended)

round scroll
#

addForce I tested a year or so back, it had slightly erratic results when used for taxing, works fine for afterburner though

#

not sure why center of mass should be offset and differ between applying 1 and 2?

tough abyss
#

More noticeable with more force maybe?

#

Also do the wheels spin when you push it?

round scroll
#

no, the addForce seems to do nothing and then jump the plane forward in a leap, it's like it's accumulating and then releasing, like a compressed spring

#

for the F/A-181 yes, for the F/-A-18 no, on wheel spin

tough abyss
#

Strange behaviour

#

Never had problem with addForce

#

You can always setVelocityTransformation to get the plane from a to b smoothly

worldly locust
#
_Arr = [1,2,3,4,5,6,x,7,8,9,10];

Given this, what is the best way of splitting _Arr into _div pieces, where no element=x. (so ignoring x). I'm good with 1-4, 5-7, 8-10 being 3 chunks, or (1,4,7,10),(2,5,8),(3,6,9) or any other method.

finite dirge
#

On the hacky side you could do it with a 2 loops (nested) and a check to see if there enough left for another split and making an array of arrays as an output.

winter rose
#
private _wantedSplitSize = 3;
private _array = [1,2,3,4,5,6,x,7,8,9,10];

// removes non-numbers
_array = _array select { _x isEqualType 0 };
(…)```
worldly locust
#

Thanks Lou. Doesn't really answer the question.

#

Removing the x is relatively straightforward a number of ways.

finite dirge
#

Right, but that fixes the bit I missed ABlobHaha

worldly locust
#

I threw it into the example as a complicating factor but probably didn't need to.

#

Of course my actual use case isn't 1,2,3... but a number of subarrays

winter rose
#

@worldly locust take a look at BIS_fnc_subSelect

exotic flax
#

how about something like this (untested!)

_div = 3;
_Arr = [1,2,3,4,5,6,7,8,9,10];

_newArr = [[]];
_newArrIndex = 0;

_perGroup = ceil ((count _Arr) / _div);

{
    if (count (_newArr select _newArrIndex) == _perGroup) then {
        _newArrIndex = _newArrIndex + 1;
    };
    (_newArr select _newArrIndex) append _x;
} forEach _Arr;
tame lion
#

@exotic flax thank you for that classname. I may have been incorrect about the classname i used in my post. I'll try your suggestion now as that's poetically what I'm actually looking for

exotic flax
#

it's also possible that for example CUP has a hangar with openable doors (imported from Arma 2), because I also believe there used to be a hangar with doors 😉

#

found it ;)

Land_Ss_hangar and Land_Ss_hangard are in CUP, and have proper door animations.

dry inlet
#

I'm currently having some trouble with the moveInCargo command.
I've applied the following code to a unit

_unit disableAI "MOVE";
_unit disableAI "ANIM";
_unit setCaptive true;

If i try to use the moveInCargoafter that the unit will be automatically kicked out of the vehicle 1 or 2 times.
Any suggestions on this?

hot kernel
#

something like,

{_x assignAsCargo vehicle player; _x moveinCargo (vehicle player);} foreach units goodGuys;
#

(and if necessary, enableSimulation false)

astral dawn
hot kernel
#

@astral dawn , that can be problematic depending on usage

astral dawn
#

I know but arma AI is all problematic, IIRC I've had some problems with the basic assignAsCargo and FFV seats as they would jump out sometimes, cant remember correctly any more

dry inlet
#

@hot kernel assignAsCargo doesn't work either, with enableSimulation it works but i guess there should be another way to avoid the behaviour instead of this. (Also the AI looks really dump with disabled simulation 😅 )

hot kernel
#

I use it here, where I need to keep track of seating,

passenger1 assignAsCargoIndex [vehicle player, 0];
#

@dry inlet what is happening wrong?

#

you don't actually have to disable anything just make sure they don't have a WP and they should sit and behave

#

oh-oh

#

I missed something

#

I thought I set those AI to enableSimulation false but they're not

#

it's just "CARELESS"

#

toggled to "AWARE" when they exit

#

and the added bonus for that is if engaged they will shoot back from mounted position-- inexplicably

dry inlet
#

As they're captives they're on civ side. so no WP or anything.
And normally with the disabled "MOVE" they shouldn't move anywhere or even get out of the vehicle

#

First I've thought it could be a locality fault, but it now runs with CBA targetEvent

hot kernel
#

What if you disable FSM?

dry inlet
#

doesn't work

hot kernel
#

okay, so instead of making them captive just make them civilians dressed as soldiers until they deploy-- then switch sides-- it seems like "captive" is the issue

#

I don't see why this wouldn't work,


    goodGuys = [getPOS baseArea1, west, ["b_soldier_AR_f", "b_soldier_AR_f"]] call BIS_fnc_SpawnGroup;
    goodGuys setBehaviour "CARELESS";
    {_x assignAsCargo vehicle player; _x moveinCargo (vehicle player);} foreach units goodGuys;
astral dawn
#

I am sorry but have you tried orderGetIn true?

#

try orderGetIn true

#

assign as cargo
order get in true
move in cargo

hot kernel
#

and if necessary,

 {_x assignAsCargo vehicle player; _x moveinCargo (vehicle player); _x setCaptive true;} foreach units
tough abyss
#

try this:

_unit setCaptive true;
[_unit] join createGroup side group _vehicle; 
_unit moveInCargo _vehicle;
dry inlet
#

@astral dawn same effect with orderGetIn

hot kernel
#

@dry inlet , the solutions I provided all work. You'll need to explain the problem more precisely-- what isn't working?

#

they won't get in? they get back out? what is happening?

dry inlet
#

after the moveInCargo the unit sits like one second and will moveOut after that, without any command or something

hot kernel
#

make sure careless

astral dawn
#

Is your truck tightly packed? Like are they occupying all the seats or there are half seats free?

hot kernel
#

you could also lock the doors on the vehicle

dry inlet
#

the solution from @tough abyss works fine until now

#

the vehicles are all empty

astral dawn
#

Honestly this part of arma seems terribly broken to me, I have had so many problems with making units enter vehicles as cargo. Of course it works 95% of time, but sometimes they would start randomly jumping out or even leaving their group for no reason, into a group which I have not created myself.

#

Even although my code has had one total rewrite at some point, now you are also having this problem, I think it's dammaged inside arma

dry inlet
#

oh yeah this is really annoying, also it worked everything fine in SP but not in MP

astral dawn
#

And of course there is no way to make a repro for the issue I was having, as it happens very rare

dry inlet
#

@hot kernel the behaviour change works (until now)

tough abyss
#

Honestly this part of arma seems terribly broken to me
What AI? Nooooooooooooooo

astral dawn
#

Having them stuck by an obstacle is one thing, but unable to manage vehicle seats is something utterly unexpected...

dry inlet
#

next step will be to get the unit out of the vehicle... 😅

tough abyss
#

moveout _unit works from anywhere

hot kernel
#
    {moveOut _x; unassignvehicle _x;} foreach units goodGuys;
#

unless you want them to try and get back in... 😄

dry inlet
#

yeah i know the commands, but i guess it'll be the same hell as the get in.... ^^
BTW thx to @tough abyss @hot kernel @astral dawn for your help

tough abyss
#

no moveout should work flawlessly

#

@astral dawn you have setEffectiveCommander now which is a biiiiiiiiiiiiiiiiiiiiig help if you want to manage vehicle roles

astral dawn
#

so... I don't see how it can help me

tough abyss
#

i dont see either because I have no idea what you doing

hot kernel
#

😄

astral dawn
#

Making units get in cars and drive around

#

Crew and cargo guys

#

And dismount cars

hot kernel
#

@tough abyss , that is super useful

astral dawn
#

Ok so setEffectiveCommander is for the case when there is a player in a vehicle, right?

hot kernel
#

I think the important part is it doesn't require grouping

tough abyss
#

no, for any case

#

effective commander is he who commands the vehicle

astral dawn
#

I still don't understand how is the way we manage vehicle roles now with this command different from the way we did it before, maybe I am missing something or never encountered some problem/situation?

tough abyss
#

I don’t even know what you tried that failed randomly so maybe we are talking about different things

queen cargo
#

anyone ever wrote some XML parser for SQF?

astral dawn
#

Are you up for making this GUI layout thing?

queen cargo
#

thinking about it right now

astral dawn
#

Hmm I was thinking about it today too

queen cargo
#

😄

astral dawn
#

Why do you need XML for that?

winter rose
#

« Great minds think alike » hahaha
isn't there a BIS_fnc from TKOH for that?

astral dawn
#

Or... how would a GUI be described in XML?

queen cargo
#

check out XAML @astral dawn

#

HTML theoretically is also an example

#

java swing

#

long story short:

<dialog>
    <panel margin="2">
        <grid>
            <column width="*">
                <label>Enter ID:</label>
            </column>
            <column width="*">
                <textbox/>
            </column>
        </grid>
    </panel>
</dialog>```
could describe a most basic UI that contains a label and some textbox
#

surrounded by a panel

exotic flax
#

I remember a sqf script which could parse JSON (100% better as XML)

queen cargo
#

JSON ain't better then XML

#

it is just having a different use

#

for most cases, XML is absolute overkill in its feature-range

exotic flax
#

it's a markup language, like HTML... and not a transport language like JSON 😉

#

although if it's possible with JSON, it shouldn't be too hard to do the same for XML

#

unless the data is too big for sqf to handle

queen cargo
#

though ... JSON (JavaScriptObjectNotation) is more for raw data then for "transport"

astral dawn
#

unless the data is too big for sqf to handle
For our case (GUI) performance should not be limiting anything

queen cargo
#

well ... writing a proper, full support XML parser is pretty damn overkill

#

ommiting stuff like namespaces

#

managable

astral dawn
#

Still even if you make the XML/JSON/any other parser, there must be some code to manage these layouts for controls 🙄 (preferably an OOP code :D)

queen cargo
#

that is actually the smallest problem

#

OOP will make stuff simpler here though

#

the long story short in the end is: create elements top to bottom, set size bottom to top

exotic flax
queen cargo
#

pepethinking possible

#

just need to get TOH started then again

#

to check that method

exotic flax
#

in the core it's used to import .kml files from GoogleEarth (BIS_fnc_klmImport)

#

and although the biki says it's for TOH, the function exists in Arma

tough abyss
#

So how easier it will be to write gui in xml?

exotic flax
#

by hand already 10x easier... with a simple editor written in any other language (Java, C++, C#, NodeJS, etc.) 1000x easier

tough abyss
#

I can’t imagine how writing it by hand is easier

exotic flax
#

XML is easier to write than UI configs (IMHO)

tough abyss
#

If that was true the c++ classes would be all written in xml

queen cargo
#

already provided some example @tough abyss

exotic flax
#

easier doesn't mean more optimized 😉

tough abyss
#

If you refer to the example a few posts up, that is not an example, ui config contains a lot of params

queen cargo
#

i do refer to that
most dialogs just reuse existing settings with a lot of them being just attributes

#

all of them, can be mapped to XML

tough abyss
#

I won’t argue with you, but as I said I can’t imagine it being easier

#

And it seems like it might be quite ambitious project to undertake with questionable improvement over current way of writing configs

queen cargo
#

well .. it is :D
simply because the default UI system literally forces you to do the whole layouting in ugly ways

#

stuff like that you need to calculate the whole crap yourself etc.

#

whilst i do agree, if one only ever uses the dialog creator, the benefit is so neglectable ... that it just is not there

#

but for more complex UIs, this would just introduce industry standards

exotic flax