#arma3_scripting

1 messages · Page 733 of 1

tough abyss
#

without a player being present

steel fox
tough abyss
#

so the code i posted works in a debug console no issues

#

but when i put it in the event scripts, it does not work. My guess is because of the respawn screen, the player is technically loaded but hasn't selected a vehicle yet.

#

it despawns all my alive units during respawn menu, so you cant spawn in the vehicles until something loads them in.

#

i was hoping the local player init wouldn't load untill the player spawned in

steel fox
#

init runs upon joining

tough abyss
#

and i dont want to keep creating zeus modules for when the player respawns

#

so i cant use the on player respawn event script

#

brb thanks for your time

steel fox
#

Yes you can

#

Just check if old body is null

#

then you know it is a first spawn

tough abyss
#

true

peak pond
#

Hi, is a waypoint's onActivation script run on every machine, or just the machine of the group's owner?

tough abyss
peak pond
#

Ok, thanks. I may put a safety check in the script just to be safe.

tough abyss
# steel fox Yes you can

I think you have a good idea, i don't know what the issue is. anyway heres my code ```params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];

if (_oldUnit == objNull) then {
_logic = createGroup sideLogic;
_zeus = _logic createUnit ["ModuleCurator_F",[0,0,0],[],0,"NONE"];
_zeus setVariable ["Owner", ""];
_zeus setVariable ["Name", ""];
_zeus setVariable ["Addons", 2];
_zeus setVariable ["Forced", 0];
[_newUnit, _zeus] remoteExec ["assignCurator",2];
_zeus addCuratorEditableObjects [[_newUnit], true];
[_zeus, [-1, -2, 0]] call bis_fnc_setCuratorVisionModes;
_zeus addCuratorPoints 0.1;
};

#

it will work on debug console if i replace the variables with _newUnit = player

jade acorn
#
waitUntil {sleep 1; this in units group player };
_this call BIS_fnc_ambientAnim__terminate;```
in unit's init. Why is this *no bueno*? I'm trying to terminate the ambient animation when the unit joins players group - it joinSilents player in other place
bitter jewel
#

no sleeping or waiting in unit init

jade acorn
#
[] spawn { waitUntil {sleep 1; rfl_1 in units group player }; rfl_1 call BIS_fnc_ambientAnim__terminate;
};``` this one works but the unit looses all of its gear except uniform and weapon
#

it's for singleplayer btw

bitter jewel
#

that is a feature of BIS_fnc_ambientAnim

jade acorn
#

oh, so I have to give this stuff back to him through another script?

bitter jewel
#

give "ASIS" as third argument

jade acorn
#

I'll try

bitter jewel
#

equipmentLevel: String - the equipment level of the unit. Possible values:

NONE
LIGHT
MEDIUM
FULL
ASIS
RANDOM
#

[this, "SIT1", "ASIS"] call BIS_fnc_ambientAnim;

jade acorn
#

yes I must have missed that part, thank you so much

#

I tried to do the same thing with Ambient AI feature from 3den Enhanced that creates the same animation either as ambientAnim or ambientAnimCombat, but it's impossible to terminate any of those with the same spawn as above, manually setting combat behaviour also doesn't work, unless I'm wrong clueless

bitter jewel
#

i haven't used that feature of 3den enhanced

#

but you should be able to terminate the animation with switchMove or playMoveNow

proven charm
#

why does the element order change when using createHashmapFromArray?

little raptor
#

aka unordered map

#

There's no order in hashmaps

#

If you need order you must use arrays

proven charm
little raptor
#

It doesn't "shuffle"
It depends on the hash

#

Hashmap uses the hash to map to a bucket

warm hedge
#

AKA the order means nothing for hashmap

proven charm
#

hmm

pliant stream
#

