#arma3_scripting

1 messages · Page 446 of 1

little eagle
#

Well, it is kinda counter intuitive that writing private 1000 times is better than once.

thick oar
gleaming oyster
#

That's a really odd name.

young current
#

@supple vine no weapons cant use user actions

supple vine
#

right, thx

gleaming oyster
#

Can you add an action to a weapon holder though?

young current
#

weapon holder is an separate "vehicle" type object that shows the weapon on it through a proxy

gleaming oyster
#

So it's like a transparent object placeholder that is transparent?

young current
#

if I read that right, yes.

gleaming oyster
#

A little redundant in my wording lol

little eagle
#

Those ground weapon holders are invisible models that show the items inside via proxy.

gleaming oyster
#

So, is it possible to add an action to them? Since they're still "objects" ?

little eagle
#

If you pick them up, the ground weapon holder is destroyed and your soldier shows the item as proxy. In case of a weapon.

#

You could add an action to every player and put inside it's condition that player having the item.

gleaming oyster
#

Alright.

little eagle
#

Backpacks are objects, so you probably can add actions to those too.

#

And uniforms and vests use a cargo dummy object similar to the backpack, though they are not themselves that object.

#

Which means that backpacks can be retextured, while vests can't...

#

This game is shit.

#

¯_(ツ)_/¯

young current
#

you mean vest on ground?

little eagle
#

Carried by player.

#

On ground too I guess.

young current
#

didnt they add something for that

little eagle
#

"something"

young current
#

so you can reach the cloting proxies too with setObjectTexture

tough abyss
#

Is it a bug that BIS_fnc_holdActionAdd's param "conditionShow" even after beginning execution runs? I feel like it shouldn't since the action has already passed conditions to show. The action disappears but if you hold the key it still exec's code

#

kinda odd

raven oracle
#

{
this addEventHandler ["hitPart", { 
  this animate ["Terc",1]; 
}];
} forEach _KHTargets;```
How to  access each index of the array to execute that code?
With "this" being replaced by the code which represents the array item for each iteration
gleaming oyster
#

@raven oracle _x is your special variable used with forEach, thus _x would represent the current tested element when iterating through

raven oracle
#

right, so _x is a magic variable created upon usage of this?

little eagle
#

_x is a magic variable created by using forEach

#

Or count, select and apply.

raven oracle
#

right, Thanking you for your help.

gleaming oyster
#

You also got _forEachIndex there too

little eagle
#

The second this will also have to be replaced.

#
(_this select 0) params ["_target"];
_target animate ["Terc",1]; 
#

The select 0, because HitPart is bananas.

raven oracle
#

this is not an eventhandler method?

little eagle
#

this is only a thing in the editor.

#

Local variable (despite not starting with _ underscore) used in the init box, and trigger code boxes and stuff like that.

raven oracle
#

i meant that the script you sent, looks to me like it just animates the targets into a down state?

little eagle
#

Yeah, didn't bother to write down everything again.

#

That's just what goes into the code block of the HitPart eventhandler.

raven oracle
#

oooh, right, now im with you. Thanks

little eagle
#

I'd do it, but:

Registraion of new accounts for the Community Wiki has been temporarily suspended. We apologize for the inconvenience.

gleaming oyster
#

I thought that was supposed to be reset after new year?

ruby breach
#

Apparently not

young current
#

maybe it did and got closed again

little eagle
#

They know and it's just me that's banned.

glass zinc
#

What page on the wiki shows all the new commands and fuctions BI has added from the new DLC?

little eagle
#

If it's not listed there, then no one made it yet.

glass zinc
#

ok thank you

#

was hoping for something just just showed me the ones that came out with the DLC so i could just pass those onto my actual coders to make them aware of them, will have to figure out another way

ruby breach
#

In typical fashion, it's blank.

little eagle
#

Wait, are we 1.82 or 1.84?

lone glade
#

1.82

young current
#

82

lone glade
#

BAD GOAT

#

dis is no arma 82

little eagle
#

82.1

young current
#

821

#

8.12

ruby breach
#

.812... Oh wait, that's Dayz, nvm

little eagle
#

At the pace we're going, version 821 will be released in the year 6000.

still forum
#

@little eagle currently Lou Montana is doing the most wiki stuff. And he just asked if we want a remake of the eventhandler page

little eagle
#

I have the source open and will edit it later, maybe. Can you or @winter rose just update it then if I give you the edited thing? Please.

winter rose
#

hello there

little eagle
#

:^)

still forum
#

@ruby breach the commands are labeled as 1.82. Just need to wait till the wiki cache refreshes

winter rose
#

ppl keep placing devbranch commands as 1.81, and it's WROOONG

still forum
#

no

#

devbranch 1.81 is wrong

#

but that Kex guy labeled 1.81 as stable. Which is definetly wrong

#

@ruby breach cache is refreshed now ^^

winter rose
#

that's what I meant, and yes, wrooong
devBranch, ok
1.81, nope, nope, noppity nope, patch not out

ruby breach
#

Sweet

tame portal
#

@little eagle I thought your normal Bohemia Account is your wiki account now?

#

Was that plan abandoned?

#

Ah nevermind I just realized my account is gone now too 😄

still forum
#

No.

#

Behind the scenes your wiki account get's created automatically and connected to your BI account

#

But Bots used BI accounts to gain access to wiki and spam the crap out of it

tame portal
#

ah okay

verbal otter
#

apply is something like forEach?

little eagle
#

It's similar in that both are loops. The purpose is different though, as apply returns an array of the same size as the input containing the return values of each iteration of the code block.

#

Whereas forEach returns the return value of the last iteration of the code block. Which is seldomly used.

verbal otter
#

@little eagle ty

hearty plover
#

// Fire on target.
while {[_targets] call ORMP_fnc_numberAliveInGroup > 0} do {
    ["INFO | ORMP_fnc_sniperFire | Checking target validation."] call ORMP_fnc_log;
    private _targ = selectRandom units _targets; // select rand victim in group
    _sniper reveal _targ;    

    // If in view, take the shot.
    private _vision = [objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos _targ];
    if (_vision >= 0.4) then {
        [format["INFO | ORMP_fnc_sniperFire | Good shot, %1 vision, needed 0.4.", _vision]] call ORMP_fnc_log;
        [format["INFO | ORMP_fnc_sniperFire | Good shot, %1 is primary target.", _targ]] call ORMP_fnc_log;
        ["INFO | ORMP_fnc_sniperFire | Taking shot"] call ORMP_fnc_log;
        _sniper setUnitPos "DOWN";
        _sniper doTarget _targ;
    } else {
        [format["INFO | ORMP_fnc_sniperFire | No shot, %1 vision, needed 0.4.", _vision]] call ORMP_fnc_log;
        _sniper forgetTarget _targ;
        _sniper setUnitPos "MIDDLE";
    };
    sleep 25;
    ["INFO | ORMP_fnc_sniperFire | New target."] call ORMP_fnc_log;
};

["RETURNING ORMP_fnc_sniperFire."] call ORMP_fnc_log;```
#

IS there any reason that this would break on a dedicated server?

#

It works hosted locally, via edenEditor, but breaks if I host it anywhere else.

#

The sniper simply doesn't shoot.

still forum
#

have to execute it on the machine where the sniper is on

hearty plover
#

In this case, the sniper would belong to the server correct?

still forum
#

If it's a AI then usually yes

hearty plover
#

Do all eden-placed AI belong to the server?

still forum
#

yes. Unless any headless client mod/script

#

what?

hearty plover
#

Let me back up.

To assure these scripts happen on the sever, should I clal them via initServer.sqf, or should I just pass the correct arguments to a remoteExec?

#

Currently they are called as such.

still forum
#

I would initServer I guess

hearty plover
#
enableSaving [false, false];
// All clients stop executing here, do not delete this line
if (!isServer) exitWith {};

// Execution stops until the mission begins (past briefing), do not delete this line
["SCRIPT COUNTDOWN STARTED"] call ORMP_fnc_log;
sleep 10;

["SCRIPTS STARTED"] call ORMP_fnc_log;
// Enter the mission code here
execVM "scripts\manageIndirect.sqf";
execVM "scripts\manageSnipers.sqf";
#

In just init.sqf

still forum
#

that should work though

little eagle
#
if (isServer) then {
   // do server stuff
};

???

#

I don't see _targets defined anywhere.

frozen knoll
#

^ only if its called on server

little eagle
#

init.sqf is executed everywhere.

frozen knoll
#

yeh

hearty plover
#

I am defining targets in the editor

#

one player group called ormp1

#

another called ormp2

still forum
#

is the sniper member of player group?

hearty plover
#

the sniper, also defined in the editor as snp1, and snp2

#

No, they are ai, targeting the player group.

#

From a distance of 700+

#

clear weather, and clear LOS.

#

This script fails if you add any rain / overcast for some reason.

frozen knoll
#

makes sense though doesnt it

hearty plover
#

It doesn't

#

Because I can cleary see, adn shoot said sniper.

#

In the same weather conditions.

little eagle
#

Well, what does that fancy log say.

hearty plover
#

Also, calling forceWeaponFire doesn't work.

#

LEt me get some screen shots.

#

I need to do my file output... D:

#

But that's another day.

little eagle
#

Well, what's the point of the log then? Seems like that is meant for situations like these.

hearty plover
#

