#arma3_scripting

1 messages ยท Page 639 of 1

ruby galleon
#

so as you can see- it's on the list, but I can actually call it to do anything

spark turret
#

@fossil yew your code was wrong. you never parsed the _this into _group correctly, i assume bc _this doesnt exist in an init field, or bc its the group and not an array. anyways, this code works if put into the groups init field:

Also, if the game tells you theres an error with _group, you can believe it. No need to search for errors somehwere else :P

if (!isServer) exitWith {}; 
systemChat str this;
this spawn { 
    params ["_group"]; 
    waitUntil { time > 0 }; 
 systemChat str _group;
    { 
        doStop _x; 
        _x doWatch (_x getRelPos [100, 0]); 
    } forEach units _group; 
 
    _group setBehaviour "AWARE"; 
    _group setCombatMode "YELLOW"; 
    _group setSpeedMode "LIMITED"; 
}
ruby galleon
#

so my main goal is to be able to use that similar support framework, but to have it use a requested weapon

spark turret
#

!

#

my bet is on _this not existing in init field

willow hound
ruby galleon
#

yeah sure thing

willow hound
ruby galleon
#

assigned to a Rhino MGS- also grayed out

willow hound
spark turret
#

well the code he provided does not work from the init field

willow hound
# ruby galleon assigned to a Rhino MGS- also grayed out

Ah, dangit.
Then you'll have to make your own system I believe. Two options:
Simpler: Use addAction.
More complicated: Use a custom Commanding Menu.

Since you've mentioned that you're new to this (and since I have no experience with custom Commanding Menus) I suggest the simpler option.
Or maybe you're lucky and someone has made and shared a script that does what you want before.

willow hound
ruby galleon
#

I will have to do some exploring, then!

real tartan
#

in initPlayerLocal.sqf should I use

[player] execVM "myScript.sqf";

or

params ["_player", "_didJIP"];

[_player] execVM "myScript.sqf";

Should I expect that player is already initiated ?

willow hound
west grove
#

hm is there a simple way of counting all objects that are currently visible on the player screen?

#

i mean not just based on line of sight, but also objects that could be behind a wall but are still being rendered

#

i'm doing some debugging and want to check where how many objects are eating performance

finite sail
#

isnt quite what you need, but is what comes to mind first

ruby galleon
#

I'm guessing that function can basically act as a look trigger?

willow hound
#

I'd say no, not unless you have access to the engine itself.

finite sail
#

and this is a little more refined, though I couldnt get it to work

fossil yew
#

I've manually placed that soldier in 3den looking just where I want him to look, that's why ... it's silly, I know, but I'm getting desperate.

Telling ai where to look shouldn't be that difficult.

spark turret
#

A dirty way that achieves it is "this disableAi "move";"
It stops the ai from walking or rotating. Can still shoot and move upper body a bit

spark turret
#

also your code works fine for me with slight alterations

little raptor
#

so no need for inArea

vague geode
#

Does setPlayerVoNVolume set any players VON volume globally or locally to the PC executing it?

obtuse quiver
#

hello can someone help me remember the function that allows a group of player to spawn in a random marker on the map together?

obtuse quiver
#

currently im using this because is the only one i remember, but for groups you need a total different one.

randomSpot = selectRandom ["pos_01","pos_02","pos_03","pos_04","pos_05","pos_06","pos_07","pos_08","pos_10"];
this setPosATL getMarkerPos randomSpot;

willow hound
#

Use forEach and units with the group.

obtuse quiver
#

sorry, still at the beginning with scripts what should i do? ๐Ÿ˜…

willow hound
#
_randomPos = getMarkerPos (selectRandom [...]);
{
  _x setPosATL _randomPos;
} forEach (units MyGroup);
obtuse quiver
#

oooooooooooooooh thanks alot mate!

obtuse quiver
#

strange, i tried it and it doesn't work

#

_randomPos = getMarkerPos (selectRandom ["pos_01","pos_02","pos_03","pos_04","pos_05","pos_06","pos_07","pos_08","pos_09","pos_10"]); 

{ 
  _x setPosATL _randomPos; 
} forEach (units MyGroup);

winter rose
#

```sqf
/* your code */
```

please

obtuse quiver
#

sorry

willow hound
willow hound
obtuse quiver
#

Yes it was that

vague geode
obtuse quiver
#

thanks alot ๐Ÿ™‚

finite sail
#

sometimes, I discover something and think... wow.... I wish I knew about that before

#

is one such thing... as a dynamic mission maker (the mission is dynamic, not the author), I have, in the past written my own code to do what this does

spark turret
#

Dw, i recently found out too arna can do math with Vectors

#

Had also written my own stuff for that before

finite sail
#

but vectors are the work of the devil

#

because I don't understand them, obv

#

I do understand them, tbf, just not how to work with them...

finite sail
#

Dedmen, feature request: could fnc_isPosBlacklisted be expanded a little? It can take an array (making a rectangle) or a trigger as a blacklist area.. could it also accept a marker?

still forum
#

I don't do script

finite sail
#

who could I ask?

still forum
#

KK

finite sail
#

thanks

still forum
#

but he'll want ticket prolly

finite sail
#

yes ty

spark turret
#

Quaternions on the other hand...

#

Once you understand how to add and do scalar product, you can do anything really

winter rose
#

yaoi*

jovial steeple
#

Checking a player's pockets for Demo charges, what syntax should I be using instead of Magazines?

if ("DemoCharge_F" in Magazines Player)

cosmic lichen
#

@jovial steeple "DemoCharge_Remote_Mag"

jovial steeple
#

Did I get the classname wrong?

spark turret
#

my guess is that the democharge_remote_mag is the class used as the item and the democharge_f is the physical object after being placed

jovial steeple
#

Found it, DemoCharge_Remote_Mag is the name of it when its an inventory item.

leaden mason
#

Hello! There was a problem with doFSM. I would like to make an atomic evacuation command (helicopter arrived -> took the detachment -> flew back). Implemented at a high level (execFSM), but I would like doFSM. The problem is that when using _heli land "LAND", it shifts its position x y in search of free space, respectively, after landing, immediately takes off and flies to the previous moveTo, how can you interrupt moveTo without killing fsm? It only helps to force flyInHeight, but it's not so effective.

cerulean cloak
#

So I'm trying to use an interaction on an object in game with variable name clacker to detonate some explosives. I'm trying to use BIS_fnc_holdActionAdd launched from the init.sqf file to do that. Here's my code.

[
            clacker,
            "Detonate Claymores",
            "images\destroy.paa",
            "images\destroy.paa",
            "_this distance _target < 3",
            "_caller distance _target < 3)",
            {},
            {},
            {
            { 
                private _claymore = missionNamespace getVariable [format ["clay_%1", _x], objNull]; 
                _claymore setdamage 1; 
            } foreach [1, 2, 3, 4];
            },
            {},
            [],
            1,
            0,
            true,
            false,
        ] BIS_fnc_holdActionAdd;

When I run it it says error missing square bracket in the last line.

oblique arrow
#

you have a , too much @cerulean cloak

cerulean cloak
#

In the line with false?

robust hollow
#

yea, the last , after false and also ] BIS_fnc_holdActionAdd; -> ] call BIS_fnc_holdActionAdd;

oblique arrow
#

yep last line

cerulean cloak
#

Thanks

cerulean cloak
#

Anyway to define an array as a series of integers between a &b without typing them all out?

warm hedge
#

Use for and pushBack

chilly bronze
#

i found something interesting. basically im making a spotlight that points at wherever the mouse cursor is. if you use the setVectorDir command, it is supposed to only rotate the object from 0-360 degrees around 1 axis (so rotating the light left and right but it stays pointed at the same elevation). But, if you use BIS_fnc_setPitchBank and set the pitch to any angle, then it "unlocks" the other 2 axis and setVectorDir also affects the pitch? anyone want to explain?

#

`_light = createSimpleObject ["a3\data_f\VolumeLight_searchLight.p3d", getPos player]; // create spotlight
//[light, -90, 0] call BIS_fnc_setPitchBank; // why does this work?
_light setPos (getPos player vectorAdd [0,0,5]); // move light above player
_trailLight = "Reflector_Cone_01_Long_white_F" createVehicle getPos player; // create spotlight light effect
_lightOrigin = _light modelToWorld [0,1.9,0]; // origin of spotlight, since the model origin is not where the light comes from
_trailLight setPos (_lightOrigin); //
_trailLight setDir (direction _light + 180); // set light effect as same direction as spotlight
_spotLight = "#lightpoint" createVehicle getPos player; // create ground light effect
_spotLight setLightBrightness 0.6; // brightness
_spotLight setLightAmbient[0.99, 0.99, 0.74]; // ambient

while {alive player} do {
_target = screenToWorld [0.5,0.5]; // get cursor location
_light setVectorDir (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply -1); // set direction spotlight
_trailLight setVectorDir (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply 1); // light effect
_spotLight setPos _target; // move ground light
sleep 0.025;
};`

little raptor
#

@chilly bronze
use syntax highlighting. see the pinned messages.

chilly bronze
#

sorry, im just asking why if you uncomment the second line, the setVectorDir magically also controls the pitch of the light and it works as intended, its just kinda weird

little raptor
#

I cant read your code. add syntax highlighting

chilly bronze
#
_light = createSimpleObject ["a3\data_f\VolumeLight_searchLight.p3d", getPos player]; // create spotlight
//[light, -90, 0] call BIS_fnc_setPitchBank; // why does this work?
_light setPos (getPos player vectorAdd [0,0,5]); // move light above player
_trailLight = "Reflector_Cone_01_Long_white_F" createVehicle getPos player; // create spotlight light effect
_lightOrigin = _light modelToWorld [0,1.9,0]; // origin of spotlight, since the model origin is not where the light comes from
_trailLight setPos (_lightOrigin); // 
_trailLight setDir (direction _light + 180); // set light effect as same direction as spotlight
_spotLight = "#lightpoint" createVehicle getPos player; // create ground light effect
_spotLight setLightBrightness 0.6; // brightness
_spotLight setLightAmbient[0.99, 0.99, 0.74]; // ambient

while {alive player} do {
    _target = screenToWorld [0.5,0.5]; // get cursor location
    _light setVectorDir (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply -1); // set direction spotlight
    _trailLight setVectorDir (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply 1); // light effect
    _spotLight setPos _target; // move ground light
    sleep 0.025;
};
little raptor
#

_light setPos (getPos player vectorAdd [0,0,5]); // move light above player
this is wrong. getPos is inAGLS format

#

_target = screenToWorld [0.5,0.5];

(getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25]
incompatible position formats. getPos: AGLS

#

screenToWorld: AGL

little raptor
#

so when you setVectorDir, you're actually changing the vectorUp (or should I say, Z vector in model space)

#

that's why it "works"

#

if you simply use setVectorDirAndUp, you can save yourself the confusion

chilly bronze
#

i do i was just messing around on a completely flat area

#

and being lazy

little raptor
#

no need for the BIS_fnc_setPitchBank

chilly bronze
#