because the order it uses makes searching more efficient (that's the assumption anyway)

little raptor
#

Or hash table

pliant stream
#

it could preserve iteration order but that would make the table more complicated

#

you can do it yourself by storing your data in an array and using a key->index table instead

proven charm
#

I'm just curious why the order of elements changes

little raptor
#

Like I said just google it and you'll see

pliant stream
proven charm
#

thx for the link , I think I understand little better now

#

buckets and all, I think it's an optimization thing?

little raptor
#

?
A bucket is just an array element

#

(usually)

pliant stream
#

it's all part of the hash table algorithm. the nice thing about hash tables is that they provide average constant time access

#

in other words, on average the time needed to find an element stays the same even as you add more elements

#

though that is not entirely true in reality, and also depends on the quality of the hash

#

a bad hash reduces efficiency of the table. the worst possible hash which assigns all keys the same hash value produces linear access times

#

that is, with that worst possible hash, as you double the size of the table, the time required to find a key also doubles

proven charm
#

interesting stuff, thx guys 🙂

lofty vine
#

has anyone experienced issues with using keyhandler, in terms of activation without an actual keypress?

E.g: someone opens a menu without pressing Y.

or perhaps a key activating something its NOT supposed to?

E.g someone opens a menu by pressing P instead of the assigned key(Y).

winter rose
bitter jewel
#

seems so

winter rose
#

any way to get layer name from its id? 😁

winter rose
#

ouh smart! 👍

winter rose
#

ah well, not mandatory for what I want to do, I'll find a workaround.

copper raven
#

don't have arma installed to examine how all the indexing and stuff works, could help more otherwise 😄 hope you get it working

proven charm
#

interesting that with hashmaps you can delete element when doing foreach loop without breaking the loop

#

(skipping elements)

copper raven
#

yes because the keys are copied

proven charm
#

ok

pliant stream
#

can you loop over a map?

proven charm
#

hashmap yes

pliant stream
#

{ } foreach _map ?

proven charm
#

yeah

pliant stream
#

are you sure deleting works? seems a bit sus

tough abyss
#

Makes sense if you're only deleting the element and not the key as a whole

proven charm
#

this is what I used to test: ```
_hm = createHashmapFromArray [["test1",7],["test2",5],["test3",2]];

systemchat format ["==== %1 ====", _hm];

{

systemchat format ["%1 => %2", _x, _y];

if(_y == 2 || _y == 5) then
{
systemchat "deleting...";
_hm deleteAt _x;
};

} foreach _hm;

pliant stream
#

this test is not good enough

proven charm
#

how so?

tough abyss
#

Makes sense to me

#

no reason it'd be trying to iterate over a hashmap like an array, it'd just be performing key lookups

#

so deleting a key shouldn't break anything

pliant stream
#

that's not how any of this works

tough abyss
#

That's exactly how a hashmap works

pliant stream
#

that's how lookup works

#

by doing a lookup

#

you can't iterate by doing lookups

tough abyss
#

A foreach does not iterate over a hashmap in the same way one iterates over an array.

#

Is my point.

#

So deleting arbitrary elements during iteration shouldn't break anything

pliant stream
#

you have no way of knowing that

tough abyss
#

???

pliant stream
#

first of all you'd have to know the algorithm they use

pliant stream
#

i assume it's the same naive array of arrays as it is in A2

still forum
tough abyss
#

Yeah I meant value not element

tough abyss
#

mixup in wording

pliant stream
#

it doesn't have to

tough abyss
#

I've never seen it break anything

#

¯_(ツ)_/¯

still forum
#

A hashtable is just multiple arrays.

pliant stream
#

usually it's one array

#

it would work if you used unordered_map, though i know you're not

still forum
#

You are iterating through many arrays. Deleting elements will mess it up the same as it does with arrays

tough abyss
#

That's entirely implementation defined

#

I'm used to things like unordered_map and such

still forum
#

Yeah I'm telling you how it's implemented

pliant stream
#

implementation defined... 🙄

tough abyss
#

Fair enough, wasn't aware it was implemented that way and I've never seen it implemented that way

#

I stand fairly corrected

still forum
#

It's basically exactly how hashtable is described on Wikipedia i think

#

Pretty sure.. multiple arrays as the buckets

pliant stream
#

yeah array of arrays is the kindergarten algorithm

#

it's fairly naive though. most real world implementations use open addressing

tough abyss
#

The entire idea of arrays as buckets is a bit... yuck

#

Might as well not be using buckets at all if you're not using open addressing

pliant stream
#

you do know how unordered_map works right?

tough abyss
#

I know the gist of it

pliant stream
#

yeah well they use an array of linked list buckets

tough abyss
#

Right but I'm talking about literally just hashing raw arrays and calling them buckets

pliant stream
#

what?

tough abyss
#

As in how that'd be a stupid thing to do

pliant stream
#

yeah sounds that way. did someone do that?

tough abyss
#

It has been done

#

and it's as bad as it sounds

pliant stream
#

i have no idea what you even mean

proven charm
#

so my test code is not supposed to work... 🙄

tough abyss
#

I must be wording it poorly

winter rose
tough abyss
#

what I'm saying is it'd be a very naive and stupid decision to use arrays as "buckets" instead of a linked list structure

tough abyss
#

as in literally just throwing arrays into a hashmap and pretending that it's anywhere close to actual buckets

pliant stream
#

wait you're saying linked list better than array?

#

why is that?

tough abyss
#

...?

#

I thought we'd already established that's how it's usually done

#

don't think I need to explain why

still forum
winter rose
#

« They say of the Acropolis where the Parthenon is… »

pliant stream
#

do you know why unordered_map is implemented that way?

tough abyss
#

I assume it's because of literally everything that makes buckets a good idea in the first place?

pliant stream
#

well you assume wrong

#

it's because of the iterator stability guarantees imposed by the standard, and most of the C++ community considers unordered_map largely worthless because of it

tough abyss
#

Well I've been around the C++ community and I've never heard this lol

#

Nor has any education I've received ever talked about that

pliant stream
#

well it's entirely a performance issue. i guess it depends on the circles you hang around whether or not it'll come up

tough abyss
#

I know the standard enforces a lot of... unnecessary performance overhead in areas

#

but I don't really see a noticeable performance problem w/ unordered_map hashmaps in any usage of them I've done

pliant stream
#

well there's plenty of literature on the subject out there

#

plenty of benchmarks too

tough abyss
#

Are we talking significant performance decreases on a macro scale or microoptimization?

#

Cos I'd say it's quite a different story if it only applies when trying to scale a massive application for instance

pliant stream
#

the scale of the problem depends on how heavily your workload depends on the hash table

tough abyss
#

Well yeah

#

I mean moreso in terms of actual complexity

#

is this something that the average developer should be seriously considering avoiding

pliant stream
#

algorithmic complexity?

#

code complexity?

tough abyss
#

Yes

pliant stream
#

it's a hash table, it's average O(1) either way

#

we're talking about constant factors

tough abyss
#

Fair enough, though I know the average can sway due to implementation factors

#

Moreso what I'm getting at is

#

Is this a problem only someone writing code for a microcontroller should be worried about or something more universally applicable?

#

What's the scale of the performance difference

#

I'll have to look into the literature on it

pliant stream
#

well you don't have to worry about it

tough abyss
#

Wow that certainly grows at scale doesn't it

#

Interesting, I was not aware, thanks for informing me

proven charm
#

would this code work for deleting elements? ```
_hm = createHashmapFromArray [["test1",7],["test2",5],["test3",2]];

for "_i" from (count _hm - 1) to 0 step -1 do
{
_keys = keys _hm;
_k = _keys # _i;
_v = _hm get _k;

systemchat format ["%1 => %2", _k, _v];

if(_v == 2) then
{
systemchat "deleting...";
_hm deleteAt _k;
};

};

pliant stream
#

no

#

don't delete while you iterate

proven charm
#

hmmm

pliant stream
#

push all the keys to be deleted into an array and do another loop to delete them all afterwards

proven charm
#

ok

#

what if I use + copy? ```
_hm = createHashmapFromArray [["test1",7],["test2",5],["test3",2]];

{

systemchat format ["%1 => %2", _x, _y];

if(_y == 2) then
{
systemchat "deleting...";
_hm deleteAt _x;
};

} foreach +_hm;

pliant stream
#

that's fine

proven charm
#

ok thx 🙂

still forum
#

I hope you aren't doing lookups by value too often pout_kitty

tough abyss
#

Certainly doesn't invalidate the entire advantage of hashing

proven charm
tough abyss
#

Is there a particular reason you're testing this?

still forum
#

Ah it's a _y <... Check, instead of a ==?

proven charm
proven charm
tough abyss
#

Well it's just

#

I don't see what it could be being used for that would benefit from this implementation

pliant stream
#

sounds like you want a queue

proven charm
#

no problem, you have already helped me so thx for that

still forum
distant oyster
lofty vine
#

Ahh, good point. I dont think it applies in the same way in our case as we are using numpad for it. Although it could be so. Thank you for pointing that out : D

peak pond
#

Is there some function to make an AI speak one of its preset dialogs? For example, in my paradrop script, I want to make a group leader say "Dismount!" over group channel.

little raptor
peak pond
#

Ah great, groupRadio looks like what I need, thanks.

vapid drift
#

Am I missing something simple here? The condition is apparently being ignored - the actions are visible all the time:

            player addAction [format["<t color='#FF0000'>Torch Nest</t> %1", _nest], {
                    params ["_target", "_caller", "_actionId", "_arguments"];
                    hint "Torching";
                    _caller removeAction _actionId;
                },
                [_nest], 6, true, true, "",
                "_this distance2D _target <= 3;"
            ];
little raptor
vapid drift
little raptor
#

also in this case _this and _target are the same thing

#

both are player

vapid drift
#

ah... yes, that would be it isn't it

little raptor
#

so distance is always 0

vapid drift
#

hmm I'm not sure the best way to go about this then. I could add the action to the "nest" and use this or modify the radius but that will require me looking directly at the object correct?

#

In this case, that doesn't really work because the nest is made of several objects... unless I were to add the action to everyone of them?

winter rose
#

then using _target distance _arguments and providing the nest as argument

vapid drift
little raptor
vapid drift
#

Yeah, I didn't think so - that's what I'm looking at also

little raptor
#

just add the action to the "nest"

vapid drift
#

well, like I said, I nest is made up of several different objects. Should I just add an action to each one to ensure the player can activate wherever they're looking?

#

I'm not sure what would be considered too taxing... looking at roughly 19 objects per nest

winter rose
#

use a global var and be done with it

little raptor
#

or use the player's var space

#

getVariable and setVariable

vapid drift
#

Regardless I'm looking at 19 possible objects the player could be looking at (could be realistically lowered to around 10) and multiple nests across the map... not sure how a single variable would help in this case

#

or am I missing something?

vapid drift
#

Can you explain how that would work in this case? I currently have the nests in an array and listen for a thermite grenade... I was hoping to replace that with the action route

winter rose
vapid drift
winter rose
#
player distance ([] call ST234_fnc_getNearestNestPosition)
little raptor
winter rose
#
NestPositions = [/*...*/];
// ...

NestPositions findIf { player distance _x < 3 } != -1
```etc, etc
vapid drift
#

Ok... I don't think I'm fully tracking yet but I'm almost there! Thank you both

#

And there we go:

format["_this distance2D [%1, %2] <= 3;", (getPos _nest select 0), (getPos _nest select 1)]
#

lol is that worse?

little raptor
#

it'll do

vapid drift
#

I mean it works but I also don't want to get stuck with "good enough". Are the other options "better" or just different?

little raptor
vapid drift
glacial dust
#

Hi, does someone have a recommendation for an animation of someone running and jumping from the ramp of a transport aircraft?

vapid drift
#

Well, I've gotta run... please ping me if you happen to think of something better

little raptor
#

like the one for dismounting the back of a HEMMT

glacial dust
#

Maybe, I will take another look, thanks for the suggestion @little raptor

tidal ferry
#

Hey, I need help with being able to move an non-physics object slowly from A to B on dedicated multiplayer

#

Still having trouble with it, and not much clue where to start 😅

little raptor
#
p1 = [blabla];
p2 = [blablabla];
velo = [blabla];
spd = vectorMagnitude velo;
start = time;
duration = (p1 vectorDistance p2) / spd;
onEachFrame {
obj setVelocityTransformation 
[
    p1,
    p2,
    velo,
    velo,
    p1 vectorFromTo p2,
    p1 vectorFromTo p2,
    vectorUp obj,
    vectorUp obj,
    (time - start) / duration
];
}
tidal ferry
#

AMAZING. Thank you 🙏

little raptor
#

that's just for testing tho

tidal ferry
#

Promise I'll reverse-engineer it when I'm not in mission crunch so I can better understand it 😆

#

Of course

#

Any clue if it'll work in MP yet? I'll test it but just curious to know

little raptor
tidal ferry
#

Thanks a ton

little raptor
#

just go in Eden, place a player, run the mission and execute

#

@tidal ferry also you need to add a termination condition ofc

tidal ferry
#

Will do

little raptor
#

if (time - start > duration) exitWith {onEachFrame ""}

tidal ferry
#

And yeah sounds good

real tartan
#

trying to locate some control idc from inventory display, but don't know if using right event handler

player addEventHandler 
[
    "InventoryOpened", 
    {
        params ["_unit", "_container"];

        _unit spawn
        {
            waitUntil { !isNull ( findDisplay 602 ) };

            {
                ( findDisplay 602 displayCtrl ( ctrlIDC _x ) ) ctrlAddEventHandler ["onMouseEnter", {
                    params ["_control"];
                    hint format ["%1", ctrlIDC _control];
                }];
            } 
            forEach ( allControls findDisplay 602 );
        };
    }
];
little raptor
real tartan
#

error: displayCtrl expecting number, control provided

little raptor
tidal ferry
little raptor
#
_x ctrlAddEventHandler ...
little raptor
#

units don't have physics either

little raptor
tidal ferry
little raptor
#

what's the object?

real tartan
#

player addEventHandler 
[
    "InventoryOpened", 
    {
        params ["_unit", "_container"];

        _unit spawn
        {
            waitUntil { !isNull ( findDisplay 602 ) };

            {
                _x ctrlAddEventHandler ["onMouseEnter", {
                    params ["_control"];
                    hint format ["%1", ctrlIDC _control];
                }];
            } 
            forEach ( allControls findDisplay 602 );
        };
    }
];

no hints

tidal ferry
#

I can DM you about if if you'd like

#

WAIT

#

Nvm, think I got it

little raptor
#

there's no such event handler

#

it's mouseEnter

#

read the wiki

real tartan
#

When using the event names listed here with the ctrlAddEventHandler, ctrlSetEventHandler, displayAddEventHandler or displaySetEventHandler commands, the prefix "on" in the event name must be removed (e.g. 'ButtonDown' instead of 'onButtonDown').
damn, I am blind

tidal ferry
#

Hey @little raptor, question

#

Does the above script need to be executed in the scheduled, or unscheduled environment?

#

I'm looking to stuff it into an execVM so I can use it with parameters and modify as needed, but it breaks in execvm

#

Could very well be my own inattentiveness but just wanted to ask

little raptor
tidal ferry
#

But I mean, starting the onEachFrame from execVM

little raptor
#

as I said that's just for testing

#

you need to ditch onEachFrame

tidal ferry
#

Ah, gotcha

little raptor
#

doesn't matter where you execute it

#

it's an event handler

little raptor
# tidal ferry Of course

and just to be clear, "for testing" doesn't mean "just change the variables and you're good to go"
it means you have to optimize it and fix stuff
what I wrote is naive and slow, and only for testing purposes

tidal ferry
#

It gets the basic functionality that I need done in SP, I'm just trying to figure out how to put it in an execVM so I can more easily use it

#

params ["_obj",["_velo",[100,0,0]]];

p1 = getPosASL _obj; 
p2 = getPosASL _obj vectorAdd [0,50,0]; 
//velo = [0,100,0]; 
spd = vectorMagnitude _velo; 
start = time; 



duration = (p1 vectorDistance p2) / spd; 





_execCode = { 
_obj setVelocityTransformation  
[ 
    p1, 
    p2, 
    _velo, 
    _velo, 
    p1 vectorFromTo p2, 
    p1 vectorFromTo p2, 
    vectorUp _obj, 
    vectorUp _obj, 
    (time - start) / duration 
]; 
};
addMissionEventHandler["EachFrame",_execCode];

#

I'm aware this is probably super sloppy, but I'm also super tired 😅

#

I'm pretty sure that the local variables aren't being passed to the event handler, which is why it's not firing right

tidal ferry
#

Oh I'm a dolt

#

One sec

little raptor
# tidal ferry ```sqf params ["_obj",["_velo",[100,0,0]]]; p1 = getPosASL _obj; p2 = getPosA...
if (missionNamespace getVariable ["alreadyExecuted", false]) exitWith {};
movingObjs = [];
alreadyExecuted = true;
addMissionEventHandler["EachFrame", {
  {
    _obj = _x;
    _p1 = getPosWorld _obj;
    _p2 = _obj getVariable ["destination", _p1];
    _dist = _p1 vectorDistance _p2;
    if (_dist  < 0.1) then {
      movingObjs = movingObjs - [_x];
      continue;
    };
    _speed = _obj getVariable ["speed", 1];
    _dir = _p1 vectorFromTo _p2;
    _interval = _speed * diag_deltaTime / _dist;
    _velo = _dir vectorMultiply _speed;
    _obj setVelocityTransformation  
    [ 
      _p1, 
      _p2, 
      _velo, 
      _velo, 
      _dir, _dir, 
      [0,0,1], [0,0,1], 
      _interval
    ];
  } forEach movingObjs;

}];
#

there

#

it'll work with as many objects as you want

#

and the destination can change too

#

you just do:

_obj setVariable ["destination", _someASLPos];
_obj setVariable ["speed", _speedInMPS];
movingObjs pushBackUnique _obj;
tidal ferry
#

o7

#

Amazing, I'll try this

tidal ferry
#

Absolute legend

#

Thank you, you've saved me so many hours of trying to figure this out so far 😂

little raptor
little raptor
tidal ferry
#

No clue where it's going

little raptor
tidal ferry
#
this setVariable ["speed", 0.01];```
#

It goes to light speed even when I put it super low

#

Orriginally I had it at like 50

little raptor
tidal ferry
little raptor
#

I'm talking about the event handler

#

I changed the code to make sure you don't mess it up

#

try it again

tidal ferry
#

OH, hurr durr, I missed that 😅

tidal ferry
#

Sorry about that, thanks for your patience

little raptor
#

added a guard

little raptor
#
player setVariable ["destination", getPosASL player vectorAdd [0,100,100]]; 
player setVariable ["speed", 1];
movingObjs pushBackUnique player
#

change pushBack to pushBackUnique to be safe

little raptor
#

wat?

#

are you executing that in init?

tidal ferry
#

Object init, yeah

little raptor
#

you should never put variable names in init

tidal ferry
#

Oh?

little raptor
#

they may not even exist

tidal ferry
#

Hrm

#

Aaaaaaa

#

Okay

#

Let me try it differently then

little raptor
#

in your case finalPos may not even exist

tidal ferry
#

...Very good point

#

So

#

It's somewhat working

#

So far, only problems are

#
  1. The speed is way too fast, definitely not in M/S, more like KM/S, but that's an easy fix
#
  1. The vector only moves vertically, think it's due to you putting the vectors as [0,0,1] in the setVelocityTransformation, though as we've proven, I am a dunce, so
little raptor
#

there's nothing wrong with my code

tidal ferry
#

Ah

#

Double checkinng now

little raptor
little raptor
real tartan
#

is there an opposite function to BIS_fnc_colorRGBAtoHTML ? ( HTML to RGB(A) )

tidal ferry
#

How are you executing it? Just debug console?

little raptor
#

yes

#

no

tidal ferry
#

Yeah, I'm trying it from the debug console over and over again with almost the exact code

little raptor
#

I mean the mission

#

you've probably broken it

little raptor
#

almost the exact code

#

try the exact code

tidal ferry
#

I have

little raptor
#

no change at all

tidal ferry
#

Give me like

#

5 seconds

little raptor
#

even the tiniest change will break it

tidal ferry
#

Yeah, so, works perfectly fine on player unit

#

But it breaks on the object I'm trying to move

little raptor
tidal ferry
little raptor
#

what is the object?

#

give me the exact type and class and properties

tidal ferry
#

It's a very large, collissionless, physicsless, background prop inheriting from house_f

little raptor
tidal ferry
#

Simulation is enabled

#

Essentially, when I fire the script

#

It basically moves at light speed to a position like

#

I'd say maybe 10-20km above the posASL I give it

#

As mentioned, it has no physics and basically just floats in the air

little raptor
#

as I mentioned, physics has nothing to do with this

#

you're moving the object with position and velocity

#

not physics

tidal ferry
#

Okay

#

Well, as mentioned it works for the player unit with the exact code you give me, but not with the object

#

Tbh I can probably just use a workaround with a dummy unit and attachto 😅

little raptor
tidal ferry
#

Testing

#

Also, I'm going to replace player in that code with finalPos, an invis helipad I've got placed that I want it to go to

little raptor
#

no

#

don't

tidal ferry
#

Alrighty

little raptor
#

that's my point

tidal ferry
#

And, to be absolutely clear, replace blablaObj with the variable name of the intended object, yes?

little raptor
#

yes

tidal ferry
#

Same result

#

Basically, spinning sideways in a rotation around a position roughtly like... 10km above the player

#

Rising quickly

#

Rotational velocity is like, helicopter rotor speed

tidal ferry
#

Yes

#

Verbatim, pasted right into the debug console

#

Then with the second bit of code you just sent executed after that

#

Tbh I can probably figure out a workaround using attachto and physics objects given we know it works with the player unit

little raptor
#

restart the mission and try with this instead:

_oldObj = blablaObj;
blablaObj = createSimpleObject [typeOf _oldObj , getPosASL _oldObj ];
deleteVehicle _oldObj ;
blablaObj setVariable ["destination", getPosASL player vectorAdd [0,100,100]]; 
blablaObj setVariable ["speed", 1];
movingObjs pushBackUnique blablaObj 
tidal ferry
#

Will do

#

Same code as before?

little raptor
#

what same code?

#

the EH yes

tidal ferry
#

But also the EH yeah sorry

little raptor
tidal ferry
#

Hurr durr I meant the EH

#

Yeah I gotcha

#

Same EH code?

little raptor
#

yes

tidal ferry
#

Cool cool

little raptor
#

that one has no problem at all

tidal ferry
#

Do I replace blablaObj with the varname of the target object?

little raptor
#

ofc yes nootlikethis

tidal ferry
#

Just making

#

Absolutely certain

#

That did... something different

#

It shifted position a little ways down from where it was originally at in the air

#

Rotated maybe like 90 degrees

#

Correction, now oriented to perfect north

little raptor
#

what do you use for speed?

tidal ferry
#

Same thing you posted

#

Literally verbatim minus changing the varname

little raptor
#

I have no idea then

tidal ferry
#

Same 😆

#

I'll just cook a workaround with attachto and the player unit

#

Thanks a ton for your time and patience

little raptor
#

I mean my direction code is not 100% correct

#

but I don't know what that has to do with position

#

let me fix that too

tidal ferry
#

Up to you

little raptor
# little raptor ```sqf if (missionNamespace getVariable ["alreadyExecuted", false]) exitWith {};...
if (missionNamespace getVariable ["alreadyExecuted", false]) exitWith {};
movingObjs = [];
alreadyExecuted = true;
addMissionEventHandler["EachFrame", {
  if (isGamePaused) exitWith {};
  {
    _obj = _x;
    _p1 = getPosWorld _obj;
    _p2 = _obj getVariable ["destination", _p1];
    _dist = _p1 vectorDistance _p2;
    if (_dist  < 0.1) then {
      movingObjs = movingObjs - [_x];
      continue;
    };
    _speed = _obj getVariable ["speed", 1];
    _dir = _p1 vectorFromTo _p2;
    _interval = _speed * diag_deltaTime * accTime / _dist;
    _up = if (_dir#0 == 0 && _dir#1 == 0) then {
      [0,1,0];
    } else {
      _dir vectorCrossProduct [_dir#1 * -1, _dir#0, 0];
    };
    _velo = _dir vectorMultiply _speed;
    _obj setVelocityTransformation  
    [ 
      _p1, 
      _p2, 
      _velo, 
      _velo, 
      _dir, _dir, 
      _up, _up, 
      _interval
    ];
  } forEach movingObjs;

}];
little raptor
tidal ferry
#

Will do

#

Same setVariable code?

little raptor
#

yeah

tidal ferry
#

Same result

little raptor
# little raptor ```sqf if (missionNamespace getVariable ["alreadyExecuted", false]) exitWith {};...
if (missionNamespace getVariable ["alreadyExecuted", false]) exitWith {};
movingObjs = [];
alreadyExecuted = true;
addMissionEventHandler["EachFrame", {
  {
    _obj = _x;
    _p1 = getPosWorld _obj;
    _p2 = _obj getVariable ["destination", _p1];
    _dist = _p1 vectorDistance _p2;
    if (_dist  < 0.1) then {
      movingObjs = movingObjs - [_x];
      continue;
    };
    _speed = _obj getVariable ["speed", 1];
    _dir = _p1 vectorFromTo _p2;
    
    _obj setVectorUp [0,0,1];
    _obj setVectorDir _dir;
    _velo = _dir vectorMultiply _speed * diag_deltaTime;
    _obj setPosWorld (getPosWorld _obj vectorAdd _velo)
  } forEach movingObjs;
}];
#

@tidal ferry what about that?

tidal ferry
#

Trying it

#

No visible effect

#

Wait I entred it wrong one sec

#

Same result as before

#

Just rotates to exact north and lowers by a few hundred meters

#

WAIT

#

It's slowly moving

#

Think we may have got it

little raptor
#

it has nothing to do with velocity transformation and stuff anymore

#

if your object doesn't still move the problem is your object

tidal ferry
#

Okay awesome

#

Guesss we're just cursed then

little raptor
#

you are meowsweats

tidal ferry
#

Fantastic

#

I'll have a look at this and see if I can reverse-engineer further

fair drum
tidal ferry
#

Oh my God, @little raptor, thank you 😆

#

You have no idea how much time you've saved me here

little raptor
tidal ferry
#

The last code worked

little raptor
#

you said no meowsweats

tidal ferry
#

Oh sorry

#

I said no, but then realized I typed it wrong

#

Then I corrected it and ssaid it worked

#

My bad 😅

#

That last iteration worked

#

In SP, at least

#

Going to test it for MP but should be just what I need

#

Thanks a ton for your time and help and patience

#

No way I would have been able to sort it with my sanity intact

dapper cairn
#

So sorry if this isnt the right channel for his but if there a script/trigger i can place on a radio for the players to interact with and activate to set off a bunch of explosives?

The players basically mouse wheel on a radio and select a function and it sets off a series of explosives

still forum
vivid estuary
#

quick question. whats the best way to execute a slot restriction script for a Dedicated server?

currently i have it as

init.sqf
[] execVM "Scripts\Restrictions\PilotCheck.sqf";

PilotCheck.sqf
https://www.sqfbin.com/bovavopomebalegosuju

vivid estuary
echo smelt
#

Anyone here know much about Sql work and database work?

hallow mortar
# vivid estuary on the radio init field ```this addAction ["Detonate Explosives","Scripts\Explo...

The addAction should have some extra parameters so the players can't activate it from the default 50-metre range. (https://community.bistudio.com/wiki/addAction)
The detonation script needs some tweaking. For example, to apply a command to multiple targets, you would need a forEach and an array:

{ _x setDamage 1; } forEach [bomb1,bomb2,bomb3];

But the setDamage command may not be right - it doesn't work with all explosives. You might need to instead use the ol' reliable fallback:

{ _bomb = createVehicle ["Bo_GBU12_LGB",_x,[],0,"CAN_COLLIDE"]} forEach [targetobj1,targetobj2];```
The script also needs some way to remove the action once it's been used. If it's okay to remove all actions from the radio, then `remoteExec` and `removeAllActions` will be all you need. If you want to only remove that specific action and leave others, it gets a little more complicated.
dapper cairn
#

this addAction ["Destroy Charges",{ _x setDamage 1; } forEach [charge1,charge2,charge3]];

Okay... so im using a radio (ground static item) to set off the satchels... im close but now with the above line they just go off when nothing being pressed aka, the Destroy Charges action was not selected

warm hedge
#
this addAction ["Destroy Charges",{{ _x setDamage 1; } forEach [charge1,charge2,charge3]}];```
dapper cairn
#

I love you

past wagon
#

If I take a plane (with a pilot in it), put it in the air in the exact direction I want it to fly in, and give it a waypoint also in the exact direction I want it to fly in, then what type of AI should I disable in order for the pilot to fly in a completely straight line and not make any deviations from the path? anyone have any suggestions?

mossy lark
#

You could just use unitCapture and unitPlay for that

past wagon
mossy lark
#

good question, not sure

past wagon
#

ok I will check it out

#

yeah, I don't think unitCapture is a good option for me. I need it to fly for like 4 minutes

crude vigil
past wagon
crude vigil
signal hazel
#

Hello everyone! Havent posted in a while here, and the time has come. I've been making a custom tank composition for a while now, and some problems have stopped me from completing it. Its a Jagdtiger, and ii havent had any issues till the cannon of the tank. Originally i wanted to use a flak36 cannon, but there are no "animateSource ["base_Hide",1]; and so the base of the cannon sticks out. So I used the Pak40, hid the wheels and stands and locked it in place. there are some issues with it too! the cannon is mad tiny and when i try to attach anything to it, and move the tank, the attached item to the pak40 glitches back and forth like crazy. Any solutions to that? Either to use the Flak36 without the base (legs) or to attach a barrel to the >cannon< of the Pak40, so it can turn with the cannon, if it can be done. Thanks in advance! (pls ping if you have any answers)

leaden merlin
#

Very simple question here. How can I get a vehicle to move once people gave boarded it? I'm really lost on how to trigger this properly.

versed widget
#
if !(isNull objectParent player) 
then {while {speed vehicle player >= 200} 
do {addcamshake [5,5,5]; sleep 0.3};};
}```
can someone help me with this, it seems that the statement has no effect at all until i flip the greater than to smaller than
winter rose
pliant stream
#

jesus christ that formatting

versed widget
#

i still didnt get it, i took the example from the wiki
if (speed _truck1 >= 100) then {hint "You're going too fast!"};
i just changed the _truck1 with vehicle player, no hint appeared after hitting 100

winter rose
#

that's because the check is immediate

#

it's not wait until vehicle's speed >= 100

versed widget
#

ah ! well that explains it

leaden merlin
#

This is a scripting issue that I'm lost on because I'm just a dumbdumb I guess. What I am trying to do is better understand how in missions you can have transports function well. My goal with the included mission sample is trying to get the transport to pick me up, drop me off, move ahead and wait there, and do that a few times. The only workaround I found was by disabling the AI to move and create a proximity trigger between me and the vehicle, but this is absolutely ineffective because it will only work once and not repetitively. Obviously transports aren't limited in this way, so I want to learn how to accomplish that.

Sample is in the VR map with vanilla assets so I tried to make it available for anybody to give me novice pointers here. Big thanks to anyone who wants to help what's likely one of the easiest questions regarding the editor. :p https://www.dropbox.com/s/50zewz0bmn003nw/WhatOnEarthAmIDoingWrongHere.VR.pbo?dl=0

#

It's missing triggers btw as I've been messing around the last two hours and still haven't a clue what I'm doing. Ignore that as the "obvious" mistake. Look at it as a template where I'd like to see a working solution.

tough abyss
#

Waypoints?

#

Could just set waypoint condition to wait until you're in the transport

#

Move to scripted location

#

Repeat arbitrary times

leaden merlin
#

What would be the most efficient way of doing that? Like, the easiest way to set it up that any group that has that waypoint would meet the conditions. I've seen some for the player but I was hoping to better understand groups.

tough abyss
#

@leaden merlin Depends how you'd want it implemented

#

Would you want the entire group to be in the transport before it moves or just one or two or ?

#

Lots is left up to your discretion

leaden merlin
#

whole group, ideally. I'm absolutely lost on it

tough abyss
#

Well for the most basic implementation of that it'd literally just be this for the condition

#
_allInVehicle = true;
{
  if (vehicle _x != _vehicle) exitWith {_allInVehicle = false};
} forEach (units _group);
_allInVehicle
#

With _vehicle being the transport in question and _group being the group in question

#

obviously many ways to implement it and this is just barebones

#

but it's the general idea

#

you'd probably want to handle cases where the vehicle can't fit the entire group

leaden merlin
#

I think I understand the conditions of that, but my brain is completely fogging out seeing it all click in the editor. That would be the trigger, yeah?

tough abyss
#

That would be the waypoint condition for the initial movement

#

so if that's what you mean by trigger then yes

leaden merlin
#

So, big picture, how would this go? Disable the driving AI at a pickup spot, link the waypoint trigger as above with the condition to move so it can move, and repeat that?

tough abyss
#

Yup pretty much

#

as I said the fine details are largely up to you but that's the gist of it

copper raven
#

you can write it like this: units _group findIf {objectParent _x isNotEqualTo _vehicle} == -1

tough abyss
#

technically you could shorten the above code to just

((units _group) findIf {vehicle _x != _vehicle}) == -1;

#

yup

#

was just writing that

#

though I did a forEach because the iteration may come in handy for other checks you may add in the future

#

cleaner to add more lines to the forEach than to chain conditions in a findIf

leaden merlin
#

The trigger just needs to be linked to the vehicles waypoints too, right?

tough abyss
#

In 3DEN?

leaden merlin
#

Yes

tough abyss
#

Not sure about the specifics of how 3DEN does it but that sounds right

#

I usually only set up waypoints via script

leaden merlin
#

thank you this worked

#

I have been trying to grasp this all morning.

tough abyss
#

Glad it worked and glad I could be of help

#

I would heavily recommend looking into the group-related commands on the wiki if you want to get a better grasp on working with them

leaden merlin
#

My issue was trying to understand the start-and-stop logic behind the transport itself. It wasn't so much whom to set as a trigger but more about how the underpinnings of it go.

tough abyss
#

Ah, that's fair enough

#

Hopefully this served to make things more clear then :)

leaden merlin
#

It did!!!

final sun
#

Hello,I have a simple question. Can a custom function be called inside an event handler? I'm getting an error and I'm just checking I'm not looking for the wrong thing.

proven charm
#

sure can

final sun
#

Weird, I'm getting an undefined variable in expression. But both variables are defined and exist. I even tried hardcoding the variables and the result is the same

tough abyss
#

Show code?

final sun
#

lines 55-76

tough abyss
#

What's coming up undefined?

willow hound
#

_unitTargetFunc 🙃

tough abyss
#

Would make sense if that's the case

#

local function definition trying to be called from an EH

final sun
tough abyss
#

Yup alright then

#

_unitTargetFunc is locally scoped

#

the EH does not get run in the same scope when the player dies

#

thus the function does not exist and you get that error

#

if you want to fix that you'll either want to make the function globally scoped via some means or pass it as a param to addEventHandler

#

nvm thinking of something else for the latter

final sun
#

Thanks for the info, If I make the function global though It seems I have to make a lot of my variables global as well otherwise it throws a similar error but this time for the function. I though it was never a good idea to make anything global am I wrong?

tough abyss
#

Functions are generally best made global unless you have a good reason to pass them as parameters

#

Or more simply unless you're not accessing them from outside of the local scope

#

In your case you need global access to the function for how you're trying to do this

#

As far as causing more errors

#

That'd be because you're accessing vars that are part of that file's local scope as part of that function

#

The thing to understand is that this is what's happening

#

Your file runs -> file defines locally scoped functions and vars -> sets up Killed EH -> file ends -> locally scoped functions and vars no longer exist

#

so then when your EH code gets run it's trying to call a function that no longer exists

#

same with your vars that your function uses such as _Threats

#

so you need to either make those vars globally scoped or rethink how you're doing things

final sun
#

That's a really good explanation, thanks I'll look into it. Though I might pick the lazy way and just make them all global even though I might regret it later

tough abyss
#

Global is only evil if you use it poorly

#

It's more about knowing when/how to use things than avoiding things entirely, they all have purpose

vivid estuary
frozen seal
#

Hi everyone!
So I can get all nearest tanks using this:

_all = nearestObjects [_this select 0, ["Tank"], 50];

#

What should I replace "Tank" with to get list of all nearest projectiles/bullets?

#

I tried "Bullet" and "Projectile" but that's not it.
Is there a doc page with a list of all available object types?

tough abyss
#

@frozen seal So a couple things to consider here

#

As I had to do this same sort of detection for my current mod

#

Firstly, I'm going to assume you're aware that that command only gets the nearest tanks within 50m, not all tanks

#

Secondly, the command and methodology to use is going to change depending on what you're trying to detect

#

As far as object types go you're just using class names, so if you look through config viewer that is essentially your list of object types

#

Combine that with inheritance and you can fine-tune what you detect

#

Now the main thing for you to keep in mind is that there is no general class that all projectiles inherit from

tough abyss
#

Generally all bullets inherit from BulletCore/BulletBase

#

but projectiles in general vary widely

#

from RocketCore/ShellCore/etc.

#

depending on what they are

frozen seal
#

I see. Let me give you a broader context of my problem. I'm trying to modify this script to work with tanks. Right now it only works with small arms and tank machinegun but not tank main gun:

_projectile = nearestobject [_this select 0,_this select 4];

setacctime 1;
_camera = "camera" camCreate (getpos _projectile);
_camera cameraeffect ["internal", "back"];
while{alive _projectile && alive _camera}do
{
_camera camSetTarget _projectile;
_camera camSetRelPos [0,-13,1.2];
_camera camCommit 0;
sleep 0.00001;
};
if(alive _camera)then{sleep 0.1};
_camera cameraeffect ["terminate", "back"];
camdestroy _camera;
setacctime 1;
#

I'm super new to scripting (but not to programming in general) so I might be missing some obvious things

#

I figured _this select 4 returns the current projectile type and it works fine with small arms, but for some reason it fails to work with tank main gun (nearestobject returns null)

tough abyss
#

Generally nearObjects is better for detecting things like projectiles than nearestObject/nearestObjects

#

So that could be part of it

#

Other than that I'm not sure, so I'd give that a shot

frozen seal
# tough abyss Other than that I'm not sure, so I'd give that a shot

Sorry for noob question but scripting synthax melts my brain after years of coding in C#

I can't make getPos work in this case:

_pos = getPos _this select 0;
_projectile = _pos nearobjects [_this select 4];

(the script called from "fired" event, so if the documentation is correct _this select 0; should return the shooter, however I still get type mismatch error)

hollow thistle
#

unary operator has higher precedence than binary

#

getPos _this select 0;

#

getPos _this => result

#

result select 0

#

change to getPos (_this select 0);

#

projectile should be passed to fired EH btw

frozen seal
# hollow thistle `getPos _this select 0;`

That still gave me errors (something about 1 element provided, 2 expected).
But your advice about fired event having projectile argument is correct. No need for nearestobject. I wonder why did the original author use it.
Thank you!

hollow thistle
#

also

#

!quote 5

lyric schoonerBOT
hollow thistle
tough abyss
#

ASL and World are your friends

#

ATL is shady but sometimes useful

plush belfry
#

Is there a good video or tutorial someone could point me to? I wanna get into scripting in Arma, or is the documentation also good enough to learn it?

past wagon
#

Would setVectorDir [0,0,0] make an object completely level?

tidal ferry
#

Hey, question

#

Anyone know what the best way to rotate an object 90 degrees on the Z axis, relative to its current orientation, is?

digital hollow
#

new dir would be dir-cross-up

tidal ferry
#

Ah nvm, found it

#

Thanks

#

On a related note, anyone know the classnames for the MLRS explosion?

#

Or really just, the largest possible explosion in vanilla arma 😆

#

E.g. "HelicopterExploBig" but b i g g e r

tidal ferry
digital hollow
#

forward vectorCrossProduct up gets you the right side direction vector

little raptor
brazen lagoon
#

this is kind of a #server_admins question but I think its a bad script or something

#

what is a normal count of guaranteed messages?

#

as in, 3000 guaranteed messages in a second. that's really high, right?

tidal ferry
leaden merlin
#

Another question here! Looking to see how to get waypoints working in a script. For example...

"waitUntil {leader group player in truck1};"

How can I alter that to clear when a group enters the truck? I can understand individual units, but I wanted to get it working with a group. I tried replacing that with a group name directly, so unless that has to be formatted differently, I'm a bit lost.

little raptor
#

how to get waypoints working in a script
what does that have to do with waypoints?

#

and you can't suspend in waypoint statements so I have no idea what you're talking about

past wagon
#

How would I use setVectorDir to make an object completely level to the horizontal?

#

Sea level…

tidal ferry
#

Why do vectors have to be so confusing notlikemeowcry

little raptor
#

not dir

little raptor
#

what's confusing about vectors?

tidal ferry
#

Just terminology, trying to describe rotations and such

#

Anyways- still having trouble with the thing I'm trying to do

#

I need to "pitch" an object I have about 90 degrees

#

Irrespective of rotation

past wagon
tidal ferry
#

Need to execute the script with multiple different objects, each with different rotational orientations

little raptor
#

pitching is not rotation about Z

tidal ferry
#

I'm new to vectors

little raptor
#

it's about X

tidal ferry
#

Okay

#

So then, how to pitch it 90 degrees relative to its current orientation?

little raptor
#

you have to change the vectorDir and Up:

_y = vectorDir _obj;
_z = vectorUp _obj;
_x = _y vectorCrossProduct _z;
_newZ = _y;
_newY = _newZ vectorCrossProduct _x;
_obj setVectorDirAndUp [_newY, _newZ];
#

this is -90 deg rotation about X

tidal ferry
#

Okay, thanks, I'll try this

little raptor
#

if you want +90 negate _newZ

tidal ferry
little raptor
tidal ferry
#

So like... _newZ = _newZ vectorMultiply -1?

little raptor
tidal ferry
#

Gotcha

little raptor
tidal ferry
#

Worked like a dream

#

Fantastic

#

Well, I'm figuring out now that apparently the model is upside-down 😆

#

Think I need to roll it 180 on the y-axis

little raptor
tidal ferry
#

I thought rotating it 90 degrees would work perfectly

#

Which it mostly did

#

But it needs to be rolled 180 degrees after that

#

So I need to rethink this a bit nootlikethis

#

Okay so

#

Pitching -90 degrees, then rolling 180 degrees will work

#

My single brain cell is feeling pretty confident in that

#

Let me see if I can figure this out

#

Yeah nope clueless

#

I'm sorry, I'm a writer, not a mathematician

little raptor
#

180 deg roll is just reversed up

little raptor
tidal ferry
#

Okay, so _z multiplyVector -1?

little raptor
tidal ferry
#

Bless 🙏

little raptor
#

also it's vectorMutiply...

#

where on earth did you get multiplyVector meowsweats

tidal ferry
#

It was a gift from my last remaining brain cell

#

Finally got it working as intended, thanks so much for your help and guidance @little raptor 🙏

real tartan
#

how can I parse Line One (something) from string Line One (something)<br/>Some Line two</br> ?

pliant stream
#

quaternions is where it's at. don't need to think about vectors 🙂

little raptor
#

SQF has native matrix and vector support so it's several times faster

#

and easier

pliant stream
#

sqf doesn't offer any matrix interface either though

little raptor
#

it does

pliant stream
#

really

#

those vectorBlahBlah functions, do they work on vectors of any dimension?

little raptor
#

2 and 3

pliant stream
#

lame

#

what a missed opportunity

#

oh there is matrix multiply and transpose

#

but you can't get or set the transform matrix of an object can you?

little raptor
#

you can make it yourself

pliant stream
#

well not really

little raptor
#
_y = vectorDir obj;
_z = vectorUp obj;
_x = _y vectorCrossProduct _z;

_mat = matrixTranspose[_x, _y, _z];
pliant stream
#

now do skew

little raptor
#

that gives the rotation matrix

#

wat?

pliant stream
#

you know what skew is, yes?

little raptor
#

no

#

maybe I call it something else

tidal ferry
#

Hey, so does anybody know the best way to check what an object's 3den layer is?

#

I'm working on a script to help our missionmakers optimize their missions, but I'm having trouble finding a simple way to grab 3den layer on a specific object

#

Is that information available to check from an object in a mission?

cosmic lichen
#

Getting the layer an object belongs to is not possible IIRC.

tidal ferry
#

Hrm

#

Well, is there any way to list all available 3den layers?

little raptor
#

and then finding the object is the list of objects?

tidal ferry
#

That's my current working plan

cosmic lichen
#

That would work but it's not a direct way

tidal ferry
#

Just need a way to find all missionn layers

cosmic lichen
#

from object to layer

pliant stream
little raptor
cosmic lichen
#

to get all layers, use
getMissionLayerEntities layerID together with for

little raptor
#

objects have no shear in Arma

pliant stream
#

well some do

#

not your objects

tidal ferry
#

Wait found it I think

little raptor
tidal ferry
#

Perfect

#

Got it

cosmic lichen
#

Ha! Didn't remember that command 🤦‍♂️

#

Perhaps I should fix see also on the biki done

pliant stream
little raptor
#

sure, but I don't think it's really needed to take into account thonk

pliant stream
#

how's that?

little raptor
#

because you can't "set" the shear

pliant stream
#

right, that's the problem isn't it?

#

that there is no object setTransform matrix command

tidal ferry
#

Another question for params specifically

#

So, I want my script to only accept object datatype

#

So currently params looks something like...

#
params [["_object",objNull,[objNull]]];
#

(I'm aware this is bad, will clean it up later)

#

But, for data type argument

#

What do I put there?

#

Do I just put something referencing an actual object? Or do I need to put a string like "object" or somesuch in?

#

Or well, better example would be like

#
params [["_trueOrFalse",true,[true]]];
#

Might've answered myself but still would love to be sure

little raptor
#

or all lods skewed?

little raptor
pliant stream
#

It's part of the transform matrix

#

Why wouldn't it be all lods

little raptor
#

I don't know

pliant stream
#

It's no different from rotation

little raptor
#

undesired effect or something?

tidal ferry
pliant stream
#

You know setting the transform would give you scaling too

little raptor
#

and set it too

#

but not as a matrix

pliant stream
#

Oh really

#

I didn't know you had scaling control in A3

little raptor
#

it's new

pliant stream
#

What command is that

little raptor
#

setObjectScale

#

it's scalar tho, not vector

pliant stream
#

Oh

#

Lame

fervent kettle
#

using the following

titleCut ["Transport zur Front wird vorbereitet...", "BLACK FADED", 18, false ,false];
*some code*
sleep 16;
*some code*
sleep2;
titleCut ["", "BLACK IN", 2];

in theory it should wait 18 seconds with black screen before returning to normal, right?

winter rose
fervent kettle
#

@winter rose

        [west, "HQ"] sideChat "Transport is being prepared!";
        sleep 3.5;
        player enableSimulation false;
        titleCut ["Transport zur Front wird vorbereitet...", "BLACK FADED", -1, false ,false];
        [player, ["hmvv", 125, 0]] remoteExec ["say3D", ([0, -2] select isDedicated), false];
        sleep 16.0;
        titleCut ["", "BLACK IN", 2];
        player enableSimulation true;
        sleep 2.0;
        _player setPosATL (getPosATL createRespawn vectorAdd [random 3, random 5]);
little raptor
#

can't you control all that using one titleCut?

fervent kettle
#

basically, the black should last 18 secs before returning to normal

tidal ferry
#

Can you assign variables to simple objects?

winter rose
tidal ferry
still forum
#

Yes you can

tidal ferry
#

Sick

still forum
#

I'm pretty sure CBA uses that for their namespace thing

fervent kettle
#

I got it to stay black, but how do I end the black now 😮

winter rose
#

How you did should do

little raptor
still forum
#

There was bug once where map processed locations even if invisible and it killed map fps

#

Don't they use location and simple object now? Depending on global or not?

little raptor
#

_isGlobal isEqualTo true
meowsweats

#

well simple objects have local version too... meowsweats

#

why not use that then? thonk

winter rose
fervent kettle
still forum
winter rose
still forum
winter rose
#

I dream of a super strict language like C# is (was?) and despise JS and its ===

still forum
#

Let me tell you about a thing called Enforce Script kittypet2

winter rose
#

harr harr 😁
yeah I heard the legend…

vivid estuary
#

anyone know anything about registering items for ACE Fortify and executing a pushback on fortify_locations?

i have my script for it but it keeps throwing an errors for missing ; or ,

https://www.sqfbin.com/izowesunefaqecojavum

steel fox
#

is it still acex? didn't some of that change due to the merge?

vivid estuary
faint oasis
#

can we attachto and enable the "Freelook" ?

little raptor
faint oasis
past wagon
#

can someone please explain to me the syntax for the Vector3D array that I need to use with setVelocity? I just need to set an object's speed to a set amount, say, 500. The other elements I would like to leave as they are. It says it's in the format [x, y, z] but I'm not sure what is what.

plush nova
#

where is unit init called/local to? it seems like editor-placed units run their inits on the server

#

is this true for created units too? or are those created wholly-locally

faint oasis
plush nova
#

Sorry I mean the init in the cfgvehicles def

#

If you createunit is that also run everywhere?

tough abyss
#

Yes

past wagon
tough abyss
#

The velocity vector is just m/s along each axis

#

So set the velocity along the direction you want

#

Which is most easily done by setting the velocity to the vectorDir multiplied by your desired velocity

#

@plush nova also group locality can mess things up, so even though it's global you should exec the command on the client that the group is local to

#

And then it should have no issue creating the unit on other clients as well

plush nova
tough abyss
#

Yeah, though you could get around that with a remoteExec to the client that it's local to

plush nova
#

Right, call createunit directly* is what I meant

tough abyss
#

Yup

past wagon
vivid estuary
#

anyone know what the turret path for the tank commander is?

#

im thinking its [_veh turretUnit [0]] but im just trynna make sure before i bring a server down to change it just to be wrong

tough abyss
#

@past wagonMultiplying the entire vector with vectorMultiply would result in the same as multiplying each individual component and putting them back together if that's what you're asking

#

If you multiply them by differing amounts it will no longer be the same direction

past wagon
#

ok

#

well that doesnt seem to be working for me either

#

can anyone else come up with a script that just makes a plane fly in the exact same direction at a constant velocity for like 4 minutes? because I've been trying for hours and I seem to not be capable of doing so lmao

little raptor
plush nova
#

Hmm is it generally a good idea to use setvelocitytransformation instead of setvelocity if you want "smooth" movement over mp with fine control

little raptor
#

both are good

#

setVelocityTransformation needs manual control over movement

plush nova
#

So I noticed my units stutter a little with just setvelocity

#

(only in mp)

past wagon
#

ok

little raptor
#

you can try that too blobdoggoshruggoogly

past wagon
#

what is the interpolation interval?

little raptor
plush nova
little raptor
#

I mean you have to control everything

past wagon
little raptor
#

position, vec dir, up

past wagon
#

ik

little raptor
#

then figure it out on your own

past wagon
#

i mean, thanks a lot for telling me about that command because its literally everything I want in one

past wagon
#

i dont like copying other people's scripts

little raptor
#

e.g. if you have two points an interval of 0.5 means midpoint

past wagon
#

ok. so what effect does it have on the command in this context?

#

ohh

#

is it basically the point at when the changes occur?

#

or the midpoint between the two sets of states?

little raptor
#

0 means state 1

#

1 means state 2

past wagon
#

ohh

little raptor
#

any value between 0 and 1 is interpolated between state 1 and 2

past wagon
#

oh

#

so it picks which ever stage you give it via the interpolation interval and sets the object to that stage?

little raptor
#

just read it

tidal ferry
#

Hey, anyone know ACE interaction framework well enough to help me get ace_interact_menu_fnc_addActionToObject working in multiplayer?

#

...Wait, hold on

past wagon
#

why does a plane flying in a constant direction at a constant velocity have to be this complicated....?

plush nova
#

the velocity you give it is a "hint" for mp sync

#

basically what you're saying when you call setvelocitytransformation is "this object is on rails between point A and point B"

#

and the interval is where on the rail it is

past wagon
#

so it instantly sets the object to that point on the rail?

plush nova
#

the velocity does nothing on SP

#

yes

#

on MP the velocity is designed to be a "best guess" of how fast you're moving on those rails

little raptor
past wagon
#

okay then this command has nothing to do with what I need

plush nova
#

although most usages of it i've seen hit it on eachframe anyways

#

so basically the way you could use it is each point in time you set it to a different place on the rail, and if you do this on every frame this looks like movement

tidal ferry
#

I am a buffon, carry on

past wagon
#

but if I have a specific point in the mission when I want the plane to start flying, then how does the onEachFrame EH work?

#

wouldn't that be initialized at the start of the mission, so my code would start running right away?

little raptor
past wagon
#

okay

#

and its a mission eh

#

okay that makes sense

#

if I have the starting position, ending position, and direction of my object, what should I put for the velocity? I want the velocity to remain the constant

tidal ferry
#

Is there any way to check from inside of a script if it is called, or spawned?

#

E.g. if a called function is accidentally spawned, it will abort and return an error

little raptor
#

and velocity is _p1 vectorFromTo _p2 vectorMultiply _speed

uncut sphinx
#

Can I use hashmaps the same way one would use dictionaries in Python?

steel fox
#

Yes

little raptor
uncut sphinx
#

cool, wasn't sure if there was any additional subtlety

pallid prairie
#

Hello! Modding a legacy version of DayZ Standalone, 0.28, fully in SQF, and I'm having an issue. Since DayZ is all Enforce now I figured I'd have luck here. I'm trying to figure out how to allow scripts to run in a loop in the background on my server, first in the form of a debug menu showing FPS, location etc as a hintSilent. I've tried a few different things in my init.sqf, including call compile preprocessFileLineNumbers "debug.sqf" and [] execVM "debug.sqf" and neither method results in my debug menu appearing upon joining my server. debug.sqf is a simple file that starts a while loop and should call hintSilent with information about my name, UID, blood, shock and FPS. This script works perfectly in 0.14 but not in 0.28, is there something I am doing wrong?

#

This used to be easy as pie when I ran a 0.47 server so I'm probably missing something really simple

#

I added a diag_log to the sqf file and it isn't being logged so that must mean my script isn't even being called for whatever reason. Meanwhile I have a script in my root directory and use call compile preprocessFileLineNumbers for the hive saving script and it calls and loads just fine

surreal gorge
#

not s ure if right place, but is there a way to edit weapon attributes? like increasing range of MPRL AA?

pallid prairie
surreal gorge
little raptor
surreal gorge
plush nova
#

so i'm using _someUnit attachTo [player, [0, 0.04*25, 0.04*25], "pilot", true]; and it seems to work fine in SP, but on MP the attached object doesn't seem to follow the bone rotation

plush nova
#

it doesn't seem to have that option

jade acorn
#

yes you're right, I know that it works properly tho

#

but I think I have found a solution for you

#

wiki says you could use setDir and then _attachedObj setPosASL getPosASL _attachedObj to synchronize the movement over network in MP

#

also you have this

_expl1 = "DemoCharge_Remote_Ammo" createVehicle position player;
_expl1 attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"];
_expl1 setVectorDirAndUp [[0.5, 0.5, 0], [-0.5, 0.5, 0]];``` in the wiki, could try adjusting this for your needs to see if it works
plush nova
#

thanks, i'll try it out

formal sentinel
#

playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", _house, false, _pos, 1, 1, 150];

#

How do I increase the volume?

#

playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", _house, false, _pos, 4, 1, 150];
Can I change it like this?

winter rose
#

have you read the documentation?

formal sentinel
#

Yes, but because there are two 1's, it's confusing...

winter rose
#

the documentation's syntax does not use ones…

hallow mortar
#

It does, in example 2. But if you look at the Parameters list, you can count the parameters and compare them to the examples to see which is which. Remember: optional parameters can be dropped from the end, but never skipped.

winter rose
#

It does, in example 2

sssyyynnntttaaaxxx

hallow mortar
#

The examples are a demonstration of the syntax intended to help people understand it, no?

winter rose
#

I mean, the "Syntax" part of the doc doesn't use numbers, it lists parameter names

hallow mortar
#

Note: I'm not saying the example is wrong, I'm saying that's where the 1s came from and it's pretty reasonable

fervent kettle
#

which display IDD should I use for players on dedicated server? Just 46?

winter rose
fervent kettle
#

then the problem lies elsewhere. In SP and own hosted it works but on dedi it doesn't

winter rose
#

what do you even talk about?

fervent kettle
#

uh ye sorry, displayAddEventHandler

winter rose
#

…about what

#

it's a dedi, it doesn't even have interface

fervent kettle
#

adding a key-bind function

#

basically "Press Alt+F4 to Zeus yourself"

winter rose
#

Then you can
On players' machine

fervent kettle
#

Atleast I got that part right meowsweats , but somehow it is not doing it on dedicated server

#

that's what's in my init.sqf

doSomeStuff = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) == 54) then {_nul = [] execVM 'someScript.sqf'};"];
pliant stream
#