It's right now for live trace debugging.

#

I can turn it on, and it throws sleeps into the log statement, and I can just kinda see everything as it goes, a bit slower..

#

It reports everythings working, and I can see the sniper go prone, and wiggle as he targets me.

frozen knoll
#

diag_log format["Targets - %1 | Victim - %2 | Vision - %3 | Sniper - %4",_targets,_targ,_vision,_sniper];

#

best way to debug is to see what everything is doing then u might realize a issue

hearty plover
#

I do see it.

#

Live, via system chat.

#

Vision is good, target is repoting good, group is found and correct memebers alive is found.

#

Also, again, this is only failing on the dedicated server.

#

No mods are running, during these tests..

willow trail
hearty plover
#

(other than CBA)

frozen knoll
#

your not showing how _sniper is defined in your snippet so its hard to know

gleaming oyster
#

Sounds like a locality issue

frozen knoll
#

sounds like the server doesnt know about it jay

hearty plover
#

snp1 is a unit placed via eden editor.

#
[snp1, ormp1, false] spawn ORMP_fnc_sniperFire;
[snp2, ormp1, false] spawn ORMP_fnc_sniperFire;
#

snp1, snp2 are eden placed units.

#

ormp1, ormp2 are eden placed groups.

frozen knoll
#

_sniper reveal _targ;

#

where in the script is _sniper defined... must be above what you have posted?

hearty plover
#

Yeah, sorry

frozen knoll
#

_sniper = _this select 0; im guessing

#

?

hearty plover
#
["CALLING ORMP_fnc_sniperFire."] call ORMP_fnc_log;

params [["_sniper", objNull, [objNull]], ["_targets", grpNull, [grpNull]], ["_danger", false, [false]]];

// stop, and reveal the target.
doStop _sniper;

// Set danger level
if (_danger) then {
    ["INFO | ORMP_fnc_sniperFire | -- DANGER ENABLED --"] call ORMP_fnc_log;
    _sniper setskill ["aimingAccuracy", 0.9];
} else {
    ["INFO | ORMP_fnc_sniperFire | -- DANGER DISABLED --"] call ORMP_fnc_log;
    _sniper setskill ["aimingAccuracy", 0.02];
};

// Fire on target.
while {[_targets] call ORMP_fnc_numberAliveInGroup > 0} do {
    ["INFO | ORMP_fnc_sniperFire | Checking target validation."] call ORMP_fnc_log;
    private _targ = selectRandom units _targets; // select rand victim in group
    _sniper reveal _targ;    

    // If in view, take the shot.
    private _vision = [objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos _targ];
    if (_vision >= 0.4) then {
        [format["INFO | ORMP_fnc_sniperFire | Good shot, %1 vision, needed 0.4.", _vision]] call ORMP_fnc_log;
        [format["INFO | ORMP_fnc_sniperFire | Good shot, %1 is primary target.", _targ]] call ORMP_fnc_log;
        ["INFO | ORMP_fnc_sniperFire | Taking shot"] call ORMP_fnc_log;
        _sniper setUnitPos "DOWN";
        _sniper doTarget _targ;
    } else {
        [format["INFO | ORMP_fnc_sniperFire | No shot, %1 vision, needed 0.4.", _vision]] call ORMP_fnc_log;
        _sniper forgetTarget _targ;
        _sniper setUnitPos "MIDDLE";
    };
    sleep 25;
    ["INFO | ORMP_fnc_sniperFire | New target."] call ORMP_fnc_log;
};
["RETURNING ORMP_fnc_sniperFire."] call ORMP_fnc_log;
#

That's the full function.

little eagle
#

ormp1 and ormp2 are groups composed of players?

#

Maybe there is no player connected yet, and ai is disabled, so the groups are null / undefined.

#

[_channelID, {_this radioChannelAdd [player]}] remoteExec ["call", [0, -2] select isDedicated, _channelName];

#

Why is this on the wiki -.-

hearty plover
#

But the getAliveMemebers is returning the correct number of players

#

and the target is outputed

#

Each memeber in the group also has variable names, ormp1_1, ormp1_2, etc.

#

That way I can see who, in the group, after the selection is made, is being shot at.

little eagle
#

So "Taking shot" is logged or no?

hearty plover
#

It is.

#

Here, you see, this is me, connected to the server, staring at the sniper.

#

The sniper never shoots.

#

I moved up until the vision was up to 1 as well, still nothing.

little eagle
#

Well, then it's just a thing about doTarget.

hearty plover
#

Now, it works, hosted from the edenEditor

#

but the moment I put it on a dedicated box, or host an actual multiplayer game, it fails.

little eagle
#

Have you checked the servers RPT?

hearty plover
#

I will check again.

#

Also, before I do.

#

I am going to add diag_log to my logger.

#

be right back

frozen knoll
#

also as a test

#

// If in view, take the shot.

#

just make him take the shot with out a check

#

and see if he takes it

#

if he does then u can say its to do with the check on dedi

#

cancel out any checks etc

#

also try [snp1, ormp1, false] spawn ORMP_fnc_sniperFire; in debug after u have loaded in etc to see if theres a timing issue

#

heaps of things u can try and cancel out

formal vigil
#

Meanwhile, here's something quick for you to help me with:
I'm working on a sector control type missions and I want the arsenal to be spawned when sector is captured by BLUFOR. Works fine locally, when I use the "Play in Multiplayer" option in Eden it doesn't work. I suspect it's a locality issue, but I'm not quite understanding it well yet, so I hope you'd be able to help me fixing this issue...

#
  • On the sector in the "Expression" field I've got:
null = [_this select 0] execVM "d_functions\fn_onSectorCapture_spawnHaloFlag.sqf";
  • fn_onSectorCapture_spawnHaloFlag.sqf:
private ["_module"];

_module = _this select 0;

if (_module getVariable ["owner", sideUnknown] isEqualTo WEST) then 
{
        diag_log format ["<<OperationSnake>>: Arsenal will be spawned"];
        _arsenal_safepos     = [getPos _module, 1,100,10,0] call BIS_fnc_findSafePos;
        _arsenal_marker_name = format ["mrk_arsenal_%1", random 100];
        _arsenal_marker      = createMarker [_arsenal_marker_name, _arsenal_safepos];
        _arsenal_marker setMarkerType "hd_dot";
        _arsenal_marker setMarkerText "Arsenal";
        _arsenal = "uns_EQPT_US" createVehicle getMarkerPos _arsenal_marker;
        if (isServer) then { ["SpawnNotification",["An Arsenal box has just spawned in"]] remoteExec ["BIS_fnc_showNotification",-2,true]; };
        if (!isServer) then { ["SpawnNotification",["An Arsenal box has just spawned in"]] call BIS_fnc_showNotification; };
        
        if (isServer) then {[_arsenal] remoteExec ["execVM d_functions\fn_addArsenal.sqf",0,true];};
        if (!isServer) then {null  = [_arsenal] execVM "d_functions\fn_addArsenal.sqf";};
}```

- `fn_addArsenal.sqf`:

```sqf

if (!isDedicated) then {
  waitUntil {!isNull player && {time > 0}};
  
diag_log format ["<<OperationSnake>>: Adding Arsenal action item to spawned crate..."];
_arsenal_object = _this select 0;

hint "Adding Arsenal";

_arsenal_object addAction ["<img size='1' image='\a3\ui_f\data\gui\Cfg\Hints\Gear_ca'/><t color=""#59f3ff""> Arsenal </t>", 
{
    ["Open",false] spawn BIS_fnc_arsenal;
}
,nil,-1, true, false, "","", 3];
};```

Box itself is created, however on mutiplayer there is no arsenal action added and I don't have any clue how to make it work.
frozen knoll
#

wheres _module defined?

#

if (_module getVariable ["owner", sideUnknown] isEqualTo WEST) then
{

formal vigil
#

ah

#

forgot to include

#

just above that line:

#

`private ["_module"];