that didn't work, i just used this and it worked```sqf
_dirVec = (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply -1);
_light setVectorDirAndUp [_dirVec, [0,0,1]]; // set direction spotlight

smoky verge
#

I don't understand what's wrong in this

{
 {_x setPos (getPos RTB)}; 
forEach allPlayers};
warm hedge
#

What's the context?

#

It's defo wrong tho

smoky verge
#

is the only content of an sqf supposed to teleport all players to an invisible helipad called RTB

warm hedge
#

First of all, {} codes themselves doesn't do anything. It requires to be call or spawned. Second, the ; afther the getPos RTB terminates the current code, so forEach can't recognize the code

#

(sorry if I'm something gibberish, I'm drunk)

smoky verge
#

so

call {
 {_x setPos (getPos RTB)};
forEach allPlayers};

?

warm hedge
#

Remove the ; after the RTB, should do I think

smoky verge
#

oh yeah sorry forgot to edit that

#

yup

#

worked

#

thanks

little raptor
#

getPos: AGLS

#

setPos: AGL

#

that can cause issues

smoky verge
#

used ASL and it worked

odd nest
#
_houseList = [];
{
for "_i" from 0 to 20 do {
    if ( [(_x buildingPos _i), [0,0,0]] call BIS_fnc_arrayCompare ) exitWith {
        if (_i > 0) then {
            _houseList set [count _houseList, [_x, _i]];
        };
    };
};    
}forEach _nearesthouses;

_randomHouse = _houseList select (floor (random (count _houseList)));
_housePos = (_randomHouse select 0) buildingPos (floor (random (_randomHouse select 1)));

_crate = createVehicle ["Box_East_Wps_F", _housepos, [], 0, "CAN_COLLIDE"];

getting the error "0 elements provided, 3 expected"

copper raven
#

are you trying to create a box at a random position of a random house?

odd nest
#

yes around a map marker

copper raven
#
private _position = selectRandom selectRandom (getMarkerPos "WEST_AO_3" nearObjects ["House", 25] apply {_x buildingPos -1} select {!(_x isEqualTo [])});
private _crate = createVehicle ["Box_East_Wps_F", _position, [], 0, "CAN_COLLIDE"];

(implying there will always be a house with atleast one position inside within the radius of the origin)

winter rose
#

one-linersโ€ฆ

odd nest
#

Thanks guy main problem ended up being the map. I guess zargabad has no "safe" locations to spawn a crate.

copper raven
#

you can add your own positions in some config, then vectorAdd the offset to the origin of the house

spark turret
odd nest
#

I got it to work! 25 was too low of a number I guess. thanks everyone

spark turret
#

houses are big and have their object center and position in the middle

chilly bronze
#
soldier playMove "Acts_Pointing_Front"
#

when doing animations, is it possible to stop the AI that has a rifle rested from raising their weapon for a moment before and after? it looks awful

#

nevermind fixed by setting behaviour to safe

young current
#

Use different play commands perhaps

west grove
#

switchMove should usually work

#

but it doesn't show transitions

#

playMoveNow could also work, though in my experience it depends a lot on unit behavior settings

analog walrus
#

Quick question, is there any function that allows calling a script on a particular object from an sqf file itself? Something like <variable> execVM "script.sqf"? I've been searching, but haven't been able to find any script-calling functions that also have a left hand variable

winter rose
#

@analog walrus โ†‘

analog walrus
#

should've looked at the examples more carefully, welp

queen cargo
#

Better tho, Ditch the execvm stuff and start using call

#

And Cfgfunctions

winter rose
#

execVM is good for a one-time usage only, that's it

analog walrus
spark turret
#

Whats the difference between execVM and callcompile?

proper sail
#

execvm is spawn compile

winter rose
#

execVM is (more or less) equal to spawn compile preprocessFile

last rain
#

How I can check DLC active in player or not? I wish if player not buy DLC script give to him vanilla weapon, if buy he has DLC weapon.

warm hedge
#

getDLCs will do?

last rain
#

if player not buy DLC, ingetDLC he not have this?

winter rose
last rain
#

isDLCAvailable the same?

warm hedge
#

I don't think so?

winter rose
#

I don't knowโ€ฆ is it available on Steam or is it in owned DLCs
in doubt, use getDLCs @last rain

last rain
#

Okay, thanks

little raptor
still forum
#

yes, lineNumbers is set to true, so I guess it should.. but.. dunno, code is weird

#

params are passed to preproc, but never used or stored.. weird stuff ๐Ÿ˜„
or its some child class virtual shenanigans.. but the lineNumbers is set to true

little raptor
#

one to get the array of positions (for each object)

#

one to return a random position

still forum
#

but buildingPos only returns one position?

little raptor
#

-1 returns all

still forum
#

ah -1 specialty

worn forge
#

Answering my own question;

_arr = [1,2,3];
selectRandom _arr // produces 1, 2, or 3

_arr = [[1,2,3], [4,5,6]];
selectRandom selectRandom _arr // produces 1, 2, 3, 4, 5, or 6
winter rose
#

yup

worn forge
#

otherwise multiple selectRandom statements produce an error

winter rose
#

see it as selectRandom (selectRandom _arr)

#

or, less one-lined,

private _array = [[1,2,3],[4,5,6]];
private _subArray = selectRandom _array; // [1,2,3] or [4,5,6]
private _result = selectRandom _subArray; // 1,2,3,4,5 or 6
quasi sedge
#

How to parse all classes of vehicles from current moddset?

#

"rhs_t72bd_tv","rhs_t80bv","rhs_t80um","rhsusf_m1a2sep1tuskiiwd_usarmy"...

little raptor
quasi sedge
#

M1238A1_Mk19_socom_wd,bin\config.bin/CfgVehicles/rhsusf_rg33_wd,bin\config.bin/CfgVehicles/rhsusf_rg33_m2_wd,bin\...

#

to this

#

"M1238A1_Mk19_socom_wd", "rhsusf_rg33_wd", "rhsusf_rg33_m2_wd"

quasi sedge
#

@winter rose could you write full command? im kinda lose a bit here

winter rose
winter rose
#

sorry, apply configName _x

#

replace select by apply

#

@quasi sedge โ†‘

quasi sedge
#

roger

quasi sedge
#

mm nothing happens

#
21:26:20 [CBA] (settings) INFO: Checking mission settings file ...
21:26:20 Script 'cba_settings.sqf' not found
21:31:20 [CBA] (settings) INFO: Checking mission settings file ...
21:31:20 Script 'cba_settings.sqf' not found
#

.rpt is empty

winter rose
#

your data is in the _names variable

#

just type _names in the debug console after your code (and a ; of course)

quasi sedge
#

gotcha, big thanks!

past tiger
#

Sometimes player setCaptive true seens to fail... really?

worn forge
#

Likely something else is setting it back? I haven't noticed an issue

winter rose
#

that or a locality issue ๐Ÿ™ƒ

past tiger
#

Admin players can use setCaptive only on their player character. Player character is allways local.

#

WIKI says Local Arguments, Global Effects

#

So nothing wrong.

#

Sometimes i use setCaptive and AI units don't stop to shot me.

#

But if you have no issue, i will check better.

winter rose
#

mods ๐Ÿ‘€

past tiger
#

I use no mods, it's just a mission.

#

I did the mission.

quasi sedge
#

typeOf _vehicle; ?

winter rose
little raptor
#

playable vehicles
that's trickier

#

you also have to filter out UAVs for example

quasi sedge
#

isKindOf 'Air'

#

isKindOf 'Tank'

#

seems worked

little raptor
#

ok, also remember to remove the UAVs

#

I think it was IsUAV

#

so getNumber (_x >> isUAV) != 1

#

you can find it in the wiki

#

or config viewer

glass glen
#

So i am doing some testing in my mission and i was wondering if there is some global entity that alive will always return true for?

willow hound
#

Hmmm alive objNull is always false, so I guess you could have true with !alive objNull...

glass glen
#

you know what i figured out how to do it without doing something crazy like I was looking for. thanks

chilly bronze
#
{
addMissionEventHandler ["Draw3D", { 
  drawIcon3D ["", [1,0,0,1], ASLToAGL (getPosASL _x), 0, 0, 0, "Target", 1, 0.05,"PuristaMedium"]; 
  }];
} forEach _opforNearby;
#

can someone explain why this returns error Error 0 elements provided, 3 expected? I know it has to do with the position array but I don't see why this is returning an error

#

_opforNearby is just an array with units [unit1, unit2, ...] etc

#

printing ASLToAGL (getPosASL _x) returns a 3 element position array so no clue why it doesnt work

queen cargo
#

The Event Hรคndler has nรถ idea about the scope it was registred

#

What you could do, is create a string for it and Compile that

chilly bronze
#

could you elaborate on that?

#

the second part

queen cargo
#

compile Format ["...", Position _x]

chilly bronze
#

worked, thanks

copper raven
#

Probably better to loop through the units inside the eh itself

queen cargo
#

Not really, Performance wise
But could also be done indeed

copper raven
#

If you call this code again, it'll readd the eventhandlers again, and it won't work properly if units start moving

queen cargo
#

True that, but the question was not how that Code could be done better ๐Ÿคช๐Ÿคช
Plus we do not know the Details here

#

Maybe exactly that is the purpose and just an attempt to get it
Well.. Working for starters ๐Ÿคทโ€โ™‚๏ธ

craggy lagoon
#

I'm wondering if someone might be able to help me with an issue that I'm having. I'm using Simplex Support Services to call in a CAS Drone. I've been able to set the custom init code to change the pylon loadout with "setpylonloadout" command. Looking at the drone the weapons have been changed to what was scripted but when I enter the gunner's position it shows the old loadout weapon names and they are red (empty). Am I attempting to do something that can't be done or am I just missing a few steps? Any advice that you can give would be greatly appreciated, thank you in advance!

craggy lagoon
#

I was able to figure out the issue as to why the gunner couldn't use the newly added weapons. I didn't have the turret path set to it defaulted to the pilot. But I'm still having the issue of the original weapon showing up in the weapon selection.

copper raven
#

Remove the weapons before applying new pylon loadout

round blade
#

Is there any means by which I can force AI to only be able to fire a weapon when crouched or prone? Ideally in a way I can bundle in to a weapon addon?

little raptor
#

Question: If I send a local "entity" to another computer, then send it back to the original computer (remoteExecutedOwner), will it get "lost in translation"?!
Like:

_ctrl = _disp displayCtrl _IDC;
[[_ctrl], {
  [_this#0, name player] remoteExec ["ctrlSetText", remoteExecutedOwner]
}] remoteExec ["call", 2];
#

or maybe:

_ctrl = _disp displayCtrl _IDC;
[_ctrl, {
  [[_this, name player], {_this#0 ctrlSetText _this#1}] remoteExec ["call", remoteExecutedOwner]
}] remoteExec ["call", 2];

?

queen cargo
#

what do you mean by lost in translation?

little raptor
#

not defined anymore

queen cargo
#

displays are local only

#

controls are too

little raptor
#

yes

queen cargo
#

so that one simply does not do anything at the other end but being null and imo should throw an issue

little raptor
#

I send it back

#

that's the question

queen cargo
#

you cannot send anything back

#

the display only ever existed on your machine

little raptor
#

I send the original value

queen cargo
little raptor
#

#arma3_scripting message
step 1: get the control on my computer
step 2: get player name on the server (also sends the control)
step 3: remote exec the command on my computer again (sends the control back)

little raptor
queen cargo
#

[...] (also sends the control) [...]
pretty much doubt that
you might get something
but not the actual control, that much i promise you (afterall ... it does not exist on the server)

little raptor
#

yes, but I send back the original array

queen cargo
#

does not matter

#

your original array resides on your pc

#

not the server

#

the server has its very own representation of that array

#

which has no control of yours

little raptor
#

hmm so do you have an idea how one can do it? (if it's possible)

queen cargo
#

aka:

client --> server: [DISPLAY, PLAYER] --> [NIL, SERVER]
server --> client: [NIL, SERVER] --> [NIL, SERVER]```
#

what you want is a Promise, or something that pretty much resembles that

willow hound
little raptor
#

I think your method does the same thing, right @queen cargo ?

queen cargo
#

more or less
the promise system of mine is general purpose though

#
[
    _target, "method_name_or_code", [/* args */], //request-related
    [_arguments], {
        params ["_arguments", "_result"]; // _result comes straight from the server here;
                // [...] CODE
    }
] call Promise_Create;```
and youre done, given that the methods are exposed on all clients and servers (eg. init.sqf)
little raptor
#

Do mission event handlers work in 3DEN?

winter rose
#

try and thou shalt see? ```sqf
addMissionEventHandler ["EachFrame", { systemChat "lol" }];

little raptor
velvet merlin
#

is there a way to set/remove shadow from (scripted) markers via sqf?

winter rose
worn forge
#

wow, the more you know

velvet merlin
#

@winter rose ok so you have to make duplicates in configs essentially

winter rose
#

yup

#

(afaik)

languid oyster
#

I have difficulties to tell an AI unit hanging from a steerable parachute to move to a certain position. Is the steerable parachute bugged somehow?

winter rose
spark turret
#

Setvelocity?

#

Ai doesnt seem to steer parachutes but thats just a guess

little raptor
#

Yeah, they don't. They just move about randomly

languid oyster
#

Technically, the parachute is a vehicle, and the unit hanging is the driver. Must be something in the chute 'vehicle' wrong then.

winter rose
#

that or AI not knowing how to deal with it, that's a possibility ๐Ÿ˜„

#

I would lean more on that side actually

little raptor
#

I think it's a height problem

#

they want to "fly" to a set height

#

but they can't

#

pretty much like helicopters

languid oyster
#

Yes, helicopters in big heights steered by AI have problems too.

#

Start doing circles and not hearing to commands anymore

little raptor
#

yup

languid oyster
#

Anyone tested sendSimpleCommand already?

winter rose
#

something tells me you are about to ๐Ÿ˜ƒ

little raptor
#

doesn't work with air vehicles afaik

#

but you're welcome to try!

little raptor
#

a parachute is one man only!

sharp skiff
#

is there a command for the init of a vehicle to set the lights on, on spawn/start?

little raptor
#

yes ๐Ÿ˜Š

#

I mean not a single command, but you can do it

midnight spoke
#

hey guys trying to get a trigger activate if a specified amount of civilians is inside the trigger area. No real time to play Arma currently.

_trigger setTriggeractivation ["civilian > x"]; 
``` would this work? or am I totally off
worn forge
#

is x defined anywhere?

little raptor
#

totally off!

midnight spoke
#

x would be the number of civilians I want in that case

worn forge
#

well trigger activation doesn't work that way

midnight spoke
#

or the number 1 under the amount of civs I would need for it to actiavet

little raptor
worn forge
#

You'd want something like:

_trigger setTriggerActivation ["CIV", "PRESENT", true];

and then

_trigger setTriggerStatements ["this && count thisList > x", "hint 'trigger on'", "hint 'trigger off'"]
little raptor
#

it only supports present and stuff

#

yeah that

midnight spoke
#

oh tanks a lot ๐Ÿ˜„

worn forge
#

that might also include incapacitated players.

midnight spoke
#

hmm will keep that in mind. Also unconcious ones with ace?

worn forge
#

I suspect so; I think in both cases those systems use setCaptive to prevent enemies from shooting downed players, and that changes the player's side to CIVILIAN

little raptor
worn forge
#

another option

_trigger setTriggerStatements ["this && {((typeOf player) splitString "_" select 0) == ""C""} count thisList > x", "hint 'trigger on'", "hint 'trigger off'"]
little raptor
#

that's bad

worn forge
#

I'm solving his problem, rather than making comments about somebody else trying to solve someone's problem.

little raptor
#

using any present and {side group _x == civilian} count thisList > x is faster

little raptor
worn forge
#

I honestly don't know what your problem is.

still forum
#

Everything here is bad as Alex's start context was wrong. problem solved in other discord
didn't actually want setTrigger*

worn forge
#

Which other discord Dedmen?

still forum
#

mine

#

But we basically did what Ryko wrote.
Which is what I already told in the other discord before Alex even asked the question ยฏ_(ใƒ„)_/ยฏ

worn forge
#

I'm just getting tired of Leopard20 jumping on everything to show how right he is.

midnight spoke
#

Well can't expect someone to have his eyes everywhere notlikemeow
Just trying to help out.
But still thank you guys

still forum
hollow thistle
#

yeah, single operator vs 4

worn forge
#
_trigger setTriggerStatements ["this && {!captive _x} count thisList > x", "hint 'trigger on'", "hint 'trigger off'"]
#

good lord captiveNum

still forum
#

wat

hollow thistle
#

dafuq is this

worn forge
hollow thistle
#

yeah, I'm reading description of it right now.

#

ah, it's Arma 2 leftovers

worn forge
#

I suppose I can see a use case where you'd want to have different sub-levels of captivity... A is "more" captive than B...

little raptor
worn forge
hollow thistle
#

No drama boys, and if code is bad it should be trashed meowtrash

#

never take code review personally.

worn forge
#

I'm fine with code review. My own ethic is never to issue criticism unless I can offer a suggestion, rather than just saying "it's bad". It's just noise, otherwise.

little raptor
still forum
#

Your code was just genuinely terrible and bad tho.
Your code doesn't work
Your code will be hella slow and inefficient
There are ways to make your code more efficient, but it still wouldn't work, and still be less efficient than even a suboptimal solution

#

Your script also wouldn't have solved the problem, as your code doesn't work.

#

Civilian units don't necessarily start with C_. Especially not in this case as this code is for a modded mission which you couldn't know.

#

Even if you want to check for start with C, you could just check if the first character is C, there is no need for a splitString?

midnight spoke
#

Now I really wish I first would've seen Dedmen's suggestion before asking here

worn forge
#

All of this is true. I'm aware that searching for strings as a method isn't the most optimal, but I was also responding to OP's need for what seemed to be an immediate, if far from perfect or efficient, solution.

still forum
#

Also Ryko.
Your script has a syntax error, you messed up the quotes around the _
And the double "" mess is messy, just use ' as quote marks when you are already in string, like you did with the hint's. That also prevents errors like the above

midnight spoke
worn forge
#

Well I did edit the quote mark thing, so I think it's unfair to poke at that particular code; further, I provided an alternate solution which abandoned that method altogether and went for the captive approach, which I think solved several issues. Unless you think that doesn't solve the problem either.

still forum
#

Nah your last code is I think the optimal solution

#

but not for Alex' usecase. we don't care about captive units actually

#

this && count thisList > x is the solution. combined with civ presence

worn forge
#

players getting incapacitated won't trigger a CIV trigger?

still forum
#

If we get that many players unconscious, the mission is already a fail

hollow lantern
#

what's the best way to check if soliderA has LOS to soldierB? I currently have an array of soldiers (_targets) that I use via _targets call BIS_fnc_selectRandom to get one unit out of it. However that does not check for a LOS of soldierA to that unit.

#

I think playing around with checkVisibility might work

worn forge
#

I haven't had 100% success trying to make a command that does this: I use a combination of terrainIntersectASL, lineIntersectsObjs and checkVisibility but even then it's failed when I'd assume it should succeed. I haven't scoured all of Arma's scripts and functions for something that's already doing this effectively, which is often the case... happily I don't need to verify whether one target can see another very often.

winged basin
#

@Dedmen If you get time could you look into allowing vests and helmets to work with the setObjectTexture command?

exotic flax
#

I would say; make a ticket on the Feedback Tracker, because this is not the place to ask for features ๐Ÿคทโ€โ™‚๏ธ

winged basin
#

Thereโ€™s already several last I checked, so no point adding another.

willow hound
#

Pretty sure nothing in the inventory is an object.

winter rose
little raptor
#

So about the event handlers that need local arguments (like "Killed"), what happens if the object changes locality?

#

will it not trigger anymore?

proper sail
#

correct

#

its why for instance on arma 2 dayz the killed evh gets added to all vehicles on the map when you login as a client

#
  • server so atleast 1 machine is doing the exec when it triggers
little raptor
#

ah, so I need to handle locality too...
so another question. what if the unit changes locality back to the original computer?

proper sail
#

then its fine again

#

tbh i replaced my killed evhs with killedmp evh, didnt notice a change in network traffic

little raptor
#

is it also true about "local" setVariables?
like can I use:

_unit addEventHandler ["Local", {
  params ["_unit ", "_isLocal"];
  if (_isLocal && {_unit getVariable ["killed_EH", -1] == -1}) then {
    _unit setVariable ["killed_EH", _unit addEventHandler ["Killed", {...}] ];
  }
}];
proper sail
#

yes dayzmod was written before the introduction of mpkilled aswell

#

so it doesnt use that

#

i do not know about your other question

hollow lantern
#
_visTargets = {[objNull, "VIEW"] checkVisibility [eyePos _sniper, eyePos _x]} forEach _targets;``` this sadly only returns a number.  I'm thinking to complicated. 
What I need is to return an array with units from the array ``_targets`` that is visible to ``_sniper``.  

I'm currently thinkering around with find and pushback

```sqf
_visTargets = _targets find {([objNull, "VIEW"] checkVisibility [eyePos _sniper, eyePos _x] <=1)};``` however this code as well only returns SCALAR instead of "objects" 

Can someone help me out where to start from, thanks!
little raptor
#

use select

#

also, you're using <=1

#

which makes zero sense

#

you should use > 0

hollow lantern
#

oh well , ok thanks I'll give it a try

#

damn that works flawless, thanks @little raptor
That's the code I used now:

_visTargets = _targets select {([objNull, "VIEW"] checkVisibility [eyePos _sniper, eyePos _x] > 0)};```
sharp skiff
#

["shotdark", 100, 1, false, 0]] remoteExec ["say3d"]
who do i fit this into addaction?

willow hound
#

?

sharp skiff
#

i want a laptop with an addaction option to execute this above!

winter rose
#

(how*)

willow hound
sharp skiff
#

yeah sry XD i meant how sry

willow hound
sharp skiff
#

hm lets see, im not good a scripting ๐Ÿ˜ฌ

#
this addAction ["Musik",["shotdark", 100, 1, false, 0] remoteExec["say3d"]]
```  looks right to me i test it now
winter rose
#

nope

sharp skiff
#

what is missin a target?

winter rose
#
this addAction ["Musik", { [theSpeaker, ["shotdark", 100, 1, false, 0]] remoteExec["say3d"] }];
sharp skiff
#

ah ok thx!

winter rose
#

missing what will say the thing

#

is it what you are adding the action to that will say it?

sharp skiff
#

"shotdark" yes its a music file set in the description.ext

winter rose
#

CfgMusic?

sharp skiff
#

or sound cant remember right now

#

second

winter rose
#

put it in CfgMusic and remoteExec playMusic then

sharp skiff
#

yeah right see that now that i openend the description.ext why did my brain put say3d in there ???

winter rose
#

ยฏ_(ใƒ„)_/ยฏ

#

brains and SQF don't mix well ๐Ÿ˜„

sharp skiff
#

no ๐Ÿคฃ

#

@winter rose hm wont work That is the full init of the laptop (Var name laptop): ```sqf
this addAction ["Musik", { [laptop, ["shotdark"]] remoteExec["playMusic"] }];;

#

did i miss something

#

?

winged basin
# still forum No

Ok well could you provide an explanation as to why? Like is it an engine limitation, etc?

sharp skiff
#

one ] to much behind shotdark?

sharp skiff
#

ah ok

robust hollow
#

if you use the ["shotdark"] syntax, you need to provide a start time after, eg ["shotdark",3]

sharp skiff
#

should it not just ignore it and play it from the begining?

robust hollow
#

no because that syntax expects a start time. if you want it to start from the beginning you would just give the string, not an array

sharp skiff
#

ok

winged basin
winter rose
sharp skiff
#

now im fully confused! so its just ```sqf
this addAction ["Musik", { ["shotdark",0] remoteExec["playMusic"] }];

winter rose
#

try just ["shotdark"]

sharp skiff
#

this addAction ["Musik", { ["shotdark"] remoteExec["playMusic"] }];

winter rose
sharp skiff
#

oh FFS i know the error its "demonfire" not "shotdark" fml

#

workls enough for today ๐Ÿคข

obtuse quiver
#

Hello, im trying to make a shrinking marker (area), every minute i want it to shrink a bit, all the scripts i saw online were over complicated and some of them laggy, i don't want the player to take damage outside the area but i would like a hint saying that the zone has moved, any ideas?

craggy lagoon
#

I'm using the MQ-9 Reaper from the USAF mod pack and I can't seem to figure out the command for removing the current weapons from the pylons. I can use the setpylonloadout command to change it be it seems to still register the old loadout as attached. Would anyone be able to help me with what command should be used?

sharp skiff
#

any think about scripting intel in the BIS wiki i cant seam to find any!

#

in the sense of "pick up intel" and "show a new task!"

plain patio
#

so i'm doing a basic teleport script but the game keeps giving me the error "script Tele.sqf does not exist" yet i have them in the respectful folder for the map itself, what should i do to fix this issue?

digital hollow
#

Show your folder structure and code calling it?

plain patio
#

@digital hollow i just sent you a dm with what ur after

little raptor
little raptor
# sharp skiff any think about scripting intel in the BIS wiki i cant seam to find any!

it's easy to do it:
https://community.bistudio.com/wiki/Arma_3_Task_Framework

  1. create the task:
    https://community.bistudio.com/wiki/BIS_fnc_taskCreate
  2. when the user picks up the intel, set the task state the true. you need a take event handler: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take
    you can use the item type to detect your intel item. for example:
if (!isServer) exitWith {};//assuming this is both for MP and SP
this addEventHandler ["Take", {//assuming this is put inside the init box of a player unit
  params ["_unit", "_container", "_item"];
  if (_item == "Document") then {
    ["taskName", "SUCCEEDED"] call BIS_fnc_taskSetState;
  };
}];

you can also do it another way. add the intel to a container (let's call it my_container), and use a condition like _container == my_container in the above code to detect the item being taken. (or do it both: _container == my_container && _item == "Document")

grim wing
#
[(position player), side player, (configFile >> "cfgGroups" >> "empty" >> "by_Assault" >> "Training" >> "Funbox")] call BIS_fnc_spawnGroup;
#

how do I make this so it places the objects just like in editor

#

without it all being faced in one direction

languid oyster
little raptor
#

there's no way you can get the AI to steer the parachute
the best thing to do is write an eachFrame event handler that simulates parachute flight

#

it's not hard to do if you're good with vectors and physics

little raptor
languid oyster
spark turret
spark turret
little raptor
#

just for fun! ๐Ÿ˜„

#

create some empty vehicle named "hel"
put it up in the air

#

run the code!

#

@languid oyster

#

you can set the destination using hel setVariable ["destination", _pos]

#

and you can have as many units up in the air as you want

still forum
spark turret
#

maybe i have a once per frame call of my script ๐Ÿ‘€

copper raven
#

what do you mean? you obviously don't want to recompile your script every frame, compile it once, then call it every frame

winter rose
#

please don't tell me execVM in onEachFrame pleasepleaseplease

spark turret
#

i actually used to do this years ago when first starting to script ๐Ÿ˜„ i didnt know how to debug so i just test and the easiest way was to have the script call itself again instead of a loop, bc it would use the updated code ๐Ÿ˜„

little raptor
#

or you could just recompile it...

#

onEachFrame { call MY_fnc_eachFrame }

languid oyster
#

Opened editor, put a parachutist unit about 100 m height, then point on him an local exec:

GlobVehicle = cursorObject;
onEachFrame {
    _vel = velocity GlobVehicle;
    _dir = direction GlobVehicle;
    _speed = 2;
    if (speed GlobVehicle < 40) then {
        GlobVehicle setVelocity [
            (_vel select 0) + (sin _dir * _speed), 
            (_vel select 1) + (cos _dir * _speed), 
            (_vel select 2)
        ];
    };
    diag_log format ["Speed: %1",  speed GlobVehicle];
};

Cool, now I only need: Calculate wind speed and direction, make a vector subtraction to not have to high air speed, make smooth turns to desired position, and simulate 'dangling' of the chute while in flight ๐Ÿ™ˆ

winter rose
#

see? easy!

languid oyster
#

Oh Lou!! Easy.

#

For you maybe ๐Ÿ™‚

spark turret
#

your code is prone to fail. if you go at speed limit, it doesnt correct the direction anymore

#

instead get the velocity, set new velocity which is capped to 40

languid oyster
#

Yes, it was only a little proof of concept. If that thing does what I wanted him to do

copper raven
#
GlobVehicle setVelocity [
    (_vel select 0) + (sin _dir * _speed), 
    (_vel select 1) + (cos _dir * _speed), 
    (_vel select 2)
];
GlobVehicle setVelocity (_vel vectorAdd [sin _dir * _speed, cos _dir * _speed, 0])
languid oyster
#

@copper raven Thanks for optimisation ๐Ÿ™‚

little raptor
spark turret
#

yeah

#

ballistic parachute incoming!

#

wooosh

still forum
#

you know setVelocityModelSpace is a thing? :3

spark turret
#
_newVel = (vectorNormalized (_vel vectorAdd [sin _dir * _speed, cos _dir * _speed, 0])) vectorMultiply _absoluteSpeed;
GlobVehicle setVelocity _newVel;

capped to a speedmax and still stearable

#

altough i think it might behave not perfectly like real force addition would

languid oyster
#

I want to code SUPERMEDIC! When using ace, and the heli is hit by some AA, player often goes unconscious. If there is a medic aboard, which is still alive and not unconscious, he shall throw out player, jump out, tandem paradrop him to ground, then heal him (if he is still alive).
Problem is, what if the heli is above water? Then the AI medic should find a suitable landing position, steer the chute to that position, and land.
This is my motivation behind the AI steerable thing

little raptor
#

it's always capped to maximum...

#

shouldn't it "accelerate"?

winter rose
still forum
#
GlobVehicle = cursorObject;
onEachFrame {
    _speed = 2;
    if (speed GlobVehicle < 40) then {
        GlobVehicle setVelocityModelSpace ((velocityModelSpace GlobVehicle) vectorMultiply _speed);
    };
    diag_log format ["Speed: %1",  speed GlobVehicle];
};

so much simpler no?

not quite sure what you're trying to achive. but model space velocity will be quite a bit easier to use?

spark turret
#

hm now that i think about it, if its constant, you dont need to cap it

little raptor
#

anyway, I just tested my own code with parachutes

#

it doesn't work

#

which means setVelocity doesn't work on parachutes

#

so the setVeolcity method won't work

spark turret
#

it does work for scripted parachutes on crates

#

(done that in the past)

little raptor
#

oh right

#

I was using setVelocity on the unit meowsweats

winter rose
little raptor
obtuse quiver
winter rose
#

not going to work, you cannot sleep in a trigger - the code there is unscheduled

obtuse quiver
#

ah i see, so... how do i make it repeat every 60 seconds?

#

this && round (time %60) ==60 ?

little raptor
obtuse quiver
#

wdym? im a noobie

little raptor
obtuse quiver
#

thanks im going to read that now

little raptor
obtuse quiver
#

yeah i just want to understand what everything mean but hey thanks again dude!

little raptor
#

also you code is wrong

#

you're always resizing the marker to [4300, 4300]. it never shrinks

obtuse quiver
#

let me guess the "true" and set marker and ger marker size

#

Ah

#

ops

#

sooo i have to set the minimum in there

little raptor
obtuse quiver
#

not at all, i was experimenting ๐Ÿ™‚

little raptor
#

if you simply remove: [4300, 4300], from your code it will work fine

obtuse quiver
#

nice thanks i learned something today

little raptor
#

np. I updated the code above

languid oyster
hot kernel
#

How can I make this MP compatible? It's currently pasted in the unit's init.

call {
    this spawn {
        while {sleep 1; (currentWeapon _this) == "arifle_MXM_F"} do {
            waitUntil {uiSleep 1; (daytime > 20) && {cameraView == "GUNNER"}};
            setApertureNew [2, 5, 14, .9];
            waitUntil {uiSleep 1; cameraView != "GUNNER"};
            setAperture -1
        }
    }
};

Any ideas?

winter rose
#

yes - don't use init field

winter rose
still forum
#

"remove this call wrapping too, it is useless" not in init field, it fixes the 0=... stuff that people normally do.

hot kernel
#

@winter rose
I started using call instead of null=, but if it goes in initplayerlocal that scope is useless, like you said.
do I need remote exec or anything? Just that in the initplayerlocal?

winter rose
still forum
#

ye

hot kernel
#

yeah but I uninstalled CBA ๐Ÿ˜„

#

Thanks for the help guys!

grim wing
copper raven
#

you can't return anything to the init fields, otherwise you get an error (unless u run cba)

grim wing
#

can someone help me why this isnt showing in zeus under compositions?

#

its showing in the editor

little raptor
#

That's what I mean

copper raven
#

yea, but i think it then works, no? it's only a static check

#

need to test

little raptor
#

Dunno, never did that

copper raven
#

yea ๐Ÿ˜„

#

5 //error
call {5} // works

#

why is that a thing though

little raptor
#

Man sqf just keeps getting weirder the more you learn

willow hound
grim wing
#

is there a way to port them over to zeus?

willow hound
still forum
#

3DEN compositions work completely differently from Zeus compositions.

A 3DEN composition is actually literally just the copy-paste information (when you press ctrl+c) dumped into a file.
Zeus works completely differently and cannot handle that stuff.

Zeus compositions are actually not "compositions", but groups. Like how you place a group/squad of soldiers down.

willow hound
#

@winter rose Write that down, write that down!

#

Fine, I'll do it myself!

grim wing
#

Ahh so basically change

        {
            side=8;
            name = "Compositions";
            class Custom

to a group instead of empty

still forum
grim wing
#

didnt work sad face

little raptor
#

Is anyone good at world to screen projections?

#

let me ask the question first.
so I'm trying to create a "drawLine2D" function.
there's a problem with worldToScreen command. if the position is offscreen the command returns an empty array.
so I want to account for these cases as well.
what I do is project the position onto the camera plane, then convert the projection to the camera coordinates.
but the line angle is off. can anyone tell why?

#
deleteVehicle test;
test = createSimpleObject ["Sign_Arrow_F", eyePos player, true];
onEachFrame {
    _disp = findDisplay 46;
    _n = getCameraViewDirection cameraOn; //camera view dir; and the normal of the view plane
    _vup = vectorUpVisual cameraOn; //camera's vectorUp; used only for banking

    _u = _n vectorCrossProduct _vup; //side vector

    _vup = _u vectorCrossProduct _n; //get the actual vector up; used to later transform the projection from world to camera (screen) space 

    _p = positionCameraToWorld [0,0,0];
    
    _p1 = ASLToAGL eyePos player;
    
    test setPosASL AGLToASL _p1;
    
    _p2 = ASLToAGL eyePos AI;

    _p1p = worldToScreen _p1;
    (if (_p1p isEqualTo [] || true) then {
        _v = _p1 vectorDiff _p;
        _p1p = _v vectorDiff (_n vectorMultiply (vectorMagnitude _v * (_v vectorCos _n))); //projection
        test setPosASL AGLToASL (_p1 vectorAdd _p1p);
        [0.5 + vectorMagnitude _p1p * (_p1p vectorCos _u), 0.5 - vectorMagnitude _p1p * (_p1p vectorCos _vup)]; //projection in screen coordinates
    } else {_p1p}) params ["_x1", "_y1"];

    _p2p = worldToScreen _p2;
    (if (_p2p isEqualTo [] || true) then {
        _v = _p2 vectorDiff _p;
        _p2p = _v vectorDiff (_n vectorMultiply (vectorMagnitude _v * (_v vectorCos _n))); //projection
        test setPosASL AGLToASL (_p1 vectorAdd _p2p);
        [0.5 + vectorMagnitude _p2p *(_p2p vectorCos _u),  0.5 - vectorMagnitude _p2p * (_p2p vectorCos _vup)]; //projection in screen coordinates
    } else {_p2p}) params ["_x2", "_y2"];
    
    
    test setVectorDirAndUp [_vup, _n];
    
    
    _line = _disp getVariable ["LLine", controlNull];
    if (isNull _line) then {
        _line = _disp ctrlCreate ["RscLine", -1];
        _disp setVariable ["LLine", _line];
    };

    drawLine3D [_p1, _p2, [1,1,1,1]];

    _line ctrlSetPosition [_x1, _y1, _x2 - _x1, _y2 - _y1];
    _line ctrlCommit 0;
};
#

this is a copy paste example,
you also need to create some unit named "AI" for it to work

#

I want to get the 2D line (ctrl) and the 3D line to overlap

#

ok here's another question:
does anyone know the name of the function that 3DEN uses when you hover the mouse over a connecting line?

#

apparently it also uses controls for those lines

#

so I could see what I'm doing wrong

#

It's a bit buggy, but at least not broken like mine! ๐Ÿ˜„

still forum
#

its probably not script

little raptor
#

can you send me the code then?! ๐Ÿ˜‰

still forum
#

Tell me what exactly to search for

little raptor
#

I don't know. Maybe a mouse moving event handler?

It only shows when you hover the mouse over some line in 3DEN. like hovering the mouse over the line connecting group members

#

I guess it should be in a mouse moving event handler, no?

still forum
#

world to screen on non-map screen right?

#

no wait screen to world?

#

mouse hover will be screen to world

copper raven
#

do you mean hovering over the connecting line when the "Group to" whatever tooltip appears? @little raptor

little raptor
#

yes

#

that's the one!

#

@still forum maybe searching for "Group to" can have some results!

#

I did a search in functions, but no dice

#

functions in 3den.pbo

still forum
#

UI mouse position distance to the closest point on line defined by its UI render coordinates is smaller than 0.01ยฒ, then mouse is "on" line

little raptor
#

ok, so then how does it draw the line?

#

the control I mean

still forum
#

I assume you want "WorldLineToUI" which turns a line in 3D world coordinates, into a line in 2D UI coordinates

little raptor
#

yeah

still forum
#

or just WorldToUI which does it for one coordinate.

Well how does it draw? DrawLine3D I guess

little raptor
#

no, it's a control
at least looks line one
drawLine3D doesn't pass thru lods

#

but this one does

#

for example, if you put a wall between the group members you can see the line passing thru it (it's actually a 2D line, so it doesn't really pass thru anything, it's just in front of the screen)

still forum
#

"DrawDiagLine3D", I guess that one passes through lods

little raptor
#

what is that?!

still forum
#

nothing you have access to

#

it just uses the normal engine line drawing. same as everywhere

#

as for the WorldToScreen, it finds the rotation from camera towards the pointby rotating the inverse transform by point-camPos.

then X screen coord = 0.5 * (1.0 + camDirX * (1/CamDirZ) * cameraInvertedLeft);
y= 0.5 * (1.0 + camDirY * (1/CamDirZ) * cameraInvertedTop);

#

that sufficient?

little raptor
#

thanks, I'll see what it means!

still forum
#

actually WorldToScreen does the same thing, just copy-pasted instead of calling the actual function for it

#

"if the position is offscreen the command returns an empty array."
nope, if the position is behind the camera it returns empty array.

#

The other code that 3den uses does the same, no position when behind camera

#

but I guess 3den must do something extra to handle that, as you can put your camera into the line?

little raptor
#

yeah

#

exactly

still forum
#

Ah!

#

no the other code had special check for behind

#

if direction to point is behind camera, it does a intersection with juuuust infront of camera nearPlane
0.001m infront of nearPlane

#

and then uses that as the point

#

I don't think you have script access to the near clip plane.
But I guess with cam pos and direction you should be able to generate it

quartz coyote
#

Is there a way to add a scope on a weapon that is in a weapon crate/container ?

little raptor
#

maybe that's the solution!

still forum
#

"what are cameraInvertedTop and cameraInvertedLeft here?" properties of the camera perspective ยฏ_(ใƒ„)_/ยฏ

little raptor
#

anyway, thanks for bearing with me! I'll see if I can figure this out

still forum
#

well my copy paste is broke.. grr

#

x = (xScreen - uiTopLeftX) / (uiBottomRightX - uiTopLeftX)

xScreen is the thing you got above

#

These are UI region from 0-1 think

#

default for uiBottomRightX and Y is 0.925
and topleft 0.075

#

can be configured in the config where the fovTop/fovLeft/tripleHead things are

#

never seen these values be configured though

little raptor
#

that's very interesting. thanks. let's see if it works!

raw scaffold
#

help needed!... would like one character to have nightvision capabilities without wearing nods. just a simple press "n" option ... is this possible?

little raptor
#

If you use the second option, you will lose the nvg features (e.g. you can't see the lasers anymore)

hallow mortar
#

Set a password and don't tell people what it is until you're ready?

lean anchor
#

oh no i mean i for like 2 mins at the start of a mission restart

#

(it auto restarts every 3 hours)

velvet merlin
#

super confused trying to modify Escape BI game mode

  1. it assigns all playable slots to BIS_grpMain, yet on a DS unis BIS_grpMain always returns empty array
                   init="BIS_grpMain = group this;";
                   isPlayable=1;
  1. allPlayers takes a 60+ seconds to become non empty
  2. getting separated from my group right at mission start despite any respective sqf commands as far as i can see - does setUnitLoadout (executed on the server) mess group assignment up?
  3. playableUnits remains empty despite the other 9 AI still present from the player slots
#

rpt wise the only strange stuff is this:

 9:30:27 Cannot create object 4:5 with type[AIGroup], param[group], NMT code[103]: 
 9:30:27 Cannot create object 4:6 with type[AISubgroup], param[subgroup], NMT code[107]: 
 9:30:27 Client: Object 4:6 (type Type_108) not found.
 9:30:27 Client: Object 4:5 (type Type_104) not found.
 9:30:27 Cannot create object 4:8 with type[AIUnit], param[unit], NMT code[112]: 
 9:30:27 Client: Object 4:5 (type Type_104) not found.
 9:30:46 Client: Object 4:8 (type Type_113) not found.
 9:30:46 Client: Object 4:8 (type Type_114) not found.
 9:30:47 Setting invalid pitch -0.0000 for L Alpha 1-1:1 REMOTE
 9:30:47 Setting invalid pitch -0.0000 for L Alpha 1-1:2 REMOTE```
#

in Eden/SP, all this works fine. i am quite experienced in MP coding, but never seen this - yet haven been using Eden but 2d editor so far

dusty badger
#

Is there a way to check if a trigger is currently active from within its own activation condition using thisTrigger?

#

Ideally I want to use this so that once count allUnits is above a certain number, no new triggers may be activated but triggers that are currently activated will stay active

little raptor
cosmic lichen
#

triggerActivated thisTrigger

#

this might work as well, dunno

little raptor
#

"this" means it's "preliminary condition" is satisfied

#

for example, for a trigger with CIV PRESENT condition, this returns true if there are any civilians in it

cosmic lichen
#

yeah, but what about custom conditions?

#

this && time> 5

little raptor
#

this still has the same meaning as before.
so yeah, it should be triggerActivated thisTrigger || {this && {count allUnits < n}}

#

it satisfies the condition that @dusty badger asked

#

I want to use this so that once count allUnits is above a certain number, no new triggers may be activated but triggers that are currently activated will stay active

dusty badger
#

So when the trigger is looping the check for its activation condition, will this return its activation state at the end of the previous loop? If that makes sense.

little raptor
#

no, only if it's "initial condition" is satisfied

#

for example, for a trigger with CIV PRESENT condition, this returns true if there are any civilians in it

#

I'm not 100% sure but it'd make no sense if it worked in a different way

dusty badger
#

Ok, I think I get it, thanks!

little raptor
# still forum "if the position is offscreen the command returns an empty array." nope, if the ...

Btw, about that camera problem, I couldn't figure it out, but instead I resorted to a "creative" way to use worldToScreen
all I had to do was mirror the position relative to the camera position, then use worldToScreen on this mirrored point. and then finally stretch the line to the outside of the screen! :D

nope, if the position is behind the camera it returns empty array.
this helped a lot! thanks for the explanation! :)

onEachFrame {
    _disp = findDisplay 46;
    _line = _disp getVariable ["Line", controlNull];
    if (isNull _line) then {
        _line = _disp ctrlCreate ["RscLine", -1];
        _disp setVariable ["Line", _line];
    };
    _p = positionCameraToWorld [0,0,0];
    _uiScale = 10*(safeZoneWAbs + safeZoneH);
    
    
    
    _p1 = ASLToAGL eyePos drone;
    _p2 = ASLToAGL eyePos AI;

    drawLine3D [_p1, _p2, [1,1,1,1]];
    
    _p1p = worldToScreen _p1;
    _p2p = worldToScreen _p2;
    
    
    
    if (count _p1p == 0 && count _p2p == 0) exitWith {
        _line ctrlSetFade 1; 
        _line ctrlCommit 0;
    };
    _line ctrlSetFade 0;
    
    if (_p1p isEqualTo []) exitWith {
        _p1p = worldToScreen (_p vectorAdd (_p vectorDiff _p1));
        
        _p1p params ["_x1", "_y1"];
        _p2p params ["_x2", "_y2"];
        
        _line ctrlSetPosition [_x2, _y2, (_x2 - _x1)*_uiScale, (_y2 - _y1)*_uiScale];
        _line ctrlCommit 0;
    };
    
    _p2p = worldToScreen _p2;
    if (_p2p isEqualTo []) exitWith {
        _p2p = worldToScreen (_p vectorAdd (_p vectorDiff _p2));
        
        _p1p params ["_x1", "_y1"];
        _p2p params ["_x2", "_y2"];
        
        _line ctrlSetPosition [_x1, _y1, (_x1 - _x2)*_uiScale, (_y1 - _y2)*_uiScale];
        _line ctrlCommit 0;
    };
    
    _p1p params ["_x1", "_y1"];
    _p2p params ["_x2", "_y2"];

    _line ctrlSetPosition [_x1, _y1, _x2 - _x1, _y2 - _y1];
    _line ctrlCommit 0;
};
#

this one works, if anyone else was interested

dusty badger
#

Do custom functions called from within trigger conditions have access to magic variables only accessible within those conditions?

dusty badger
#

alright cool

languid oyster
#

Hey guys, I have difficulties changing AI parachute deploy height. Basically, I want to tell an AI unit dropping towards ground at which height the parachute should be deployed. Standard height is 150m, but I need the AI to deploy at higher altitude.

little raptor
velvet merlin
#

why is there such long delay after mission start until allPlayers picks up player entities?

#

even in a hosted session it takes several seconds

languid oyster
#

@little raptor works like a charm. Once again, many thanks!!

winter rose
velvet merlin
#

the same is true on dedicated server

#

like i was questioning the implementation on the engine level

#

like it has to sync the data sure, but something is done strangely there

winter rose
#

kinda agree. both player-side and server-side?

velvet merlin
#

tested only server side - player side it most likely has the player itself at least instantly/once defined

languid oyster
#

@little raptor I'm currently testing this and that with your parachute script. I can only draw my hat on your math skill. It looks really cool when the AI homes in to me. Never could have done this by myself.

still forum
#

@velvet merlin allPlayers scans all "player camera positions" in the world.
Basically every player announces "Hey, there's a camera of a player here, so when you do stuff around me, I wanna know about it"
and thats what allPlayers looks into and returns

Though I don't see why that would be delayed for so long

velvet merlin
#

thanks. will add some logging both and client to determine timing

#

the only reason for a longer delay i can think of is to make sure it detects all players from the start rather to init the variable once the first was found

sudden yacht
#

How can i make a unit invincible with ace? This allow damage false seems not to work.

hollow thistle
#

It should work after medical rewrite.

sudden yacht
#

After medical rewrite? When would that be?

hollow thistle
#

Idk, year or more ago.

#

Are you using current ace version?

sudden yacht
#

Hmm. I think i figured out the issue. thanks guys

dusty badger
#

changing the trigger interval seems like a pretty good way to simultaneously reduce the amount of work it takes to update triggers in your mission, while also compensating for things moving at high speeds that you may not want activating triggers that often

#

like if it checks every 3 seconds then anything going faster than 233m/s is less and less likely to activate a trigger with a range of 700m, and when it does it will be only for a brief moment

timber warren
#

im trying to spawn randomized loot containers. i can place the containers in my map, but i want to place random predefined items in them. i was told i need a script and i am inexperienced

little raptor
#

wait, when did I become a veteran?!

proper sail
#

yes magic happened

winter rose
still forum
#

wat

winter rose
still forum
#

when did Lou become blue

#

leo

proper sail
#

somewhere between now and 4 hours ago

still forum
little raptor
#

that's what I was thinking! ๐Ÿ˜„

young current
#

with blue name comes great responsibility.

winter rose
#

only a bottle of scotch no?

proper sail
#

do i pay my rent to leopard instead of lou now

young current
#

no

winter rose
#

no ๐Ÿ‘€ indeed

little raptor
#

Imma overthrow Lou! ๐Ÿ˜„

young current
#

sounds like fast way to lose the blue name ๐Ÿ˜…

winter rose
#

he was a brave veteranโ€ฆ for one hour

little raptor
#

no sir, have mercy! notlikemeowcry

little raptor
cosmic lichen
#

slow down man. Blue for 20minutes, now biki access, what's next? BI CEO? ๐Ÿ˜„

little raptor
cosmic lichen
#

The only thing that comes with the title is access to that channel with the weird ppl ๐Ÿ˜„

spark turret
#

At what point does on become a veteran

still forum
#

there is no point

#

there is only a blurry line

#

someday you are not careful and trip over the line and smash your face into the ground and BAM! veteran!

spark sun
#

When you are old.

winter rose
#

THAT'Sโ€ฆ accurate

quick peak
#

Hey. Is it possible to enable and disable respawn module? Syncing it to trigger don't work, neither changing condition of presence

quick peak
#

i see, thanks

hollow thistle
#

Respawn position? Disable simulation

#

It works when respawn is on object so might work on module too.

spiral temple
#

can I ask here questions about scripting?

exotic flax
#

that's that this channel is for

waxen sand
#

I will let Maletzki to get his answers and I will ask as well

#

will wait*

spiral temple
#

well, better to ask before ;)