does 46 exist?

fervent kettle
#

46 is just the mission, so I'd assume yes?

pliant stream
#

assert (!isnull findDisplay 46)

fervent kettle
#

with the "assert" part?

pliant stream
#

what?

fervent kettle
#

if I should put the assert before the brackets, I have never seen that word

pliant stream
#
assert (!isnull findDisplay 46);
doSomeStuff = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) == 54) then {_nul = [] execVM 'someScript.sqf'};"];
fervent kettle
#

that's somehow also not working

pliant stream
#

anything in the logs?

fervent kettle
pliant stream
#

well at least we now know for certain that 46 exists

fervent kettle
#

yea

vague geode
#

Is there any way to find out how much blood a unit is loosing?

I know about the isBleeding and getBleedingRemaining scripting commands but I would like to know how heavily a unit is actually bleeding as in how many of those blood stains (slop_00.p3d) are getting created by the units injury...

tough abyss
#

@fervent kettleI doubt it'll change anything, but just out of curiosity it might be worth trying to pass a code param rather than a string

#

May be a strange side-effect of the string needing to be compiled

digital rover
#

I'm modifying an array server side and making it public with publicVariable. If called multiple times in 1 frame in an unscheduled environment, is the game smart enough to only update clients 'once' rather than spamming them?

Right now I'm making all the changes and calling publicVariable once, assuming that it isn't smart enough.

tough abyss
#

I don't believe so but someone who knows the implementation details might know for sure

fervent kettle
tough abyss
#
doSomeStuff = (findDisplay 46) displayAddEventHandler ["KeyDown", {if ((_this select 1) == 54) then {_nul = [] execVM 'someScript.sqf'}}];
fervent kettle
#

oh, that's simple and self explanetary

tough abyss
#

@digital rover Regardless I'd look into rethinking how you're doing things if something you're broadcasting is needing to be updated multiple times per frame at all

vague geode
tough abyss
#

You can run various commands that result in those actions but I'm not aware of any command that allows you to just pass those strings as a parameter

still forum
#

The network message is sent when you run the command

#

And it has to, because publicVariableEventHandler is a thing.