_module = _this select 0;`

little eagle
#

Please use the code block with highlighting:
```sqf
some code
```

formal vigil
#

aaaah, that I was searching for, thank you @little eagle

little eagle
#

Highlighting?

frozen knoll
#

the first script

#

you have a ; on then end?

hearty plover
#

@frozen knoll thanks man trying it now,.

formal vigil
#

@frozen knoll yes, I do, lemme fix that

frozen knoll
#

haha sweet just looking thru what could be a issue... also did u check ur rpt?

formal vigil
#

yes, no errors there

#

mind that it's working when I use "Play in Singleplayer" in Eden, so I'm guessing I've got remoteExec messed up or something along those lines

frozen knoll
#

on - fn_addArsenal.sqf:

little eagle
#

On the sector in the "Expression" field I've got:

frozen knoll
#

just try remove if (!isDedicated) then { };

little eagle
#

The what?

frozen knoll
#

because i dont know if "Play in Multiplayer" is dedicated

hearty plover
#

rpt shows no sign of what could be wrong, exact same logs I get normally.

#

Like I said, it works flawlessly hosted locally.

formal vigil
#

no, it returns false

hearty plover
#

It has to be a locality issue of some sort.

little eagle
#

What is a sector?

frozen knoll
#

yeh for sure

hearty plover
#

Very frustrating.

#

D:

#

I am also playing in multiplayer from eden

#

not playing in singleplayer./

frozen knoll
#

personally i do all my multiplayer testing with a "dedi" setup on my machine

little eagle
#

Maybe doTarget is just borked.

formal vigil
#

me too

frozen knoll
#

not play in multiplayer

little eagle
#

I do it all in SP and then it just works. : P

#

idk, never had problems with MP.

hearty plover
#

I need to set that up asap bamba

#

this is going to compleelty botch this weeks op for my group now.

#

D:

#

Been stuck on this for like 2 weeks.

frozen knoll
#

use TADST

hearty plover
#

Wait.

frozen knoll
#

nice and easy on ur own pc

hearty plover
#

doTarg

#

arguments have to be local...

#

Does the target have to be local too?

little eagle
#

Doubt it.

lethal ingot
#

How come

if (vehicle player == player)then{

gives me true, even when I'm on my foot?

little eagle
#

But it would be hilarious if the command actually checks and that's what breaks it.

frozen knoll
#

because ur in player vehicle

#

the vehicle ur in is player

#

lol

hearty plover
#

Such a STUPID name for that.

little eagle
#

vehicle player == player ONLY reports true if you are on foot.

lethal ingot
#

Yeah, it gets me every time. Object = vehicle

#

Thanks

formal vigil
#

@frozen knoll removed those two lines from that file, still didn't work

lethal ingot
#

Would

if !(isNull objectParent player) then {do something};

Be better?

frozen knoll
#

darjusz your script need to be called on all machines for it to work

#

not just server or just on player

little eagle
#

Yes, MJRamon.

formal vigil
#

that's the "0" parameter in remoteExec, isn't it?

frozen knoll
#

if (isServer)
if (!isServer)

#

before that

#

ur tring to tell the script to do stuff on server and do stuff not on server

little eagle
#

Supreme in-vehicle check:

if (player in player) then {
    // on foot
};
gleaming oyster
#
if !(isServer)
//versus
if (!isServer)

?

lone glade
#

I got better commy

formal vigil
#

@frozen knoll I'll remove those if statements then and retry.

frozen knoll
#

if (isServer) then {[_arsenal] remoteExec ["execVM d_functions\fn_addArsenal.sqf",0,true];};

#

was it initially called from server?

lethal ingot
#

@little eagle
Arma in a nutshell

frozen knoll
#

null = [_this select 0] execVM "d_functions\fn_onSectorCapture_spawnHaloFlag.sqf";

#

local

lone glade
#
if (allPlayers findIf {_x in player} > -1) then {
};
little eagle
#

I made an expanding brain meme image once with all the in-vehicle checks.

unborn ether
#

@gleaming oyster because

if (!isServer AND !hasInterface)
//versus
if !(isServer AND hasInterface)
little eagle
#

Those are not the same.

frozen knoll
#

@formal vigil if (isServer) then { ["SpawnNotification",["An Arsenal box has just spawned in"]] remoteExec ["BIS_fnc_showNotification",-2,true]; };
make it ["SpawnNotification",["An Arsenal box has just spawned in"]] remoteExec ["BIS_fnc_showNotification",-2,true];
without the isServer check as i believe ur running that locally

#

same for

#

if (isServer) then {[_arsenal] remoteExec ["execVM d_functions\fn_addArsenal.sqf",0,true];};

unborn ether
#

didnt meant it to be the same, just made it explicit

frozen knoll
#

and change the 0 to -2

#

as u dont need to run it on server just all connected clients

formal vigil
#

@frozen knoll just did exactly what you've suggested and it still didn't work

little eagle
#

Keep the 0 so it works in SP.

formal vigil
#
["SpawnNotification",["An Arsenal box has just spawned in"]] remoteExec ["BIS_fnc_showNotification",-2,true];
        
        //if (isServer) then { ["SpawnNotification",["An Arsenal box has just spawned in"]] remoteExec ["BIS_fnc_showNotification",0,true]; };
        //if (!isServer) then { ["SpawnNotification",["An Arsenal box has just spawned in"]] call BIS_fnc_showNotification; };
        
        [_arsenal] remoteExec ["execVM d_functions\fn_addArsenal.sqf",-2,true];
#

@little eagle +1 for that

#

I get the Notification, though

frozen knoll
#

play in multiplayer then open debug and paste [_arsenal] remoteExec ["execVM d_functions\fn_addArsenal.sqf",-2,true]; and click local

#

what happens?

#

sorry

#

_arsenal not defined

formal vigil
#

returned some number in the window, but still didn't attach the action to the box

frozen knoll
#

_arsenal_safepos = [getPos _module, 1,100,10,0] call BIS_fnc_findSafePos;
arsenal_marker_name = format ["mrk_arsenal%1", random 100];
_arsenal_marker = createMarker [_arsenal_marker_name, _arsenal_safepos];
_arsenal_marker setMarkerType "hd_dot";
_arsenal_marker setMarkerText "Arsenal";
_arsenal = "uns_EQPT_US" createVehicle getMarkerPos _arsenal_marker;
[_arsenal] remoteExec ["execVM d_functions\fn_addArsenal.sqf",-2,true];

formal vigil
#

that number is probably the "JIPID" I guess

frozen knoll
#

paste that and run as local

little eagle
#

Wait, wtf is this:

[_arsenal] remoteExec ["execVM d_functions\fn_addArsenal.sqf",-2,true];
#

???

frozen knoll
#

lol true

formal vigil
#

what I did wrong there?

little eagle
#
[_arsenal, "d_functions\fn_addArsenal.sqf"] remoteExec ["execVM", 0, true];
formal vigil
#

oh, ok, lemme try that

frozen knoll
#

_arsenal_safepos = [getPos _module, 1,100,10,0] call BIS_fnc_findSafePos;
_arsenal_marker_name = format ["mrkarsenal%1", random 100];
_arsenal_marker = createMarker [_arsenal_marker_name, _arsenal_safepos];
_arsenal_marker setMarkerType "hd_dot";
_arsenal_marker setMarkerText "Arsenal";
_arsenal = "uns_EQPT_US" createVehicle getMarkerPos _arsenal_marker;
[_arsenal, "d_functions\fn_addArsenal.sqf"] remoteExec ["execVM", -2, true];

#

try that in multiplayer debug run local

little eagle
#

00000000000000000000000000000

frozen knoll
#

with module defined

#

even so u dont have to define module

#

_arsenal_safepos = getPos player;
_arsenal_marker_name = format ["mrkarsenal%1", random 100];
_arsenal_marker = createMarker [_arsenal_marker_name, _arsenal_safepos];
_arsenal_marker setMarkerType "hd_dot";
_arsenal_marker setMarkerText "Arsenal";
_arsenal = "uns_EQPT_US" createVehicle getMarkerPos _arsenal_marker;
[_arsenal, "d_functions\fn_addArsenal.sqf"] remoteExec ["execVM", -2, true];
try that in multiplayer debug run local

#

just getPos player

#

-2 ... dont want it to run on server

#

in a multiplayer enviroment 0 is not needed

formal vigil
#

but if I put 0, the mission will also work in SinglePlayer

frozen knoll
#

if ur supporting both

little eagle
#

0 is the way to go.

formal vigil
#

I do, actually

#

well, that's a minor concern right now

#

I've restarted the mission

little eagle
#

No, this is the main concern here.

formal vigil
#

I've set that to 0.

#

And I'm getting an error now

#

in line 4 fn_addArsenal:

frozen knoll
#

in multiplayer?

formal vigil
#

_arsenal_object = _this select 0;

#

yup

frozen knoll
#

hint "Adding Arsenal";

#

server cant run that

formal vigil
#

ok, I'll remove this

#

it was for debugging purposes, anyways

#

retrying

little eagle
#

Dedicated server just ignores hint, there is no error.

formal vigil
#

correct

#

the error was thrown with:

#

_arsenal_object = _this select 0;

#

so I'm thinking maybe the order of parameters is incorrect?

little eagle
#

Can you copy paste it from rpt? Because that is no error just a line of script.

formal vigil
#

sure

cedar kindle
#

allVariables profileNameSpace

#

shouldnt this work?

still forum
#

not in MP

cedar kindle
#

ooh

little eagle
#

Disabled in MP, because

frozen knoll
#

_arsenal = "uns_EQPT_US" createVehicle getMarkerPos _arsenal_marker;

cedar kindle
#

that makes no sense

little eagle
#

Pubbies worried about their profile data.

cedar kindle
#

meh

formal vigil
#

Error select: Type Object, expected Array,String,Config entry

frozen knoll
#

_arsenal_safepos = getPos player;
_arsenal_marker_name = format ["mrkarsenal%1", random 100];
_arsenal_marker = createMarker [_arsenal_marker_name,[_arsenal_safepos select 0,_arsenal_safepos select 1]];

#

thats if ur getting player pos to test

little eagle
#

Why the random 100, there're just as many numbers between 0 and 1 as there are between 0 and 100?

frozen knoll
#

or position player]

formal vigil
#

@little eagle because I don't want my mission to create duplicate marker names when going after 20 sectors 😃

little eagle
#

But there're just as many numbers between 0 and 1 as there are between 0 and 100.

#

You may as well write 1, because there's literally no difference.

formal vigil
#

really?

little eagle
#

Yes.

formal vigil
#

isn't the parameter the max value for the random?

little eagle
#

It is.

#

But it reports floats.

formal vigil
#

like: random 100 => give me a random integer between 0 and 100

little eagle
#

Not integer, float.

formal vigil
#

aaah, floats, gotcha

#

makes sense

little eagle
#

Even if computers had actually real numbers and not just cheap floats, this would be the same.

#

The analogue computer will replace the quantum computer, you'll see.

young current
#

meh I did remember wrong and you were right @little eagle cant use setobjecttexture on vests although the hiddenselectiontextures do work on them from config 😛

#

must have been a dream

formal vigil
#

so, it's throwing an error: Error select: Type Object, expected Array, String, Config entry for fn_addAdresnal.sqf in line 2

#

which is:

little eagle
#

Yeah, because their containers are just dummies, whereas the backpacks are actually the container. Not that they couldn't weasel around that ofc.

formal vigil
#

_arsenal_object = _this select 0;

lone glade
#

O rly commy?

little eagle
#

params

formal vigil
#

perhaps these parameters should be in opposite order?

lone glade
formal vigil
#

[_arsenal, "d_functions\fn_addArsenal.sqf"] remoteExec ["execVM", 0, true];

little eagle
#

The wiki is wrong, are you surprised?

lone glade
#

no

young current
#

yeh since backpack and face works the rest could too

lone glade
#

I'm just pointing out someone could fix it

#

WINK WINK NUDGE NUDGE

little eagle
#
_arsenal_object = _this select 0;

->

params ["_arsenal_object"];
#

And never again use _this select.

formal vigil
#

retrying

frozen knoll
#

_arsenal_object = _this;

#

would work fine

little eagle
#

params

frozen knoll
#

why tho

#

_this is fine

little eagle
#

params is better

frozen knoll
#

sending one bit of information

little eagle
#

params everywhere and don't worry about it anymore.

#

Why make life hard? This is the -2 all over again.

lone glade
#

oh god....

formal vigil
#

Hey

frozen knoll
#

-2 was if ur running multiplayer why send shit to server that doesnt need to be

formal vigil
#

@little eagle

#

IT WORKS! 😄

little eagle
#

So it works in SP.

lone glade
#

"why make life hard"
the answer is always:
"because I don't know better and can't admit i'm wrong"

formal vigil
#

I owe you big one, man!

frozen knoll
#

yeh but if it was only going to be multiplayer ....

#

which in this case its not

little eagle
#

Why script something only for MP. Makes testing it annoying.

formal vigil
#

But it's intended to be both, so I'm using 0

#

@little eagle +1

frozen knoll
#

i always script for the mode it will be played in

formal vigil
#

true, same here

#

additionally I tend to make missions work both in SP and MP

frozen knoll
#

why add shit that is not needed.... sending to server is pointless waste of resources if its only multiplayer

little eagle
#

But why make a mission broken in SP for no reason or benefit. 🤔

formal vigil
#

another +1 goes out to @little eagle

frozen knoll
#

if its a multiplayer only game then make it multiplayer only for optimal perfromance

little eagle
#

sending to server is pointless waste of resources if its only multiplayer
You do realize that in a server client structure, every message goes through the server anyway?

frozen knoll
#

yeh but then making the server run the code when it doesnt need to aswell... why

lone glade
#

the message has to go through the server to get to the clients....

frozen knoll
#

yeh but it doesnt execute it.... just passes it on

formal vigil
#

@frozen knoll that's why you use isServer and isDedicated tho

little eagle
#

It's remotely executed code! The resources for the actual execution are neglible compared to sending packages around.

lone glade
#

may I reminder you you're remoteExec'ing execVM

formal vigil
#

It's like delegation, IIUC.

lone glade
#

I think your worries are misplaced....

little eagle
#

I-it's beautiful, Mr. Lou.

#

But why did you have to use fucking tabs? lol

lone glade
#

4 spaces or bust for sqf

#

fite me lou

little eagle
#

If I hover over the Server icon in HandleScore, the tooltip is bonkers.

hearty plover
#

@frozen knoll @little eagle can I send you guys that function, and maybe you guys test it on another dedi?

winter rose
#

my pleasure! 😉 enjoy, and beep me if something's wrong / enhanceable

tabs are wiki default 😛 Dedmen could fix the tab size but he doesn't want to 😏

hearty plover
#

Just want to see if anyone get's variable results.

#

I feel something is indeed broken with doTarget / doFire

little eagle
#

@winter rose I found an error, there're unfortunately some tabs that should be replaced by 4 spaces each.

formal vigil
#

Ok, one last issue to solve.

#

initPlayerLocal.sqf:


execVM "d_functions\fn_addPush.sqf";

#

fn_addPush.sqf:


player addAction [
        "<img size='1' image='\A3\ui_f\data\gui\rsc\rscdisplayarcademap\icon_sidebar_hide_up'/><t color='#33cc99'> Push Vehicle</t>", 
        {
            _veh = cursorTarget;
            _vel = velocity _veh;  
            _dir = direction player; 
            if(isNull _veh) exitwith {};
            if((_veh isKindOf "Ship")) then
            {
                
                    _displayName = getText(configFile >> "CfgVehicles" >> (typeOf _veh) >> "displayName");
                    _upp = format["Pushing %1",_displayName];
                    //Setup our progress bar.
                    hint _upp;
                    _speed = 8.5;
                    _veh setVelocity [   (_vel select 0) + (sin _dir * _speed),    (_vel select 1) + (cos _dir * _speed),    (_vel select 2)  ];
            };
        }, 
        [], 
        -4, 
        false, 
        true, 
        "", 
        ""
    ];

#

Script adds action to push out the ship if it's get stuck on beach / shore (?).

#

Works in SP, not in MP.

little eagle
#

The statement of the action runs on the machine that used the action. setVelocity only works on local objects (local args), but the boat probably belongs to the server, not the client with the avatar.

formal vigil
#

Correct.

#

Is there a way to make it work on objects created by the server?

#

Would moving the statement to separate file and doing remoteExec like in the previous case did the trick?

outer fjord
#

Anybody have a good source or tutorial on how to pull data from a mission into a external program? Like kill counts and such?

little eagle
#
_veh setVelocity [   (_vel select 0) + (sin _dir * _speed),    (_vel select 1) + (cos _dir * _speed),    (_vel select 2)  ];

->

[_veh, _vel vectorAdd ([sin _dir, cos _dir, 0] vectorMultiply _speed)] remoteExec ["setVelocity", _veh];
formal vigil
#

@outer fjord only way that I have heard of is extDB

outer fjord
#

Thanks

formal vigil
#

@little eagle You have earned my utmost respect, Sir! Thank you so much for your help! Works now.

little eagle
#

Thank the guy that wrote remoteExec.

formal vigil
#

I thank you for helping me understand which code needs to be executed locally or remotely.

little eagle
#

And those sweet vector commands...

unborn ether
#

Added: New ctrlSetPixelPrecision script command what's that exactly?

astral tendon
#

How do i pass a string to a object? like _object = "MyObject" (remove the ""?)

#

Using Text returns a error that I am using a text and not a object

tough abyss
#

netID? Is that what you mean?

#

like netID is a stirng and then you can get the object from that

astral tendon
#

I found it call compile "string"

tough abyss
#

ah alright

astral tendon
#

i was doing it wrong at the begining

#

I need to actually put a object that is placed on the editor

#

or the variable is set

#

I though it would return a error or something but it just did nothing if the object did not exist

glad venture
#

Is there a way to overwrite a config file script from a mod with a new script of the server, so instead of the mods script running it would be the changed one on the server?

little eagle
#

No.

leaden summit
#

Is there a quick and easy way to increase a helicopters sling load capability?

little eagle
#

No.

leaden summit
#

😦

#

Thanks

little eagle
#

setMass on the cargo maybe.

#

With all the consequences.

leaden summit
#

Yeah could cause more trouble than it's worth

#

Oh well, looks like the Brits in my mission will just have to settle for an American chopper delivering their vehicles 🇺🇸

strange urchin
#

@glad venture If the script is stored in a global variable, you can definitely do that.

#

Though, if the script gets called by the filepath....

#

You’ll have problems

radiant needle
#

@Dedmen Is it possible to add long range radio to infantry unit via script with TFAR Beta?

#

@still forum

unkempt spire
#

need to select random unit in cfgGroup
_unit = (configFile >> "CfgGroups" >> "East" >>"OPF_F" >> "Infantry" >> "OIA_InfTeam" >> selectRandom vehicle );
I think the error is at end, tried selectRandom "unit"/this

#

unit = (configFile >> "CfgGroups" >> "East" >>"OPF_F" >> "Infantry" >> "OIA_InfTeam" >> selectRandom this >> vehicle ); ??

still forum
#

@astral tendon I found it call compile "string" no.
missionNamespace getVariable "string" does the same. And is like 10x faster.

@radiant needle Is it possible to add long range radio to infantry unit via script with TFAR Beta? Yes. Give him a Radio backpack.

radiant needle
#

Well duh, but I want it so he doesnt have to wear a backpack

#

or possibility to carry static backpack or parachute

still forum
#

@unkempt spire
selectRandom (getArray (configFile >> "CfgGroups" >> "East" >>"OPF_F" >> "Infantry" >> "OIA_InfTeam")) maybe?

#

I don't think that's possible then. Atleast not yet

radiant needle
#

Because I know you can script one to a vehicle

still forum
#

that's a completly different thing

#

And no you officially can't

#

you can hack around with the config caching to pretend that it has a radio

radiant needle
#

Am I thinking of the other TFAR?

still forum
#

"other TFAR"? What's that

radiant needle
#

The pre 1.0

still forum
#

I think that maybe had a variable you can set on a vehicle. Not sure

#

but that really only applies to vehicles

radiant needle
#

Also what are the chances of getting a RDF?

#

Think it'd be a cool little feature

#

_vehicle setVariable ["tf_hasRadio", true, true]

#

Does that work for TFAR Beta, or is that for old

still forum
#

what is a RDF?

radiant needle
#

Radio Direction Finder

still forum
#

Whaaat is that 😄

#

tf_hasRadio still does something on 1.0. So I guess it still works

radiant needle
#

RDF is a highly directional antenna, so you spin in a circle and if you hear a signal you plot it on a map

still forum
#

Ahhh Radiocompass on german. I don't think that'll be a thing ^^

#

though triangulating a radio signal opens lots of nice new gameplay possibilities

radiant needle
#

Yeah an RDF would allow you to either home or triangulate

still forum
#

but we wouldn't actually do anything with the signal. That thing would just take the coordinates of the sender and show you the direction

radiant needle
#

Yeah you probably could script it, because there are commands to see if a signal is attainable

#

and whether the unit is transmitting

still forum
#

There are no commands to see if a signal is attainable actually. That's all in plugin. But we can see who is transmitting... I think. And if we are receiving. But we don't know who we are receiving...

radiant needle
#

Yeah that'd be the only issue, don't want a unit getting a bearing if they are out of radio range

#

or not on the same frequency

#

I believe you can pull a units frequencyu though

still forum
#

nope. actually not.

#

or... Well... Kinda

#

With Intercept TFAR that should be easier though

radiant needle
#

Oh yeah I read the doc wrong, you only can get a groups default frequency

#

Now can you script it so a unit cant hear radio?

unkempt spire
#

_unit = (configFile >> "CfgGroups" >> "East" >>"OPF_F" >> "Infantry" >> "OIA_InfTeam" >> "Unit0" >> "vehicle") call BIS_fnc_getCfgData;
works but randomizing "Unit0" with
_unitran= selectRandom (getArray (configFile >> "CfgGroups" >> "East" >>"OPF_F" >> "Infantry" >> "OIA_InfTeam"));
doesnt work

still forum
#

You can get the Radio with UniqueID and from the unique ID you can access the global settings list and that contains all currently set frequencies.
You can set the unit's receiving range modifier to 0. Then it can't receive anymore

radiant needle
#

Because you might be able to simulate a directional antenna by saying "If _Bearing1 - _Bearing2 <= 2 do nothing, if >=2 mute radio

#

obviously that's psuedo code but

still forum
#

@unkempt spire generate a list of all units in the team. Then use selectRandom.
I think getArray doesn't work on a class

radiant needle
#

So if you're facing within 2 degrees of target, it lets your radio behave as normal

#

but if you are more than 2 degrees away, make it so radio coef is 0

still forum
#

yeah that would be possible. But you don't know the source/target of a radio transmission in SQF

radiant needle
#

You can't get transmission source in SQF?

still forum
#

correct. You can only see that someone is talking or if you are receiving a transmission (1.0 only). The second one actually isn't needed but people wanted a eventhandler for receiving a transmission

radiant needle
#

Can you check if a unit has a radio?

still forum
#

yes

#

Ofcause. It's in the units inventory.

radiant needle
#

Could you check if ANY unit with a radio is within 2 degrees when transmission is being received?

still forum
#

sure

#

that'll be expensive AF though

radiant needle
#

What if you restricted the radio being tracked to something that isn't in use elsewhere in the mission?

#

Like if everyone is rolling with PRC-152s, only track FADAKs

still forum
#

that wouldn't change anything

#

you can't track radios really

radiant needle
#

That's too bad, would be really fun mechanic

#

If it's something that would be significantly easier to do from within the mod itself, you should still totally think about adding it

still forum
#

If you want stuff like directional radios. Then you should use ACRE.
TFAR is made to be simple

radiant needle
#

I'll try scripting in one and see how bad it actually hits the performance, what was that command that checks if a transmission is being received?

unkempt spire
#

couldnt figure it out, just went with:

_infTeams = ["OIA_InfTeam","OIA_InfTeam_AT","OIA_InfTeam_AA","OI_reconPatrol"];
_unitarray = ["Unit0","Unit1","Unit2","Unit3"];
_unit = (configFile >> "CfgGroups" >> "East" >>"OPF_F" >> "Infantry" >> (selectRandom _infTeams) >> (selectRandom _unitarray) >> "vehicle") call BIS_fnc_getCfgData;

limiting to 4 units

ivory nova
#

"Added: A new '#' script operator (works in the same way as select, but is shorter to write and has higher priority than math functions)" Does this mean we can now write _whatever # 0?

winter rose
#

yes, but you'll get spanked.
also it's only for Array select index - all other syntaxes are not covered by #

ivory nova
#

Ahh, got it, cheers

still forum
#

and be very wary about its use when you are also using any preprocessor stuff

warm gorge
#

Has anyone had any issues with addActions on objects and having trouble getting the right angle on them for the action to popup since the last update? This is especially noticeable with info stands

errant jasper
#

Now you mention it. Yesterday during a playtest just to confirm DLC didn't break too much, we did have problem with a huge cluster of crates (one object). It could only be accessed from two out of four sides.

warm gorge
#

Yeah I'm thinking they've broken something with the changes they did with actions. Probably worth creating a ticket for

unborn ether
#

So as for 1.82, when tank (or any vehicle?) is close to some damage area, like destroyed building or indirect hit, it performs some scripted engine explosion, which doesn't respect any handlers. Thanks BIS.

UPD: Also some setDamage-like actions are also present. Even over >1 which means HandleDamage doesnt give any f...

errant jasper
#

How does ACE function compilation caching work? Everything is compiled into uiNamespace in XEH_preStart.sqf . Then later everything is compiled into missionNamespace in XEH_preInit.sqf again?

still forum
#

That's CBA not ace.
"Then later everything is copied from uiNamespace into missionNamespace in XEH_preInit.sqf"

errant jasper
#

? But both preStart and preInit simply runs all the PREP definitions which expands into compile preprocessFileLineNumbers

still forum
#

it doesn't expand into compile

#

unless you disabled function caching

errant jasper
#

Ah I see. Since I am targeting CBA but using the structure of ACE, I should still keep my preInit something like:


ADDON = false;

#include "XEH_PREP.hpp";

ADDON = true;
still forum
#

yeah

errant jasper
#

So CBA recompilation only works if you use CfgFunctions?

still forum
#

no

#

CBA has nothing to do with CfgFunctions

errant jasper
#

My bad, I got it confused because certain modules of CBA does

still forum
#

CfgFunctions is BIS code. Which afaik also does caching. aka compile once at gameStart and then just copy on preInit

#

so essentially the same as CBA

errant jasper
#

But if ACE uses CBA then why they have their own cache wrapper?

#

E.g.: PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END;

still forum
#

That does nothing

#

unless the CBA cache is disabled.

#

That's used so you can ingame call [] call ACE_PREP_RECOMPILE; to have all functions reload/recompile. So you don't need to restart the mission to reload scripts if you are testing/dev-ing stuff

errant jasper
#

Ahh okay gotcha. Thx.

willow trail
still forum
#

I could swear I already read that message before 🤔
Where did you execute it?

willow trail
#

correct, I got no answers tho. Twas late at night maybe now people are on :)
And i exucted it globally locally and on server none of them did anything

still forum
#

wiki says it will only work on server

#

What do you expect to happen?

willow trail
#

get a radio channel added to side/global/direct and stuff like that

#

i used the script a while ago and thats what it did and it worked

still forum
#

As Example 3 shows you have to add the channel on each player

willow trail
#

i tried to run example 3 on server and yet nothing happened, Do i need to do something else to add it to the players?

still forum
#

I never used that command... And I'm already through all my guesses 😄

willow trail
#

Damn, It just seems a update broke it

#

i have used that exact command before and it worked

#

i tried it yesterday and suddenly nothing happens

warm gorge
#

Ive used radioChannelCreate before with no problems. Only issue I had was occasionally players would randomly get removed from the channel after being added with radioChannelAdd (clientside)

#

Havent tried it since the update though

willow trail
#

Did you use a altered script or the same one on the wiki?

warm gorge
#

A bit different. Created the channels serverside with publicVariables using the return value of the command. Then used that to radioChannelAdd them on the clients

willow trail
#

ahh oke

warm gorge
#

Server:

SR_radioStaff = radioChannelCreate [[1, 0.5, 0, 1],"Staff Channel", "[Staff] %UNIT_NAME", []];
publicVariable "SR_radioStaff";

Client:

SR_radioStaff radioChannelAdd [player];
#

@willow trail

#

Thats how I did it

willow trail
#

Thanks i'll try it in a bit once im done verifiying arma 3

warm gorge
#

ok

little eagle
#

You only have to make sure that player isn't null and SR_radioStaff isn't nil.

warm gorge
#

Yep

little eagle
#

I wonder, does access to the channel carry over after respawn?

warm gorge
#

What am I better off using for general vehicle/object position adjusting over water and over land? Or for storing building positions in a database? PositionWorld/PositionASL/PositionATL?

little eagle
#

World or ASL I'd say, because you can actually use vector math on them, because their z=0 is on a flat plane and not dependant on terrain.

#

With ASL you can change the object type and it still works, World you can't (unless they're all soldiers) and is faster.

still forum
#

why can't you change object type with world?

#

doesn't world use model origin just like ASL?

little eagle
#

Yeah, but different models have different distances from their center to their LandConntact, so you get things that float or get stuck in the ground (thus rocket jump thanks to physx).

still forum
#

how does LandContact influence that?

#

I thought ASL and world use the same model origin

little eagle
#

If you put LandContact over the ground, your vehicle falls down.

#

ASL and World use the same z=0 for the map, but a different point in the model.

still forum
#

That was what I meant with doesn't world use model origin just like ASL?

#

and you said yes. Now you say no

little eagle
#

Depends on what you mean by origin. Thought you meant the model.

#

Origin implies a point, z=0 for ASL and World is a flat plane.

still forum
#

model origin is 0,0,0 in model local coordinates

#

generally. Unless you use some mempoint for some reason

winter rose
#

quick question: iirc one can create an array filled with 0 for example; how could I instantiate an array of 99 0s for example? besides _array = [0,0,0,0,(…)]

little eagle
#

ASL doesn't use the models origin at [0,0,0].

still forum
#

for to loop with pushBack

#

what does ASL use then?

#

Something that uses the model origin should be the most exact thing

little eagle
#
_array = [];
_array resize 99;
_array = _array apply {0};
#

ASL uses a point in the LandContact lod.

still forum
#

Thanks didn't know that. Is that written on the wiki even?

little eagle
#

Probably somewhere.

#

What did you think, that only ATL/AGL on land does this?

still forum
#

I didn't know anything does that

#

I thought they all use the model [0,0,0] origin

#

besides things like eyePos that obviously use a mempoint

little eagle
#

Well, otherwise getPosATL wouldn't report z close to 0 everywhere.

winter rose
#

@little eagle thanks! I totally forgot the resize

little eagle
#

World using the origin, and ASL using the land contact is the only reason World is faster than ASL.

warm gorge
#

I think ill use PositionWorld, seems the best option for what I have in mind. Thanks for the run down.

still forum
#

for storing positions and restoring them exactly as they were World sounds more appropriate

warm gorge
#

Yeah thats exactly what im wanting

still forum
#

Also Intercepts direct position access thingymabob returns worldpos 😉

little eagle
#

tf is that again?

still forum
#

It's the dough that makes the cookies taste good

little eagle
#

tf does that mean again?

still forum
#

what exactly?

#

tf means "technical failure"

errant jasper
still forum
#

@errant jasper if your setting is called MY_setting_stuff then you read it by writing MY_setting_stuff because it's a variable

#

@lone glade wrong mention... kinda

errant jasper
#

Well that is simple.

lone glade
#

GODDAMN

#

I keep doing that

little eagle
#

You could also do:
"MY_setting_stuff" call CBA_settings_fnc_get

#

But why?

#

Guess it works in ui namespace.

errant jasper
#

And I can safely read it in post init?

little eagle
#

If your cba_settings_fnc_init function is preInit, yea.

gleaming oyster
#

I'm looking at making my own version of the bis sectors. I currently have a function that finds any markers with sector in the name and initalizes a loop that just checks for blu and opf count inside the sector, should i just make one giant loop for all the markers or do it individually like i am right now?

#

They all exit when the alpha of the marker is zero

#

Or does it even matter?

little eagle
#

I'd say one loop and work with an array of markers. Instead of killing the loop, remove the marker from it.

gleaming oyster
#

Okay, sounds good.

winter rose
#

does anyone know if being incapacitated with Revive triggers the "Killed" Event Handler?

inland badger
#

Anyone know what the issue is here? Like in-game it works fine but ends up in the log stating that there is an error :S

} else {
(_lines select _line) select _step setVariable ["rangeT>
17:28:19   Error position: <_line) select _step setVariable ["rangeT>
17:28:19   Error Undefined variable in expression: _line
17:28:19 File mpmissions\__CUR_MP.Malden\ranges\range6\full.sqf, line 18```