I'm not really into scripting, but not a beginner in general.

I want to parse an array into params like

_myArray = ["item1", "item2", "item3"];

[_myArray] call myFunction;

how should I design the params? for single values I use ["myString", "", [""]] or ["myNumber", 0, [0]] , as example. can someone give me a hint?

willow hound
waxen sand
#

This is the noobest of questions

spiral temple
#

lol

waxen sand
#

How do I know where to write a script and how to name it?

spiral temple
#

that's really rude bud

waxen sand
#

?

exotic flax
#

Check the examples at https://community.bistudio.com/wiki/params
Makes sure you always put an underscore before the variable (since they're always private), and it's not required to validate the values (although good practice).
For arrays you can use params [ ["_array", [], [[]]] ];

waxen sand
#

I am asking for myself, I am not implying anything if that is what you mean

spiral temple
#

@exotic flax thanks, already took a look into that, just want to get sure :)
@waxen sand well, ASL is not exactly the same like PHP, VB or C++ what I already learned at University ๐Ÿ˜›

willow hound
spiral temple
#

ohhh

#

lol

#

then sorry, my bad

waxen sand
#

I was, yes

#

I am the noob here not you

exotic flax
spiral temple
#

I have to say sorry, understood it wrong.. had a long day at work today

willow hound
waxen sand
#

