#arma3_scripting

1 messages ยท Page 526 of 1

fleet hazel
#

Guys. I have a query for sql_custom

SQL1_INPUTS = 1
OUTPUT = 1, 2-String, 3-String, 4-String, 5, 6, 7, 8, 9-String, 10```
Creating a query:
```_query    =    format ["gangInfoWest:%1", 1168];
_queryResult = [_query,2] call Test_database_asyncCall;```
And I have error:
```[11:02:13:832960 +03:00] [Thread 12616] extDB3: SQL_CUSTOM: Trace: UniqueID: 112 Input: gangInfoWest:1168
[11:02:13:833357 +03:00] [Thread 12616] extDB3: SQL: Error extDB3Exception: SQL Invalid Number of Inputs Got 1 Expected 2
[11:02:13:833393 +03:00] [Thread 12616] extDB3: SQL: Error extDB3Exception: Input: gangInfoWest:1168
[11:02:13:855055 +03:00] [Thread 14932] extDB3: Input from Server: 4:112
[11:02:13:855110 +03:00] [Thread 14932] extDB3: Output to Server: [0,"Error extDB3Exception Exception"]```
Column id and cop_gang have the same values.
#

How to make 1 value used 2 times.

#

I don't want to duplicate the value in the request.

#

Solve the problem. Made:
SELECT id, owner, deputy, name, (SELECT count(*) FROM players WHERE cop_gang=gangs.id) as memberscount, maxmembers, bank, info, license, warpoints FROM gangs WHERE id=? LIMIT 1;

cosmic lichen
#

Was BIS_fnc_establishingShot changed on current dev? I am getting this error

#

*12:24:28 Error in expression <mitted BIS_fnc_establishingShot_fakeUAV || !(isNil "BIS_missionStarted")};

BIS_>
12:24:28 Error position: <|| !(isNil "BIS_missionStarted")};

BIS_>
12:24:28 Error Type Bool, expected Bool
12:24:28 File A3\functions_f\GUI\fn_establishingShot.sqf [BIS_fnc_establishingShot], line 247*

tough abyss
#

Dev or stable?

cosmic lichen
#

dev

tough abyss
#

Ok good find need to fix ASAP

#

Probably related to waituntil

cosmic lichen
#

I see.

tough abyss
#

Shouldnโ€™t error unless the camcommited before returned nil

#

How to repro? @cosmic lichen

cosmic lichen
#

Good question.

#

It sometimes happens on mission start. Sometimes it doesn't

#

It's definitely caused by the new parameter "_waitTime"

tough abyss
#

Ok it is related to deleted camera

#

The fucking camcommited returns nil when camera is null

#

facepalm

cosmic lichen
#

๐Ÿ˜„

leaden parrot
#

Is there a way to catch a layer from the eden editor so I don't have to manually fill in an array with every single item i want to have in there? ( I want to attach an addaction to all objects in one of my layers.

ebon ridge
#
#define MUTEX_SCOPED_LOCK(mutex) for [{private _runOnce = true; waitUntil {(mutex pushBackUnique 0) == 0}}, {_runOnce}, {mutex deleteAt 0; _runOnce = false}] do

MUTEX_SCOPED_LOCK(_mutex) {
   // blah blah
};

This should work right?

astral dawn
#

What is this thing?

ebon ridge
#

Just a nicer way to do MUTEX_LOCK / MUTEX_UNLOCK

#

I hope

#

exploiting for[] syntax so I can run something before and after scope

astral dawn
#

But we already have a mutex and it's simple as hell ๐Ÿค”

ebon ridge
#

This is based on that but better

#

Typically mutex locking in other languages is done using automatic scope based locking

#

This emulates that, you won't ever have a problem with unlock not being called, it code is clearer, and merges won't break it

astral dawn
#

You mean that it goes out of scope on its own and unlocks?

ebon ridge
#

yeah

#

The scope is the body of the for loop.

astral dawn
#

Oh I think I understand how it works now, yes it looks great and I think it should work

ebon ridge
#

for[a, b ,c] do { x } runs like
a; while(b) do { x; c }

astral dawn
#

I only hope that for is atomic but it should be ๐Ÿคฃ

ebon ridge
#

which bit would need to be atomic?

#

the single statements are identical to how they are in MUTEX_LOCK and MUTEX_UNLOCK, and the rest doesn't require atomicity I don't think

#

It would look like:

private _runOnce = true;
MUTEX_LOCK(_mutex);
while { _runOnce } do {
    // blah
    _runOnce = false;
    MUTEX_UNLOCK(_mutex);
};```
astral dawn
ebon ridge
#

sure, I will add it to the main test set as well

astral dawn
#

That's a damn good macro if it really works

still forum
#

what use does the isDead variable have?

#

why not directly count alive _x ?

#

what part is not working?

quartz coyote
#

Well I didn't know of any other way to check if all entities in an forEach were returning true so... that's why I'm asking. maybe you can help me make it more simple.
I'm not getting the "effect" :

_thisMan playActionNow "Surrender";
 _thisMan setCaptive true;```
still forum
#

Well I didn't know of any other way to check if all entities in an forEach were returning true so...
You did that tho
{_x getVariable ["isDead", false]} count _serroundingList; you are counting the ones that are true

#

But might aswell just count the ones where alivee _x is true

quartz coyote
#

ooooooooooh

#

true

#

indeed

still forum
#

The effect doesn't work... Have you tried just adding some logging to see what the script does?

quartz coyote
#

Nope. will do that !

#

i'm not familiar with logging

still forum
#

diag_log or systemChat

quartz coyote
#

i'll try to get more into it

#

systemChat yes.

#

but didn't know diag_log

#

i'll check

#

thanks man

#

oh hold on

#

how do I count the ones where alivee _x is true

still forum
#

Just like how you counted the ones where the variable isDead is true

quartz coyote
#

private _allSerroundingDead = {alive _x} count _serroundingList; ??

still forum
#

yes

quartz coyote
#

so

still forum
#

Surround btw

quartz coyote
#

it I want it to exitWith only if they are NOT alive then would private _allSerroundingDead = {!alive _x} count _serroundingList; work ?

#

yes sorry about spelling

still forum
#

yes

quartz coyote
#

cool thx

#

nothing happening

still forum
#

format [systemChat "%1 has surrendered",_thisMan];

#

uh.

quartz coyote
#

systemChat format ["%1 has surrendered",_thisMan];

#

never the less, it doesn't work either

umbral nimbus
#

is there any command which creates an object (missle) and tracks a target, asif it was target.

#

in VBS its possible through the createShot command. is there something simmelar I missed?

#

oh wow. I just sumbled uppon this

#

BIS_fnc_moduleCreateProjectile

#

anyone knows more about?

quartz coyote
#

nope. just open the script, you'll see what it does ? :/

umbral nimbus
#

I will then

still forum
#

If your logging doesn't happen. Add more logging

#

find the point where it stops working

quartz coyote
#

@still forum I found out why it's wasn't working.
It wasn't even executed...

#

๐Ÿคฆ๐Ÿผ

quartz coyote
#

would it be because it's created but the captive unit ?

#

I mean in a script space of the mission that can't be accessed by player ?

still forum
#

I mean in a script space of the mission that can't be accessed by player ? what?

#

player distance _thisMan undefined variable

#

Should I repeat what I just wrote?

quartz coyote
#

I've used this Hold Action a large amount of times and it has always worked...

#

So maybe explain which argument you are talking about

still forum
#

I did

quartz coyote
#

because to me... everything is right ...

still forum
quartz coyote
#

oh right okay.

#

but ...

#

ohh...

#

okay I see what I forgot

#

indeed it's passing code

winter rose
#

@still forum could you add a red circle please

quartz coyote
#

and in that code, _thisMan is undefined

#

I got it

#

thx

leaden parrot
#

https://community.bistudio.com/wiki/removeAction

This command has local effect. The action will only be removed on the computer that executes the command.

So does this mean that I can't remove an action for every player that would look at an object?

still forum
#

you'd need to remoteExec if you want to remove for all objects

#

but you need the ID of the action. And every player might have a different one

leaden parrot
#

dang. What I wanted was to make a "move and drop" script so players on the server can move some objects around.

But that seems pretty impossible for me to do if I somehow have to find a unique ID per object per player and then give them an addaction/removeaction

#

hmm.. Could I instead give the objects both the "place" and "drop" action and just keep them there ? then I dont have to add or remove something from it aand fiddle with those ids?

wild flint
#

Would declaring the action in a global variable help in that regard?

astral dawn
#

@leaden parrot or you can give action to player itself, and in the condition field of the action specify when the action is available

#

and condition will be checking if player is currently carrying some object...

high marsh
#

@leaden parrot don't add the action to the object. Add a action to each player that has a condition that checks if the object is attached. Then and only when the condition is met, it will show the action.

keen bough
#

woopsie. I called a function the same function which calls the same function.... i would say, memorykill? ๐Ÿ˜„ Game crashed ^^

tough abyss
#

on call call this [ call "call this" ];

astral dawn
#

I guess you've got a Stack Overflow

dreamy kestrel
#

does anyone know of a way to programmatically get the player steamid? is that getPlayerUID?

high marsh
#

getPlayerUID is their steam64 yeah

dreamy kestrel
#

thanks @high marsh ๐Ÿ‘

keen bough
#

alright, i am so glad i dont have to crate my own list where i can place soldiers in houses ^^ Allthough i would get much better positions tacticalwise but heck, enemy squadleader could be a douche and place a guy right within a shops big window - because 'eff that soldier!'

Anyway. Is there kind of a way to check for "the next street"-part of a street? Like a connects to b, b connects to c and d and so on?

So i could actually make kind of a navigation system (i would know way arounds - kind of but maybe i did not find a suitable command)

#

yeah, i will do a 'tactical_list' of building positions. But its time consuming to i want to first get my mission generator up and running with the basics.

#

still i have that street-"problem" finding connections or something like that.

leaden parrot
#

@astral dawn & @high marsh

I could try and do that, but not entirely sure. And if I add an add action to a player, everyone who looks at that player would get the option to use that action, right?

leaden parrot
#

Sorry I'm just new to all this so it's not going that fast

still forum
#

Fast?
Gimme my setVelocityModelSpace! FAST! PEW PEW

winter rose
#

Dedmen setVelocity [0,0,10e10];

tough abyss
#

Nope, doesnโ€™t work. You need [Dedmen, [0,0,10e10]] remoteExec ["setVelocity", ๐Ÿ‡ฉ๐Ÿ‡ช];

ebon ridge
#

Is there some way to clear the current arma rpt file either via script or in editor setting (e.g. "Clear log on mission start" or something)?

still forum
#

no

leaden parrot
#

If I want to send a hint to all players on my server how do I do that? as far as I've tested and read, hint is not firing to every player

winter rose
#

@leaden parrot remoteExec

leaden parrot
#

so I can straight up do remoteExec hint "MyText"; doesn't need some other stuff than the hint?

robust hollow
#

thats not how it works ๐Ÿคฆ

#

"MyText" remoteExec ["hint"];

still latch
#

Hello, here.
Guide me, pls.
Is there difference in terms of performance between
suit-up units with

removeAllWeapons 
removeAllItems
removeUniform 
...
player addVest 'rhs_6b23_6sh116';
(vestContainer player) addItemCargoGlobal ["rhs_30Rnd_545x39_7N10_AK", 6];
...

and
A3 loadout system?

What is faster?

leaden parrot
#

Aight Connor thanks. I'll try that

still forum
#

what is "A3 Loadout system" ? @still latch

still latch
quartz coyote
#

Hello. Any known issues with playSound3D ?
I'm encountering an issue :

playSound "whistle"; //This works fine
playSound3D ["\Sounds\whistle.ogg", _soundSource, false, getPos _soundSource, 1, 1, 200]; //This doesn't work at all```
ornate marsh
#