Code
```sqf
params ["_run", "_line", "_step"];

_lines = [
    [range6_1,range6_2,range6_3,range6_4], //Line1
    [range6_8,range6_7,range6_6,range6_5] //Line2
];

if (_run == "true") then {
    //CANCELS THE FIRE RANGE
    {
        _x select 0 animate ["Terc",1]; _x select 0 RemoveEventHandler ["MPHit",0];
        _x select 1 animate ["Terc",1]; _x select 1 RemoveEventHandler ["MPHit",0];
        _x select 2 animate ["Terc",1]; _x select 2 RemoveEventHandler ["MPHit",0];
        _x select 3 animate ["Terc",1]; _x select 3 RemoveEventHandler ["MPHit",0];
    } forEach _lines;
} else {
    //RUNS THE FIRE RANGE
    (_lines select _line) select _step setVariable ["rangeTime", diag_tickTime, true];
    (_lines select _line) select _step setVariable ["rangeLine", _line, true];
    (_lines select _line) select _step setVariable ["rangeStep", _step, true];
    (_lines select _line) select _step animate ["Terc",0];
};```
still forum
#

exactly as it says. _line is undefined

#

whoever called the function maybe passed nil to it

inland badger
#

Yea but it can't be, like it's executed like this ["false", 0, 2] execVM "ranges\range6\full.sqf";