Ohhhh..."Other than that you can place script files in any number of subfolders of your mission root folder, naming them however you like."

#

That was the answer I was looking for

#

So as long as I am strict on the names I use for my text files I can call the "Bob" or "John" for all the game cares

exotic flax
#

yup, except for naming them as the event scripts in a mission of course ๐Ÿ˜‰

waxen sand
#

Allright

#

You just saved me two days of research to finally understand something as basic as that

#

One final question

#

Do I have to use more than one text files to separate vehicle related script and infantry related script, meaning scripts that are for different things.

#

?

#

Or can I just dump all the commands on one and separate them with notes

#

?

willow hound
#

The game doesn't mind (and doesn't know) what it is you're doing in your script, it just runs one command after the other.
MyScript.sqf:

MyVehicle setPos [2, 1, 0];
MySoldier allowDamage false;
systemChat "Sample Text";
```Only the human knows what these have (or don't have) to do with each other.
exotic flax
#

You could dump everything in a single file, but I would do it.
First of all; you'll go crazy working on it or debugging issues
Second; it will limit you from proper/safe implementation (like using CfgFunctions).

That said; it doesn't matter what you do within a script, although I believe it's good practice to split up stuff unless related to each other. This comes in handy the moment you need to call scripts from Event Handlers.

waxen sand
#

Yes, that's what I thought from your previous answer

#

Thanks a lot, you have no idea how much you helped me

#

Now I just need to plan this mess I am about to make to be as less messy as possible

quasi sedge
#

How to teleport player
to gunner seat in leader's vehicle(let's say its AH-64 Apache, or Bradley M2A3 whatever)
Both players in same group (Alpha 1-1)

#

my shitty code obv not wokring

_plr = _this select 0;
_playerGrp = group player;
_GroupLeader = leader (group (player));
_vehicle = leader vehicle;
_plr moveInGunner leader _vehicle;```
still forum
#