im back, so now im struggling on tasks. I've created a task, and now I want it to be completed after 300 seconds. I know I need to use ```sqf
["BIS_task_01","SUCCEEDED"] call BIS_fnc_taskSetState;

quartz coyote
#

@ornate marsh a trigger that's set to timeout after 300s or a script with a Sleep 300; ?

still forum
#

@still latch setUnitLoadout is a single command. The other stuff is many commands.
So yes. There is a difference

ornate marsh
#

@quartz coyote yea figured out myself somehow, im working on some other scripts related to tasks so if i struggle I'll come back to you

still latch
#

@still forum yes. but what if this command calling same removeAllWeapons commands plus config parsing ones. ๐Ÿ™ƒ

tested. 180 units with same loadout
760ms vs 215ms
thank you for profiler

ornate marsh
#
_completed = "defendGasStation" call BIS_fnc_taskCompleted;
if (_completed = true) then
{ 
    [] spawn {sleep 300; ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState; };

};

So i'm working on this script and i have a missing ) somewhere

still forum
#

_completed = true that's nonsense

#

you are setting a variable, not checking it

#

and == true also makes no sense.

#

as x == true is the same as x or as x == true == true == true == true == true == true == true == true == true

ornate marsh
#

im wanting to check if _completed is true

quartz coyote
#

What he means is keep only _completed

ornate marsh
#

im used to python and thats how python checks variables

quartz coyote
#

if _completed is true then _completed itself is sufficient

#
_completed = "defendGasStation" call BIS_fnc_taskCompleted;
if (_completed) then
{ 
    [] spawn {sleep 300; ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState; };

};```
high marsh
#

The var holds the evaluated true or false value

ornate marsh
#

actually, funny story, i want to change the _completed on the 2nd line to _activated, as that checks whether the task is assigned

#

but that variable is in the trigger, whereas that code is in the init of the task creator module

#

also @quartz coyote is there anyway to countdown the seconds

quartz coyote
#

you mean in the trigger ?

#

or in script ?

ornate marsh
#

essentially i want the 300 seconds to countdown as the sleep script is working, so player know how long they have to defend

#

if (_activated) then 
{  
    [] spawn {sleep 300; ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState; }; 
 
};
else
{

    hint "Defense countdown reset";
};

Now i have a missing ; somewhere

high marsh
#

Make a control

quartz coyote
#

have that somewhere. a basic hint that would suit. wait one

high marsh
#

CtrlCreate, subtract a second through each itteration.

ornate marsh
#

do you know where the missing ; is? says its toward the end somewhere

quartz coyote
#

@ornate marsh it's not a missing one

high marsh
#

You have a semi colon adter if statement

quartz coyote
#

it's one too much

high marsh
#

Remove the one before else, it acts as a secondary path if the condition is mot met

ornate marsh
#

ah yeah got you

quartz coyote
#
if (_activated) then 
{  
    [] spawn {sleep 300; ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState; }; 
 
} //NO SEMI HERE
else
{

    hint "Defense countdown reset";
};```
ornate marsh
#

i have a trigger which, when entered, spawns in some walls, creates a task, and then assigns it. The task is created throught the CreateTask module, which is synced to the wall-spawning trigger. The trigger then runs this code when a player enters the trigger ```sqf
["defendGasStation","ASSIGNED"] call BIS_fnc_taskSetState;
_activated = true;

which in turn tells the module that it should start the timer ```sqf
if (_activated) then 
{  
    [] spawn {hint "Timer Started."; sleep 300; ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState; }; 
 
}
else
{

    hint "Defense countdown reset";
};

It is successfully creating the task, spawning in the walls etc. But it doesnt assign the task and the hint doesnt pop up to tell me the timer has started

#

can the _activated be passed over between init boxes? cause i think its not executing the script because it isnt receiving the _activated variable

high marsh
#

Lol, no. Activated is not a global or public variable in this case. An underscore is identifying of this.

ornate marsh
#

ah ok, so if i removed the underscore would that work

#

or do i have to do something else

high marsh
#

If it's set and used on the same local client yes

#

Use publicVariable if you want it everywhere

#

It'll broadcast the variable to server/client

ornate marsh
#

would i do sqf ["defendGasStation","ASSIGNED"] call BIS_fnc_taskSetState; publicVariable activated = true;

high marsh
#

What is inside the variable activated anyways?

ornate marsh
#

true once the person enters the trigger, then false when they leave

high marsh
#

If it's just the task state, call it again on your "other" init box

#

But, once your trigger gets activated it has to be true for every connected trigger. So when is it going to be false and at the same time be activated?

ornate marsh
#

essentially the task is assigned once entering the trigger, the activated variable is then assigned true, which tells the task to start the timer. if the player leaves the trigger the activated variable is set to false and the countdown resets

high marsh
#

Then the only thing you need to store is the counter and the state of the task. Nothing else.

ornate marsh
#
activated = "defendGasStation" call BIS_fnc_taskState;
if (activated) then 
{  
    [] spawn {hint "Timer Started.";sleep 300; ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState; }; 
 
}
else
{

    hint "Defense countdown reset";
};
#

is this looking right

high marsh
#

Sure.

#

As long as the task exists.

ornate marsh
#

now i need the if statment to start the timer if the task is assigned, and reset the countdown if leaving the trigger. Any ideas?

high marsh
#

Store the time left in a variable, set it to 300 on the deactivation

ornate marsh
#

i'd have to make it a publicVariable to get it across from the trigger to the module wouldnt i?

high marsh
#
[this] spawn {
    params["_trigger"];
    If(isNil {_trigger getVariable "TimeLeftCountdown"}) then {
        timeLeft = 300;
    } else {
        timeLeft = _trigger getVariable "TimeLeftCountdown";
    };
    for "_i" from 0 to 301 do {
        timeLeft = timeLeft - 1;
        _trigger setVariable["TimeLeftCountdown",timeLeft,true];
        hintSilent parseText format["Defend the base <br/> Seconds left: %1",timeLeft];
        sleep 1;
    };
};
```
On Activation
#
this setVariable["TimeLeftCountDown",300,true];
#

You can modify the activation code to display the current countdown

ornate marsh
#

would that be ```sqf
hint "You have",timeLeft,"seconds left"

high marsh
#

I've modified the code above to reflect this

ornate marsh
#

so then in the if statement in the task, how would i 1) check whether the task is assigned 2) if so, start the countdown 3) if not, reset the countdown back to 300

#

for that script at the top, it says "undefined variable in _trigger" or something like that, and the timer in the hint goes super fast to -2

high marsh
#

Forgot to add suspension

#

But this should be a reference to the trigger

#

Should be fine inside trigger inkt

ornate marsh
#

timer is going at the right speed, but the same undefined variable thing pops up. Now how do i reset the timer when leaving the trigger?

#

the thing is, I want the countdown here

acivated = "defendGasStation" call BIS_fnc_taskState;
if () then //activated equals ASSIGNED
{  
 
 //countdown starts here  
 
}
else //if countdown equals CREATED
{

//countdown stops, resets to 300

};
#

i only want the task to be assigned in the trigger "On Activation", and then the task is deassigned in "On Deactivation"

#

then the script above handles the countdown

#

in the createTask module init

high marsh
#
0 spawn {
acivated = "defendGasStation" call BIS_fnc_taskState;
if (activated) then 
{
    timeLeft = 300;
     waitUntil
    {
        timeLeft = timeLeft = timeLeft - 1;
        sleep 1;
        hintSilent parseText format["Defend the base <br/> Time Left: %1",timeLeft];
        timeLeft == 0 || killTimer
    };
}
else
{
    timeLeft = 300;
    killTimer = true;
};
};
#

I'm on mobile right mow and have zero compiler or editor, but you should get the idea now

ornate marsh
#

yea sorta, missing ; near the sleep 1 somewhere, how would i check that the activated variable = ASSIGNED

high marsh
#

_tsk = taskState "BlahTask"

#

if(_tsk == "ASSIGNED") then { }

ornate marsh
#