#

that's why, actually let me log it and see if it is empty or not

#

Nvm, seems that it is working till it should be executing the next row of targets. Thanks tho!

lone glade
#

jesus christ ded

#

that's the first thing you notice?

#

NOT THIS???
_run == "true"

inland badger
#

that part actually works, I wanted it to be a boolean but for some reason arma doesn't like it if I use that in a if statement so I just did the most simplest shit u could do.

jade abyss
#
_run = true;
if(_run)then{systemchat "Know your basic stuff"};```
#

oO

#

I guess you tried if(_run == true), or?

inland badger
#

I know, like I said just did the simplest shit I could do, I just want the system to work after that I'll cleanup the code.

#

and yes to that question

jade abyss
#

That's easiest way possible 😄

#

Don't start teaching yourself bad habbits.

inland badger
#

I'm use to php in which if(whatever == true) would work but arma said no that doesn't work, so I just added it to a string for the time being xD

jade abyss
#

=}

still forum
#

in php bool == true makes equally no sense as in Arma or any other language

inland badger
#

it's super weird as I use attach a MPHit event handler to the target and when it get hit it should send up the next target which it does perfectly and looking at the scoreboard gives the correct time as well but for some reason the error appears.

_oldTime = (_this select 0) getVariable "rangeTime";
_oldLine = (_this select 0) getVariable "rangeLine";
_oldStep = (_this select 0) getVariable "rangeStep";
(_this select 0) setVariable ["scoreTime", (diag_tickTime - _oldTime), true];
(_this select 0) animate ["Terc",1];
(_this select 0) RemoveMPEventHandler ["MPHit",0];
if (_oldStep != 3) then { 
    {
        if (!hasInterface && !isServer) then {
            diag_log format["_oldTime %1 | _oldLine %2 | _oldStep %3", _oldTime, _oldLine, _oldStep];
            ["false", _oldLine, _oldStep+1] execVM "ranges\range6\full.sqf";
        };
    } remoteExec ["call", HC];
};
#

wouldn't matter tho, it works just fine in php as if u just entered if(bool) in php, it's a habit ^^

#

Since the code is working I'm just canceling it if it's null.

#

Question, lets say I get a variable which then some how turns out to be null, could you do for example like this getVariable "scoreTime" || 0 to give it the 0 if it's null. I know in lua could do that, thats why I'm asking.

ruby breach
#

@inland badger ```sqf
_this getVariable ["someNumber",0]; //returns 0 if nil