moveInGunner takes a vehicle, not the leader of a vehicle

#

_vehicle = leader vehicle; you mean the vehicle OF the leader?

willow hound
still forum
#

Just plain english.
vehicle of the leader
vehicle leader

_vehicle = vehicle _groupLeader

quasi sedge
#

onPlayerRespawn.sqf ```sqf
_plr = player;
_plr addrating -100000;

_actionid = _plr addAction ["New vehicle", "scripts\spawnvehicle.sqf"];
_actionid1 = _plr addAction ["GetAsGunner", "scripts\getAsGunner.sqf"];

#

scripts\getAsGunner.sqf sqf _playerGrp = group player; _groupLeader = leader _playerGrp; _vehicle = vehicle _groupLeader; player moveInGunner _vehicle;

#

im a bit tilting that such simple thing not working notlikemeowcry

#
 0:41:58 [CBA] (xeh) INFO: [12679,279.967,0] PostInit finished.
 0:41:58 [ACE] (common) INFO: Settings initialized.
 0:41:58 [ACE] (common) INFO: 3 delayed functions running.
 0:41:58 Unknown task state: 
 0:41:58 Unknown task state: 
 0:41:58 Unknown task state: ```
fiery orbit
#

Is it possible to have a sector call a function and pass all three of its parameters?

exotic flax
#

statement - Code that will be executed when the ownerside of the sector changes. The following arguments will be passed: [module, ownerSide, previousOwnerSide]. (Default: Nothing)