thats what the activated varible does though? so couldnt i just do if (activated == "ASSIGNED then { }

high marsh
#

Yes, activated was never a boolean

ornate marsh
#

it was way before

high marsh
#

Well when you assigned it to true yes, then it would always be true no matter what. It also served zero purpose

#

It was like doing:

If(true) then {
    _blah = true;
};
ornate marsh
#

yea realised that now ๐Ÿ˜†

#

still a missing ; somewhere, near the sleep

#

or one too many

#

nvm fixed

#
0 spawn { 
BEN_activated = "defendGasStation" call BIS_fnc_taskState; 
if (BEN_activated == "ASSIGNED") then  
{ 
    timeLeft = 300; 
     waitUntil 
    { 
        timeLeft = timeLeft - 1; 
        sleep 1; 
        hintSilent parseText format["Defend the Gas Station <br/> Time Left: %1",timeLeft]; 
        timeLeft == 0 || killTimer;
    };
    ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState;
} 
else 
{ 
    timeLeft = 300; 
    killTimer = true; 
};
};  ```
EDIT: Now the timer isnt working or even showing up -_-
#

@high marsh

still forum
#

you should really start reading the wiki dude

#

missing left argument

#

activated = "defendGasStation" call BIS_fnc_taskState;
Don't use global variables without a tag.
Tag like BEN_activated
to make sure you don't get conflicts

ornate marsh
#

now the timer isnt showing up. man scripting is hard

#

from testing it seems like nothing is being stored in the BEN_activated variable

still forum
#

"it seems like"

#

add logging

#

just log everything that seems remotely useful and see what happens

vale sky
#

Hey Guys, do you know if there is any way to Return the Assigned Keys for an inputAction in String format? -nevermind, found it-

ornate marsh
#

systemChat doesnt appear, and when doing hint str BEN_activatedall that appears is ""

winter rose
#

systemChat str ? ๐Ÿ‘€

ornate marsh
#

i was trying systemChat BEN_activated but that wasnt displaying anything

still forum
#

systemChat doesn't display in singleplayer

winter rose
#

it shows in editor though?

astral dawn
#

I'm pretty sure that systemChat works in SP editor

ornate marsh
#
0 spawn {
BEN_activated = "defendGasStation" call BIS_fnc_taskState;
if (BEN_activated == "ASSIGNED") then   
{  
    timeLeft = 300;  
     waitUntil  
    {  
        timeLeft = timeLeft - 1;  
        sleep 1;  
        hintSilent parseText format["Defend the Gas Station <br/> Time Left: %1",timeLeft];  
        timeLeft == 0 || killTimer; 
    }; 
 ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState; 
}  
else  
{  
    timeLeft = 300;  
    killTimer = true;  
}; 
}; 

Still no idea why its not working, tried systemChat but nothing is showing up. Its something to do with the BEN_activated variable

winter rose
#

what does BIS_fnc_taskState return?

ornate marsh
#

Ok so, we have the countdown script working, but now every time i leave the trigger it flashes up "Timer Reset" and then resets back to 300 and count down again. If i go back in it then duplicates and flicks between the first countdown and the new one.

On Activation

0 spawn {
    ["defendGasStation","ASSIGNED"] call BIS_fnc_taskSetState;
    killTimer = true;
    publicVariable "killTimer";
    timeLeft = 300;    
    publicVariable "timeLeft";
    while {timeLeft != 0 or killTimer} do
    {    
        timeLeft = timeLeft - 1;    
        sleep 1; 
        strTime = str timeLeft;
        hintSilent parseText format["Defend the Gas Station <br/> Time Left: %1",strTime];   
    };
    if (timeLeft == 0 || killTimer == false) do {
    ["defendGasStation","SUCCEEDED"] call BIS_fnc_taskSetState;   
    };
}; 
wall1 hideObject false;
wall2 hideObject false;
wall3 hideObject false;
wall4 hideObject false;
wall5 hideObject false;
wall6 hideObject false;
wall7 hideObject false;
wall8 hideObject false;
wall9 hideObject false;
wall10 hideObject false;```

On Deactivation:
```sqf
["defendGasStation","CANCELED"] call BIS_fnc_taskSetState; 
killTimer = false; 
publicVariable "killTimer"; 
timeLeft = 300; 
publicVariable "timeLeft"; 
hint "Timer Reset"; 
wall1 hideObject true; 
wall2 hideObject true; 
wall3 hideObject true; 
wall4 hideObject true; 
wall5 hideObject true; 
wall6 hideObject true; 
wall7 hideObject true; 
wall8 hideObject true; 
wall9 hideObject true; 
wall10 hideObject true;

any suggestions?

#

What im tying to get is the hint/countdown to stop when i leave the trigger, then start again when i enter the trigger again

ornate marsh
#

fixed

keen bough
#

so, @high marsh the if-statement in the codebrackets will be tested only when activating the action. But how would i write it then, so the action shows only when all the requirements are met?

high marsh
#

Waaaaa

#

Read fool

keen bough
#

I ask because i dont understand it. It says it wants a 'String' and default is true (boolean). Or do i have to put in the sqf-file? Like
"test2.sqf" where the test is made and is checked and must return true?

high marsh
#

The code is compiled as a string into usable code.

this addAction [ "Kill everything", { params ["_target", "_caller", "_actionId", "_arguments"]; }, [], 1.5, true, true, "", "alive myTargetThatNeedsKilling" ,50, false, "", "" ];

Since alive myTargetThatNeedsKilling would either return true or false. Your action would show or it wouldn't

#

But it cannot return say an array, number, or text. Has to be a boolean

keen bough
#

can i do a standard if-statement in that? Or a script-file that checks the if-statment iself (would require an item near the person)?

high marsh
#

You don't need an if statement

#

It's already evaluated

#

However, if you want to check an unrelated variable you can

keen bough
#

so if i just write the classname in, it checks it surrounding for it?

high marsh
#

Classname? No.

#

You can change distance activation

#

You can check for object class in the condition

keen bough
#

How would i do it with the object class within the string-quote?

high marsh
#

_originalTarget isKindOf 'Air' , what are you wanting?

keen bough
#

there is an array of objects of one is chosen randomly to be transported to the target. They are a battery, some laptops and a kind of big machine

#

currently i check when the action is triggered, so used, if the item is in reach within the npc.

#

I would do something like this:

_value = 0;
while {true} do {
waitUntil {!isNull cursorTarget};
_curTarget = cursorTarget;


if (_curTarget isKindOf "Man") then {


 _unit = _curTarget;


 if (backpack _unit == "B_LIB_GER_Radio") then {


 _action = player addAction ["Use radio",<scriptfile>,<params>,etc...];


};

waitUntil {(isNull cursorTarget) OR (player Distance _curTarget > 2)};

player removeAction _action;

};
still forum
#

'backpack cursorTarget == "B_LIB_GER_Radio"' as condition in the addAction

keen bough
#

and whats with the item that needs to be, in addition, near the target? ๐Ÿ˜ƒ

winter rose
#

&& nameObject distance cursorTarget < 3

keen bough
#

So it looks like this ```
"'thiscoolitem "my_item_name" distance cursorTarget < 6 && cursorTarget name npc == "Duracellhรคschen"'"

Or without the  -> ' <- ?
winter rose
#

โ€ฆ this is wrong on so many levels! But we will solve that

keen bough
#

i am simply missing some kind of examples for such situations. I mean, normally you write "this (true) do stuff" but while wants it different with "this {true} do stuff"

Thats why i ask so many questions. Because arma is all but easy language usage.

still forum
#

wat

#

normally you write "this (true) do stuff" No that's also wrong on multiple levels

keen bough
#

"if (true) then" "while {true} do"

winter rose
#

Sqf is not an object oriented language.

But I am not sure what exactly is the goal of this script; you want the player to load the item on the back of the AI?

keen bough
#

it was an example how i would achieve something i want, but i know there is a different solution and i want to learn that solution.

#

thats why i wrote the example with the backpack.

#

I want "addAction" that only shows, when you have the specific item near the npc, that is named "Duracellhรคschen" just for testing purpose. And with the item near and the player looking at the npc, then they should see the action.

Currently i have 2 working solutions.

#

1:) i check it after the action was done and have even cool lines of text.
2.) i achieve it over a "while" loop.

#

but there is a 3) - And this 3rd way is within the condition

winter rose
#

add the action to the NPC, with the condition that "npc distance theObject is correct"

keen bough
#
this addAction 
[
    "<title>", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
    },
    [],
    1.5, 
    true, 
    true, 
    "",
    "myObject checkDistance to npc < 6 Meters" // _target, _this, _originalTarget
    50,
    false,
    "",
    ""
];
winter rose
#

"player is looking at npc" is not needed, the action only displays in player's action list when he looks at the npc

keen bough
#

okay, i reedit

winter rose
#

But I guess something like this yeah

#

(sorry, I am not as helpful as usual as I am on mobile and it's past @high marsh )

keen bough
#

So, i ultimatively write

this addAction 
[
    "<title>", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
    },
    [],
    1.5, 
    true, 
    true, 
    "",
    ""this_cool_objectF" distance _target < 6", // _target, _this, _originalTarget
    50,
    false,
    "",
    ""
];

?

#

and no worry ^^ i have already 2 solutions, i just want to learn the last possible solution. I just want to learn everything, instead of just parts.

winter rose
#

no quotes around the object's name and yeah

keen bough
#

testing it with 'bob' my fellow test civillian... Poor Bob. What he had seen is far beyond the realm of cruelity

#

blep ...

#

well, i spawned the object near him which is Land_Map_blank_F and it does not show the action.

winter rose
#

did you name the object?

#

My_Object = createVehicle (โ€ฆ)

And use My_Object in the action condition

jade imp
#

how does one go about making a large array of names or other things that a script can pull from at random?

astral dawn
#

I would make a large array of names that a script can pull randomly

jade imp
#

yeah thats what I'm going for now

#

I wonder if I could just integrate a name generator

astral dawn
#

Do you mean 'how do I write some other program to convert some database I have into a format that SQF can understand'?

#

Or do you mean 'do I better store it in some variable or in config or whatever?`?

high marsh
#
names = [
    "BOB",
    "BOBDUDEBOB"
];
randomName = selectRandom names;
jade imp
#

yeah I'll probably just do that

astral dawn
#

I'm pretty sure you can make a name generator, SQF can manipulate strings

high marsh
#

You sure can. Just need common name bases.

jade imp
#

okay

high marsh
#

"100 common baby names" or something like that

jade imp
#

I'm trying to make a thing that sort of generates identities for a person

#

I got it all down now I think

high marsh
#

I guess, AI already get unique identities based on their side. N

jade imp
#

yeah but I need more than just a name

high marsh
#

Faces and voice packs are unique as well. I assume you're talkiny about players

jade imp
#

yeah

#

Im basically making a thing that generates names and attaches different 'flags' to it and then spits out a list of the names

#

so if you were doing like 'cops and robbers' or something, the bad guys pick a name from the list, the cops can then look it up and it displays the randomly attached flags