inland badger
#

@ruby breach Cheers bro! 😃

kindred lichen
#
[[_msg,"PLAIN DOWN"],"cutText",true] call BIS_fnc_mp;

?? doesn't work for fnc_MP?

tough abyss
#

It’s a depecrated function I believe

#

Replaced with remoteExec

kindred lichen
#
[_msg,"PLAIN DOWN"] remoteExec ["cutText"]; 

still giving same, found string expected array error.

still forum
#

well yes.

#

all variants of cutText expect a array as right argument

#

you are passing a _msg which I guess is a string. and a string.

#

just also give a layer number to not confuse it

kindred lichen
#
[[_msg,"PLAIN DOWN"]] remoteExec ["cutText"]; 

this works.

#

I was confused because example show things like
"parameter" remoteExec ["hint"];

so I guess remoteExec, packs strings into a single element array before sending, and doesn't send parameter as a string.

ruby breach
#

Right. And for cutText you need an array as a parameter. Your first example sent two strings as parameters

scarlet temple
#

Hey guys.. i just discovered a strange behavior...
i worte a script to chop down trees in a jungle and used _x setdamage 1; to get the falling tree animation.
3 seconds later, the tree will be hidden by _x hideobjectglobal true;.. but this isn't working in MP but in SP / Editor it works fine...
Does someone know this behavior or a way hide the tree after destroying it?

tough abyss
#

Are you calling hideobjectglobal from the server only?

scarlet temple
#

global should be executed from server and client

#

but client initiate the command

tough abyss
scarlet temple
#