fiery orbit
#

so as long as I place the call llama_fnc_whatever it will pass the params?

exotic flax
#

If you put the following in that field it should work

_this call llama_fnc_whatever;
``` or ```sqf
params ["_module", "_newOwner", "_oldOwner"];
[_module, _newOwner, _oldOwner] call llama_fnc_whatever;
willow hound
fiery orbit
#

@exotic flax thank you

quasi sedge
#

gom aircraft loadout

winter rose
#

โ€ฆthere are two download links, click on one?

quasi sedge
#

uh, armaholic ftp blocked in Russia hmm, VPN works

velvet merlin
#
["BIS_grpMain 1",[O Alpha 1-1:1 (test) REMOTE,O Alpha 1-1:2,O Alpha 1-1:3,O Alpha 1-1:4,O Alpha 1-1:5,O Alpha 1-1:6,O Alpha 1-1:7,O Alpha 1-1:8,O Alpha 1-1:9,O Alpha 1-1:10]]
["BIS_grpMain XXX",O Alpha 1-1,[O Alpha 1-1:1 (test) REMOTE,O Alpha 1-1:2,O Alpha 1-1:3,O Alpha 1-1:4,O Alpha 1-1:5,O Alpha 1-1:6,O Alpha 1-1:7,O Alpha 1-1:8,O Alpha 1-1:9,O Alpha 1-1:10]]
["allPlayers XXX",[]]
["playableUnits XXX",[O Alpha 1-1:1 (test) REMOTE,O Alpha 1-1:2,O Alpha 1-1:3,O Alpha 1-1:4,O Alpha 1-1:5,O Alpha 1-1:6,O Alpha 1-1:7,O Alpha 1-1:8,O Alpha 1-1:9,O Alpha 1-1:10]]
["switchableUnits XXX",[]]
Cannot create object 4:5 with type[AIGroup], param[group], NMT code[103]: 
Cannot create object 4:6 with type[AISubgroup], param[subgroup], NMT code[107]: 
Client: Object 4:6 (type Type_108) not found.
Client: Object 4:5 (type Type_104) not found.
Cannot create object 4:8 with type[AIUnit], param[unit], NMT code[112]: 
Client: Object 4:5 (type Type_104) not found.
Cannot create object 4:9 with type[AIGroup], param[group], NMT code[103]: 
Cannot create object 4:10 with type[AISubgroup], param[subgroup], NMT code[107]: 
Client: Object 4:10 (type Type_108) not found.
Client: Object 4:9 (type Type_104) not found.
Cannot create object 4:11 with type[AIGroup], param[group], NMT code[103]: 
Cannot create object 4:12 with type[AISubgroup], param[subgroup], NMT code[107]: 
Client: Object 4:12 (type Type_108) not found.
Client: Object 4:11 (type Type_104) not found.
Cannot create object 4:13 with type[AIGroup], param[group], NMT code[103]: 
Cannot create object 4:14 with type[AISubgroup], param[subgroup], NMT code[107]: 
Client: Object 4:14 (type Type_108) not found.
Client: Object 4:13 (type Type_104) not found.
Client: Object 4:8 (type Type_113) not found.
Client: Object 4:8 (type Type_114) not found.
["BIS_grpMain XXX",<NULL-group>,[]]
["allPlayers XXX",[]]
["playableUnits XXX",[]]
["switchableUnits XXX",[]]```
#

is there anything on sqf side to remove AI from playableUnits? or an Eden setting? or something in server.cfg?

little raptor
#

But don't think you can remove them

velvet merlin
#

its like "something" tries to clean them up/remove them

#

they dont get deleted but every playable units gets separated into a <null group>

exotic tinsel
#

im not sure if this is the correct channel but we need to know if we have a headless client will we lose control of AI spawned in by Zeus?

robust hollow
#

shouldnt be any different unless you use a script to transfer ownership

brave jungle
#

Hi guys trying to fix an issue with a system I have made. Here is my extract:

_side_Option_Temp = toUpper (lbText [2100, lbCurSel 2100]);
systemChat format ["Before Switch %1", _side_Option_Temp]; //this is "GUER", as expected
switch (_side_Option_Temp) do {
    case ("WEST"): {
      _side_Option = "West";
    };
    case ("EAST"): {
      _side_Option = "East";
    };
    case ("GUER"): {
      _side_Option = "Indep";
      systemChat _side_Option; //this is Indep
      systemchat "Indep chosen."; // this is correct
    };
    default {};
};
systemChat format ["After Switch %1", _side_Option]; //this becomes any.

///blah blah - later on...

collect3DENHistory {
  _squad = configfile >> "CfgGroups" >> _side_Option >> _factions_option >> "Infantry" >> _squads_option;
  systemChat format ["%1 is the squad chosen", _squad]; //this becomes a number?

For some reason independent faction is never passed through correctly. I have run some debugging, and found that although my variable under the switch _side_Option is correctly set to "Indep", which is required for cfgGroups, it is picked up outside of the switch as any and then a number when using configFile.

Any ideas on this? the other two factions, west and east, work perfectly fine.

robust hollow
#

is _side_Option defined before the switch?

brave jungle
#

Uh it should be... I bet it isn't.

robust hollow
#

based on that snippet alone it looks like a scope issue, none of the cases should work.

brave jungle
#

Damn it.

#

Yea that's the issue I think... haha

#

Thanks indep is picked up now ๐Ÿ‘

still forum
#

#if __has_include ("test2.sqf")

little raptor
#

ok, but why?! ๐Ÿ˜„

still forum
#
//preprocessFileLineNumbers "userconfig\test.sqf"
#define TEST 1

#if TEST
bla
#endif

#if __has_include ("test2.sqf")
ble
#endif

#pragma I_do_stuff(bla, bla, bla) bla \
bla bla
winter rose
#

โ€ฆare you trying to replace sqf with preprocessor commands ๐Ÿ‘€

spiral temple
#

are there any problems related to switch do when conditions are strings?

`_randomPrices = [
"cash", "respect", "materials", "cdah"
];
_randomPriceValue = selectRandom _randomPrices;
switch(_randomPriceValue) do {
case "cash": {

};
case "respect": {

};
case "materials": {

};
case "cdah": {

};
default: {

};

};`

is not working at all.. but when I do it in classic if else statements, it works just fine. or do I miss something?

winter rose
#

also, ```sqf

spiral temple
winter rose
#

