#arma3_scripting

1 messages · Page 31 of 1

pulsar bluff
#

need a little help debugging an issue with menu/dialog

#

is there ever a reason with menus that it can work fine testing in editor but fail in MP?

#

I cant think of a reason why a menu/dialog script would fail in MP when it works fine in editor

#

same code compiled

#

this is a snippet

#
params ['_type'];
systemChat str _this;
if (_type isEqualTo 'init') exitWith {
    missionNamespace setVariable ['QS_client_loadoutTarget',cursorObject,FALSE];
    createDialog ['QS_RD_client_dialog_menu_inventory1',TRUE];
};
private _buttonCooldown = 0.5;
private _saveLimit = 10;
if ((getPlayerUID player) in (['S3'] call (missionNamespace getVariable ['QS_fnc_whitelist',{[]}]))) then {
    _saveLimit = 20;
};
if (_type isEqualTo 'onload') exitWith {
    systemChat '0';
    _display = [findDisplay 19000];```
#

and config

#
    idd = 19000;
    movingEnable = 1;
    enableSimulation = 1;
    onLoad = "['onload',(_this # 0)] spawn (missionNamespace getVariable 'QS_fnc_clientMenuLoadout');";```
#

it is failing to enter the 'onload' scope

#

no errors ... ive checked all the syntax, no bracket/semicolon errors, works fine in editor

pulsar bluff
#

solved ... apparently _type doesnt work when called from UI context in multiplayer

#

params ['_type']; fails, while private _type = _this # 0; works

#

must be a secret reserved variable

drowsy geyser
#

any help?

little raptor
#

your sorting method is not exactly correct. don't you want to know which player is first too?

south swan
#

select {!isNil "_x"} or filter argument of sortBy to get rid of non-existing elements of array 🤷‍♂️

_input = [nil,nil,nil,3,1,2];
_out = _input select {!isNil "_x"};
//_out == [3,1,2];

_out = [_input, [], {_x}, nil, {!isNil "_x"}] call BIS_fnc_sortBy;
//_out == [1,2,3]```
little raptor
#

I recommend doing it as follows:
use setVariable to store finish times on the players:

_player setVariable ["FinishTime", time];

then simply read them back and sort:

[allPlayers, [], {_x getVariable ["FinishTime", 1e10]}, "ASCEND"] call BIS_fnc_sortBy
stable dune
#

Well im too slow for this 😳

#

What mean ,1e10? Any number?

little raptor
#

1e10 = 1 * 10 ^ 10

#

so a very large number

#

(for players that haven't finished yet)

sharp grotto
#

Use servertime tho, time is different for every client ^^

little raptor
#

it's local, so all times are the same

copper raven
pulsar bluff
#

yes itwas quite frustrating

#

never had that one before

#

i still dont quite understand it, however its solved by simply using another private variable name

#

i guess it would be like in an event handler using params ['_thisEvent'];

#

perhaps params checks reserved/magic variables

#

in any case i now use a different var

#
if (_fuckyouarma isEqualTo 'init') exitWith {```
sharp grotto
#

Arma is fun, isn't it ?

south swan
#

inb4 sudden game crashes with reason "NO_U"

grand stratus
#

I have a question when it comes to the internals of 'triggers'. I want to optimize a few things and trying to cut down on the amount of triggers I have. None of the trigger radius overlap, so I want to take a list of all relavant units/players, and check the most probably trigger areas for them to be first, then pruning them from the list when they are within a triggers range, and continuing down all the trigger areas. I'm curious if something like this is already done or if it would be worth my while to give a go.

jade tendon
#

Am i reaching with this.

if!(isServer)exitWith{};
waitUntil{!(isNil"dmpReady")};waitUntil{dmpReady}; //Wait for the mod to load first
sleep 60;

{!(_x isEqualTo objNull)} count _bomber; //Count all spawned Suicide Bombers
    private ["_unit"];
        _unit = _x;

        // Only run where the unit is local and it isn't a player
        if (((count _bomber) >0) && !isplayer _unit ) then {

    // Remove bombers vest if equipped and replace it with bomb vest
        if ("V_TacChestrig_cbr_F" in assigneditems _unit) then {_x assignItem "UMI_Bomb_Vest"};

 } forEach allUnits;
copper raven
#

something wrong on your side

#

perhaps you have a macro that messes with _type part (you put the varname in single quotes)

#

actually no, wouldn't make sense, you said it works fine in sp

pulsar bluff
#

yea, weird

#

my guess is reserved variable filtered by params, but that doesnt explain why it worked in editor

copper raven
#

it works fine for me, so it's not anything "reserved"

#

in sp and mp

pulsar bluff
#

called from onload?

copper raven
#

i copy pasted your code

pulsar bluff
#

i can restore to the broken state and send you everything for a repro

#

if youre interested

copper raven
#

if you don't mind, sure 😄

pulsar bluff
#

ill put it together tomorrow

drowsy geyser
naive needle
#
[player,"Animation"] remoteExecCall ['switchMove'];
[player,"Animation"] remoteExecCall ['playMove'];```
#

is this necessary?

#

when I executed on myself

wary sandal
#

How do I make the phalanx cannon constantly fire at target?

#

i've used fireAtTarget and commandFire but it only fires once

#

do i have to put it in a while loop or would that break it?

neat monolith
#

Hello, I have an issue and I need help. I have made a DM with tanks, so they respawn when destroyed or abandoned. The problem is, that if some reason some one get in on a tank at the starting poing, and then get out, the new tank will spawn inside the old tank and blow them both. It seems to be due to a server lag, on eden test it does not happened. On eden, the old tank vanish first and the new tank respawn.

Is there anyway to delay the respawn of the new tank when they are abandoned? The delay only seems to work when they are destroyed.

#

Thanks

little raptor
little raptor
neat monolith
#

Yes

#

Delay 50
Deserted distance 30

little raptor
#

it should have a variable for when to respawn. I should check it in the game. wait one

neat monolith
#

Thanks

#

It has a delay one, but due to the fact that the vehicle is abandon, as soon as it dissapiars, it spawns. On eden is no problem, but on server with a bit of desync, it spawns one milisecond before it vanish, and boooom

little raptor
#

if you're comfortable with using scripts instead of modules you can turn that module function into a script and modify the respawn part to add a little delay before the vehicle reappears

south swan
#

ah, the usual module cycle. "Let me use the module" - "i need to change something, let me look at its code" - "it's easier to just rewrite it" 🤣

neat monolith
wary sandal
#

another question, i managed to set the VLS fire delay to 0 so that it shoots all its missiles almost instantly, but i can't find how to completely remove/reduce the VLS reloading time

#

i've tried using vls setAmmo [currentWeapon gunner vls, 18]; in an onEachFrame event but it doesn't seem to do anything

south swan
little raptor
south swan
#

at least it seems to work with Slammer for me 🤣

little raptor
#

so setAmmo or setMagazineTurretAmmo won't do anything

#

if setMagazineTurretAmmo doesn't work try adding a new mag, then set weapon reload time to 0

wary sandal
#

here's my code if anyone wants to see
g1 setMagazineTurretAmmo [g1 currentMagazineTurret [0], 18, [0]];

south swan
#

or just sqf this addEventHandler ["Fired", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; _unit setMagazineTurretAmmo [_magazine, 999, _unit unitTurret _gunner]; _unit setWeaponReloadingTime [_gunner, _muzzle, 0]; }]; for universal fun

wary sandal
#

nice haha

#

did you test it on the vls?

south swan
#

yep

wary sandal
#

one tomahawk missile gifted for each civilian

open hollow
#

you can draw d-picks with it

wary sandal
#

there are so much missiles that the particles almost don't render in anymore

open hollow
dreamy kestrel
#

Q: about cameras, how can I show or enable the XYZ axes indicator?

little raptor
zealous night
#

What's the script that allows players to save their arsenal loadout while having access to a full arsenal

grand idol
#

I have a try/catch structure that seems to catch the error in an IF statement, throw the appropriate exception when executed in the catch block at the end of the script but still executes a command within the try block AFTER the IF statement that caught the error. I didn't think that was possible. There are no errors being reported in the server or client RPT. Any idea why the try scope isn't being terminated?

south swan
#

doc says it's terminated and minimal try/throw/catch example terminates the scope 🤔

proven charm
#

i dont think the try block throws at any script errors

grand idol
#

in this case :
if (count _position == 0) throw "Spawn position occupied!";

#

So I have something like:

try {
// ... some code that should populate _position with an array ... //

  if (count _position == 0) throw "Spawn position occupied!"; // array is actually empty, so throuw error

  if (1 + 1 == 2) then
  { hint str "Yep"; };

}
catch { hint str "Array is empty!"; };

And I'm getting both the exception when the array is empty AND the result of the second IF statement. I expected to get one or the other.

cold quartz
#

does forceUnicode work with callExtension?

true frigate
#

Is there a way of getting the loadout of a unit as a string through variablename of the unit?

fair drum
still forum
true frigate
fair drum
#

then use setUnitLoadout? its really quick

cold quartz
#

or am I missing something more basic?

still forum
#

no

#

it passes as utf-8

#

you can handle it yourself

true frigate
#

I should be able to do that, but I'd like to have it stored in a notepad for future use, so if possible, copyToClipboard would be nice, but I can always run the variablename through the extended debug console and copy each one after I've taken them

#

Since it's just a one time thing, I might end up doing that actually, sounds less complex

cold quartz
#

Ah, ok. My extension is written in c# and I've been marshaling using Marshal.PtrToStringAnsi((IntPtr)function);

#

but this should work as well? Marshal.PtrToStringUTF8((IntPtr)function);

fair drum
#

so just do

copyToClipboard str getUnitLoadout _unit
true frigate
#

Alright, thank you! 🙂

cold quartz
#

That did it, thanks!

shut gate
#

I can't seem to get the syntax right for cutRsc and remoteExec. Does anyone know what's wrong with my attempt? 😦

[["Jump", "PLAIN"]] remoteExec ["1 cutRsc"];

#

When activated via trigger it should flash an image on screen for about ~2 seconds but instead it barely shows it for a frame.

#

Normal usage, i.e.

1 cutRsc ["Jump", "PLAIN"] still works fine, just local to the person who activated it

shut gate
#

Thank you 🙂

fair drum
#

I don't see an animation source for them being stored. I think you might be out of luck with retracting them.

dreamy kestrel
tough abyss
#

It's degrees iirc

#

But getting radians isn't difficult either, can just use rad to convert

dreamy kestrel
#

Sweet thanks.

dreamy kestrel
# dreamy kestrel Q: re: `inArea` `angle` is that literally a `direction`, or do I have to do som...

okay so it is a decent enough start... I have a lasso selecting objects in a build engine mode.
now I want for the lasso to be orthogonal to the camera view window.
I suspect jumping to/from world to screen coords, interchanging some coord components, all four corners worth.
Also taking into account the camera direction for angle.
Currently oriented toward 0 (N), but the lasso is correct it appears, and the selection is also well behaved inArea.
For what it is.

#

I am trying to find RGBA docs on the wiki... IIRC, alpha indicate luminescence or intensity? i.e. when drawing lines and such 'in game'?

dreamy kestrel
granite sky
#

What are you drawing exactly?

#

0,1,0,1 should be full green pixels in general.

#

Alpha means blending/transparency. 1 is solid colour, 0.5 is half foreground half background etc.

dreamy kestrel
#

maybe there is a line style I need to hit first of all...

granite sky
#

Draw where and with what?

dreamy kestrel
#

drawLine3D literally in a camera view

#

player mouse down event, hold and move to lasso.

granite sky
#

Check whether it looks different at night.

dreamy kestrel
#

as it happens it is at night, and it is rather faint looking. but again like I said, styled in dashes, etc. not a solid line...

tough abyss
#

Should be solid lines, are you are calling drawLine3D from within the draw EH?

#

Only reason I can think the line would be appearing dashed/faint is that you're either not calling it within a draw EH or there's z-fighting

sturdy delta
#

{
    _wp1 = _rfl addWaypoint [getMarkerPos (_x select 0), 0];
    _wp1 setWaypointBehaviour (_x select 1);
    
} forEach _waypoints;```

i wonder if when `_wp1` gets overwritten, is the fromer waypoint gone then? 🤔
#

like would the group just end up with just one waypoint, no matter how long the _waypoints array is?

warm hedge
#

Overwritten in what sense?

sturdy delta
#

like if I do ```
_wp1 = _rfl addWaypoint [getMarkerPos "markername1", 0];
_wp1 = _rfl addWaypoint [getMarkerPos "markername2", 0];
_wp1 = _rfl addWaypoint [getMarkerPos "markername3", 0];

will the `_rfl` group endup with just one waypoint?
#

or are these actually added?

warm hedge
#

No, will get three additional WPs

sturdy delta
#

thanks!

warm hedge
#

_wp1 in this context is just an array to get the waypoint in scripting scope, nothing to do with actual existence of the wp

#

So yeah, nothing to worry

sturdy delta
#

good to hear that!

dreamy kestrel
tough abyss
#

Just a tiny z offset should do the trick

#

0.01 or the like

#

Also PFH != Draw EH

#

There's an actual draw3D EH that ties into when the engine draws that you should be using

little raptor
tough abyss
#

I've always seen that the draw related commands are better used with the draw EH

#

¯\_(ツ)_/¯

little raptor
#

it's only better when you don't want to draw when e.g. the game is not focused (which you shouldn't ofc)

#

otherwise it's the same as per frame

tough abyss
#

I see, thanks

#

Still would recommend going for draw rather than PFH for the reason mentioned

#

Not to mention it's a trivial change

little raptor
#

I mean RscLine

dreamy kestrel
#

not familiar with that, and do what with it exactly?

little raptor
#

you said you want to draw rectangles orthogonal to the camera

#

lasso selecting objects in a build engine mode.
if you mean a 2D rectangle, then you should use contorls

dreamy kestrel
#

sounds interesting. and I can map that to screen coordinates as I receive mouse events?

little raptor
#

map that to screen coordinates
you mean world coords?

dreamy kestrel
#

I am trying to lasso objects in a rectangle. closest analog is the 3den editor selection feature.

#

it's mostly working, but the selection feels more like an ASL than an AGL at the moment.

little raptor
#

well then you want to map screen coords to world

little raptor
dreamy kestrel
#

right right, I understand how to manage all those jumps in units and so forth

little raptor
#

anyway, yeah it's possible. screenToWorld

#

tho it doesn't work when you aim at the sky

dreamy kestrel
#

that would be nonsensicle 😛

little raptor
#

anyway, you can also do it the other way
i.e project the positions of all selectable objects onto the screen (using worldToScreen) and then simply do an inArea check to see which objects fall in the rectangle

dreamy kestrel
#

I mean not that the control approach does not have merit. but the bottom line rubber meeting road I think, still I need to gauge some rectangle and objects in area.

#

not to mention distance between 'here' and getting there, introducing controls, ids, and all the rest.

little raptor
#

don't you want to select those objects with the mouse cursor?

dreamy kestrel
#

that is what I am doing now, more or less. but the in area seems a bit misbehaved

#

pretty sure all my positions before and after the screen transformations are AGL.

little raptor
#

well here give this a test:

_disp = findDisplay 46 createDisplay "RscDisplayEmpty";
_rect = _disp ctrlCreate ["RscPicture", 123];
_rect ctrlSetText "#(argb,8,8,3)color(1,1,1,0.1)";
_disp displayAddEventHandler ["MouseButtonDown", {
    params ["_disp"];
    _disp setVariable ["ClickStart", getMousePosition];
}];
_disp displayAddEventHandler ["MouseButtonUp", {
    params ["_disp"];
    _disp setVariable ["ClickStart", nil];
}];

_disp displayAddEventHandler ["MouseMoving", {
    params ["_disp"];
    if (!isNil {_disp getVariable "ClickStart"}) then {
        _oldPos = _disp getVariable "ClickStart";
        _newPos = getMousePosition;
        _oldPos params ["_x1", "_y1"];
        _newPos params ["_x2", "_y2"];
        _rect = _disp displayCtrl 123;
        
        _rect ctrlSetPosition [_x1 min _x2, _y1 min _y2, abs(_x1 - _x2), abs (_y1 - _y2)];
        _rect ctrlCommit 0;
        
        _area = [[(_x1 + _x2)/2, (_y1 + _y2)/2], abs(_x1 - _x2)/2, abs (_y1 - _y2)/2, 0, true];
        
        _units = [];
        {
            _scrPos = worldToScreen ASLToAGL aimPos _x;
            if (count _scrPos != 0 && {_scrPos inArea _area}) then {
                _units pushBack _x;
            }
        } forEach allUnits;
        
        systemChat str _units;
    };
}];
#

not tested

dreamy kestrel
#

yeah well I have other mouse EH callbacks in the mix as well. bit more to chew off adapting this in than simply just dropping it in I think.

dreamy kestrel
#

and keyboard combinations as well for modifiers and such.

#

excusing the macro shorthands, the algo is basically this transforming the starting and current mouse inputs, transformed depending on the need, for "draw" or for "area".

private _zero = [0, 0, 0];
params [
    [Q(_mode), Q(draw), [""]]
    , [Q(_startPosAGL), LGVAR2(_lassoStartPosAGL,_zero), [[]], 3]
    , [Q(_endPosAGL), LGVAR2(_lassoEndPosAGL,LGVAR2(_lassoCurrentPosAGL,_zero)), [[]], 3]
];
[_startPosAGL, _endPosAGL] apply { worldToScreen _x; } params [
    [Q(_alpha), [], [[]], 2]
    , [Q(_bravo), [], [[]], 2]
];
(_alpha + _bravo) params [
    [Q(_ax), 0, [0]]
    , [Q(_ay), 0, [0]]
    , [Q(_bx), 0, [0]]
    , [Q(_by), 0, [0]]
];
private _xmin = _ax min _bx;
private _xmax = _ax max _bx;
private _ymin = _ay min _by;
private _ymax = _ay max _by;
private _rectScreenCoords = [
    [_xmin, _ymin]
    , [_xmax, _ymin]
    , [_xmax, _ymax]
    , [_xmin, _ymax]
];
private _simpleScreenCoords = [
    [_xmin, _ymin]
    , [_xmax, _ymax]
];
private _rectWorldCoords = _rectScreenCoords apply { screenToWorld _x; };
switch (toLower _mode) do {
  case Q(draw): {
    _rectWorldCoords;
  };
  case Q(area): {
    _rectWorldCoords params [Q(_tl), Q(_tr), Q(_br), Q(_bl)];
    private _rectPos = _tl getPos [_tl distance _br, _tl getDir _br];
    private _a = 0.5 * (_tl distance _tr);
    private _b = 0.5 * (_tl distance _bl);
    private _isRectangle = true;
    private _camera = LGVAR2(_camera,objNull);
    private _cameraDir = getDir _camera;
    [_rectPos, _a, _b, _cameraDir, _isRectangle];
  };
  default {
    _simpleScreenCoords apply {
      screenToWorld _x;
    };
  };
};
#

It feels almost like the camera angle is an influence there...

#

at one point I had a rectangle drawing angle 0 (N), selection seemed appropriate to that however...
but I really want that rectangle orthogonal to the camera if at all possible, inArea(s) included

little raptor
#

first of all a rectangle projected into world is no longer a rectangle (it would be if you looked from the top)

dreamy kestrel
#

understood ofc, it just has to be accurate aligning drawn lines to selected objects

#

not sure what you mean "no longer a rectangle"

little raptor
#

it's not a rectangle anymore

dreamy kestrel
#

transform taking AGL pos in, to screen, doing the calcs there, then projecting back to world

dreamy kestrel
little raptor
#

a polygon

dreamy kestrel
#

a poly? of what? did you look at the mins and maxes in the code above?

little raptor
#

in the world it's a polygon

#

not a rectangle

#

your mins and maxes are for creating the rect in UI coords

dreamy kestrel
#

ok, of four points, or four edges. still a rectangle

little raptor
#

no

dreamy kestrel
#

maybe I could share my screen in VC, cuz I am really not comprehending what you are saying

little raptor
dreamy kestrel
#

in and of themselves the draw is just lines, edges. in that sense I suppose a polygon. but inArea takes X and Y differences, transformed from screen to world, and involving the a and b components, right... therein would lie the rub methinks.

little raptor
#

it works

dreamy kestrel
little raptor
dreamy kestrel
#

🔑 so inArea does not care whether world or screen; in fact it looks like you are using the screen coordinates there?

little raptor
#

yes

dreamy kestrel
#

ah okay... I understand now. yep, would be subtle, and not difficult to switch up.

#

thanks.

naive needle
#

How can I check if the scrollwheel action menu is open

naive needle
#

yea just found it , thank you !

torpid mica
#
//-> all Credit to KillZone_Kid
/* create render surface */
_bb = "Land_Billboard_F" createVehicle position player;
_bb setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];

/* create uav and make it fly */
uav = createVehicle ["B_UAV_01_F", _bb modelToWorld [0,100,100], [], 0, "FLY"];
createVehicleCrew uav;
uav lockCameraTo [_bb, [0]];
uav flyInHeight 100;

/* add loiter waypoint */
_wp = group uav addWaypoint [position _bb, 0];
_wp setWaypointType "LOITER";
_wp setWaypointLoiterType "CIRCLE_L";
_wp setWaypointLoiterRadius 100;

/* create camera and stream to render surface */
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["Internal", "Back", "uavrtt"];

/* attach cam to gunner cam position */
cam attachTo [uav, [0,0,0], "PiP0_pos"];

/* make it zoom in a little */
cam camSetFov 0.1;

/* switch cam to thermal */
"uavrtt" setPiPEffect [2];

/* adjust cam orientation */
addMissionEventHandler ["Draw3D", {
    _dir = 
        (uav selectionPosition "PiP0_pos") 
            vectorFromTo 
        (uav selectionPosition "PiP0_dir");
    cam setVectorDirAndUp [
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
    ];
}];

```         //-> does not put out any error, spawns the Billboard and drone correctly but leaves the billboard black. Maybe something changed in between Arma Versions?
south swan
#

It (kk's example) worked when i last checked. Do you have PiP active in game's video settings?

torpid mica
torpid mica
#

@unique sundial maybe you can help me?

vernal mural
#

is the init event handler of objects executed on JIP clients ?

sand phoenix
#

Hello, I'm trying to do an artillery barrage on a position.
I call a script.sqf with a trigger activation, works fine.

Script do return marker's position array, but BIS_fnc_fireSupportVirtual doesn't work.
Can anyone help me please ?

Here is my script :
_loc = getMarkerPos "trg"; [_loc, "32Rnd_155mm_Mo_shells", 100, 2, 10] spawn BIS_fnc_fireSupportVirtual; hint str _loc;

vernal mural
#

looks like the wiki is wrong

#

or at least confusing

#

mag: String - (Optional, default "Sh_82mm_AMOS") magazine (if left empty, first available magazine will be used)

#

Sh_82mm_AMOS ==> this is ammo, not magazine

#

32Rnd_155mm_Mo_shells contains Sh_155mm_AMOS ammo

#

if I try your line, nothing happens (and no error, which is weird)

#

if I try [getPos player, "Sh_155mm_AMOS"] spawn BIS_fnc_fireSupportVirtual, hell start to rain, as expected

#

so, when using this function, remember to understand the mag parameter as an ammo type name from CfgAmmo

#

@sand phoenix

sand phoenix
#

@vernal mural Thank you very much !
I did mistake magazine for ammo.

vernal mural
#

you were absolutely right trying a magazine, according to the wiki

#

with a bit of experience, things like Sh_82mm_AMOS don't look like magazines, that's what hinted me on the right way

#

but when sticking to what is written, magazine type was a good try

sand phoenix
#

Now I can see it was written down all along, but couldn't see it before knowing the difference you taught me, thanks again !

south swan
torpid mica
south swan
#

🤔

glossy pine
#

if u compile the sqf files into SQF bytecode do u still need the sqf files?

torpid mica
#
//i have a problem with the addAction in the initPlayerLocal.sqf. If I want to acces the player and add the Action to him how do i have to do it?
_cabingetinID = player addaction ["<t color='#FF0000'>MOC: Enter MOC trough cabin</t><br/>", tostring {
                                                                                                        _pos = getPos interrior;
                                                                                                        player setPos _pos;    
                                                                                                    }, [], 99, false, true, "", toString {vehicle player == MOC;}]; // so 

params ["_player", "_didJIP"];
_cabingetinID = _player addaction ["<t color='#FF0000'>MOC: Enter MOC trough cabin</t><br/>", tostring {
                                                                                                        _pos = getPos interrior;
                                                                                                        _player setPos _pos;    
                                                                                                    }, [], 99, false, true, "", toString {vehicle _player == MOC;}]; // or so? 
//or did i do something completely wrong? 
torpid mica
little raptor
#

_player is not defined in the action code and the condition

torpid mica
#
_bb = "Land_Billboard_F" createVehicle position player; 
_bb setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"]; 
 

uav = createVehicle ["B_UAV_01_F", _bb modelToWorld [0,100,100], [], 0, "FLY"]; 
createVehicleCrew uav; 
uav lockCameraTo [_bb, [0]]; 
uav flyInHeight 100; 
 
_wp = group uav addWaypoint [position _bb, 0]; 
_wp setWaypointType "LOITER"; 
_wp setWaypointLoiterType "CIRCLE_L"; 
_wp setWaypointLoiterRadius 100; 

 
addMissionEventHandler ["Draw3D", { 
    _dir =  
        (uav selectionPosition "PiP0_pos")  
            vectorFromTo  
        (uav selectionPosition "PiP0_dir"); 
    cam setVectorDirAndUp [ 
        _dir,  
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0] 
    ]; 
}];


sleep 10;

cam = "camera" camCreate [0,0,0]; 
cam cameraEffect ["Internal", "Back", "uavrtt"]; 
 
cam attachTo [uav, [0,0,0], "PiP0_pos"]; 
 
cam camSetFov 0.1; 

so it works for me even executed from a script 😱

torpid mica
little raptor
#

no I don't think it'll work

#

the first one should work too

#

what's the problem again?

#

no action is added?

torpid mica
little raptor
#

does it work if you execute it from console?

little raptor
#

but you might need them if the compilation fails

little raptor
torpid mica
little raptor
#

then I guess player is not defined when the script runs

#

put a short sleep before the addAction

south swan
#

can't pass arguments to condition of addAction notlikemeow

little raptor
winter rose
torpid mica
serene sentinel
#

Can someone help with script for AI rearming and drop/pickup weapons?

fair drum
serene sentinel
#

I have one script (originaly from A2) , it seems to be written well, but there are some problems. AI must pick up magazines and grenades from dead bodies when they needed and weapons when he unarmed. He picking up grenades , but he don't pickup weapon. Just goes to dead body and playing animation "take weapon" infinitely.

#

how can i put .sqf file here?

frank mango
#

if its small, then use the embed ```

#

if not, pastebin

serene sentinel
#

pastebin. com/GdU8XVvy

winter rose
dreamy kestrel
dreamy kestrel
sullen sigil
#

Is there any way to maintain automatic offset with attachTo while having memory point too?

little raptor
#

it already "maintains offset"... (?!)

sullen sigil
#

but you have to specify an offset to specify a memory point..? just using [] doesnt work

little raptor
#

[0,0,0]

winter rose
#

you can use the BIS fnc

south swan
#

so, replicate BIS_fnc_attachToRelative but with attaching to a specific mempoint?

#

or bone?

sullen sigil
#

ah, didnt know that was a thing as it doesnt appear on the seealso

#

but yes that

sullen sigil
#

I should be able to just get the difference between the player's pos and the object's pos and use that as the offset, right..? because that's not working

hallow mortar
#

use worldToModel

sullen sigil
#
private _orient = [this, player] call BIS_fnc_vectorDirAndUpRelative;
private _relPos = this worldToModel ASLtoAGL getPosASL player;
 
this attachTo [player, _relPos, "spine2", true]; 
this setVectorDirAndUp _orient;``` this seems to attach it in the wrong place, offset down and to the right of the player ![thonk](https://cdn.discordapp.com/emojis/700311400152825906.webp?size=128 "thonk")
#

it also doesnt seem to be following the bone rotation up and down, im not sure if thats supposed to happen or not

little raptor
sullen sigil
little raptor
#

offset is relative to bone

#

not object

#

if it puts it at the player's feet then your mempoint doesn't exist

#

try "head" for example to see what I mean

sullen sigil
#

oh bruh

#

the forum lied

#

what mempoint should i use for backpacks rotation then..?

little raptor
#

spine3 maybe

sullen sigil
#

ah

#

so i would want the position of the mempoint instead of player?

little raptor
#

if you want to attach it relatively, yes

#

plus its vdup

sullen sigil
#

so i need to get the offset of the object from the spine3 mempoint thonk

#
private _orient = [this, player] call BIS_fnc_vectorDirAndUpRelative; 
private _relPos = this worldToModel (getPosASL this - AGLtoASL(player modelToWorld (player selectionPosition "spine3"))); 
  
this attachTo [player, _relPos, "spine3", true];  
this setVectorDirAndUp _orient;``` seems to work in my head but not in practice
sullen sigil
#

ok, think i need help understanding

_playerPos = getPosASL player;
_spinePos = player selectionPosition "spine3";
systemChat str (AGLtoASL (player modelToWorld _spinePos));
systemChat str (_playerPos vectorAdd AGLtoASL _spinePos);``` in my head would print the same thing twice, but the top one is 5m below the bottom one, why is this?
little raptor
sullen sigil
#

I've got it now, I just need to get the dirandup working 🙂

little raptor
#

it should be AGLtoASL(_playerPos vectorAdd _spinePos)

little raptor
sullen sigil
#

i hear matrix and instantly lose what you are talking about

little raptor
#

you can do it without matrices too meowsweats

sullen sigil
#

looking at the function it just does

_obj2 vectorWorldToModel vectorDir _obj1,
_obj2 vectorWorldToModel vectorUp _obj1```
little raptor
#

just measure the dot product of each component of dir and up by those of the bone's

sullen sigil
#

surely i can just modeltoworld the selectionpos and do the same thing?

little raptor
little raptor
#

you need to use bone coords

#

not model coords

sullen sigil
#

that sounds confusing

south swan
#

inb4 attaching invisible object to bone and then relatively attaching the target object to invisible one

little raptor
#

what are you trying to do again? just trying to make sure I'm not unnecessarily complicating things

sullen sigil
#

just trying to attach an object with rotation to the player with it remaining in the position

#

i explained that poorly

south swan
#

attach to bone while keeping relative offset

sullen sigil
#

yes that

little raptor
sullen sigil
#

with the direction etc kept the same

#

messing with helper objects has given me tons of headache in the past so would like to be avoided

#

however i could just mess with the vectordirandup stuff until it looks good

#

as that part can be kept the same

#

basically at the moment the object is rotated too far forwards because it was doing diranduprelative to the player and not bone position

sullen sigil
#

getRelPos and getRelDir, right?

little raptor
#

no

#

vectorWorldToModel and worldToModel

sullen sigil
#

ok youve lost me now

#

oh wait just use the object in the BIS_fnc_vectorDirAndUpRelative function?

south swan
#
llll attachTo [player, [0,0,0], "head", true];
[hhhh,llll] call BIS_fnc_attachToRelative;```
sullen sigil
#

ok yeah i got confused lol

south swan
#

llll being emty logic and hhhh being a hemmet. Can confirm it works XD

sullen sigil
#

is there any specific helper object i should use

little raptor
sullen sigil
#

wait yeah logic works you just need to attach

south swan
#

meh

sullen sigil
#

got confused because all my helper objects i just did for ropes and jfc i hate physx because of it

south swan
#

two attaches = two lines. Measuring = math with more possibilities for error 🤷‍♂️

sullen sigil
#

this is probably a stupid question
but how do you create a logic? createVehicle?

south swan
#

well, for this specific test i've just placed it in 3DEN 🤷‍♂️

little raptor
#

also two attaches -> constant waste of performance (because you don't need one at all)

south swan
#

well, i'm eventually good at it. Generally. Meaning i error up first 3 or 4 (or 12) times but end up doing it correctly

sullen sigil
#

so that sort of works but the object gets shifted forwards

#
elLogic attachTo [player, [0,0,0], "spine3", true];

private _orient = [shotty, elLogic] call BIS_fnc_vectorDirAndUpRelative;  
private _spinePos = AGLToASL (player modelToWorld (player selectionPosition "spine3"));
private _relPos = getPosASL shotty vectorDiff _spinePos;
   
shotty attachTo [player, _relPos, "spine3", true];   
shotty setVectorDirAndUp _orient;```
#

rather than staying in place

little raptor
#

your current relPos is not in bone coords. it's in world coords

sullen sigil
little raptor
#

entire thing?

sullen sigil
#

private _relPos = worldToModel (getPosASL shotty vectorDiff _spinePos);

little raptor
#

no

#

that's not even valid syntax meowsweats

sullen sigil
#

i have now discovered that

#

oh is it the getPosASL shotty that needs doing

little raptor
#

elLogic worldToModel ASLtoAGL getPosASL shotty

#

tho I think it should be getPosWorld not ASL

sullen sigil
#

gotchu i will try both

south swan
#

seems to give some spurious Z offset in my testing 🤔

sullen sigil
#

yeah it is for me too

#

with both

south swan
#

of like -2 meters of world Z

little raptor
#

maybe attaching doesn't happen instantly

#

try a delay to see if that's the issue

sullen sigil
#

private _relPos = elLogic worldToModel ASLtoAGL getPosASL shotty vectorDiff _spinePos; puts it at over 1km above the player meowsweats

south swan
#

private _relPos = elLogic worldToModel ASLtoAGL getPosWorld shotty; seems to work 🤔

little raptor
#

that shouldn't make a "2m" diff

#

problem is elsewhere

south swan
#

it should if hemmet origins differ by that much

little raptor
little raptor
#

but obviously it should be getPosWorld

sullen sigil
#

aha

little raptor
sullen sigil
#

i may have it working

#

one sec

#

oh no it doesnt need a delay

south swan
#

getPosWorld hhhh vectorDiff getPosASL hhhh gives [0,0,1.79925], which roughly matches the z offset 🤷‍♂️

sullen sigil
#
elLogic attachTo [player, [0,0,0], "spine3", true];

private _orient = [shotty, elLogic] call BIS_fnc_vectorDirAndUpRelative;  
private _spinePos = AGLToASL (player modelToWorld (player selectionPosition "spine3"));
private _relPos = elLogic worldToModelVisual ASLtoAGL getPosWorld shotty;
   
shotty attachTo [player, _relPos, "spine3", true];   
shotty setVectorDirAndUp _orient;``` works for me
south swan
#

_spinePos isn't needed at all then. And elLogic can probably get detached and deleted

sullen sigil
#

yup, does create/deletevehicle work in that instance?

little raptor
#

And elLogic can probably get detached and deleted
well yeah that was the whole point here. not having 2 attaches

south swan
#

and worldToModelVisual/worldToModel both seem to work

sullen sigil
#

my only issue is that the object seems to move differently to the backpack but i think thats just arma

south swan
#

talking about eventually correct

sullen sigil
#

as in it clips into the backpack when stationary but not when moving etc etc

#

no big deal

sullen sigil
#

roger doger

#

doesnt exist thonk

south swan
#

ehm, wut

sullen sigil
#

it puts it at players feet

#

spine3 seems to be the only spine that exists 💀

little raptor
#

it does exist tho. but maybe not in mem LOD blobdoggoshruggoogly

sullen sigil
#

meh, its not a huge issue for me so

#

you can createvehicle a logic, right? or is there a specific command

south swan
#

you can

sullen sigil
#

uh oh

little raptor
#

better use local tho

sullen sigil
#

createvehicle on the logic just broke it

south swan
#

createUnit then 🤷‍♂️

#

with createGroup sidelogic before it

sullen sigil
#

as in broke the offset

south swan
#

To create objects of type "Logic", use createUnit. on createVehicle biki page

sullen sigil
#

bruh moment

#

no way to create a local unit is there?

#

thats a stupid question

little raptor
south swan
#

or, you know, just run the attach/get offsets/rotation once and save that in mission :3

sullen sigil
#

adding a delay doesnt rectify that either

south swan
#

eventually correct

little raptor
south swan
#

retrying the question, though. Should that be changed during the mission? Or would getting offset/rotation beforehand and hardcoding it be enough?

sullen sigil
#

im confused what you are asking

sullen sigil
little raptor
#

I mean try something other than the logic e.g. Land_Wrench_F

sullen sigil
#

oh right

south swan
#

Place stuff in editor. Attach logic. Get _relPos and _orient, copy them to clipboard, then just run attachTo with those values

sullen sigil
#

oh, want to be able to change it rather than hardcoding yeah

sullen sigil
south swan
#

on the other side of the problem. The game seems to have a "launcher" mempoint 🤔

sullen sigil
#

...i might've been a bit silly

#

one moment

#

ok so it wasnt the issue but i wasnt passing the createvehicle one into the dirandup function

south swan
#

createVehicleLocal seems to work 🤔

sullen sigil
#

...or the later stuff yes i was a bit silly hang on

#

ok yeah i was stupid

#

that does work 🤦

#

only difference is the offset is slightly different again

#

but a tiny amount so shrug

#

i'll just end up messing with rotation and shit

south swan
sullen sigil
#

this way works fine i think

#

but for the sake of it i'll check

sullen sigil
south swan
#

player selectionNames "MEMORY" gives all the mempoints if you intend to find anything more suitable

sullen sigil
#

nah this one works fine just a matter of fine tuning really

#

next step is to figure out how to make the shotgun not able to be picked up by anybody meowsweats

south swan
#

so, between "if you're good at math" and eventually getting there we spent what? 5 screens worth of messages? meowsweats

sullen sigil
#

all for me to probably abandon this soon

#
_mempoint = "spine3";

_elLogic = "Logic" createVehicleLocal [0,0,0];
_elLogic attachTo [player, [0,0,0], _mempoint, true];

private _orient = [shotty, _elLogic] call BIS_fnc_vectorDirAndUpRelative;  
private _relPos = _elLogic worldToModelVisual ASLtoAGL getPosWorld shotty;
   
deleteVehicle _elLogic;

shotty attachTo [player, _relPos, _mempoint, true];   
shotty setVectorDirAndUp _orient;

systemChat str getposasl shotty;
systemChat str getposasl player;``` final code if you want it
south swan
#

[hhhh, (unitBackpack player)] call BIS_fnc_attachToRelative; when standing near the hemmet. And then going prone. Causes me to slide forward at 50 km/h 🤣

#

also yeah, (unitBackpack player) returns the backpack object 🤷‍♂️

sullen sigil
#

Ya I tried messing with that earlier but was too much of a pain in the ass

#

Now I just need to think of how to make this into something useable lol

#

and the relative offset passed through to it

torpid mica
#

i have a addaction in my mission and want to execute the code on the whole sever and not only locally. is that possible? and if it is then how?

south swan
granite sky
#

probably with JIP too :P

south swan
#

remoteExec does accept JIP parameter in it's, uhm, parameters

restive ocean
#

Is there anyway to define what unit switchCamera effects within a trigger?

torpid mica
south swan
#

although if you need to execute that frequently - storing the executed code as a function/global variable and just remoteExec-ing that would be preferable. Sending the whole code is more for one-off hack job

torpid mica
torpid mica
#

the first one ist the code i used to use, but i need to execute that globally so the second one is hopefully using the remoteExec correctly?

south swan
#

toString isn't actually needed, addAction can take code as code

torpid mica
#

but otherwise it´s ok?

south swan
#

other than questionable formatting choices seems OK at first glance. Please, consider formatting long parameter arrays like https://sqfbin.com/udoqirotugisarasasod (one extra tab, new line after every (long?) parameter) 😉

torpid mica
#

yeah the formating is a bit of since i´ve changed and copied a lot of stuff XD have around 10 addActions in the same script and dindn´t want to type everything new

restive ocean
# little raptor wdym?

so im attaching something to a players head and defining it in a trigger for the purpose of serving as a camerea, but I also cant put switchCamera into that trigger because then it effects all units, but i want it to affect a different unit than from the one with the thing attached to it

#

and i tried putting in init but doesnt work

proven charm
#

shouldn't it be with "call": ```sqf
{} remoteExec ["call", 0];

torpid mica
#

yeah youre right

#

i missed it

south swan
#

there you go for trusting me to proofread your code 🤣

little raptor
restive ocean
#

unless im formating wrong

#

player2 Cam switchCamera "Internal";

little raptor
sullen sigil
#

not strictly scripting related but still function related, anyone know wtf im doing wrong here?

restive ocean
#

whats the proper way?

little raptor
restive ocean
#

?

little raptor
restive ocean
#

switch the camera of 1 of the units to the sphere attached to my head

south swan
little raptor
#

yes. no cat

#

"category" in case you were thinking of 🐱

sullen sigil
#

adding category subfolder and class doesnt help it 😕

#

"KJW" comes up in function viewer and so does the function name but can't click it (using ADT)

south swan
#

define "doesnt help it"

sullen sigil
#

and ADT complains of undefined variable KJW_fnc_attachToBoneRelative

little raptor
torpid mica
#

how can i use sleep in the {} remoteExecute ["call",0]; ? it always outputs: Suspending is not allowed in this context

sullen sigil
little raptor
sullen sigil
#
this spawn {/*code here*/};```
torpid mica
#

i just need to wait a short amount of time

little raptor
sullen sigil
#

oh

#

category path

#

🤦

little raptor
#

did you close the mission?

sullen sigil
#

nope -- its working now

#

i forgot category in the file path

little raptor
#

well you don't need a category folder

sullen sigil
#

🤷 works now so

torpid mica
#
[] spawn 
{
     {
           someCode;
          sleep 1;
          someCode;
     }remoteExec ["call", 0];

};

thats how i did it, but it outputs an error everytime 😦

sullen sigil
#

{} not []

little raptor
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
torpid mica
little raptor
sullen sigil
#

{} spawn instead of what you have which is [] spawn

torpid mica
little raptor
#

or make a function and don't send the whole code over network

south swan
#

remoteExec should put the sent code into the scheduled space though 🤔

little raptor
#

no

#

remoteExecing a command is unschd

dapper cairn
#

Anyone able to help me with a script? Have a few weapons on a ship with simulation turned off but want to have it where if the players mouse wheel on a laptop they can "turn on" the weapon system

So
W1, W2, W3, W4 would be the weapons, players mouse wheel on a laptop and get the prompt "Reboot Weapon Systems."

south swan
little raptor
#

call is not a function

#

it's a command

south swan
#

ah, i'm dumb and don't read the very next line. Thanks.

little raptor
dapper cairn
little raptor
sullen sigil
#

Is there an event handler for contents of player's inventory changing? Can't seem to find it if there is one 🤔

little raptor
#

no

#

you can only use inventoryopened/closed/put/take EHs

#
  • maybe a helper loop in case the user "cheats"
sullen sigil
#

inventoryput/take?

little raptor
#

no just put/take meowsweats

sullen sigil
#

ah 😅

torpid mica
#

i now have some addactions executing locally and some which use remoteExec to execute globally. But now everything gets executed globally 😦 I really don´t understand why

dreamy kestrel
#

Q: concerning camera AGL Z component limiters...
I am creating a camera, map happens to be Altis, location the wind turbines south of Oreokastro. happens to be, I think, one of the more extreme locations in terms of position ASL.
The camera seems rather restricted Z wise; I'm not sure how to 'allow' for more of a fly over in that sense.
By contrast when I am in Zeus, there is no such limitation.
Is it a camera command I can issue that allows for that?
Thanks...

sullen sigil
#

There's surely a smarter way to do this (check if shotgun has been added or removed from players inventory, cant use opened/closed EHs as other people can take and put into backpack) than hooking in to both put and take EHs

little raptor
dreamy kestrel
south swan
#

i remember searching for a reliable way of detecting player inventory changes. I don't remember ever finding one.

little raptor
#

yep. there is none

sullen sigil
#

Yeah, certainly seems to be the case... Probably an engine limitation if its not been added by now?

little raptor
#

the most reliable way is a loop

south swan
#

with storing loadout and checking for changes? Oof

little raptor
sullen sigil
#

loop of inventory searches? meowsweats

hallow mortar
#

BIS_fnc_hasItem in a while true just to make the optimisers sad

sullen sigil
#

my shotgun must be removed i n s t a n t l y

south swan
#

"x" in flatten getUnitLoadout player was like 10x faster than BIS_fnc_hasItem iirc

sullen sigil
#

actually
I guess both put and take makes sense? Put for checking for adding the shotgun, take for checking for removing?

south swan
#

because why bother with walking a tree in SQF? 🤣

little raptor
sullen sigil
#

i would also need to check its not equipped too meowsweats

south swan
#

but returns an array of arrays and using in would be a hassle 🤷‍♂️

little raptor
sullen sigil
#

is there a shotgun in the inventory?
does the backpack have config values for the position for the shotguns?
does the shotgun support this?

south swan
#

inb4 getWeaponCargo backpackContainer player;

sullen sigil
#

but vest too

#

some people have vests with huge capacity for some reason

south swan
#

i'm not reading again

sullen sigil
#

wait you could just check vestcontainer too lol

#

ignore me

dreamy kestrel
# little raptor how do you zoom?

I am using the 'normal' camera controls, navigation with WASD, mouse, scroll wheel back. does NOT zoom out. seems limited by max world ASL...

dreamy kestrel
little raptor
#

oh that. idk

dreamy kestrel
#

so I wonder there is some primitive, cam command, etc, I need to tell the camera a new limit.

little raptor
#

I personally always make my own cam controls... meowsweats

little raptor
#

maybe one of those "commands" controls it

#

ceilingHeight I guess

dreamy kestrel
sullen sigil
dreamy kestrel
little raptor
#

dunno

#

see the wiki

#

doesn't say anything...

#

well if you find which plz let me know to put it on wiki

fair drum
#

I would assume ASL since the environment is probably a very large cube including water.

sullen sigil
#

Aaand Put and Take EHs don't seem to work as I want them to 😦

dreamy kestrel
little raptor
#

blobdoggoshruggoogly
test it on a hill

#

e.g. limit it to 100. then read the AGL and ASL heights as you go up the hill

dreamy kestrel
#

ASL

little raptor
#

thanks. I'll put it on wiki

dreamy kestrel
#

may also include a blurb about cam ASL Z limits by default. seems like world ASL Z max.

sullen sigil
# little raptor uniqueUnitItems returns a hashmap

what would be the correct way to iterate through here for the classes? im using this but im like 99% sure its not the right way to do it at all

private _uniqueUnitItems = uniqueUnitItems [player, 0, 2, 2, 2, false];
if !(_uniqueUnitItems getOrDefault ["sgun_HunterShotgun_01_sawedoff_F", false] > 0) exitWith{};```
little raptor
sullen sigil
#

ah, thought you had to use special commands or something thx

torpid mica
#

i have a problem with an attached Object. I scaled an container and some lamps to other sizes (container x1.1, lamps x0.5) than i did some tests and my friend noticed that the container did not get scaled sometimes (e.g when I´m driving) and randomly jumped back to normal size, while the lamps where scaled perfectly. Does anyone has suggestions how to avoid that?
P.S. all objects where placed in the inventory and have the attachto and scale command in their init line

tough abyss
#

setObjectScale isn't intended to work properly outside of the editor.

torpid mica
#

therefor it did pretty good XD.
how to do it properly?

tough abyss
#

Any sort of updates/movement to the scaled object will unscale it

#

There is no clean solution for scaling objects consistently

#

Closest solution would be to scale it each frame, but that won't work well in MP

torpid mica
#

but damn setObjectScale worked pretty good in MP. For me it was perfect all the time (i´m the host) but for my friend it wasn´that good. Only the container had problems with the scaling. the rest worked like a charm as well

tough abyss
#

Yeah getting it to behave consistently is the issue

#

It isn't designed for it, unfortunately

#

Hopefully one day we get a proper mp-compatible scaling command

#

@torpid mica In the meantime, you can try the EachFrame solution, but be warned it may lead to weird behavior and/or performance issues:

addMissionEventHandler ["EachFrame", {
  // Put code for scaling here
}];
torpid mica
tough abyss
#

👍

gaunt tendon
#

when I do

_Ctrl ctrlSetText (getText (configFile >> "CfgWeapons" >> (currentweapon player) >> "picture"));

is there a way to flip the image and make the gun point in the other direction?
from ︻デ═一
To ╾━╤デ╦︻

copper raven
#

no

dreamy kestrel
#

hey question for the youtubers (or video producers in general)... is there a mod that display key presses for things like modifier keys as I am pressing them, and display on the screen? that would be tremendous for this particular demo.

hallow mortar
dreamy kestrel
#

will that work; I am using OBS to record in game. it will see the overlay as well?

#

ah says so in the release notes, v28+ ✅

hallow mortar
#

Yes, things like that are designed to work with OBS because they're used by competitive streamers and such

dreamy kestrel
#

huh interesting, is there a preset just for keyboard mouse inputs? otherwise, if I wanted to customize a subset of that for demo purposes, I need to do what? cook up some textures?

hallow mortar
#

¯_(ツ)_/¯

sullen sigil
#

Is there a way to add "fake" mass to the player's equipment? i.e add 10kg without having to have a 10kg object fill inventory space

gaunt tendon
#
[] spawn{
sleep 2;

private _Disp = findDisplay 46;
private _Ctrl = _Disp DisplayCtrl 666;
CtrlDelete _Ctrl;

_Ctrl = _Disp CtrlCreate["RscObject", 666];
_Px = safezoneX;
_Py = safezoneY;
_Pw  = (600/1280)*safezoneW;
_Ph  = (300/ 720)*safezoneH;
_Ctrl ctrlSetPosition [_Px, _Py, _Pw, _Ph]; 
_Ctrl ctrlCommit 0; 

_Model = getText (configFile >> "CfgWeapons" >> (currentweapon player) >> "model"); 
_Ctrl ctrlSetModel _Model;

};

I'm testing out 3d controls
anyone know why the model wont show up?
is RscObject the correct class?

sullen sigil
gaunt tendon
#

then you probably want a custom config and change the mass property of the item in particular, something like:

class CfgMagazines{
  class CA_Magazine;
  class SatchelCharge_Remote_Mag: CA_Magazine;
  class DemoCharge_Remote_Mag: SatchelCharge_Remote_Mag{
    mass = 10;
  };
};
gaunt tendon
warm hedge
fossil peak
#

Is there a way to make a mod to run an SQF in the mod folder instead of adding the sqf to the mission folder?

#

or I should say just have a mod initialize an SQF?

tough abyss
#

Yes

#

make a CfgFunctions in the mod's config.cpp and set an sqf file as preInit or postInit

fossil peak
#

lemme give that a try

fossil peak
#

this should work right?

#

I'm not sure if that's broken or if the sqf is broken lol

#

oop I just saw what I did I think

#

forgot to close the postinit lol

#

lemme see if that works

#

hmm still seems to not work

#

@tough abyss this should work right?

tough abyss
#

perhaps, seems you're missing a tag though

#

and the path is likely incorrect

#

there's a few different ways to write a CfgFunctions, just check against that biki link and pick a way to do it

fossil peak
#

I'm sorry I'm newbish what do you mean by tag?

#

Oh the tag

tough abyss
#

My bad, I gave you the wrong link

#

this one will show you

fossil peak
#

oh thanks

copper raven
# fossil peak <@456226577798135808> this should work right?

you are defining the category only here, no actual functions, a category also takes a folder path, not actual source file,

class CfgFunctions {
  class MyTag {
    class MyCategory {
      file = "myFolder"; // category folder
      class MyFunction {
        file = "myFolder\myFile.sqf"; // explicit source file specification, otherwise it would look for a file in "myFolder\fn_MyFunction.sqf"
        postInit = 1;
      };
    };
  }
};
fossil peak
#

like this?

copper raven
#

i just realised i missed the tag in my example, but yeah

fossil peak
#

it seems like maybe my file paths are wrong? cause it still does nothing lol

copper raven
#

i don't know how you are packing your addon exactly so can't help you with that

#

but the \addons part seems wrong

#

also why name the file initPlayerLocal.sqf? it's missleading

fossil peak
#

I was just placing a different script in there that would be easier to tell if it works or not

tough abyss
#

keep in mind the sqf file name will have to follow the format

#

fn_whateverElse.sqf

#

like that page states

fossil peak
#

aaaaaaaaaaa

tough abyss
#

sorry

fossil peak
#

thats fine lol

tough abyss
#

fn_whateverElse.sqf

#

is the file name

#

and then to call it as a function it'll be TAG_fnc_whateverElse

#

(if you need to call it as a function)

copper raven
#

also it's cleaner this way

#

you don't have to specify the exact file(s) for the functions

#

(what you currently are doing)

fossil peak
#

also this is the file structure

copper raven
#

you don't need the file = in the most inner class

#

you named your function postInit (for some reason), so you would have to name the file fn_postInit.sqf it's basically fn_<classname>.sqf

fossil peak
#

I renamed the file too

#

that should work?

gaunt tendon
#

is there a better way to do this?

Fnc_SHARED_bIsKindOf = {//call
//----------------------------------------------------------
params["_StrClass", "_aCfgClass"];
//----------------------------------------------------------
private _bRet = FALSE;

{//foreach _aCfgClass
  ScopeName "FindLoop";
  if(_StrClass isKindOf _x) then{
    _bRet = TRUE;
    breakOut "FindLoop";
  };
}foreach _aCfgClass;

_bRet
//----------------------------------------------------------
};

_bVehicle = [_OBJ, ["LandVehicle", "Plane", "Helicopter", "Ship"]] call Fnc_IsKindOf;
copper raven
# fossil peak

fn_postInit.sqf not postInit.sqf, must be fn_ prefixed, also by

you don't need the file = in the most inner class
i meant entire thing

copper raven
fossil peak
copper raven
# fossil peak
...
class Cat1 {
  file = "\addons";
  class postInit { postInit = 1; };
};
...
fossil peak
#

that'll run the postinit sqf?..

#

would it be easier to voice call and just stream what I'm doing lmao

copper raven
fossil peak
#

lemme see if this works

copper raven
#

"\addons"; what's that?

#

that's not what i wrote

fossil peak
#

you're right lol lemme fix that

#

sorry I'm just confused at this point I fixed that lemme see if it works

#

omg it works

#

holy cow

#

thank you

#

I have no idea how it works but it does lmao

tough abyss
#

the page goes into some detail regarding how it all works

#

tl;dr though the reason it works is because you're defining the contents of that file as a function by including it in CfgFunctions

#

and having postInit = 1 tells the game to automatically run that file after a mission finishes initializing

#

you can also do preInit = 1 to run it before missions finish initializing

#

and some other things

fossil peak
#

Mhm well thanks both of you guys

#

I didn't realize running an SQF from a mod would be so challenging for a newb like me lol

#

in missions its just with the initplayerlocal and whatnot

tough abyss
#

yup well now you know 👍

#

keep defining functions in their own files with CfgFunctions, much cleaner than spamming execVM or defining functions in an init file

drowsy geyser
#

Is it possible to disable the mouse steering via code?

little raptor
#

nope

drowsy geyser
#

and disabling the mouse completely?

winter rose
#

put your mouse away

drowsy geyser
#

Was trying to prevent the player from changing its direction

winter rose
#

disabling the mouse could be done creating an empty display I guess

drowsy geyser
#

oh, thanks i will try that

chrome hinge
#

Hi everyone

#

Im trying to set up my MARTA settings and im thrown this error when i name the module to BIS_marta_mainscope. I have tried to rename marta module to other things and refer to that name, use this and set marta variables to unit inits, group inits, and mission init. I also tried to fish out this file location to look closer whats wrong but could not find it. my A3 file does not have modules folder. Any tips on what to try next? Has anyone a working example of mission with modified MARTA settings so i could take a look? 16:01:54 Error position: <_targets - [objnull];
_targetStrings = >
16:01:54 Error Undefined variable in expression: _targets
16:01:54 File A3\modules_f\HC\data\scripts\HC_local.sqf..., line 97
16:01:55 Error in expression <e getvariable "enemygroups";

tough abyss
#

The core issue is that _targets is undefined, whatever that represents. I'm not familiar with MARTA, but I'd start by making sure you're not missing any target related settings.

#

Also, that file is packed into the base game, which is why you can't find the folder.

chrome hinge
#

oops meant to tag the first line

tough abyss
#

And why are you naming it that?

chrome hinge
#

i was told here to name it that last time i asked, it threw the error then too but i thought i try to dig it up myself before bombarding question after question here 😄

tough abyss
#

It seems like BIS_marta_mainscope is pre-defined for setting variables, which would explain why overwriting it causes issues

#

If you're using a module you should probably use the init method shown later on the page

chrome hinge
#

I have tried that and it did not give any response

#

i also tried to referring to BIS_marta without naming the module

tough abyss
#

So you tried like this in the init?

#
this setVariable ["rules", [["o_", [0.00001, 1, 0, 1]], ["b_", [1, 0, 0, 1]], ["n_", [0, 0.7, 0, 1]], ["n_", [0.8, 0.8, 0, 0]]], true]
#

But with whatever your settings are?

chrome hinge
#

No, i tried these 2

tough abyss
#

Try doing it the way I showed then

chrome hinge
#

with this setvariable?

#

i tried that too

tough abyss
#

Hm

chrome hinge
#

also tried putting the setting to mission init, inits of units and triggering the setting after mission starts

tough abyss
#

Not sure then, can't test anything on my end at the moment and not familiar with what this system even does

#

Sorry

chrome hinge
#

Alright, it is th esystem that creates nato markers on map and in 3d when using high command

#

It can also display them without HC, and that i got to work but anything else doesnt seem to respond. Also just displaying the symbols command didnt refer to BIS_marta

#

but thanks anyway!

tough abyss
#

Yeah no problem

#

You made sure to set this up properly too?

chrome hinge
#

yeah, that was the only thing that worked

sullen sigil
#

Is anyone aware of a way to run weaponsItems on just the primary weapon of the player? The array returned is in the order of which they were taken by the unit so is not consistent

south swan
sullen sigil
#

That's what I'm using at the moment but doesn't have the array in the same format

sullen sigil
#

Ok, so -- I've nearly got an array formatted properly, I'm just struggling to find out how I'd know what the player's secondary muzzle is?

_pWM = primaryWeaponMagazine player;
_arr pushBack [(_pWM select 0), (player ammo primaryWeapon player)];
if (count _pWM > 1) then {_arr pushBack (_pWM select 1);} else {_arr pushBack [];};``` is what I have atm
sullen sigil
#

Yeah just having to format it manually 😅

#

Just need that secondary muzzle bit

south swan
#

inb4 filtering weaponsItems for element that matches player's primaryWeapon is actually faster than formatting the stuff by hand

sullen sigil
#

Bruh moment
now how do i do that

south swan
#

(weaponsItems player) select {(_x#0) isEqualTo (primaryWeapon player)}?

sullen sigil
#

ah, thank you lol

#

i am rather obviously hopeless with arrays

smoky rune
#

Is there any way to get addon logo's path to .paa file?

#

I'm talking about logo that is shown in Arsenal in the items list

sullen sigil
#

the .paa file..?

smoky rune
#

yeah, paa, my mistake

sullen sigil
south swan
#

player is actually missing from weaponsItems, it seems. Oops 🤷‍♂️

sullen sigil
#

ah nvm incorrect bracketing on my part

#

Ah it's an array inside of an array

south swan
#

select 0 it then 🤷‍♂️

sullen sigil
#

Yup, works perfectly now

#

aaaand that way doesn't work for the offset thonk

hallow mortar
#

the hitPart EH includes a param called isDirect, which indicates whether the hit in question was a direct hit or splash damage. Is it possible to make an equivalent check in a handleDamage EH, given that it doesn't have that param?

wary sandal
#

how do i pass variables in a spawn statement?

params ["this", "target2"];
(gunner this) commandArtilleryFire [getPosATL target2, "12Rnd_230mm_rockets", 12];
};```
i tried a couple different ways like this one but i can't get it to work
hallow mortar
#

It's because you're using the wrong syntax for params

#

params creates local variables (indicated with a leading _underscore), not global ones; that's its purpose

#

Also, inside the spawn, _this is still a special variable (in fact, it's the special variable that params is interpreting - private _param1 = _this select 0 is the same as params ["_param1"]) and you shouldn't overwrite it. Use a different name for your first param.

south swan
#

I'm pretty sure that overwriting _this works and is proposed somewhere on biki

hallow mortar
#

It might "work" but I would personally describe it as bad practice

south swan
#

In user comments, though, not in the main content. On the very params page

wary sandal
#

should've not given this sample as an example, since params shouldn't be needed in my case (i think)

#

i just want to pass the variable target2 which is a vehicle i defined in the 3den editor, and this which is the artillery battery

#

would something like this work?

(gunner _this) commandArtilleryFire [getPosATL target2, "12Rnd_230mm_rockets", 12];
};
hallow mortar
#

Well, you don't need to pass target2 since it's a global variable already

wary sandal
#

in the spawn scope

hallow mortar
south swan
#

le confusion

hallow mortar
#

(unless overwritten by something else)

#

Even if it's not Editor-defined, it's at very least a global variable, which is available in all scopes on the machine where it was defined

wary sandal
wary sandal
south swan
#

And params is just a syntactic sugar for _this select X

wary sandal
wary sandal
hallow mortar
# wary sandal why did it throw an error then?

I don't know. I don't think I've seen the exact code you used at the time, so it's hard to say. But you can clearly see it's a global variable which is available in all scopes by how it doesn't start with an underscore. And if it's defined in the Editor, its contents may change if overwritten but it won't become undefined.

wary sandal
#

which led me to think that both variables were not defined

#

my bad

hallow mortar
#

Yes, this is a special variable. While it appears to be a global variable, it's not really, and it's specific to the current scope.

wary sandal
#

thanks for having enlightened me mate

#

i would've never figured out

sullen sigil
#

How do I detect when an animation has finished playing on the player? waitUntil animationPhase blah blah blah doesn't seem to work

hallow mortar
#

animationState?

sullen sigil
#

seems to complete automatically

hallow mortar
#

What do you mean?

sullen sigil
#
0 spawn {
player playMove "AmovPercMstpSrasWrflDnon_AmovPercMstpSnonWnonDnon";
waitUntil {animationState player != "amovpercmstpsraswrfldnon"};
systemChat "hi!";
};``` prints "hi" straight away
#

(used copied animationstate of player straight after running for the check hence difference)

hallow mortar
#

playMove doesn't necessarily take immediate effect - the current animation needs to complete, the transition animation might have a different name - and you're checking on the very next frame. You might need to add a small delay.

sullen sigil
#

tried that too, still does it

#
0 spawn {
player playMoveNow "AmovPercMstpSrasWrflDnon_AmovPercMstpSnonWnonDnon";
sleep(0.5);
waitUntil {animationState player != "amovpercmstpsraswrfldnon"};
systemChat "hi!";
};``` still doesnt wait beyond the sleep
hallow mortar
#

Try having it output the animationState constantly during this process so you can see what it actually thinks is happening at what time

sullen sigil
#

ah nvm

hallow mortar
#

Also you don't need () on sleep

sullen sigil
#

works now

#
0 spawn {
player playMoveNow "AmovPercMstpSrasWrflDnon_AmovPercMstpSnonWnonDnon";
sleep(0.5);
waitUntil {animationState player != "amovpercmstpsraswrfldnon_amovpercmstpsnonwnondnon"};
systemChat "hi!";
};``` works
#

just need to figure out how to play the animation without stopping the player from moving -- is this an animation specific thing?

hallow mortar
#

Probably

sullen sigil
#

Doesn't seem to be an animation specific thing, using the same one as ACE/EM -- whichever lets you hit 0 to holster weapon to back and still can't move thonk

hallow mortar
sullen sigil
#

Just makes you point it towards the ground (i.e ctrl double clicked)

#

Trying to make it so the player will appear to change primary weapon with animations 🤔

hallow mortar
#

You probably used WeaponInHand instead of WeaponOnBack ...

sullen sigil
#

player action ["WeaponOnBack", player];

#

Ah, puts weapon on back but equips pistol -- which is what I'm trying to avoid too lol

hallow mortar
#
player action ["SwitchWeapon", player, player, 100]```
sullen sigil
#

That does nothing for me thonk

#

Probably because there's no 100 weaponindex?

hallow mortar
#

Yes, that's the point. If you try to select a muzzle that doesn't exist you switch weapon to nothing

#

I know it works because I just did it

sullen sigil
#

Hm... Are you running any mods?

hallow mortar
#

Nope

sullen sigil
#

I'll try unmodded then in case it's whichever mod adds the 0 functionality to check

#

Don't know if its EM or ACE

hallow mortar
#

You should check what weapon indexes you actually have, I wouldn't be surprised if ACE adds up to 100 and you're just selecting some invisible thing. Might need to use a higher number.

sullen sigil
#

Is there a quick way to do that?

hallow mortar
#

weaponsInfo

sullen sigil
#

Isn't that just for one object

#

nvm

#

you can ""

hallow mortar
#

Well, here's how ACE does it:

_unit action ["SwitchWeapon", _unit, _unit, 299];
sullen sigil
#

Where is that? was looking for it earlier 😅

sullen sigil
#

Ah, ty

#

Yeah that's working for me now, any easy way to figure out once it's finished?

hallow mortar
#

currentWeapon would probably do it

#

Unless that part takes immediate effect I guess

#

I mean you should be able to just see roughly how long the animation is and wait that long, no need to check

sullen sigil
#

it does from what testing I've just done

#

And yeah, would just be nice in case another mod changes it or smth 🤷

hallow mortar
#

Well, about the worst that can happen is they stand there awkwardly for like a second or two, I don't think it would be a huge deal.
The previous animationState check would probably also work though.

sullen sigil
#

Yeah, not like they're going to be stood in the middle of a field this way actually

#

Perfect, that works great now

shut reef
#

Does anyone here have experience with ```sqf
BIS_fnc_slerp

It... does not do what I would expect it to do
fair drum
#

😉

shut reef
fair drum
shut reef
#

Yeah I also only found it and there is no real documentation on it

#

Though I kinda solved my own question, as I entirely forgot again that it takes normalized vectors. duh xD

#

So it probably actually works the way it should. xD
But hey, now you learned of a new function

shut reef
#

Or maybe not? It doesn't seem to actually slerp the vector, but rather lerp each individual value within the array

granite sky
#

Did you check the code?

shut reef
# granite sky Did you check the code?

I'm not fluent enough in trigonometry to debug that.
Hence my asking.
I've tried this:

private _a = [-1,0,0];
private _b = [1,0,0];
private _slerpVertices = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1] apply { [_a,_b,_x] call BIS_fnc_slerp };
diag_log _slerpVertices;

which I'd assume would return a curve, but in fact:

[[-1,0,0],[-0.951057,0,0],[-0.809017,0,0],[-0.587785,0,0],[-0.309017,0,0],[4.37114e-008,0,0],[0.309017,0,0],[0.587785,0,0],[0.809017,0,0],[0.951056,0,0],[1,-0,-0]]    
granite sky
#

That looks like a non-normalized slerp to me.

#

So just normalize the result and you should be fine.

shut reef
#

The result first and foremost does not actually produce a slerped vector from all I can tell, cause y and z are never touched

granite sky
#

well, there isn't a unique valid slerp between your two inputs.

#

The two input vectors have to define a unique plane.

#

If you wanted a 180 degree curve then make two 90-degree curves.

shut reef
#

That reduces the usefulness of the function a lot :/

granite sky
#

You can't expect it to just guess which plane to use.

shut reef
#

I guess not. But hence my asking. Might be a good tidbit to add to the wiki page.
Thanks either way!

#

Is there any telling from the outside whether slerp or just rotating vectors is faster?

#

It's 1 matrixMul, 2x cos, 2x sin vs 1x acos, 1xcos, 1xsin and a couple vector commands.

granite sky
#

for anything O(1) in SQF you can get a good estimate by just counting the commands.

shut reef
#

but are trig functions and vector functions both O(1)?

fair drum
#

Disappointed that the function does not play a slerp sound, nor does it spawn me a slurpie.

#

Oh yeah, this one is over my head math wise lol.

brazen lagoon
#

how do you find if a vehicle has ammo or not?

granite sky
#

probably needs magazinesAllTurrets for general cases.

brazen lagoon
#

thats what i was afraid of..

#

its a shame magazinesDetail doesnt really give you anything machine readable

dreamy kestrel
#

Q: dealing with camera EHs, mouse down, mouse up, mouse holding, mouse button click...
I am finding more of a mouse holding event being triggered than a mouse button click (literally down+up, right).
Assuming button click does what I think it should do, that is a better place for things like object selection, clearing selections, ctrl toggling selections, and so on.
Which would free up mouse down I think for some other event combinations, shift append to selection, for instance.
But I am finding that instead of a distinct boundary between button click and holding, more of a holding procedure seems to be happening...
So I wonder how better to handle that.

tough abyss
#

I mean the only difference between clicking and holding should be a more extended delay between mousedown and mouseup

dreamy kestrel
#

I totally agree, but it appears to be like direct opposite, button click then holding, no space in between or the line is just that blurred...

tough abyss
#

So it's registering as a click while still holding?

dreamy kestrel
#

that's what it feels like to me. what I might consider 'button click', does not appear to isolate and contain that, moves straight into holding

tough abyss
#

Hm

dreamy kestrel
#

maybe I need to signal button click was the last 'handled' EH of any import, and ignore the next holding

#

but it seems like kind of an EH kluge to me

tough abyss
#

Yeah or you may be better off just using the raw mousedown/mouseup EHs with timers for differentiating between clicks and holds

dreamy kestrel
#

I do have downs, ups, holdings, movings, handled as well. that is true.

#

okay thanks.

tough abyss
#

👍

dreamy kestrel
#

follow up question, what sort of timer might be appropriate the to isolate and contain the button click event?

#

reading a couple of unrelated (non A3) generally, 200 ms? 1 s?

#

otherwise it is kind of smh territory that would not be isolated by A3, but hey...

#

starting with something simple like [QMVAR(_mouseLeftTime), true] call BIS_fnc_deltaTime; and measure during the button click and/or holding events...

#

question for me is, to be consistent with the mouse button click, what is the time for that EH? that should be my boundary edge for holding concerns, I think.

tough abyss
#

I'm not sure, you'll have to do some testing

#

Ultimately you're going to be doing deltaTime checks mixed with timeouts to set and unset flags

#

The exact timeouts to go for I'm not sure

dreamy kestrel
#

clear does not appear to be clearing anything. I am systemChat diagnostic measuring that, and the delta is definitely increasing no matter what I do.

// mouse down EH, capture _mouseLeftTime state
private _mouseLeftTime = [QMVAR(_mouseLeftTime), true] call BIS_fnc_deltaTime;
// button click EH, measures the delta
private _mouseLeftTimeNow = [QMVAR(_mouseLeftTime)] call BIS_fnc_deltaTime;
_mouseLeftDelta = abs (_mouseLeftTime - _mouseLeftTimeNow);
// _mouseLeftDelta increasing from 30s+ ... half expecting it should yield a 'new' boundary
// assuming Down always comes before Click

Leaving out that the state is stored and kept between EH invokes, it is.
https://community.bistudio.com/wiki/BIS_fnc_deltaTime
I see, somewhat expectantly, starting up the mission, from 30s+ into the mission, but is always increasing.
I expect that I should be clearing the variable but it is not.
Can we inspect the deltaTime code perhaps? i.e. is it a diagnostic bug?

#

Here's a simple test in the console, the base is always 0.001, okay, happy with that. but the delta delta appears to always be increasing?!

_timer = 'mytimer';
_a = [_timer, true] call bis_fnc_deltatime;
_b = [_timer] call bis_fnc_deltatime;
[_timer, _a, _b, abs (_a - _b)]

That is a bit disconcerting, because is it reliable then? Certainly does not appear to be even remotely deterministic.
It is not a true RTOS, of course, but I would expect at least some consistency there.

#

shouldn't clear actually clear it?

south swan
#

looks like the first run after clearing just returns time (or close to that). Sounds logical to function's description 🤷‍♂️

dreamy kestrel
#

well the docs do warn time ... so looks like maybe we need to roll our own based on the diag_tickTime.

south swan
#

🤷‍♂️ what's the intended usecase?

dreamy kestrel
#

er, maybe I misread the docs a bit... based on the example anyway, on second glance.

#

so left and right edges should look the same. call a third time with true for clear to reset.

south swan
#

call once, wait, call once more - you get time between calls

#

first ever call returns time - 0.001

#

"clear" makes it behave as if the next call is first call

dreamy kestrel
#

well, I misread it, but not by far. even with this pattern, which is closer, if not following, the example, still is increasing...

_timer = 'mytimer';
_a = [_timer] call bis_fnc_deltatime;
_b = [_timer] call bis_fnc_deltatime;
[_timer, true] call bis_fnc_deltatime;
[_timer, _a, _b, abs (_a - _b)]
south swan
#

and _b should be 0, because no time passes between calls

dreamy kestrel
#

run it for yourself. and repeatedly. tell me what it does.

south swan
#

here's the code sqf private _oldTime = missionNamespace getVariable [_id, SMALL_NUMBER]; missionNamespace setVariable [_id, time]; time - _oldTime;

dreamy kestrel
#

now a couple minutes out, I am getting this, ["mytimer",195.163,0,195.163]

south swan
#

well, duh

dreamy kestrel
#

["mytimer",220.394,0,220.394]

south swan
#

because _a is first call that returns time - 0.001, and _b is the second call that returns time between two calls that is 0

dreamy kestrel
#

the timer should be reset. I should see very little delta, if any. but it is increasing! how is that "duh"?

granite sky
#

I don't understand what you're expecting it to do.

south swan
#

_b is delta

#

_a is time - 0.001

dreamy kestrel
#

but it is not _b from the very 'first' call. should be _b from the clear call, no?
according to the example.

south swan
#

no

dreamy kestrel
#

I ran it again, ["mytimer",361.707,0,361.707]

granite sky
#

well yeah?

dreamy kestrel
#

I am blind okay, now I see it lol

tough abyss
#

361.707 - 0 = 361.707 :P

dreamy kestrel
#

being literally start time, then delta

south swan
#

*time - 0.001

dreamy kestrel
#

okay that is a much better measurement. about 0.5 s button click, probably not less than 1 s before responding to mouse holding.

#

distribution being anywhere from about 0.4 s but I saw as much as 0.6 also.

#

I wonder, as mouse EH goes, I should see mouse up before button click, yes?

granite sky
#

You'd have to test it. I found recently that click is before doubleclick.

#

but one can't guess these things :P

dreamy kestrel
#

that what is before what? well, that one seems obvious... or did you mean double click before click?
I need to gauge from down, up, holding, maybe also moving, button click...

south swan
#

clicks don't seem to affect "MouseHolding" in my testing 🤷‍♂️

dreamy kestrel
#

how do you mean?

south swan
#

onMouseHolding
Fired on: Fires continuously while mouse is not moving with a certain interval.

dreamy kestrel
#

and it seems like a common mouse EH issue, not exclusive to A3...

south swan
#

so "MouseHolding" is "mouse cursor is placed over this control and is not moving" or something like that

#

and has nothing to do with clicks 🤷‍♂️

dreamy kestrel
#

I just need to delay responding to "and hold" gestures (or moving) events for a bit, time for the click to be digested.

#

assuming mouse down is my left edge...

south swan
#

wait for buttonUp, check the deltaTime 🤷‍♂️

dreamy kestrel
#

yeah I could drop the button click altogether and just measure right edges around up/holding...

dreamy kestrel
#

maybe a dumb follow up question... mouse button click occurs before mouse up?

#

so answer appears to be button click after mouse up, which would make some sense

#

this is interesting, click and hold then up, events go: mouse down, button click, mouse up... still get a button click in that... INTERESTING. would NOT have expected that.

south swan
#

mouseClick does fire 0.5s after mouseBtnDown even if there were no mouseBtnUp

dreamy kestrel
#

it is funny in the above scenario I just described, button click fires off much SOONER than even that... like < 0.1

#

but is significantly delayed when the mouse went up in a typical down then up button click.

south swan
#

for me it's like 0.2-0.5 s between down and click if button is up, roughly 0.5 s if button is held down

#

input handling (and ui in general) is hell anyways 🤷‍♂️

dreamy kestrel
#

sure, okay. it may depend on the system IO. mouse and keyboard are both connecting through USB 3.0 for me.

#

you got that right, sir ^^
anyway I think I have a little better handle on the dynamics involved I think. enough to sort out some better EH responses.

jade acorn
#

I store my initial fogParams as an array in variable msnFog and I want a trigger to setFog to the initial values if current fog values are different. But whatever I try, like comparing msnFog to fogParams or other variable that would have the array of current fog params, it always throws an error about condition == type array, expected bool, number etc. I am pretty sure I did something like that last year and worked as it should, now it doesn't

hallow mortar
#

== doesn't work with arrays, you need isEqualTo

chrome hinge
#

"MARTA_reveal" makes a group always visible and "MARTA_hide" makes it always invisible. Is there any way to hide a group so that it can still be revealed later?

meager spear
#

Hello! I am looking to create a sqf script to execute the zen_modules_fnc_moduleExportMissionSQF every X minutes. The idea is to create an autosave system with a txt file created every X minutes.
Any idea on how to create it?

shut reef
frosty juniper
#

Can someone help me write a script?

#

To pull audio such as vehicle RPM out of the game so I can pair it up with another piece of software

proven charm
tough abyss
#

Trying to port a liberation scenario, however I'm getting this error:

#

I have no idea whats causing it as I have not edited that specific file

hallow mortar
#

It's relying on a variable that's presumably supposed to be defined somewhere outside of that file, but that's not happening. I don't know enough about Liberation to say where that would be; possible locations might be init.sqf, initServer.sqf etc. or in one of the Liberation init/setup functions.

granite sky
#

I would guess that militia_squad is composed of classnames from faction files that you have edited, and the first error is there and causes militia_squad to be undefined. Check the RPT.

wary sandal
#

could anyone guide me on how to make the ship move foward? (I don't want to make it "walkable") My guess would be to get the bis_carrierParts on the full model and increment the Y position in a foreach loop but i'm not sure how to do that

#

||also i'd like to add some foam at the front of the ship by maybe attaching some invisible speedboats to the Liberty||

dreamy kestrel
#

I think I understand even better now how to arrange the "onMouseButtonClick" events with regard to "onMouseButtonDown" and "onMouseButtonUp". Especially gauging whether to handle a simple mouse click response; contrasted with a click and hold action, lasso, drag, rotate, whatever.

It is kind of a chick egg catch 22 relationship.

Simple button click sequence: down -> up -> click
Contrast that with, "and hold" gestures: down -> click -> up

So instead of measuring timers or whatever, I can scan for down, or having been up, during a normal click. If necessary also prohibit gesture states.

Contrast that with gestures, would watch for the 'open' button click, that is my gate before initiating and/or continuing gestures. Stoppage, of course, when up is discovered.

dreamy kestrel
tough abyss
#

just keep in mind the movement of the pieces isn't guaranteed to be synced over a network which could result in some weird looking behavior if you're using it in MP

sharp grotto
#

I guess you could attach each element to the other and only move one, then movement in MP would be smooth meowsweats
Still a bad idea to move such a huge object i guess 🤷‍♂️

granite sky
#

I would guess that it's not a vehicle simulation, so update rate might be rubbish anyway.

#

In that case you'd want to attach all the pieces to a can or something :P

hallow mortar
#

I think onEachFrame position setting would probably do it. I have doubts about setVelocity working since it's a static object without physics.

I believe they used Keyframe Animation to move it in the Art of War mission, but I kinda struggled with those modules when I tried them so...

dreamy kestrel
#

even if you could inch 'all' of its LODs along, because some platforms are traversable by infantry and/or vehicles, gonna be a mess I think.

hallow mortar