high marsh
#
namesOrdered = [
    ["A",[Al,Andy,Archer,Anderson],
    ["B",[Bob,Bobberson,Bob]
];
#
player setVariable["TAG_playerName","Bob",true];

jade imp
#

I'll probably do something like that

high marsh
#

Or store the player UID with name

#
If(isServer) then {
    profileNamespace setVariable["Bob'sSuperSecretUIDAsAString","Bob",true];
};
```
jade imp
#

so after the names, for the flags I want it to have like a 20% chance to pick something, then a 10% chance to pick a second item, and 5% - so on

high marsh
#

Although, I would store an array of information instead of just the name

#

That way you can grab any and all info from servet profile

jade imp
#

yeah I'm making an array now

high marsh
#

If you store it on the server profile, you can use these variables after restart

jade imp
#

I wouldn't need it to persist

#

but it wouldn't hurt

#

can you even use percentages

high marsh
#

Huh?

jade imp
#

like tell it "there is a 20% chance to add X"

high marsh
#

Math

jade imp
#

sweating

#

fine I guess I'll just use math

#

lol

keen bough
#

@winter rose i just named it somewhere _object and not global. I actually could make it global.

jaunty ermine
#

would someone be able to help me out? I've got a script that spawns in aircraft randomly and gets them to fly to a couple of waypoints, but I'm having trouble getting the planes to delete themselves when reaching the end.
this is what I have in the waypoint statement: _wp2 setwaypointstatements["true","{_aircraft deleteVehicleCrew _x} forEach crew _aircraft; deleteGroup _crew1; deleteVehicle _aircraft;"];

keen bough
#

the _aircraft is also created via _aircraft = createVehicle?

jaunty ermine
#

would you be upset if i said it's with BIS_fnc_spawnVehicle ?

harsh sphinx
#

I'm having difficulty understanding how to pass something dynamic within a define that is then using the hash https://community.bistudio.com/wiki/PreProcessor_Commands#.23. Without the hash it's fine and I can parse it as I see fit, but with the hash it strictly enforces what I pass so passing _x literally passes _x into the define and not what _x actually is. Can someone shed light on whether there's a way to achieve what I'm after without changing this define?

keen bough
#

@jaunty ermine Nah, why should i be upset? I am not a super-pro-scripter ^^ I just make things work on a practical side. As far as i know, you either have to name the vehicle (temporary within a script) or you find it again at the end of the script with nearestObject/nearestObjects and delete then.

jaunty ermine
#

ok, so if I were to name it like _posPlane = _aircraft select 0 and use the defined name instead of _aircraft in the delete script that should work?

keen bough
#

I am missing more informations on that, but if you store the planes in a local variable, you can delete them later (with the same script) - that i know for sure.

harsh sphinx
#

@jaunty ermine I don't think you have access to _aircraft within the condition, maybe try something like (vehicle this)

keen bough
#

yes! the driver command! Works absolute fine too.

fluid wolf
#

Ok here's a quick stupid question probably, how can I detect if a specific type of vehicle is near to another, without being able to name one of the two?

jaunty ermine
#

thanks guys, was doing my head in for a while. I'll give these a quick test

fluid wolf
#

Say like, B_Hunter needs to detect when an instance of B_MBT_01_F is within 50 meters, and then do an action.

harsh sphinx
#

Can't you just use a trigger for that? Depends how dynamic it needs to be

fluid wolf
#

I can use a trigger for it, but the trigger still needs to tell when the object entering it is B_MBT_01_F and not anything else

harsh sphinx
#

{typeOf _x == 'B_MBT_01_F'} count thisList > 0 something like that?

jaunty ermine
#

ok, so using (vehicle this) deletes the crew (yay) but not the aircraft (boo)

fluid wolf
#

Possibly, I cant tell exactly what that does just looking at that one though

harsh sphinx
#

it's just a condition within the trigger?

fluid wolf
#

No I get that

harsh sphinx
#

if that vehicle enters it will be true

fluid wolf
#

Ahh ok I see it now

keen bough
#

oooohh XD what the code does XD

harsh sphinx
#

or rather, it will be the amount of that type of vehicle that there is

fluid wolf
#

Ok ok, yea that might be the starting point I was looking for

harsh sphinx
#

but true because > 0

#

it's a little dirty but does the job

fluid wolf
#

Yea, from there I can ID each one and action them

keen bough
#

if its dirty and its works, its clean ๐Ÿ˜„

fluid wolf
#

^ Literally everything I've ever written

harsh sphinx
#

@jaunty ermine can you hint out (vehicle this) and see what it returns? it should be the vehicle

#

otherwise maybe objectParent might be of some success

jaunty ermine
#

@harsh sphinx it shoots out a random string of numbers and characters

harsh sphinx
#

I don't know how that gets processed, but if you're deleting the crew first then you might not be able to reference this anymore since the group leader was removed.

#

Can't you just use setDamage without the effects, or is there something I'm missing with deleting all the crew first gracefully?

jaunty ermine
#

was reading some blog post, they seemed pretty adamant to delete the crew first, I'l try shortening it down to just deleteVehicle

harsh sphinx
#

Alternatively maybe you can just set it as a variable first thing then be able to keep referencing the vehicle.

#

Yeah you should delete the crew first when deleting the vehicle but if you're destroying it I'm not sure if it applies

jaunty ermine
#

im not destroying, i need it to poof out of existence

harsh sphinx
#

but using setDamage on it without the effects is essentially the same thing

#

it will disappear

#

it's just a workaround if you don't have access to the unit to get the vehicle, but I'm sure you could just cast it

fluid wolf
#

Is tehre a way to keep an AI unit firing on full auto? I tried running things like dofire and forcefire but that only causes them to fire a single burst, and if its possible i'd rather not just cast dofire every 0.1 seconds

#

Alright

#

That'll have to do

#

gotta make a new weapon config anyhow

tough abyss
#

@jaunty ermine you can assign vehicle reference obtained from a crew member to a variable, delete crew then delete vehicle by using reference from the variable

#

_veh = vehicle Bob; _veh deleteVehicleCrew Bob; deleteVehicle _veh;

#

Obviously if you have more units than just Bob in it you will need to loop through all deleting them before deleting the vehicle

jaunty ermine
#

ok, so finally got it to work, as trying to reference the vehicle and group by name wasn't working , I used a work around by just using (vehicle this) for the object and have {deleteVehicle _x} forEach crew (vehicle this) + [(vehicle this)] in the waypoint statement. also @harsh sphinx, _veh setDamage [1, False] doesn't seem to work with ACE3's cookoff system

quartz coyote
#

Is there a way to extract an "effect" like hitGroundSoft="ImpactEffectsSmall" and use it to create a particle effect where ever I want ?

#

I have no clue how Addons work so I don't know if it's possible

#

I'd like to create the illusion of a bullet hitting the ground without the actual bullet

winter rose
#

You could create the bullets on the ground, you would have the impact sounds as well?

quartz coyote
#

don't care about the sound for now. just want the effect. How would I do that ?

young current
#

AllInOne config for example

#

And then your typical particle effect commands

quartz coyote
#

well that's a bit too advanced for me

young current
#

? You download the all in one config from forums, look up the config for your favourite effect, turn those parameters into particle effect script.

quartz coyote
#

Ok So I found this but now how do I convert it to a particle effect script ?

    class ImpactEffectsSmall //sources - ["A3_Data_F_ParticleEffects"]
    {    
        class ImpactDust1 //sources - ["A3_Data_F_ParticleEffects"]
        {
            simulation = "particles";
            type = "ImpactDust2";
            position[] = {0, 0, 0};
            qualityLevel = 2;
            intensity = 1;
            interval = 1;
            lifeTime = 1;
        };
[...]```
still forum
quartz coyote
#

Okay so I was indeed looking at drop. thanks

still forum
#

Problem is "ImpactDust2" is not a valid "ParticleType"
I assume it just means it inherits from the ImpactDust2 effect in config so you can take missing values from Dust2

#

I don't have the default values to hand.

quartz coyote
#

So do I keep "Universal" as a particle ?

#

a lot of particle effect I've seen, just use the default Universal particle

still forum
#

Maybe

#

just try around till it works ๐Ÿ˜„

quartz coyote
#

rgr ๐Ÿ˜„

young current
#

I recall cfgCloudlets having the actual particle stuff

quartz coyote
#

Found it :

        class ImpactDust2: Default //inherits 40 parameters from bin\config.bin/CfgCloudlets/Default, sources - ["A3_Data_F_ParticleEffects"]
        {
            interval = 0.005;
            circleRadius = 0;
            circleVelocity[] = {0, 0, 0};
            particleShape = "\A3\data_f\ParticleEffects\Universal\Universal";
            particleFSNtieth = 16;
            particleFSIndex = 12;
            particleFSFrameCount = 8;
            particleFSLoop = 0;
            angleVar = 1;
            animationName = "";
            particleType = "Billboard";
            timerPeriod = 3;
            lifeTime = "1 + (4.2 * dustness)";
            moveVelocity[] = {"(surfNormalX / 2) * inSpeed / 250 * 0.9", "(surfNormalY / 2) * inSpeed / 250 * 0.9", "(surfNormalZ / 2) * inSpeed / 250 * 0.9"};
            rotationVelocity = 1;
            weight = 1.36;
            volume = 1;
            rubbing = 0.15;
            size[] = {0.2, 2.2};
            sizeCoef = 1;
            color[] = {{0.2, 0.175, 0.15, "(0.3 * dustness) + 0.05"}, {0.4, 0.32, 0.25, "(0.21 * dustness) + 0.035"}, {0.45, 0.37, 0.3, "(0.1 * dustness) + 0.016"}, {0.45, 0.37, 0.3, "(0.036 * dustness) + 0.006"}, {0.45, 0.37, 0.3, 0}};
            colorCoef[] = {1, 1, 1, 1};
            animationSpeed[] = {1};
            animationSpeedCoef = 1;
            randomDirectionPeriod = 0.1;
            randomDirectionIntensity = 0.05;
            onTimerScript = "";
            beforeDestroyScript = "";
            destroyOnWaterSurface = 1;
            destroyOnWaterSurfaceOffset = -0.2;
            lifeTimeVar = 1;
            position[] = {0, 0, 0};
            positionVar[] = {0.1, 0.1, 0.1};
            moveVelocityVar[] = {0.5, 0.5, 0.5};
            rotationVelocityVar = 0;
            sizeVar = 0.5;
            colorVar[] = {0.05, 0.05, 0.05, 0.2};
            randomDirectionPeriodVar = 0;
            randomDirectionIntensityVar = 0;
        };```
still forum
#

๐Ÿ‘
Now have fun copying everything over manually to script ๐Ÿ˜„

young current
#

๐Ÿ‘

quartz coyote
#

wallbang

#

but I gotta learn I guess

young current
#

Particle effect editor mod could also be useful

quartz coyote
#

indeed !

young current
#

And now that I think about it I recall seeing a particle effect module thing too

quartz coyote
#

Hey what is dustness ??

#

it's used as a multiplier but can find it's value or meaning

still forum
#

That afaik is the "dustness" value of the material of the surface where the "impact" goes into

#

same as "surfNormalX" that's the direction the surface points to.

#

dustness 0 doesn't throw up much dust, obviously. Like concrete for example.
But dustness 1 throws up a cloud of dust.

quartz coyote
#

so will 1 + (4.2 * dustness), work in my drop command ?

still forum
#

no

#

you don't have dustness

#

you need to make something up

#

I'd say make it a variable so you can tweak it till it looks good

harsh sphinx
#

I'm having difficulty understanding how to pass something dynamic within a define that is then using the hash https://community.bistudio.com/wiki/PreProcessor_Commands#.23. Without the hash it's fine and I can parse it as I see fit, but with the hash it strictly enforces what I pass so passing _x literally passes _x into the define and not what _x actually is. Can someone shed light on whether there's a way to achieve what I'm after without changing this define?

heavy plover
#

Hi All, I've tried making an admin menu but I'm having trouble with double clicking what I want to do in the list and making it do it. Could someone please review and let me know if anything jumps out? It's too long to paste so I put it in a pastebin https://pastebin.com/rJr5WK1r Thanks

harsh sphinx
#

onLBDblClick

heavy plover
#

I'll give it a try. Thank you

#

Still won't work ๐Ÿค”

copper raven
#

How did you add the handler

heavy plover
#

I guess I didn't? Not that clued up on all of this

#

Sounds like that's my problem though

tough abyss
#

@harsh sphinx you can't

harsh sphinx
#

fuck, okay thanks

heavy plover
#

@copper raven _ctrl ctrlAddEventHandler ["LBDblClick","[] spawn AG_DCT; closeDialog 0;"]; works, I just need to change the var for each one so it doesn't run them all at once like they do currently

#

Thanks for the help everyone

quartz coyote
#

Is there a way to get a position that would be ALWAYS in front of marker what ever the marker's direction ?

tough abyss
#

Try markerPos _marker getPos [markerSize _marker select 1, markerDir _marker]

still forum
#

You mean system time at mission start?

#

Don't see any problem with that. But why not instead add a "currentSystemTime" command?

hollow thistle
#

This would be really useful. And I don't think it has any security risks with that.

still forum
#

but only the system time at mission start
Just call time command and add the elapsed seconds then

#

over 5-10 hour duration ah yeah. that

#

Yep. Already wrote that in my notes.
Timestamp would be useless to most

tough abyss
#

Make sure it also works on Linux

tough abyss
#

new to visual studio, how can i compile something?

high marsh
#

Hit build. Build and debug with F5.

still forum
#

The play button at the top

high marsh
#

Oh!

#

Shiny!

winter rose
#

Ctrl+Shift+B, but you don't compile SQF

high marsh
#

๐Ÿค”

#

๐Ÿคฆ

winter rose
#

This โ˜๏ธ is why I love you all ๐Ÿ˜‚

muted zephyr
#

Great ai on my mission are shooting at friendly people any one know of a way to disable there weapons

high marsh
#

Are the AI enemies to the friendly AI?

#

If AI of your own side is killing team mates then their reputation score is low and they'll be fired at upon hitting a threshold

#

Otherwise:

BOB_AI disableAI "TARGET;
#

And to enable again:

BOB_AI enableAI "TARGET";
muted zephyr
#

Hmm that is odd since there inviceable since they act as a store for vehicles

high marsh
#

Obviously whoever set that up didn't ensure that the AI brain component of the unit was disabled

muted zephyr
#

That would be me

#

But in previous versions it wouldn't do that

high marsh
#
BOB_AI disableAI "All"
#

Doesn't matter, the AI will continue to be AI regardless of where or why you put them there for

muted zephyr
#

Ok thanks

#

Also what is a good script for AI air support

high marsh
#

Write your own, or google.

astral dawn
#

Were the car emojis a reference to the car script or anything?

high marsh
#

THE CAR SCRIPT

craggy adder
#

I've added an action to an object via the action's init field like so:

_actID = this addAction ["Read Intel", "scripts\read_intel.sqf", [_this select 0, _this select 1]];

read_intel.sqf is as follows:

diag_log (_this select 3) select 0;
diag_log (_this select 3) select 1;

When a player activates the actions on the objects, why is the output an array like this?

19:39:15 [any,any]
19:39:15 [any,any]

I'm expecting each output to be a single object based on the documentation.

#

I want the script to have access to the player that activated the action.

tough abyss
#

Just try _this select 1 in script

craggy adder
#

That helped me get where I want to be, thanks. But I'm still puzzled that anything passed into the third argument of addAction comes through as a string of any instead of the passed in value.

quasi rover
#

I placed turrets such as MK49 Spartan, Praetorian on editor. but the turret is moved by players sometimes during in-game.
How to fix the turrets not moved by players, but functional?

vast acorn
#

Hello! I'm trying to spawn a logic entity (LocationArea_F), but I'm having trouble figuring out the correct syntax.

#

This is what I tried: _areaLogic = "LocationArea_F" createVehicle _areaPos;

tough abyss
#

If it is logic you need to use createUnit

vast acorn
#

I've actually tried that too, but it hasn't worked either:

    private _grp = createGroup sideLogic;
    _arealogic = "LocationBase_F" createUnit [_areaPos,_grp];

This creates nothing when I run it. What am I doing wrong?

winter rose
velvet merlin
#

someone has a snippet to ensure infinite ammo via fired EH? (or otherwise) (for primary, secondary, pistol weapon and grenade)

cloud thunder
#

I prefer Reloaded over Fired because it will execute less and the unit still has to reload so less taxing and less immersion breaking and not so obvious.

_unit addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newmag", ["_oldmag", ["","","",""]]];
    if (_oldmag # 2 isEqualType "") then {_unit addMagazine (_newmag # 0)} else {_unit addMagazine (_oldmag # 0)};
}];
#

@velvet merlin

velvet merlin
#

thanks you two. i want actually near instant reload and not just magazines but also bullets

#

like for damage testing purposes

#
player addEventHandler ["Fired",
{
    player setWeaponReloadingTime [player,currentMuzzle player,0.1];

    private _weapon = currentWeapon player;
    player removeWeapon _weapon;

    private _magazines = magazines player;
    {
        if (!(_x in _magazines)) then
        {
            player addMagazine _x;
        };
    }forEach TEST_CurrentMagazines;

    player setVehicleAmmo 1;

    player addWeapon _weapon;
    player selectWeapon _weapon;
}];```
#

this is what i am using so far

#

however for actual mission purposes your approach Jigsor is a good one ๐Ÿ‘

#

also want to implement a system to give AI more ammo as in the WW2 setting they dont have much

tough abyss
#

can i get a developer to talk to me who know's how to do sql and like do scripts like for altis life make a jail script or something.

#

PM me

winter rose
#

Not interested in the car script?

velvet merlin
#

anyone familiar with custom Eden attribute modding here?
we would need a Rsc with a dynamic amount of controls - can this be done somehow? ie is the ctrlCreate usable to extend a Rsc, or just script dialogs/displays?

stuck lodge
#

I wanted to combined two scripts that both use initPlayerServer.sqf. Would this be the proper way to combine the two?

`params ['_entity','_jip'];
{
_x addCuratorEditableObjects [[_entity],true];
} foreach allcurators;

waitUntil {!isNull ZGM && ZGM == ZGM};
{
if (!isNull (getAssignedCuratorUnit ZGMM)) then {
ZGM = getAssignedCuratorUnit ZGMM;
if (isNull (getAssignedCuratorLogic ZGM)) then {
unassignCurator ZGMM;
sleep 1;
ZGM assignCurator ZGMM;
if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then {
ZGM call TFAR_fnc_isForcedCurator;
};
};
};
} foreach allcurators;`

still forum
#

Doesn't look wrong to me

#

besides the global variables without prefix ๐Ÿ˜„

stuck lodge
#

alright cool, yeah I just have been using them as is because I don't know what else to use,

stuck lodge
#

should I be using something else for the variables to make it more clean?

still forum
#

Use some tag/prefix to make sure noone else can have the same variable names
DEV_ZGM for example

stuck lodge
#

gotcha

keen bough
#

if i dont understand it wrong, a trigger "on activation" will send to the script automatically "thisTrigger" (trigger object), aka the player over?

In on activation like

call narS_fnc_iAmYourDoom;

And in my function i can use the player activating the trigger with

_thePlayer = _this select 0;

?

still forum
#

call narS_fnc_iAmYourDoom; You don't pass any parameters
_thePlayer = _this select 0; so no you can't get a value out of parameters that you never passed

#

will send to the script automatically "thisTrigger" yes
aka the player over No. thisTrigger is the trigger, not the player

#

thisList contains the list of units inside the trigger.

#

If you want player. Just use player

keen bough
#

ah okay then it passes its over only within itself.

still forum
#

No also in sub functions

#

It's a normal local variable

#

So in fnc_iAmYourDoom you can access the thisTrigger variable from the higher scope

#

but you won't magically get _this arguments that you never passed

keen bough
#

can i pass it as param? [thisTrigger object] call fnc_yourdoom?

#

Because i could write my testscript without the trigger. I just want to learn how the trigger works and how i can abuse triggers for my needs.

still forum
#

thisTrigger object what is that supposed to be?

#

thisTrigger is a local variable. Not some kind of command

winter rose
#

a quick realisation I had this weekend: the server technically can "script.sqf" remoteExec ["execVM"], this is not disabled at all ?

still forum
#

yes

winter rose
#

yay! Danke

queen cargo
#

@tough abyss stuff like that ain't that simple, you are better of asking in an explicit life-related forum or discord server ๐Ÿ˜‰

tough abyss
#

Any in mind I got told to come here if I can get a Altis life discord would be appreciated

still forum
keen bough
#

thats whats stands on wiki for "on activation"
Expression executed once the trigger is activated.

Passed variables are:

thisList - list of all objects in trigger area, based on 'Activation'
thisTrigger - trigger object

Cant i put thisTrigger (trigger object) in the [_thisTrigger] call fnc_awesome?

still forum
#

Cant i put thisTrigger (trigger object) in the [_thisTrigger] call fnc_awesome?
Yes. But not like that. The variable is thisTrigger not _thisTrigger

keen bough
#

ah, so i understood it more or less correct that i can hand over thisTrigger. And thisList ist really all objects? Even something thats there from the world itself or is it only placed stuff via zeus/editor and/or objects brought into the trigger area?

still forum
#

Dunno. I'd think only vehicles/units

keen bough
#

That would be neat, will test it as soon i have something to test with.

still forum
#

@tough abyss remoteExec comes to mind. Call a script that updates it. But you have to be very careful to stay in sync everywhere which seems to be quite a chore

keen bough
#

Should i make use of pre-placed triggers or is it better to write zones i wanna use in scripts too?

still forum
#

also objects are just a single number over network. Not expensive at all. So don't think you need to care about that

#

remoteExec variants sounds best for that then.
But you have to keep in mind that you have some overhead for remoteExec too, mainly the name of the function you are calling.

Also for JIP clients you need to make sure that they get the full pacakge

queen cargo
#

you should update it though ... it is quite old

#

Initial full sync still required for obvious reasons

keen bough
#

Why dont you use a database? There you could store all the data you need. You have even a choice between two Databases. inidbi2 (quick, dirty, not too powerfull but it gets the job done) and the other one which name i dont know.

still forum
#

DATABASE! Mร–CHTEN SIE DATABANK?! Intercept-DB DaTaBรคNk max gUd beSCHTE in welT

#

Also because database would be server side only then. Which doesn't help with moving data between clients at all

tough abyss
#

Should getHit, getHitpointdamage, gethitindex all return 0 on obj null or invalid selection instead of nothing?

still forum
#

I think that would be preferable. You rarely expect a command to return nothing all of the sudden while wiki says it returns a number

tough abyss
#

will this break anyt existing scripts?

still forum
#

Are there people that expect getHitIndex to return nil on nullObj?
If there were people I'd call them cray cray

#

I only know a handful of people who even use getHitPointDamage/getHitIndex so I assume it's not a big problem at all

tough abyss
#

any other commands like this screaming inconsistency?

#

any commands with messed up ingame help?

still forum
#

Don't know anyone who even looks at ingame help

#

to answer your question: yes, many.

#

the new calculatePath one doesn't have any ingame help text I think

tough abyss
#

i know there were quite a few saying weapon instead of muzzle or even magazine

#

got caught myself dont remember which one

#

what is default for assigned team?

#

like what should assignedteam objnull return?

winter rose
#

teamNull iirc?

#

โ€ฆnope, only teamMemberNull exists

tough abyss
#

"" for assignedTeam objnull?

#

will this break scripts?

#

i mean returning "" instead of nil

#

will this break scripts?

#

and if nil?

#

so "main" is default?

#

but it makes no sense obj null should not have color

#

i guess if it was not nil your expression would return 0 anyways

ornate marsh
#

im trying to attach to a heli to make a helicarrier essentialy. Looked online and tried this [this, variableName] call bis_fnc_attachtorelative; but that isnt working. Found this script then: https://pastebin.com/qQ0Xrzdh which attaches the carrier, but then only the stern and the tower spawns in, but then i cant attach objects to it

young current
#

have you just tried the attachTo command?

tough abyss
#

what should getObjectType return for objNull?

#

0 or -1?

ornate marsh
#

attachTo works for attaching objects to the carrier but I need to get the carrier attached to the heli and make the heli move

young current
#

that wont work

#

you will have to attach everything to the helo

#

but do note that attaching stuff loses their collision

#

so your helicarrier will go through things and blow up

ornate marsh
#

i mean everything is attaching to where the carrier should be, yet the carrier itself doesnt move.

#

i've tried attaching the carrier to the heli but it doesnt go anywhere

young current
#

where/how are you using the command?

ornate marsh
#

init box of carrier object in 3den:

this attachTo [carrierMovement,[12.736,3.257,-14.317]];
this setVectorDirAndUp [[-0.738,-0.674,0],[0,0,1]];

init box of object on deck:

this attachTo [carrier,[-25.042,-50.889,26.123]];
this setVectorDirAndUp [[-0.808,0.59,0],[0,0,1]];

Heli varName: carrierMovement
Carrier varNaem: carrier

#

also tried call bis_fnc_attachtorelative but that also does nothing

young current
#

try using those commands in the debug console

ornate marsh
#

i need to find a way of attaching all the parts of the carrier to the heli in 3den, that will work, i've done that in zeus

young current
#

then you may need to write them into a sqf that waits a bit for the game to properly initialize

#

its possible for example for the carrerier to init before your chopper and thus the attach to command has no target

ornate marsh
#

if i just use the attachTo on the carrier and attach it to the heli, it will only move when i type [_carrier] call BIS_fnc_Carrier01PosUpdate;

winter rose
#

open this function in the function viewer and see what it does; it references multiple carrier parts put all together. grab them all one by one, attachTo, and you should be good (collision not guaranteed)

ornate marsh
#

ive got the attach working, now just need [carrier] call BIS_fnc_Carrier01PosUpdate; to constantly repeat

winter rose
#

what did you attach, the carrier or the parts?

leaden parrot
#

What am I missing for this to work?

gm_1 addCuratorEditableObjects [[Land_HBarrier_3_F],false];

It tells me that it's an undefined variable in the expressions, but I thought the "object" part could be jsut the name for it from the config viewer?

winter rose
#

Check the wiki for the command's syntax, and if it is a classname, it's between quotes

leaden parrot
#

it expects objects

#

so does that mean I can't load it in direclt but need to spawn it first and name it before adding it with addCuratorEditableObjects ?

young current
#

oh wait @ornate marsh isnt the carrier many parts?

ornate marsh
#

i've (hopefully) got it working now

young current
#

Well good luck but I think your going to break it xD

ornate marsh
#

i got it working, used [carrier, carrierMovement] call BIS_fnc_attachToRelative; in the carrier init, then ```sqf
0 spawn {while {true} do {
[carrier] call BIS_fnc_Carrier01PosUpdate;
sleep 0.00000001;
};
};

young current
#

I hope you dont actually hope you will be able to land on it ๐Ÿ˜„

#

in MP anyway

#

It might work but I would not get my hopes up

ornate marsh
#

im not landing on it yet. gonna make a script which detaches the carrier from the heli and freezes it in place

young current
#

that could in theory work.

#

good luck ๐Ÿ‘

ornate marsh
#

Yeah it's working so far, just gotta do some tweaks, any idea on how to make an addAction appear all the time?

young current
#

add it to the player perhaps

ornate marsh
#

Yea tried that, was looking for a solution on how to attach players to the carrier without disabling simulation, but I think I got a workaround

cosmic lichen
#

Does anyone know a way to easily retrieve the required addons from within Eden Editor via script?

finite tusk
#

Load up Arma with mods, save a mission WITHOUT Binarization
In the mission.sqm somewhere, you'll be looking for binarizationWanted=0; addons[]= { "Addon_Name_Of_Asset_Here" "Another_Addon_Asset_Goes_Here" "ETC" "ETC" }

@cosmic lichen

#

Maybe?

#

Think it's dependent on if you've placed anything down. If not, shove a bunch of random stuff down and take a look in the file for anything extra you've added.

You'll soon learn what goes where

cosmic lichen
#

You'll soon learn what goes where That was a good one ๐Ÿ˜‰

#

_configClasses = ("true" configClasses (configFile >> "CfgMods")) + ("true" configClasses (configFile >> "CfgPatches"));
{
    _name = getText (_x >> "name");
    if ((_name find "Arma 3" == -1) && !(_name isEqualTo "")) then
    {
        _modList = _modlist + _name + endl;
    };
    true
} count _configClasses;```
I am able to return that list
#

But I actually want the information displayed in display3denRequiredAddons. The code for that display seems to be engine driven.

finite tusk
#

Ducks out.

#

That's all you man ๐Ÿ˜„

elder karma
#

Is there some way to make camera modules display on montiors/laptops?

#

I'm designing a fun-op where the players defend an embassy and I wanted to have a command center with monitors linked to various camera views.

finite jackal
glass frigate
#

I have two groups (Alpha 1-1, Alpha 1-2) BLUEFOR and two groups OPFOR. I need a script that will check if all the units in a single group (Alpha 1-1 or Alpha 1-2) are dead. The dead group will then respawn at its original starting point/origin. Thanks for the help.

surreal peak
#

could use something like:

_alivecount = ({alive _x} count units _GROUPNAME);
if (_alivecount == 0) then {
//do stuff
};
#

in a trigger or loop @glass frigate

#

first two are people having similar questions, rest are some important things

still forum
#

private _noUnitsAlive = (units <groupname>) findIf {alive _x} == -1 would be more efficient in the cases where there are still units alive

keen bough
#

was

if (!isnil _variable) then
dostuff

correct?

still forum
#

not if you want to check if _variable is nil

#

isNil takes the name of the variable

#

not the content

keen bough
#

I want to check if its not empty, to create something

still forum
#

Then give it the name of the variable

keen bough
#

its from a weapon array. I thought that using

!= ""

would be not a good practice.

still forum
#

Correct

#

!= "" will also not work if _variable is nil

keen bough
#

variable will be defined through the weapon array (select) but has "" in it, when there is nothing in it (no supressor as example)

still forum
#

What is your definition of "empty" though?
Nil and empty strings are different things. isNil doesn't check for empty string

#

Then use _variable != ""

keen bough
#

Thought would not be a good practice to do it that way or am i misinformed? Didnt want to learn bad habits :3

still forum
#

There isn't any other way to do it... (okey there are.. but they are all stupid :D)

#

If you want to check if string is empty string, you have to check if string is empty. That's what == "" or != "" is doing

keen bough
#

hahaha ^^ care to tell me one example how to do it 'stupid'? ^^

still forum
#

count _variable == 0 (string consists of 0 characters)
(_variable splitString "") isEqualTo [] (If we split out all characters into seperate strings, and get 0 strings, it's empty)
toArray _variable isEqualTo [] (If we split out all characters to their ascii codes, and get an empty array, the string was empty)

keen bough
#

ah, i understand. Nice to know - thank you

#

(some will not belive that i understood :D)

winter rose
#

_variable + "b" == "b" :p

keen bough
#

if (something to throw) then throw (target = lou or dedmen or general direction of somebody) else look tough ๐Ÿ˜›

still forum
#

((toArray (_variable + "๐Ÿ•ด๏ธ")) - [128372]) isEqualTo ([1337^(23363 mod 13)]-[sqrt 1787569])

winter rose
#

oh my xD

keen bough
#

Oh! Before i forget it. I have a small problem that i may fix easily but i wanna know what you would think:
Would you have a sat scan on personal scale (local markers an all) or on a global scale so everybody could see?

#

is there a way a script would wait for player input (coordinates, especially)?

still forum
#

coordinates? on the map?
Can use onMapSingleClick and just let the player click onto a spot

keen bough
#

Hrmhrm. Yes yes, that would work indeed. I always forget that we arent in arma 2 anymore. Equipment is top notch future like! We click on virtual maps! ๐Ÿ˜„ good idea

#

youve got to be kidding me... i wanna split of my old price-check shopt script and i forgot that the original has over 2000 lines of code ...

young current
#

Could as well write a new one

still forum
#

if (life_wannaShop) exitWith {diag_log "Illegal use of my script. Visit armastore.net to buy it"; endMission;}

still forum
#

couldn't think of anything better so quickly ๐Ÿ˜„

winter rose
#

hintC

still forum
#

will be gone on endMission tho I think

queen cargo
#

to mind blow you guys:
diag_log format (["%8 %9"] + productVersion);

tough abyss
#

Like what?

#

Does anyone know if there is any way to survive a helicopter crash or plane like its just stupid how it blows up on impact on the water maybe a script

spice axle
#

Vehicle allowDamage false

tough abyss
#

Will that make the blow up but not damage me?

cosmic lichen
#
player allowDamage false; helicopter allowDamage false;
spice axle
#

No that result in no damage to the vehicle. But in water iโ€˜m not sure if the engine still works. But you can fly with 300 km/h into the surface and will be alive

digital hollow
#

There's the Survivable Crashes mod.

dusky drift
#

what does # do

#

I can't find any page on it

#

nvm I just found out it's the same as select

tough abyss
#

Is not

velvet merlin
#

does setMass work with ThingX?

dusky drift
#

is there a way I can test if a classname like B_Soldier_F belongs to blufor or opfor?

digital hollow
#

You can tell by the B_

dusky drift
#

yeah but how would I do that in code?

digital hollow
#

select alt syntax 3

still forum
#

there is probably some entry in the config class for it

#

you cannot trust on it always starting with B

#

especially with mods

dusky drift
#

"B_Soldier_F" isKindOf "BLUFOR" and "B_Soldier_F" isKindOf "NATO" both return false

still forum
#

Yes because isKindOf doesn't do what you think it does

dusky drift
#

I thought so

still forum
#

Just look into config and see what you could use

#

side = 1; That sounds promising

tough abyss
#

SetMass is PhysX so it should @velvet merlin

still forum
#

O_Soldier_F is side=0

#

I_Soldier_F is 2.

#

tadaaa

dusky drift
#

so how do I get the side from "B_Soldier_F"

still forum
#

getNumber (configFile >> "CfgVehicles" >> yourclass >> "side")

tough abyss
#

There gotta be some BIS fnc for it

dusky drift
#

I'm trying to hide all modules in the zeus modules tab except for fire support and remote control. I wrote this code to try and do that, but putting it in the init field of the game master doesn't change anything

this addEventHandler ["CuratorObjectRegistered", {
    params ["_curator", "_input"];
    _costs = [];
    {
        _cost = if (getNumber (configFile >> "CfgVehicles" >> _x >> "side") == 7) then {
            _out = [];
            switch (_x) do {
                case "ModuleCASBomb_F": { out = [true, 0.1] };
                case "ModuleCASGun_F": { out = [true, 0.1] };
                case "ModuleCASGunMissile_F": { out = [true, 0.1] };
                case "ModuleCASMissile_F": { out = [true, 0.1] };
                case "ModuleOrdnanceHowitzer_F": { out = [true, 0.1] };
                case "ModuleOrdnanceMortar_F": { out = [true, 0.1] };
                case "ModuleOrdnanceRocket_F": { out = [true, 0.1] };
                case "ModuleRemoteControl_F": { out = [true, 0.1] };
                default { out = [false, -10000] };
            };
            _out
        } else { [true, 0.1] };
        _costs = _costs + [_cost];
    } forEach _input;
    _costs
}];
#

I'm not sure what I'm doing wrong

#

lkajwdalj I just realized the switch statements have _out written as out

#

Changing that fixed it

#

maybe I should learn to pay better attention to my code

tough abyss
#

Which side is 7?

still forum
#

logic

round scroll
#

where do I find the definitions for defines.hpp and dialog.hpp for GUI creation? I usually copied these from an old mission, but on this laptop I have none ... any way to get current ones from arma itself or a download location?

#

found it: copyToClipboard ("Default" call BIS_fnc_exportGUIBaseClasses);

vocal mantle
#

Hey, so I've been away from modding/scripting for awhile. Has individual weapon object referencing been implemented yet? I'm pretty sure it was mentioned awhile back that it was in progress.

tough abyss
#

No but you can now add weapon with accessories directly to the box

leaden parrot
#

How do I find the addon names for the objects I want to allow, with this script https://community.bistudio.com/wiki/addCuratorAddons ?

I thought I could just right click my objects in the editor and get their name from the config viewer, but that doesnt seem to work?
gmO_1 addCuratorAddons ["A3_Modules_F_Curator_Lightning", "Land_BagFence_Short_F"]; the lighting bolt shows up here ( took the code from their example) but the sandbags does not.

tough abyss
#

Land_..... is not an addon name

#

Type utils 2 in debug console

#

Enter class name it will tell you which addon

leaden parrot
#

aww man,

#

it works, but. now my zeus has access to everything in that addon. I was hoping that I could add only 1 specific object. oh well

tough abyss
#

Then look at what @dusky drift did with curator EH

leaden parrot
#

"curator EH" what does that mean?

Im taking a look now. Can hopefully find out how that works

keen bough
#

@tough abyss is the weapon-add with accessories already on the stable? Or still in dev-branch?

tough abyss
#

means curator based event handler in this case addEventHandler ["CuratorObjectRegistered"... @leaden parrot

leaden parrot
#

cheers mate

astral dawn
#

Is there any way to prevent my group handle from being deleted when I move all the units out from this group?

astral dawn
#

Or maybe there is another way to achieve this?
I need to reorganize the formation of units in my group (who follows who). For this I create a new temporary empty group, make everyone join the temp group, then I make units join the old group in needed order.

dusky drift
#

I'm not 100% sure if this goes here but what syntax highlighting code do you guys use for arma code in code blocks?

astral dawn
#

I didn't know that there is one for code blocks

#

There is, however, syntax highlighting for VS Code, Notepad++ and Eclipse

#

I think also for Sublime

keen bough
#

Me with scripting:
<checks something with global variable test1>
<never deletes test1>
<later tries to test something that runs perfectly fine with test1>
<test1 shows different result than expeced>
<try to find the error. Start to doubt my scripting>
<go furious about how dumb i am that i have a running script that anyhow shows something completely different!>
<brain works for a moment>
<click>
<shamefully deletes the old test1 test variable>
<results as expected>
...

#

i lost 30 minutes...

astral dawn
#

Yes we need better debugging

keen bough
#

fun part is, when you have a grenade launcher and you do (select grenade magazine select name) it will throw a generic error when you have no grenade loaded.

So you have to use param. My param for normal magazine is the same. It results in string "Empty" but not with empty grenade-slot. There it shows me "" instead of "Empty"...

Such weirdness has only arma i guess.

weak tiger
#

I seem to get a value of 0 always when calling knowsAbout on a vehicle, is there an alternative to use for vehicles?

#

note im using side knowsAbout vehicle

#

same when trying to use commander vehicle and driver vehicle

digital jacinth
#

The problem proably is because you are using the side and not many or any unit/group of that side knows about it. Have you tried with a group standing right next to the vehicle?

weak tiger
#

im staring at it with a rangefinder from 500m and it shows on the map

#

I do get a value when I run player knowsAbout vehicle though

#

so I guess I can use that, is just more ideal in this situation to use the side

digital jacinth
#

how many units are there on your side?

weak tiger
#

as its server run

#

2

digital jacinth
#

they are in your group as well?

weak tiger
#

yes

digital jacinth
#

weird.

keen bough
#
case {_name in _assaultrifles}:       {_returnValue = "aRifle"};

Eh, how do i need to write it correctly in the code bracket of the case? I was testing around a bit but i am currently a bit clueless.

robust hollow
#

case (_name in _assaultrifles): {_returnValue = "aRifle"};

high marsh
#

^ needs colon

#

In a switch do satement, default doesn't. Cases do.

keen bough
#

so that was connor wrote is correct?

still forum
#

@vocal mantle Has individual weapon object referencing been implemented yet? I don't remember anyone mentioning that it was being worked on. As it's not really possible to do.
@astral dawn Is there any way to prevent my group handle from being deleted when I move all the units out from this group?
https://community.bistudio.com/wiki/deleteGroupWhenEmpty

keen bough
#

ah eff... i already wrote the if-standard pattern. Was not much work but i kind of like cases.

tough abyss
#

does ACE use setUnitLoadout?

#

especially for adding backpacks?

umbral nimbus
#

I have noticed that depending on one's system specs and running mods, the time it takes from joining the 3d world to actually having the splashscreen removed and see the 3d world varries from 2 tot up to 15 seconds. In MP this is moat pronounced.

When I want a mission to start with a splash screem or some other intro texts, this appeara to be running behind the Mission Splash screen and some players only fall in halfway through.

Is there a way to let a script wait until this splashscreen is gone and the player actually sees the 3d world?

the hasInterface command, doesnt seem to work

still forum
#

@tough abyss arsenal does yes

tough abyss
#

Ace arsenal?

still forum
#

yes

tough abyss
#

Backpacks are bugged if you add them using setUnitLoadout

still forum
#

how bugged

tough abyss
#

Desynced content

astral dawn
#

@still forum deleteGroupWhenEmpty doesn't prevent the group from being deleted in this case, that's the problem.
I have made a test that moves all units from a group and checks what isGroupDeletedWhenEmpty returns before moving units, and it returns false.

still forum
#

JoinSilent is the note about automated deletion of groups when it's empty

#

deleteGroupWhenEmpty should disable exactly that ยฏ_(ใƒ„)_/ยฏ

astral dawn
#

So... maybe I should create a bug tracker page for that?
I wonder if units removed from group by their destruction will also cause the group to be nullified. If so, it would mean that deleteGroupWhenEmpty just does not work :/

quasi sedge
#
private ["_air","_land","_veh"];
_air = [];
_land = [];
_veh = "";
{ 
    _veh = configName _x;
    switch (true) do {
        case (_veh isKindOf "air") : {_air pushBack _veh};
        case (_veh isKindOf "car") : {_land pushBack _veh};
        case (_veh isKindOf "tank") : {_land pushBack _veh};
    };
} forEach ("true" configClasses (configFile >> "CfgVehicles"));
diag_log format ["ะะฐะทะตะผะฝะฐั ั‚ะตั…ะฝะธะบะฐ - %1",_land];
diag_log format ["ะ’ะพะทะดัƒัˆะฝะฐั ั‚ะตั…ะฝะธะบะฐ - %1",_air];
#

problem is that diag_log limiting classnames

#

,""RHS_Ural_Zu23_MSV_01"",""RHS_Ural_Zu23_VDV_01"",""RHS_Ural_Zu23_VMF_01"",""RHS

#

this is end of log

#

any workaround here?

still forum
#

diag_log only prints 2000 characters

#

Easier would be to copyToClipboard

#

Also I remember seeing that script. And I also remember giving you a faster and shorter variant ๐Ÿค”

still forum
#

First step, use lazy eval instead of multiple nested if's.
Second step, use lazy eval at all.

call (missionNamespace getVariable 'BIS_fnc_inString')
missionNamespace is useless, you are already in missionNamespace.
Thus the getVariable itself is useless, you can just write down the name.
Third instead of calling some BIS func always prefer engine commands.
Use find to check if string contains another string, but keep in mind that find is case sensitive.

_unit setVariable ['QS_treat_target',objNull,FALSE];
useless false at the end, also why is your false all uppercase? all uppercase indicates macro.

params ['_actionTarget','','','_actionName','','','','','','',''];
What are all the useless empty strings at the end?
Just only take the params that you actually need.

        private _return = _actionName isEqualTo 'HealSoldier';
        if (_return) then {
            [_actionTarget] call QS_fnc_treatOverwrite;
        };
        _return;

That one doesn't do much tho

round scroll
#

wasn't there a map/apply like function in SQF now to get a subset of an array into a new array? My current code looks like ```sqf
_targets = [];
{
// systemChat format ["side: %1", side _x];
if ((str side _x) in _flakEnemy) then {
_targets pushBack _x;
};
} forEach _possibleTargets;

still forum
#

apply is the map command.

#

But you want select. not map

#

_targets = _possibleTargets select {(str side _x) in _flakEnemy}

round scroll
#

very elegant, thanks @still forum

quartz coyote
#

Hello, Is it possible to have an array in mission params ?
Example :

    class VehicleRespawnRule {
        //ParamsArray[7]
        title = $STR_vehicle_respawn;
        texts[] = {"30secs / Only When Destroyed", "30 Seconds / 25m"};
        values[] = {[30, nil], [30, 25]};
        default = [30, nil];
    };```
still forum
#

Yes

#

You already know how to create an array. You use it on texts and values

#

but suddenly inside values and on default you forgot it again

#

arrays in config are {}, not []

quartz coyote
#

ah

#

I didn't know it was like that in config

#
    class VehicleRespawnRule {
        //ParamsArray[7]
        title = $STR_vehicle_respawn;
        texts[] = {"30secs / Only When Destroyed", "30 Seconds / 25m"};
        values[] = {[30, nil], [30, 25]};
        default = {[30, nil]};
    };```
#

is that it ? or are the [] too much ?

#

I do a lot of things by "imitation" or "reproduction" so I don't always know the rules behind them

still forum
#

the [] are wrong

#

you use {} in configs to make arrays. but [] in scripts

#

just swap them out

quartz coyote
#

Ah !

still forum
#

also to define a array value. You need to put [] behind the name. Like behind texts and values.
Also need to do that on default

quartz coyote
#

values[] = {30, nil}, {30, 25}; default[] = {30, nil};

#

??

#

if not, I don't understand what you mean

digital jacinth
#

values[] = {{30, nil}, {30, 25}}

#

array in array

quartz coyote
#

Oh I see !

#

is default[] = {30, nil}; correct tho ?

#

So is there a way to extract only index 0 with BIS_fnc_getParamValue ?

#

maybe ("VehicleRespawnRule " call BIS_fnc_getParamValue) select 0 ?

#

there is an error with default[] = {30, nil};
'Default/' is not a value

still forum
#

maybe that config entry that you're trying to use doesn't support arrays

#

could store as string and use parseSimpleArray

#

oh also nil is a script thing, it doesn't exist in config.
And I also don't think parseSimpleArray could parse it.
Maybe use a special value like -1 or smth

quartz coyote
#

this is mission param

#

nil is working perfectly well

still forum
#

nil in config will turn into "nil"

tender fossil
#

Does anyone know how to execute code for JIP only with Arma 2's multiplayer framework?

#

I've got it working on both me and JIP but I want it to execute on JIP only

#
[nil, nil, "per", rHINT, "Hello"] call RE;
#

initJIPcompatible.sqf

#

But it indeed also executes it on server at mission start

winter rose
#

I was about to slam you with remoteExec ๐Ÿ˜„

tough abyss
#

Well there is BIS_fnc_MP if you like pain and then there is RE ...

tender fossil
#

@winter rose ๐Ÿ˜„

#

@tough abyss But do you know how to get it working for JIP only?

tough abyss
#

All I remember that it was a major torture, not particularly interested revisiting the pain

tender fossil
#

Haha alright ๐Ÿ˜›

still forum
vagrant mango
#

Hey yall. So I am trying to add inspectable intel to my mission in the form of stuff on whiteboards and on phones and such that they can inspect for a blow op of the image. I was wondering if there is a way to tell in an item's attributes for a texture field or what not what the accepted size is for the image so it doesn't over stretch it.

vernal mural
#

some items such as whiteboard have specific fields for this task, so you can provide them an alternate texture you have designed. The size is not always the same, depending on the object you'd like to retexture

vagrant mango
#

Yeah.

#

Sorry so what I meant was. I am populating that information into that field.

#

I need to figure out what the default is or what not so my texture fits instead of gets stretched.

#

As a just incase I use initInspectable so they can hold action and see the full image.

#

But for example on the whiteboard, I have stuff that goes off the board.

#

Im guessing its because of the size of my image and its stretching it to fit but locking the aspect ratio to do so.

#

Ideally I just would like to find where the .paa's exist so I can just see what their size is pixel wise.

#

But Windows Search sucks.

vernal mural
#

oh I see. If you want to have a good looking feature, indeed you have to take the original texture from the game files and modify it, so it has the good size and shape plus the intel you want to draw on it. To find original texture, you can look into the config of the wanted object by right-clicking on it and then "view config" choice. It will open the config browser of A3 at the correct index, and you will be able to browse through object's properties, including texture ones. They are in the "hiddenSelectionTexture" entry

vagrant mango
#

Awesome. Thats what I was looking for. Thanks man.

vernal mural
#

Due to some internal mechanics, the texture path does not always perfectly reflect the "true" file path, but it will give you a solid starting point

vagrant mango
#

Yeah its a relative path. I just need to find where that damn thing starts lol.

#

I tried searching in the steam directory and no dice.

vernal mural
#

it's a bit more complex : game files are stored in archive files, with .pbo extension. It's like a zip but for A3. So windows explorer won't be able to find them. You have to manually open the PBO and browse into it to find the correct PAA file

vagrant mango
#

Ah.

vernal mural
#

You'll need some tools to browse PBOs

vagrant mango
#

Alright.

#

That makes sense.

#

Gotcha.

#

Now considering the item is from a specific DLC I'd need that DLC's PBO correct?

vernal mural
vagrant mango
#

Nvm.

#

I think I figured it out.

#

The root of the path it gives is a3

#

a3.pbo

#

Derp.

#

Word.

#

Thanks a bunhc.

#

bunch*

still forum
#

look at the second part of the path

#

that tells you the pbo

vernal mural
#

yep. Base game PBOs are in the "Addons" folder, DLC PBOs are in different folders. Also, you might consider other objects coming from mods. They work the same way : in the @MyMod folder there is an "addons" folder keeping all of the mod's PBO.

So yes, basically in A3, everything is a mod.

#

@vagrant mango although there is indeed a a3.pbo file, I'm highly sceptical on the fact that you could find anything useful in it.

vagrant mango
#

Yeah

#

What Dedmen said was correct.

still forum
#

as I've said.. Second part of the path is the pbo name

#

everything is a3

vagrant mango
#

Found it in structures_f

#

a3 was referencing the Arma install folder.

still forum
#

no it wasn't

vagrant mango
#

Cool. Got the .paa now I gotta open it and see how big it is.

#

Thnks a bunch.

still forum
#

but doesn't matter what a3 means.

vernal mural
#

yeah it's not really the root folder, but you get the idea. It means "the game", nothing more.

#

well guys, quick question : is there any particular reason for witnessing suppressFor having different effect on a hosted game and on a dedicated server ?

#

In both cases the command is played from the server machine

#

but in hosted mode, all targeted AI are firing, whereas on the dedicated server only 1 on 3 will obey

vagrant mango
#

Dude awesome. It worked perfectly. Grabbed the PAA converted it and edited it. Then saved it and it worked fine. Thanks a bunch.

quartz coyote
#

@still forum I really can't figure out a way of remembering the right way to put that freacking remoteExec...
Is this correct ?

_FOB_respawn_id call BIS_fnc_removeRespawnPosition; // not remoteExeced
[_FOB_respawn_id, BIS_fnc_removeRespawnPosition] remoteExec ["call", 0]; // remoteExeced```
vernal mural
#

@quartz coyote you might want to consider remoteExecCall

quartz coyote
#

one thing at a time cowboy. can't even master remoteExec, i'll be lost if you add a Call at the end ๐Ÿ˜„

#

@vernal mural Does that work ?

_FOB_respawn_id call BIS_fnc_removeRespawnPosition; // not remoteExecCalled
_FOB_respawn_id remoteExecCall ["BIS_fnc_removeRespawnPosition", 0]; // remoteExecCalled```
still forum
#

"you might want to consider remoteExecCall" no you don't

#

_FOB_respawn_id remoteExec ["BIS_fnc_removeRespawnPosition", 0]; that

quartz coyote
#

but but but ... where does the call go ........

still forum
#

Why would you need call

#

Read the remoteExec wiki page

quartz coyote
#

I dunno

still forum
#

remoteExec has a call/spawn integrated

quartz coyote
#

why would this guy need a call ???
``Revo
The INCORRECT way to call reveal command on a certain object for every player:
[player, _desired_object] remoteExec ["reveal", 0];
In this case player object will be the object obtained on the computer where remoteExec is initiated. If it is dedicated server, player will be objNull, if it is client, player would be player object on this client. In any case this will not reveal _desired_object for all connected players.

The CORRECT way:
[_desired_object, {player reveal _this}] remoteExec ["call", 0];
The _desired_object will be identical on every client, this is what we want, but player will refer to individual player on each client, so _desired_object will be revealed to all connected players.``

still forum
#

Because he's calling a piece of code

quartz coyote
#

๐Ÿคฆ๐Ÿผ

still forum
#

Remote exec can execute functions if you give it the name

#

that piece of code up there, is neither a function nor has it a name

quartz coyote
#

I see

#

Dunno if i'll manage one day

#

until next one, thanks

cosmic lichen
#

@quartz coyote Don't worry, ppl have been studying SQF for years and still can't explain some of the voodoo ๐Ÿ˜„

quartz coyote
#

@cosmic lichen ๐Ÿ˜‚

#

Thanks for cheering me up ๐Ÿ˜‚

winter rose
#

Welcome to this pit of poor souls

vagrant mango
#

So now im having some weird issue with the initInspectable function. Have the whiteboard, with the texture up. Shows in the editor just fine. I am using a slightly zoomed in version of the photo for the initInspectable (So they could read the words if they have trouble) and it seems to be changing the whiteboards texture#0 and smushing it all up.

#

ONly when you load into the game.

#

Not in the editor, it shows fine there.

tough abyss
#

studying SQF ๐Ÿค”

winter rose
#

enduring SQF?

tough abyss
#

SQF - an academic subject ๐Ÿ˜ฎ

#

waves and shakes his SQF diploma

#

SQF
Q
F

vapid crypt
#

Status
Quo
Function

#

I would argue its fairly easy to learn and figure out. As Hagrid said, "Vastly misunderstood language, Harry. Vastly misunderstood."

winter rose
#

Stupid Quack Functions

#

but I don't want to diss on it even if it has its flaws โ€“ I guess it grew on me after all this time ๐Ÿ˜‰

vapid crypt
#

I think it does for everyone after dealing with it for a while. Vastly misunderstood ๐Ÿ˜‰

#

@vagrant mango so only happens when actually inspecting the object? I would assume its some sort of incompatible texture issue and would recommend eliminating that as an issue. Is the image compressed?

queen cargo
#

SQF itself is perfectly fine
though ... there are things one could improve at the execution side
but the operators make it complicated

astral dawn
#

Do you want to say that M242 SQF diploma is fake?? ๐Ÿ“ƒ ๐Ÿ‘ˆ

vapid crypt
#

I would like to know who issued it and to make sure receiver != issuer

winter rose
#

one can see people didn't have naming standards, not even mentioning setDammage, but some commands are getters and setters, others are just property named, some argument orders are inconsistent; one of my wonderings is why a while do uses only code brackets where if then uses ( ) too?

But all in all, besides the existence of breakTo, the language is readable

tough abyss
#

Because it needs to be executed each iteration

vapid crypt
#

while needs a code bracket because it expects a script. if statements expects a boolean ๐Ÿ˜ƒ

winter rose
#

while could have used a boolean ๐Ÿ‘€

vapid crypt
#

your not wrong

winter rose
#

argh

tough abyss
#

() evaluated once

#

{} can be called many times

winter rose
#

I say meh, and I mean it!!

vapid crypt
#

M242 makes a good argument. I can see the validity of his SQF diploma already ๐Ÿ˜„

winter rose
#

a good side of the sqf is being able to switch (true) ๐Ÿ˜„

#

but there is no do-while ๐Ÿค”

vapid crypt
#

there is also no if () then {} else if () {}

winter rose
#

Ah true!

#

also, then ๐Ÿ‘€

#

How many compile errors did I have because of this!

vapid crypt
#

๐Ÿ˜ฌ

tough abyss
#

Give me return and Iโ€™ll be happy

winter rose
#

a simple SQF goto would be fine

vapid crypt
#

I originally learned Java. Forgive my heathen ways

winter rose
#

runs away very far

#

we almost had Java in Arma ๐Ÿ™ƒ

tough abyss
#

Sqs has one

winter rose
#

I know, where do you think I learnt bad coding ๐Ÿ˜„

tough abyss
#

Stackoverflow?

winter rose
#

you don't learn StackOverflow, you copy-paste

vapid crypt
#

google is my intern. He looks things up for me

tough abyss
#

Or downvote and close

winter rose
#

I don't even have an account ๐Ÿ˜„ so far every question I had was already asked by another

tough abyss
#

There is sqf section on stackoverflow

winter rose
#

ooooooh

tough abyss
#

Oh yeah

winter rose
#

I may have to create an account then ๐Ÿ˜„

#

and bring mockโ€ฆ support to these poor souls

tough abyss
#

Should be more posts on sqf, SO is like first site that pops up in searches

winter rose
#

I admit I never search Google for sqf.

vapid crypt
#

I did when I was first learning ๐Ÿ˜ƒ

winter rose
#

I read the wiki ๐Ÿ‘€ but I do simple scripts though, not frameworks ^_^

tough abyss
#

Thatโ€™s because it leads to forums with 100 posts and no good answer

#

SO is built to have quality answers

#

Many solutions you find on forums would have been instantly downvoted on SO and good ones upvoted

#

It is harsh but fair

vagrant mango
#

@vapid crypt no... so like... for example. I have a subfolder with pics\Whiteboard1.jpg in it... that is in the Texture #0 field of the Whiteboard object. That shows in the editor just fine. It shows it at the proper resolution and everyting. Now in initPlayerLocal.sqf I have [WB1,"pics\WBInspect.jpg"] call BIS_fnc_initInspectable; which is using basically that same image but zoomed into the text so they can actually read it if they cant from just standing and looking at it.

#

Problem is... on mission load, the pics\WBInspect.jpg is overwriting the Texture #0 field in the Whiteboards attributes.

#

So it SEEMS because of load order that behind the scense what initInspectable does is replace the Texture #0 attribute with what you give it. And since initPlayerLocal.sqf is apparently executeed after objects are initialized it would make sense that would happen.

#

Unfortunate though.

vagrant mango
#

Is it possible through ace_vehiclelock_fnc_addKeyForVehicle to make that a custom key for an array of vehicles?

cosmic lichen
#
[Revo_Laptop] call BIS_fnc_initIntelObject;

๏ปฟif (isServer) then
{
  Revo_Laptop setVariable [
  "RscAttributeDiaryRecord_texture",
  "a3\structures_f_epc\Items\Documents\Data\document_secret_01_co.paa",
  true
 ];

 [
  Revo_Laptop,
  "RscAttributeDiaryRecord",
  ["Secret Documents","These documents outline the enemy's defenses and movement, as well as meetings of high ranked warlords."]
 ] call BIS_fnc_setServerVariable;

 Revo_Laptop setVariable ["recipients", west, true];

 Revo_Laptop setVariable ["RscAttributeOwners", [west], true];
};
#

This code is giving me an error in line 3. Invalid number in expression

#

I am too blind to see it

robust hollow
#

start of line 3

#

invisible character

#

or uhhh... thin character

daring pawn
#

simple question i hope;

is there a quick way to use KnowsAbout or something similar to see if a unit knowsAbout any unit of a faction type?

glass frigate
#

targetKnowledge

daring pawn
still forum
#

@winter rose one of my wonderings is why a while do uses only code brackets where if then uses ( ) too?
Because it needs to re-execute the CODE every iteration. Not like if which only executes once.
If you'd just use boolean like while (_x < 1) do {_x = _x + 1} it would be a endless loop, as the condition is never rechecked.
@vapid crypt there is also no if () then {} else if () {} Actually I implemented that with Intercept-CBA, wasn't that hard, BI could do it too, or I could do it for BI. But honestly I'd rather not have that in game.
@cosmic lichen happens when copying from BIF. invisible characters inserted

still forum
#

Wanna break missions?
Put this into your mods preInit 0 = compileFinal ""

tough abyss
#

You sure?

still forum
#

well that'll make the 0 = ... that people often do in init boxes error

winter rose
#

that'll teach'em not to use vehicle init!!

#

or teach BI to remove this stupid "should return nothing" limitation ๐Ÿ˜ or both, one can dream

digital jacinth
#

just do _nil for the return value, donot write into missionNamespace

winter rose
#

if you wanted to break Arma 2 (and I guess Arma 1 and OFP), you could do true = false ๐Ÿ˜†

#

(I think it got patched in A2 or OA at some point, where commands were protected from override)

still forum
#

Yeah in OA

winter rose
#

once you did player = objNull, you were in a bad situation indeed ๐Ÿ˜›

still forum
#

player = nil
if (player == dedmen) then dostuff

tough abyss
#

Attempt to override final function - 0
๐Ÿ˜ 

winter rose
#

hearing Dedmen laughing in the distance

#

seriously though, is there any (good!) reason to keep using vehicle inits?

tough abyss
#

you know what page needed on biki

#

new shit that was added over old shit ppl still use

#

like private ["xzczxczxczxc"]

#

and such

cosmic lichen
#

@robust hollow @still forum Thank. How did you see that? Poseidon Tools didn't show that character.

robust hollow
#

vscode ๐Ÿ‘Œ

still forum
#

I just know it's the case.

#

And vscode shows it ^^

tough abyss
#

so if someone was away from arma can check all the cool stuff and stop embarrassing themselves

still forum
#

new shit that was added over old shit ppl still use we do some of that on the code optimization page

tough abyss
#

yeah but that is like buried and way too advanced

cosmic lichen
#

I copied that code directly from the Biki. Maybe guess it already contained that character

still forum
#

But yes. I'd prefer a page for that. with explanation why a new thing is better than the old thing.
That way I can just link to it instead of re-explaining things

#

I copied that code directly from the Biki. Maybe guess it already contained that character
Oof. Maybe someone copied from forum to biki then?

tough abyss
#

which page @cosmic lichen ?

cosmic lichen
#

BIS_fnc_initIntelObject

tough abyss
#

which example?

cosmic lichen
#

First one

still forum