ah.. srsly? shit

#

didn't see that

tough abyss
#

It does at least explain your problem 😃

scarlet temple
#

so many hours 😩

#

noooooo

tough abyss
#

I wish the wiki made this more clear generally, would be nice to have the index show markers for server only or everywhere commands etc. For now you have to scour the docs and learn every commands quirks.

scarlet temple
#

it's arma.. why should it be easy?

tough abyss
#

Purposefully made hard to keep you guessing.

errant jasper
scarlet temple
#

@tough abyss thanks mate... is working now -.-

nimble pewter
#

Is there a script for disabling the gmg on the marid?

scarlet temple
#

you can empty the ammo

#

for this specific weappon

nimble pewter
#

Won't that remove the 12.7 ammo too?

plucky hornet
#

Tried this_

scarlet temple
#

this removeWeapon "missiles_titan"; for example

plucky hornet
#

I don't know what the gmg is called (script wise) but you should be able to find it if you locate it in the functions viewer

#

Okay so quick question here, anyone here who has any experience with the 360 Degree Training course or making shooting ranges with a scoreboard?

verbal otter
#

Error foreach: Type String

#

i hate arma for this

little eagle
#

Why? It says what's wrong.

verbal otter
#

i use forEach for array, and i check array in this script

#

typeName is ARRAY

#

but not for arma

little eagle
#

Well, the code block too has to not be a string.

#

So maybe that's where you got it wrong.

lone glade
#

post the error and the code then we can help you

verbal otter
#
23:11:27   Error foreach: Тип Строка, ожидался Массив
23:11:27  line 343 ```
#
        _sls_lb lbAdd "Empty";
    } else {
        {
            [_x,_forEachIndex] spawn _getPlayerTrd_listFill;
        } forEach _data;
    }; ```
#

systemChat returns array

#

that is array:

#

[[34,0,""30Rnd_556x45_Stanag"",100,7,48,""76561198029642630"",""1"",""TR""]]

#

@little eagle no, code block not in string 😦

little eagle
#

Your code obviously says to use forEach on _data only when _data is NOT an array.

#

Did you miss that it says else?

verbal otter
#

in another place of script i use this construction and it works 😕

little eagle
#

No, your logic is inverted.

#
if (_data isEqualTo []) then {
        // _data is an array
 } else {
        // _data is NOT an array
 }; 
#

Yet you use forEach _data exactly when _data is not an array.

#

That will error and that's a good thing.

verbal otter
#

isEqualTo like isEqualType?

little eagle
#

omg

#

Let's start over.

#

_edt_cn ctrlSetText ">

#

Why does it print this line? That seems like a different line than the forEach.

verbal otter
#

this line right after forEach

little eagle
#

Can you post the whole error?

#

This starts at line 2 or 3.

#

Why does an ui script use spawn? This looks weird.

#

Also 343 lines sounds concerning.

verbal otter
#

changed a little bit script, but error still

#

i use spawn because in all ui scripts 😄 don't know why

#
} forEach _data;
} else {
_sls_lb lbAdd "о
23:41:05   Error position: <forEach _data;
} else {
_sls_lb lbAdd "о
23:41:05   Error foreach: String, ожидался Array
23:41:05 File C:\My documents\Arma 3 - Other Profiles\TR\mpmissions\TR.Malden\code\auction.sqf, line 341
#
        {
            [_x,_forEachIndex] spawn _getPlayerTrd_listFill;
        } forEach _data;   << line 341
    } else {
        _sls_lb lbAdd "Empty";
    };```
little eagle
#

Just post the whole thing. No one knows what _data is, except that it clearly is a string.

#

pastebin or something.

#

Github gist has syntax highlighting.

verbal otter
little eagle
#

That looks different.

#

span class="re5"> seller = {
What is that?

verbal otter
#

idk, that pastebin added

#

my code starts from seller = {

#

(count _data > 0)

#

but

#

_data is string

little eagle
#

count works on string and array.

#

For string reports the length of the string, where it counts non ascii as 2 or 3 chars, and for array it reports the size.

verbal otter
#

but systemChat returns

#

typeName _data = "ARRAY";

little eagle
#

_getPlayerTrd_listFill is completely undefined.

#

Okay, I think I know.

#

Check _getPlayerInv_listFill

#

You probably use a variable called _data there and missed using private.

verbal otter
#

ok, ty

#

will try

little eagle
#

This is why private ARRAY is cancer.

#

You WILL miss a variable.

#

Only a matter of time.

verbal otter
#

@little eagle you are a genius, everything works 😃

little eagle
#

phew, redeemed.

verbal otter
#

i just moved _getPlayerTrd_listFill to buttom and it works 😄

#

thank you a lot!

little eagle
#

Well, the proper fix is to correctly use private in every function.

verbal otter
#

understand

#

thank you again!

glad venture
#

whats the best way to spawn in AI with commands?

#

I spawned in a blufor man with bis fnc spawnvehicle, set his side to WEST, and was playing as blufor, and he shot at me and killed me, does anyone know how to fix that?

little eagle
#

If units from the same side shoot you, you probably were marked as renegade, because you killed too many friendlies or civilians.

astral tendon
#
player targets [];

For some reason the debug console is returning nothing, even though there is a guy right in front of me, but the Wacth is returning the aray

frozen knoll
#

what are you trying to achieve and how

astral tendon
#

just the the aray

#

Anyway, seens like my debug console is broken, nothing works on it.

ruby breach
#

Do you have BIS_fnc_debugConsoleExec allowed in CfgRemoteExec?

#

Watch fields don't use it, which may explain your issue

astral tendon
#

I have no idea what is that

#

i never touch it

molten folio
#

is this possible and will show in the RscCombo?

little eagle
#

Skip the panelWL variable alltogether, orherwise it doesn't work.

molten folio
#

what u mean?

#

@little eagle

little eagle
#

Skip the panelWL variable, otherwise it doesn't work.

astral tendon
#

A exemple is this

_unit = player;
_targets = _unit targets []; 
_targets;

returns nothing on the debug but it returns on the Watch
what is going on?

molten folio
#

what do u mean skip it? i want these Licenses to be in the combo

little eagle
#

Your script is broken though due to this variable.

molten folio
#

how do i fix it?

#

xd

little eagle
#
private _test = ["license_civ_pilot","license_civ_dive","license_civ_gun","license_civ_rebel","license_civ_dive"];

private _index = lbAdd [9902, _test];
lbSetData [9902, _index, _test];
lbSetCurSel [9902, 0];
molten folio
#

oh

#

kk

#

Thanks

little eagle
#

Well.

#

lbAdd needs a string, not an array, so you also need a loop.

molten folio
#

?

little eagle
#
private _test = ["license_civ_pilot","license_civ_dive","license_civ_gun","license_civ_rebel","license_civ_dive"];

{
    private _index = lbAdd [9902, _x];
    lbSetData [9902, _index, _x];
} forEach _test;
molten folio
#

and i keep the lbSetCurSel at the end?

little eagle
#

No, why? It's pointless. The first (0) element is selected anyway.

molten folio
#

oh k

#

{
if (isPlayer _x and (_x != player)) then
{
_uid = getPlayerUID _x;
_index = lbAdd [9901, (name _x)];
lbSetData [9901, _index, _uid];
};
} forEach TW_panel;

#

if i remove _x !=player will i be albe to see my self?

astral tendon
molten folio
#

rip lol

astral tendon
little eagle
#

The config viewer is scripted with scheduled code, and so by nature, it has tons of race conditions. If you're unlucky, it just dies.

astral tendon
#

race conditions?

molten folio
#

@little eagle how do i paste my code in a box like u did

little eagle
#

```sqf
player addItem "ace_banana";
```

molten folio
#

test

#

Oh ty

still forum
#

🤔

meager heart
#

player targets [];
For some reason the debug console is returning nothing
targets depends on knowsAbout values, Roque_THE_GAMER

little eagle
#

race conditions?
Yeah. When different script instances are executed at once and run against each other resulting in unstable and unpredicatble results. Especially nasty when the broken behavior happens rarely, but consistently.

astral tendon
#

@meager heart but why it does on watch?

meager heart
#

what ?

astral tendon
#

The debug console is returning nothing but the Watch is returning the aray

still forum
#

"Watch" is part of the debug console

astral tendon
#

But, as commy says, that maybe have to do with my scripts being shit

meager heart
#

sounds trueble* 😀

little eagle
#

Nah, the config viewer is not your script, though I guess a bad custom scheduled script can fry the scheduler faster.

astral tendon
#

if you not going to cringe, i show you

molten folio
#

private _test = ["license_civ_pilot"]; in the arrays should it have "' , or ``

still forum
#

"" or ''

#

" or '

molten folio
#

so both?

still forum
#

one of them

molten folio
#

ye

still forum
#

both work

molten folio
#

k

#

what if i wanna add more than one

#

private _test = ["license_civ_pilot","license_civ_drive"];

#

??

still forum
#

Yes.. That's... yes.

molten folio
#

ty

still forum
meager heart
#

on that page ^ in examples _mySingleArray = ["Item1","Item2]; missing "

still forum
#

🤦

molten folio
#

`private _test = ["license_civ_pilot","license_civ_drive"];