and you wrote default**:** {

spiral temple
#

ahh... yep, right...

#

in php you need that ":" after default

brave jungle
#

count (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OI_reconSentry") What is this actually counting? returns 6, should probs mention

winter rose
winter rose
brave jungle
#

Oh i Missed that that third one the number of sub-entries in a config entry

#

so thats not the way to count a units in a group via config

winter rose
#

no ๐Ÿ‘€

brave jungle
#

Any ideas on that? Im guessing just count these sub classes

winter rose
#

to be fair, that page was refactored yesterday as well ๐Ÿ˜„

brave jungle
#

haha

winter rose
#

but isn't counting subclasses correct?

brave jungle
#

Oh bril yeah i'll take a look into it

#

thanks

winter rose
#

careful, for tis I who wrote that code ๐Ÿ˜

brave jungle
#

Oh boy... time to steal it all

#

haha

winter rose
#

more like "be wary, may implode your CPU, steal your money and burn your pillow"!

brave jungle
#

hahah better get a fire extinguisher ready in that case

spiral temple
#

hmmm there is still something wrong.... for me it looks ok

switch(_currentDay) do {
    case 6;
    case 13;
    case 20: {
    
    };
    case 24: {
    
    };
    case 25;
    case 26: {
    
    };
    case 31: {
    
    };
    default {
        _randomPrices = [
            "cash", "respect", "materials", "cdah"
        ];
        _randomPriceValue = selectRandom _randomPrices;
        switch(_randomPriceValue) do {
            case "cash": {
            
            };
            case "respect": {
            
            };
            case "materials": {
            
            };
            case "cdah": {
            
            };
            default {
                ["ErrorTitleAndText", ["Something went wrong. Please report this to an admin (error: random price not set)"]] spawn ExileClient_gui_toaster_addTemplateToast;
            };
        };
    };
};

or is this

case 6;
case 13;
case 20:

not intended for numbers?

worn forge
#

Looks fine to me, what's the error message?

winter rose
#

I am afraid he does not have them activated, otherwise he would have seen the default'#': error

spiral temple
#

@winter rose sorry, now I understood ๐Ÿ˜‰

brave jungle
#

sqf only need to be after the top ```

worn forge
#

restart with error logging and try again

spiral temple
#

err how can I activate error logging?

#

-showScriptErrors as startup param?

brave jungle
#

yep

#

in the launcher

spiral temple
#

client side?

brave jungle
#

In the A3Launcher, goto parameters, under author at the bottom tick the show script errors box

#

restart your client and then try again with the code

spiral temple
#

are these script errors logged into my local .rpt?

brave jungle
#

they'll show in a black box in trhe middle of your screen

spiral temple
#

it vanishes too fast ๐Ÿ˜„

brave jungle
#

they're logged in ur local .rpt though yes

spiral temple
#

aye, I missed a ; anywhere in the code, much thanks

brave jungle
#

what did the full rpt say

#

it can be misleading with the missing ; if you're not familiar with this debug system

spiral temple
#
15:28:07 Error in expression <leClientPlayerScore = _newPlayerRespect
format["setAccountScore:%1:%2", _newPlay>
15:28:07   Error position: <format["setAccountScore:%1:%2", _newPlay>
15:28:07   Error Fehlendes ;
15:28:07 File a3_infiSTAR_Exile_customApps\apps\fn_avmg_advent_calendar.sqf..., line 74
15:28:07 Error in expression <leClientPlayerScore = _newPlayerRespect
format["setAccountScore:%1:%2", _newPlay>
15:28:07   Error position: <format["setAccountScore:%1:%2", _newPlay>
15:28:07   Error Fehlendes ;
15:28:07 File a3_infiSTAR_Exile_customApps\apps\fn_avmg_advent_calendar.sqf..., line 74
brave jungle
#

Ah yeah un-related to above, check your code above the switch

spiral temple
#

every time these stupid semicolons... the beginner error #1

brave jungle
#

haha

spiral temple
#

I do "script" for 10 years in different languages now, and still missing them...

winter rose
#

"alright, we are shipping your machine to the client"

winter rose
spiral temple
#

@winter rose wilco ๐Ÿ™‚

quasi sedge
#

im using MGI_1ManTank script

#

after some time script stops working with following .rpt error

#
MGI_agent = nil;
(findDisplay 46) displayRemoveEventHandler ["keyDown",MGI>
17:23:18   Error position: <displayRemoveEventHandler ["keyDown",MGI>
17:23:18   Error Type Any, expected Number
17:23:18 Error in expression <gent;```
winter rose
#

then it's broken ๐Ÿคทโ€โ™‚๏ธ

quasi sedge
#
MGI_EHTank =  ["MGI_TK","onEachFrame", {
    _veh = vehicle player;
    if (!isNil "MGI_agent" && {!(_veh in MGI_tanks) or !(MGI_agent in _veh)}) exitWith {
      deleteVehicle MGI_agent;
      MGI_agent = nil;
      (findDisplay 46) displayRemoveEventHandler ["keyDown",MGI_keysDriving];
      MGI_keysDriving = nil;
    };
brave jungle
#

posting the EH isn't gonna fix it ๐Ÿ˜„

winter rose
#

@quasi sedge ask the author to fix it, or see if there isn't an updated version available already

little raptor
#

the script is written kinda badly

#

but the fix is simple:

 (findDisplay 46) displayRemoveEventHandler ["keyDown", missionNamespace getVariable ["MGI_keysDriving", -1]];
#

I don't understand the author's compulsive need to set everything to nil! ๐Ÿ˜„

#

the issue is due to timing

#

if (!isNil "MGI_agent" && {!(_veh in MGI_tanks) or !(MGI_agent in _veh)}) exitWith {
it may exit here without ever defining the variable

little raptor
#

I bet he really needed those 4 bytes! ๐Ÿ˜„

quasi sedge
#

@little raptor big thanks!

brave jungle
#

while !{ _totalUnits isEqualTo _total } the ! is in the wrong place isn't it...

#

so basically while _totalUnits isn't == to _total do some stuff

#

Ignore me...

#

Would help if I read by errors.

grizzled lagoon
#

Hello, I have a question how do we adapt the size of the dialogs according to the screen resolution?

worn forge
grizzled lagoon
#

Yes

brave jungle
#

So uh.

#

I made an infinite loop and I can't figure out why.

#
    _total = 60;
    _totalUnits = 0;
    _unitCount = count ("true" configClasses _squad);
    _groupSide = west;
    _Finalgroup = createGroup _groupSide;

    while { !(_totalUnits isEqualTo _total) } do {
      //Catch code before going over 60 units
      _NextTotal = _totalUnits + _unitCount;
      if (_totalUnits isEqualTo _total) exitWith {};


      if (_NextTotal >= _total) then {
        _intDiff = _NextTotal - _total;
        systemChat str _intDiff;
        for "_i" from 0 to _intDiff do {
          _unitID = format ["Unit%1", _i];
          systemChat str _unitID;
          _unitType = getText (_squad >> _unitID >> "Vehicle");
          systemChat str _unitType;
          _Unit = _unitType createVehicle _position;
          [_unit] join _Finalgroup;
        };
      } else {
        //Create a group with given data
        _group = create3DENComposition [_squad, _position];
        {
          add3DENConnection ["sync", _x, _ZeusAttributeCuratorAddEditableObjects];
          _x set3DENAttribute ["ControlMP", true];
          sleep 0.01;
        } forEach _group;
        _totalUnits = _totalUnits + _unitCount;
      };
    };
    //to avoid loading screen lock (found during testing)
    sleep 0.1;
  };

it's looping at
} else { //Create a group with given data _group = create3DENComposition [_squad, _position]; //blah

#

Variables are correct, no errors.
My guess is it isn't catching that its reached 60 because the while loop is never ending. I attempted to stop it via if (_totalUnits isEqualTo _total) exitWith {};

#

Should add that the squads are created correctly, its on the final part where it is making the final units to get to 60, in which it just never ends.

cosmic lichen
#

Have you checked the value of the variables?

winter rose
#

= 60

#

because 50 < 60, 50+ 12, 62 != 60

brave jungle
#

Ahhhh

cosmic lichen
#

Just check the variables next time

brave jungle
#

Yeah

#

Okay ty

cosmic lichen
#

put a systemChat or diag_log or so everywhere

brave jungle
#

Yeah I have been, but didn't catch the bad value etc. from the looping

#

thank you anyhow

brave jungle
#

Think im over thinking it... How would I go about fixing it?

brave jungle
#

Yeah

winter rose
#
private _array = [];
private _limit = 5;

while { count _array < _limit } do
{
  _array pushBack "value";
};
torpid pewter
#

It seems that running player enablesimulation false in a vehicle doesn't work. The player can still fire turrets and move the vehicle. Is this a known issue, and if so is there a workaround? I'd like the player to only be able to look around for a set amount of time and then able to move/fire turrets normally.

brave jungle
#

if you're trying to stop the vehicle itself, use vehicle player enablesimulation false

#

by using player, you're stopping the player inside the vehicle only, not the vehicle

torpid pewter
#

Yeah that seems to work. However I can't look around. Is there a command to disable everything but looking around?

winter rose
#

nope - you can lock turrets and/or vehicle though

torpid pewter
#

Are you talking about the option in the editor to lock vehicles or something else?

winter rose
#

scripting

#

lock
lockDriver
lockTurret
etc

torpid pewter
#

Seems interesting but doesn't work for my purposes. It needs to work when the player is already in the turret/driver seat.

waxen sand
#

Hi

#

easy question:

#

How can I make the game do a sector owner check?

#

Or detect when a sector changes owner and act as a trigger

#

?

little raptor
waxen sand
#

Yes

little raptor
#

you can find all the possible values in the config

waxen sand
#

Just found it

#

Thanks

#

Ok. I am completely new to this and probably not very smart so bear with me for a bit.

#

sector getVariable ["TaskOwner", 0]

#

That is the command when a trigger is triggered for the game to check the owner of a sector, right?

copper raven
#

all it does is gets a variable from whatever sector is, it doesn't check/compare anything

waxen sand
#

Sure

#

What I need is the trigger. Like "when sector_1 changes owner, do "this""

#

Nvm

#

Found that as well

waxen sand
#

What is the difference between execFSM and execVM?

#

In short

queen cargo
#

Ecevm is what you should not use and get the "use [...] call fnc_your_method and Cfgfunctions" and can be used to spawn sqf scripts
Execfsm runs the "finite state Machine" you probably do not have and use ๐Ÿ˜‰

#

Fsm is documented in biki tho

cold glacier
winter rose
upper lintel
#

Is there a way to load an arsenal loadout by name?

#

I want to equip AI with loadouts that I have created in the arsenal and saved under a particular name.

robust hollow
#

you could export the loadout and use that?

upper lintel
#

I obv want to do it programatically and dynamically.

exotic flax
#

you could make a list with exports (done with getUnitLoadout), and dynamically set the loadout when needed with setUnitLoadout

winter rose
#

maybe using profileNamespace content, but then it would not work on another machine

upper lintel
#

getUnitLoadout requires an actual unit to have the desired loadout already.

winter rose
upper lintel
#

Ok, thanks, I'll try that.

#

I still don't see how to use getUnitLoadout to access arsenal saved loadouts.

robust hollow
#

it isnt, it is an alternative way to access defined loadouts (not in arsenal)

#

if you are really set on using arsenal loadouts then this might work, but as mentioned it would only work for you unless someone else has the same preset defined on their profile.

private _name = "My arsenal name"; // name to search for
private _data = profilenamespace getvariable ["bis_fnc_saveInventory_data",[]];
private _index = _data find _name;
private _inventory = if (_index == -1) then {[/* default loadout? */]}else {_data#(_index + 1)};
_inventory params ["_uniform", "_vest", "_backpack", "_headgear", "_goggles", "_binocular", "_primary", "_secondary", "_handgun", "_items", "_other"];
upper lintel
#

@robust hollow That works, thanks

lean anchor
#

hey guys,
im slightly confused as why my maths isnt working here.

_test = if ((count (allPlayers - entities "HeadlessClient_F")) > 0 ) then {diag_log format ["autopause debug"];};

I am running this after creating an EH for Onplayerconnect that then does the code above on server side(called 2 mins after server start so that the mod it will call is init'ed). i know that this being evaluated as i have another diag_log to show if it runs past this line and im only using the diag_log format ["autopause debug" to debug.

i have managed to get the disconnect to work by simply changing it from more than 0 to equal to 0. I am about to go try != as i hope that works.

oddly when running this from the debug in game and executing on server works fine....

limber parcel
#

do i need a hpp file for a insignia mod? nad if so, what does "timepacked=" mean?

upper lintel
#

@robust hollow Do I use _inventory with setUnitLoadout?

robust hollow
#

nah its not the right format for that. you could reorganize the array if you want, or use individual commands which is what arsenal does i imagine

upper lintel
#

Okay, I'll just try the _data select (index + 1) array for now

robust hollow
limber parcel
#

because im trying to make a insignia mod and its not showing up so im thinking that im missing some code to force it to the arsenal

robust hollow
lean anchor
#

i have the EH's firing 2 mins after mission start and the two HCs are there

lean anchor
#

does the EH store the number of HCs as it created or is it evaluted every EH fire

limber parcel
#

im new to this! idk what the differnnce is

winter rose
#

ah! well scripting is using SQF, config is hpp/defines ๐Ÿ™‚

limber parcel
#

ah i see

robust hollow
lean anchor
#

im trying to get an EH that fires["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule; when players connect

#

you can replace "autopause debug" with ["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule;

#

its just that it isnt firing ["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule; ever....

robust hollow
#

how many players are connected?

#

if it is just one, then you will need to change the condition because they also wont have unit when that event fires.

lean anchor
#

thats it right there

#

im just testing with 2 HC and connecting myself to the edi

robust hollow
#

i think a reliable alternative check would be on the _uid. the server (dedicated) will return "__SERVER__", and if the wiki is to be believed, HC's will return "HC1234" where the number is the process id. so you could do one of these

private _isPlayer = parseNumber _uid != 0;
// ----
private _isPlayer = _uid find "7" == 0;

or something like that, and it should only be true when a real player is connecting.

modern ivy
#

Hey all,
there is 'mission end' trigger?
if i wanna execute script / command when the text pops up

#

or event

lean anchor
#

so while my mind is reee'ing trying to work out what you mean, ill get back to you on if it works soon!

modern ivy
#

tnx, but Ive tied it before, that event fired when the mission complete (score table), I want to execute some code when the 'mission complete / fail' appears.

#

sorry for broken English ๐Ÿ™‚

lean anchor
#

if ((_test) != 0) then {diag_log format ["acon.sqf done"];} else {diag_log format ["acdddddddddddddddddddsqf done"];};

#

im being told im missing brackets?

#

where from?

exotic flax
#

let's clean it up a bit:

if ((_test) != 0) then {
   diag_log format ["acon.sqf done"];
} else {
   diag_log format ["acdddddddddddddddddddsqf done"];
};
#

and please read the documentation about format, because that is not how you use it

#

either use diag_log "acon.sqf done"; or set the proper parameters in format ["string %1", _value];

lean anchor
#

will do

#

one sec

robust hollow
modern ivy
#

ok, that a little bit socks, but iam glad to have any solution, although I dont like infinite loops. I will try it tomorrow and come back with the conclusions.
thank you!

lean anchor
#

ahhhhh ok ty Grezvany! i get what i did wrong there

#

@exotic flax is there any syntax change inyour code to mine?

exotic flax
#

nope, just made it readable so it's easier to spot any errors

lean anchor
#

because i made it neater in my script and ive changed it a bit and its still telling me im missing brackets