{
private _index = lbAdd [9902, _x];
lbSetData [9902, _index, _x];
} forEach _test;
` this isnt working xdd help plz

still forum
#

@molten folio
```sqf
<code>
```

#
private _test = ["license_civ_pilot","license_civ_drive"];

{
    private _index = lbAdd [9902, _x];
    lbSetData [9902, _index, _x];
} forEach _test;
molten folio
#

xddd

still forum
#

What is so hard on just copy pasting things

#

I don't understand

molten folio
#

what do u mean copy paste?

little eagle
#
  1. copy
#
  1. paste
molten folio
#

-_-

still forum
#

CTRL+C and CTRL+V buttons

#

I don't see any issue with your code.

astral tendon
#

@molten folio put a space bellow the sqf

molten folio
#

its not showing in the combo

still forum
#

If the control is on the currently "active" dialog that should work

astral tendon
#

them paste it

meager heart
#

also you can press SHIFT+ENTER for the new line

molten folio
#

i have another sqf file for players which works fine

still forum
#

inside code block you can just press ENTER @meager heart

meager heart
#

yep ^

#

but
in just
text
shift+enter

little eagle
#

The code snippet has no combo box.

#

The code snippet on it's own does nothing, the error is probably somewhere else.

molten folio
#

the array just dont wanna show up in the RscCombo

#

fml

little eagle
#

The code snippet has no combo box.

#

The code snippet on it's own does nothing, the error is probably somewhere else.

#

¯_(ツ)_/¯

still forum
#

which is probably your problem

little eagle
#

Or maybe the idc is wrong. Or maybe the idc is used already.

#

Could be a thousand different things, but my 🔮 is malfunctioning.

molten folio
#

made it like this

{
    private _test = ["license_civ_pilot","license_civ_rebel"];
    private _index = lbAdd [9902, _x];
    lbSetData [9902, _index, _x];
} forEach _test;```
#

@still forum this what u mean ?

little eagle
#

2 little context

#

And no, that's just broken.

#

_test is undefined now.

molten folio
#

oh

#

than whats he mena

#

any help @still forum

little eagle
#

Okay, let me spell it out. You need to post more of your script, otherwise no one knows what you're doing and where it may fail.

molten folio
#

Main.sqf

_k = createDialog "panel";


buttonSetAction [9903, "[] spawn life_fnc_givingWl"];
buttonSetAction [9904, "[] spawn life_fnc_removeWL"];

TW_panel = playableUnits;
{
    if (isPlayer _x and (_x != player)) then
    {
        _uid = getPlayerUID _x;
        _index = lbAdd [9901, (name _x)];
        lbSetData [9901, _index, _uid];
    };
} forEach TW_panel;

lbSetCurSel [9901, 0];```

Whitelist.sqf 
```sqf
{
    private _test = ["license_civ_pilot","license_civ_rebel"];
    private _index = lbAdd [9902, _x];
    lbSetData [9902, _index, _x];
} forEach _test;```
little eagle
#

How are these executed?

lone glade
#

^ if this was up to me I would say with a guillotine

little eagle
#

🏳

#

Also, _test is undefined in Whitelist.sqf

molten folio
#

these are exectued

#

with a hotkey

#

main.sqf works fully fine

#

but only main is exuted

#

do i need to #include ''whitelist.sqf"?

#

or [] spawn life_fnc_whitelist

#

?

little eagle
#

Well, you do have to execute Whitelist.sqf somehow. Scripts don't magically activate themselves.

molten folio
#

Ekcsdee

#

i wanna die

#

im retarded

#

so ill put [] spawn life_fnc_whitelist;?

little eagle
#

Did you define life_fnc_whitelist somewhere?

molten folio
#

yes

little eagle
#

Use call not spawn, for justice.

molten folio
#

k

#

x

#

d

little eagle
#

Also fix _test being undefined.

molten folio
#

ye will do

glad venture
#

so, if i wanted to add an action and only add values for title, script, and condition would I be able to do that without putting all the rest of the parameters?

finite jackal
#

Anyone know how to get
C_Van_02_vehicle_F Van (Cargo) Laws of War DLC vehicle
to have the rear passenger option enabled if spawned via createVehicle

•AnimateSource does not have any options for this
•By default, it seats 2 and holds cargo in the rear; Using virtual arsenal/vehicle customization, you can select an option allowing for seating in the cargo area floor.

meager heart
#

"rear passenger option" ?

#

don't know what you mean by that, but probably addAction will helps 😀

glad venture
#

@meager heart i am using addAction, but is there a way to skip all the other parameter and only put title script and condition instead of all this: [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection]

meager heart
#

you mean _something addAction ["Text",{}];?

#

or

#
_id = _object addAction ["Action text", {/* code */}, [], 1, false, true, "", "<condition>"]; //nothing after the condition check ?
#

check wiki, if the parameters marked as (Optional), they are optional, you don't have to use them, in that case will be used default values

#

@glad venture

glad venture
#

would i just put like [title,script,,,,condition] ?

meager heart
#

if you mean skip arguments, priority, showWindow, hideOnUse, shortcut then no

#

you can skip radius, unconscious, selection after condition

glad venture
#

so i just put in default values

kindred lichen
#

If I add an MPKilled event handler, do I have to add it again if that player dies and respawns?

radiant needle
#

Is there a way to cancel doSuppressiveFire?

radiant needle
#

Also is there a way to set a UAVs name so it doesnt show up as a human

little eagle
radiant needle
#

I tried that and it didnt work

#

do I need to try doing like (driver this) or something?

little eagle
#

What?

radiant needle
#

if I just do this setName it doesnt work

#

do I need to do (driver this) setName or something?

little eagle
#

What are you trying to do?

radiant needle
#

Make it so when you look at a Phalanx it doesnt show a generic person name like "Chalie Miller"

little eagle
#

And it's placed in the editor and you're trying to do it via init box?

radiant needle
#

yeah, but I also need to do it via script in another mission I have

little eagle
#

Can't you just double click the ai and rename it from the ui?

radiant needle
#

It doesnt have an Object: Identity tab like people do

little eagle
#

Give me a minute, I'll try something with the game running.

#

If I look at the turret, it says "Praetorian 1C", not a name.

#

No "Chalie Miller".

radiant needle
#

weird I get this

little eagle
#
effectiveCommander this setName getText (configFile >> "CfgVehicles" >> typeOf this >> "displayName")

Try this. Are you on a dedicated server?

radiant needle
#

Right now Im just running in editor

little eagle
#

Well, I can't repro. Not what happens for me. Is the thing on bluefor or indep?

radiant needle
#

the thing you gave me works

little eagle
#

Yeah, but I'm not sure it works on remote machines, MP.

radiant needle
#

according to Waffle SS it does not work in MP

little eagle
#

That's not why, lol the comments on the wiki.

#

I'm starting a second instance of the game to test local hosted MP.

radiant needle
#

Not too big of a deal, since my missions in MP run difficulty where no name tags show

#

Also here is the script im working on if you have any suggestions

little eagle
#

Problem is that there's a name randomization script by bi, and that could cause a race condition.

radiant needle
#

Race condition?

little eagle
#

Two script running at the same time, whichever finishes last is the one taking effect.

#

Roughly.

radiant needle
#

Also any reason why [[[(getPos _CIWS), 1500],[]],[]] call BIS_fnc_randomPos; returns invalid so often?

little eagle
#

Yeah, doesn't work in MP. But if you don't need to use it there, it's fine I guess.

radiant needle
#

My script or the name thing?

little eagle
#

The name thing, well, it seems like it does work after a time.

#

OK, it is a race condition on clients. The command works fine in MP and the wiki is wrong again.

#
this spawn {
    effectiveCommander _this setName getText (configFile >> "CfgVehicles" >> typeOf _this >> "displayName");
};
#

This makes it so it's executed after the name randomization synch script by BI.

#

Even on clients.

#

Also any reason why [[[(getPos _CIWS), 1500],[]],[]] call BIS_fnc_randomPos; returns invalid so often?
Dunno, I never used randomPos function. I don't even know what it does.

radiant needle
#

Picks a random position while evaluating whitelist and blacklist conditions

#

the way I have it, it's picking a random position within 1500 meters of _CIWS

little eagle
#

Maybe there is no position that fits your blacklist conditions in the area.

tame portal
#

I don't see this function in the ArnA 3 wiki

radiant needle
tame portal
#

Only Take On Helicopters

radiant needle
#

Introduced Arma 3 in V1.0

tame portal
#

Ah

radiant needle
#

I mean it works like 4 times out of 10

#

I could understand it failing if I had blacklist conditions

little eagle
#

I think your syntax is wrong.

umbral oyster
#

drawIcon3D supported parseText?

radiant needle
#

Too many brackets?

little eagle
#

@radiant needle Use this one instead of the BI function:

private _randomPos = _CIWS getPos [1500 * sqrt random 1, random 360];
radiant needle
#

why times square root random 1?

little eagle
#

Because the area of a circle grows with it's radius to the power of two. If you didn't use a sqrt'd random number, it would make the distribution biased towards the center.

radiant needle
#

yeah but you arent evaluating the area of anything

little eagle
#

1500 is the radius around _CIWS

radiant needle
#

Yeah but isnt getPos just creating a vector

little eagle
#

No, getPos reports a positon, not a vector. I guess positions are vectors from the map origin, but still.

#

Same principle used here.

radiant needle
#

I gotta see this for myself

#

Wheres my marker making script