#arma3_scripting

1 messages · Page 754 of 1

trim quail
#

Amazing

viral marsh
#

Heya - I'm quite new to scripting, so any help would be appreciated. I'm looking for a way to display an image on the screen of all players in the game.

viral marsh
drifting portal
#

if I remote execute a command that returns a variable, how do I obtain that variable?

winter rose
drifting portal
#

local to a player that drives a certain vehicle

#

but I can't do anything with the camera without having it as a variable

open fractal
drifting portal
#

also its only the camCreate

#

I'm global executing

#

well to be precise

#

I'm executing to a single player on their client side

open fractal
#

You can remote exec whole functions and pass args

#

Camera controls are entirely local as well

winter rose
#

don't do myFnc = {}, that's the unsafe way

drifting portal
open fractal
#

cameras aren’t global

winter rose
#

The function has to be declared on the client
if you publicVariable such function, you saturate network

open fractal
#

Oh my bad misread

winter rose
#

@drifting portal save yourself some time and efforts, do it the proper way ;-)

drifting portal
#

thanks

open fractal
#

I gotta say Lou the first scripting tutorials I watched used execvm exclusively rather than CfgFunctions

#

it really did me dirty

ebon citrus
open fractal
distant oyster
#

its the straightforward, easy way

open fractal
#

one of them had me make a .sqs meowsweats

distant oyster
#

okay maybe dont trust that one 😄

ebon citrus
#

Like... 6 years?

#

Just feels like a curse word to me

fleet sand
#
    obj = (_this select 0);
    pos = position (_this select 1);
    rotateClockWise = (_this select 2);
    rotatespeed = (_this select 3);
    object = obj createVehicle pos;
    posASL = AGLToASL pos;
    t1 = time;
    t2 = time + rotatespeed;

onEachFrame{

    if(rotateClockWise == true) then {
        object setVelocityTransformation[
            posASL, //fromPosASL
            posASL, //ToPosASL
            [0,0,0], //fromVelocity
            [0,0,10], //ToVelocity
            [0,0,1], //fromVelocityDir
            [0,0,1], //toVelocityDir
            [0,1,0], //fromVectorUP
            [1,0,0],//ToVectorUP
           linearConversion [t1, t2, time, 0, 1] // how to make this infinily loop ?
        ];
    } else{
            object setVelocityTransformation[
            posASL, //fromPosASL
            posASL, //ToPosASL
            [0,0,0], //fromVelocity
            [0,0,0], //ToVelocity
            [0,-1,0], //fromVelocityDir
            [0,1,0], //toVelocityDir
            [0,0,1], //fromVectorUP
            [0,0,1],//ToVectorUP
           linearConversion [t1, t2, time, 0, 1]
        ];
    };
};

Hi guys i am trying to make object rotate in place.
Is there a way to make this interval loop between 0 and 1 infinitly ?
I mean it goes from 0 to 1 and once it reaches 1 goes back to 0?

open fractal
#

am I understanding this correctly?

#

can't you just reset t1 and t2 once t1 exceeds t2

#

like

#

my syntax is very wrong

#

hold on

#
        private _rotation = linearConversion [t1, t2, time, 0, 1, true] // how to make this infinily loop ?
        if (_rotation == 1) then {
            t1 = time;
            t2 = time + rotatespeed;
        }
        object setVelocityTransformation[
            posASL, //fromPosASL
            posASL, //ToPosASL
            [0,0,0], //fromVelocity
            [0,0,10], //ToVelocity
            [0,0,1], //fromVelocityDir
            [0,0,1], //toVelocityDir
            [0,1,0], //fromVectorUP
            [1,0,0],//ToVectorUP
           _rotation
        ];
    }
#

you can also pass local arguments and stack by using EachFrame event handlers

fleet sand
#

Ty very mutch this actually works.

open fractal
#

yw

fleet sand
# open fractal yw

i am sorry i have a question how would i pass local variable to event handler in this example ?

open fractal
#

there's a couple spots where I forgot underscores but you get the idea

#
addMissionEventHandler ["EachFrame", {
params ["_arg1","_arg2"];
},[_arg1,_arg2]];
fleet sand
# open fractal ```sqf addMissionEventHandler ["EachFrame", { params ["_arg1","_arg2"]; },[_arg1...
params ["_obj","_pos","_rotateClockWise","_rotatespeed"];

    _obj = (_this select 0);
    _pos = position (_this select 1);
    _rotateClockWise = (_this select 2);
    _rotatespeed = (_this select 3);
    private _object = _obj createVehicle _pos;
    private _posASL = AGLToASL _pos;
    private _t1 = time;
    private _t2 = time + _rotatespeed;


id = addMissionEventHandler["EachFrame",{
    params ["_obj","_pos","_rotateClockwise","_rotateSpeed","_object","_posASL","_t1","_t2"];

    private _rotation = linearConversion [_t1, _t2, time, 0, 1,true]; //error type any expcted number

    if!(_rotation == 1) then {
        _t1 = time;
        _t2 = time + _rotatespeed;
    };

    if(_rotateClockwise == true) then {

        _object setVelocityTransformation[
            _posASL, //fromPosASL
            _posASL, //ToPosASL
            [0,0,0], //fromVelocity
            [0,0,10], //ToVelocity
            [0,0,1], //fromVelocityDir
            [0,0,1], //toVelocityDir
            [0,1,0], //fromVectorUP
            [1,0,0],//ToVectorUP
            _rotation
        ];

    } else{
            _object setVelocityTransformation[
            _posASL, //fromPosASL
            _posASL, //ToPosASL
            [0,0,0], //fromVelocity
            [0,0,0], //ToVelocity
            [0,-1,0], //fromVelocityDir
            [0,1,0], //toVelocityDir
            [0,0,1], //fromVectorUP
            [0,0,1],//ToVectorUP
           _rotation
        ];
    };
},(_this + [_obj,_pos,_rotateClockwise,_rotateSpeed,_object,_posASL,_t1,_t2])];``` 
now i have error type any expected number. 
How would i fix this ? error line is marked.
warm hedge
#

Mission EH's arugments are _thisArgs, not _this

quasi rover
#

around 100 MP EventHandlers("MPHit") on buildings affect on server performance?

open fractal
#

params does all that for you

#
params ["_variable"]
_var = _variable; //_var = _this select 0;
ebon citrus
#

And pueely depend son what code you execute in the EH

#

If it's just empty, no, no performance impact what so ever

warm hedge
fleet sand
# open fractal `params` does all that for you

ok i get that now second question so those local parameters can enter in EH parameters ? or do i have to again have params in EH? Also how _thisArgs works i am not 100 % clear on that

warm hedge
#

If you put 123 into arugments there, _thisArgs is 123

#

Same if is an array

open fractal
#

most arguments are passed through _this, but in the mission eventhandler it's _thisArgs

warm hedge
#

Also params takes _this by default (if you don't specify) so you need to do like _thisArgs params []

fleet sand
warm hedge
#

Check out the link I posted above

warm hedge
#

Since Mission EHs also had _this you can't just refer _thisArgs w/o specifing it

open fractal
#

oh that's right, because the passed args are separate

#

this is why you make the mods and i make the funny go-kart scripts

warm hedge
open fractal
#

@fleet sand in case you're still confused, this means it should be

addMissionEventHandler ["EachFrame", {
    _thisArgs params ["_obj","_pos","_rotateClockwise","_rotateSpeed","_object","_posASL","_t1","_t2"];
#
_thisArgs params ["_obj","_pos"];

does the same thing as

private _obj = _thisArgs select 0;
private _pos = _thisArgs select 1;
fleet sand
open fractal
#

so what I wrote out for you combines your original arguments with the newly defined variables and passes it all to the event handler expression

#

I should clarify you can't access local variables without passing them as arguments in the event handler expression

#

onEachFrame, which you had previously, couldn't pass arguments at all which is why you had that mess of global variables

warm hedge
#

Also, the answer to the possible why (what he said tho): You need to specify what variables to be used in the Mission EH, because by default are undefined in it. Keep it mind that every EHs use their own scope, every local things out of them can't be used w/o decrearing it

open fractal
#

and in case you didn't catch it

params ["_obj","_pos","_rotateClockWise","_rotatespeed"];

    _obj = (_this select 0);
    _pos = position (_this select 1);
    _rotateClockWise = (_this select 2);
    _rotatespeed = (_this select 3);

is redundant. you can just write

params ["_obj","_pos","_rotateClockWise","_rotatespeed"];
#

except _pos since you modify that

#
private _pos = position _pos
``` would work
#

or better yet

private _posASL = getPosASL _pos;
``` considering the context
#

two birds with one stone

warm hedge
#

Technically pointless execution works everytime, but is just pointless

fleet sand
#
    params ["_obj","_pos","_rotateClockWise","_rotatespeed"];
    private _object = _obj createVehicle _pos;
    private _posASL = AGLToASL _pos;
    private _t1 = time;
    private _t2 = time + _rotatespeed;


_id = addMissionEventHandler["EachFrame",{
    _thisArgs params ["_rotateClockwise","_rotateSpeed","_object","_posASL","_t1","_t2"];

    private _rotation = linearConversion [_t1, _t2, time, 0, 1,true]; 

    if!(_rotation == 1) then {
        _t1 = time;
        _t2 = time + _rotatespeed;
    };

    if(_rotateClockwise == true) then {

        _object setVelocityTransformation[
            _posASL, //fromPosASL
            _posASL, //ToPosASL
            [0,0,0], //fromVelocity
            [0,0,10], //ToVelocity
            [0,0,1], //fromVelocityDir
            [0,0,1], //toVelocityDir
            [0,1,0], //fromVectorUP
            [1,0,0],//ToVectorUP
            _rotation
        ];

    } else{
            _object setVelocityTransformation[
            _posASL, //fromPosASL
            _posASL, //ToPosASL
            [0,0,0], //fromVelocity
            [0,0,0], //ToVelocity
            [0,-1,0], //fromVelocityDir
            [0,1,0], //toVelocityDir
            [0,0,1], //fromVectorUP
            [0,0,1],//ToVectorUP
           _rotation
        ];
    };
},[_rotateClockwise,_rotateSpeed,_object,_posASL,_t1,_t2]];```
Ty guys for explaning. This is what i have now and _rotation once its reaches 1 it never gets reset any tips on that ? @open fractal
quasi rover
# ebon citrus Why?

not coded yet, but try to:

{
    _x addMPEventHandler ["MPHit", {
        params ["", "", "_damage", "_instigator"];
        if (_damage > 0.1) then {
            _x setVariable ["attacker", _instigator];
        };
    }];        
} forEach _buildings //arond 100 buildings
open fractal
#

otherwise you might get moderated

fleet sand
open fractal
#

so just move the if then above _rotation i think

#

so that the variables actually properly update before they're used

#

wait

#

that won't work

#

I'd remove _t1 and _t2 from params and just define them on the first iteration

#
_id = addMissionEventHandler["EachFrame",{
    _thisArgs params ["_rotateClockwise","_rotateSpeed","_object","_posASL"];
    if (isNil {_t1}) then {
        _t1 = time;
        _t2 = _t1 + _rotatespeed;
    }

    private _rotation = linearConversion [_t1, _t2, time, 0, 1,true]; 

    if (_rotation == 1) then {
        _t1 = time;
        _t2 = _t1 + _rotatespeed;
    };
#

edited that one ^ accidentally made the variables private

#

will clean up the code in a minute

open fractal
#

I did it wrong anyway

#

im not smart enough to tell you if you can store the local _t1 and _t2 between iterations

#

mm yeah there's the issue

#

until someone more experienced can chime in I'd say just settle for a global variable or setVariable for your t1 and t2

fleet sand
#

I just put t1 and t2 as global variables and it works but as soon they are local it dosent

open fractal
#

yeah those specifically can't be local variables because they have to carry over between iterations

#

my bad

#

if you want to create multiple objects you can assign it to the object itself with setVariable

fleet sand
fleet sand
open fractal
#

i'll show you

#

probably won't work perfectly but

_object setVariable ["t1",serverTime];

this basically attaches the t1 variable to _object and stores serverTime in it

#
private _t1 = _object getVariable ["t1",0];

this grabs that stored value, and if it isn't found it substitutes 0

#

hence ```sqf
if (_t1 == 0)

#

i think t1 is the only variable that needs to work like this since everything else is a constant

fleet sand
open fractal
#

but yes setVariable and getVariable are great to fall back on if you need to work outside of the local scope

#

here it can be even more efficient

#

wait i lied i dont know what i was going to do

winter rose
open fractal
#

@fleet sand you can put ```sqf
_object setVariable ["t1",serverTime];

before the event handler
#

and cut out ```sqf
if (_t1 == 0) then {
_object setVariable ["t1",serverTime];
_t2 = _t1 + _rotateSpeed;
};

#

that way it won't run that check on every frame

open fractal
little raptor
#

have you guys been trying to make an object rotate for 6 hours? thonk

open fractal
#

yeah

#

off and on

#

times are tough when you aren't around leopard

fleet sand
open fractal
#

tbf the object worked a while ago we've just been mashing brain cells together to make it cleaner

little raptor
#

you can just make 1

open fractal
#

you know that colony collapse thing that happens with bees

#

that's what my neurons are doing

open fractal
little raptor
#

yes

fleet sand
#

ah well i was trying so i can dinamicly create the object to rotate around so mission would be running and i can on flip of a switch make object rotate around.

little raptor
open fractal
#

damn

#

that'll do it

little raptor
open fractal
#

that check if the eventhandler already exists is a large cranium maneuver in my eyes

#

it's almost like you've done this a while

little raptor
#

I have

little raptor
#

use time

fleet sand
#

i was running this in server enviormente at least i hope.

little raptor
#

you should still use time

open fractal
#

is time more efficient?

little raptor
#

no

#

same

fleet sand
#

dosent that mean that diffrent players would see in diffrent position the object that is rotating ?

little raptor
#

no

fleet sand
#

"Returns time elapsed since mission started (in seconds). The value is different on each client. If you need unified time, use serverTime." This is form wiki on the time.

little raptor
#

but using serverTime won't fix it

#

it's just inherent to the MP environment

fleet sand
#

What is the benefic then of using time instead of serverTime ?

little raptor
#

no jitter when serverTime syncs

open fractal
#

this script should only be run on the server (or object owner's machine) anyway as far as I can tell

little raptor
#

no

#

it should run where the object is local

open fractal
#

object owner's machine

#

that's what I meant, just phrased weirdly

little raptor
#

server has a different FPS than the local machine (and others)

#

the only thing that matters is the local machine's time

fleet sand
#

Also ty for your input learned a lot today still a lot to learn.

vague geode
#

Is there a way to make Portable Helipad Lights IR only?

little raptor
ebon citrus
#

is there a method to creating an object with createvehicle so that is shows up in 3den?

#

create3DENEntity?

distant oyster
#

yes

ebon citrus
#

cheers

magic sundial
#

I have an ai unit ordered to target another unit, but it completely ignores the order and proceeds to shoot anything else, i have no clue as to why. When i do it in like an isolated environment it works fine, but if the target is on a roof still completely visible to the shooter, it just ignores the target and shoots the player next to it. Anyone have a clue as to whats going on?

little raptor
magic sundial
#

tried that

little raptor
#

does it have a leader?

magic sundial
#

its a solo unit in its own group

#

Its almost like diasbling its autotarget has no effect

#

like it will just do whatever it want, im so confused hahaha

little raptor
magic sundial
#

Still ignores target

#

had it on its init

little raptor
#

don't use it in init

#

if that's what you're doing no wonder it doesn't work

magic sundial
#

Nah was just trying to quickly test it

little raptor
#

for now just try in debug console

magic sundial
#

I "think" it works

#

Idk if theres a delay between exec or not

#

ok yea it works

#

Cheers man, idk why orders arent working tho, first time ive experienced it

quasi rover
#
"message" remoteExec ["hint", -2]; ```
if I play as a hosted server, the message is displayed to me or not?
quasi rover
#

I tried. as you said. it's not. but I just thought me as a hosted server and player as well, the message will be displayed.

little raptor
quasi rover
#

thx

winter rose
#

this is why one should usually use 0

trim quail
#

Use 0 or whatever the fuckin limit is. The servers standard for what I've seen on purchased dedicated servers, is -2 or -1. You should always set it to 0 or it messes it up.

open fractal
#

documentation? What’s that?

wet geode
#

Is there a way to make a Mk82 bomb to fall out of the sky with out a air craft?

wet geode
#

Thanks mate

fathom monolith
#

Hi I wanna increase the gunner camera shake when firing with the rhs bmp2 I need help pls

hallow mortar
#

That sounds like something that would be best done with a config mod, not a script

open fractal
fathom monolith
hallow mortar
#

No

errant swan
#

hey all: I am trying to dynamically create some little side credits.

[["STARRING", 0.2, 1],
[format ["%1, %2, %3, %4", name (units group a1 select 0), name (units group a1 select 1), (units group a1 select 2), (units group a1 select 3)], 0.2, 4],
[format ["%1, %2, %3, %4", name (units group a1 select 4), name (units group a1 select 5), (units group a1 select 6), (units group a1 select 7)], 0.2, 4],
[format ["%1, %2, %3, %4", name (units group b2 select 0), name (units group b2 select 1), (units group b2 select 2), (units group b2 select 3)], 0.2, 4],
[format ["%1, %2, %3, %4", name (units group b2 select 4), name (units group b2 select 5), (units group b2 select 6), (units group b2 select 7)], 0.2, 4, 1]
] spawn BIS_fnc_EXP_camp_SITREP;

This method poses a problem in mutliplayer if the units are dead or empty because nobody joined. Does anybody have any ideas on how can I approach this dynamically so i dont run into that issue?

open fractal
#

woah fear

#

notlikemeowcry where are the variables

#

you can construct the arrays first with forEach loops first instead of writing out arguments for each unit individually

little raptor
#

not nested

errant swan
#

ill give it a try thanks @little raptor u are and continue to be the goat

distant oyster
#

but there is no check if the unit is valid?

little raptor
errant swan
open fractal
distant oyster
#

according to biki

open fractal
#

I'm confused as to what that means. units will return dead units rather than respawned players?

coarse dragon
#

Is there a way to disable squads Pathing but not target alignment. Then have thier pathing enabled again

coarse dragon
#

Is it possible that a trigger could reactivate it?

coarse dragon
#

Interesting

#

How would one do that for squads

little raptor
#

forEach loop

coarse dragon
#

😬

distant oyster
drifting portal
#

My question is about this

#

how does the game detect a weapon switch when the player switches?, don't want to use a loop for obvious reasons

#

check the attachment I replied to

open fractal
drifting portal
#

hmmm good idea

steel fox
#

Doesn't that just catch switching between weapons on a weapon? Like a underbarrel GL. As it is mapped to the F key

drifting portal
#

I need to figure out how to check always

#

correct?

#

or does it work like an EH?

open fractal
#

can't tell ya

#

no idea what you're doing

drifting portal
#

gui for a vehicle

#

gui shows the weapon name, so when the player switch I just want it to detect the switch so I can change the gui text to currentWeapon vehicle

open fractal
#

you can try this actually

drifting portal
#

how did I not notice that

#

bruh

#

I need to find the dikcode

#

this will help I think

drifting portal
#

deleting an EH will delete its children EHs too?

open fractal
#

elaborate?

winter rose
drifting portal
#

such as ui eh

#

if I delete getin, will the ui eh get disabled too?

#

well

#

I will just post the script

#

to save you the headache

#
this addEventHandler ["GetIn", {
    params ["_vehicle", "_role", "_unit", "_turret"];
    
    disableSerialization;

"someLayer" cutRsc ["RscTitleDisplayEmpty", "PLAIN"];
private _display =  uiNamespace getVariable "RscTitleDisplayEmpty";
uiNamespace setVariable ["thecurrentdis", _display];
uiNamespace setVariable ["vehiclelol", _vehicle];
_veh = _vehicle;
_ammocount = _veh ammo (currentWeapon _veh);
_ammocount = str(_ammocount);
_RscFrame_1800 = _display ctrlCreate ["RscFrame", 1800];
_RscFrame_1800 ctrlSetText "Weapons system";
_RscFrame_1800 ctrlSetPosition [0.768125 * safezoneW + safezoneX, 0.027 * safezoneH + safezoneY, 0.237187 * safezoneW, 0.11 * safezoneH];
_RscFrame_1800 ctrlCommit 0;

_RscPicture_1200 = _display ctrlCreate ["RscPicture", 1200];
_RscPicture_1200 ctrlSetText "#(argb,8,8,3)color(1,1,1,1)";
_RscPicture_1200 ctrlSetPosition [0.938281 * safezoneW + safezoneX, 0.027 * safezoneH + safezoneY, 0.0670312 * safezoneW, 0.11 * safezoneH];
_RscPicture_1200 ctrlCommit 0;

_RscText_1000 = _display ctrlCreate ["RscText", 1000];
_RscText_1000 ctrlSetText ([configFile >> "CfgWeapons" >> (currentWeapon _veh)] call BIS_fnc_displayName);
_RscText_1000 ctrlSetPosition [0.773281 * safezoneW + safezoneX, 0.038 * safezoneH + safezoneY, 0.159844 * safezoneW, 0.044 * safezoneH];
_RscText_1000 ctrlCommit 0;

_RscText_1001 = _display ctrlCreate ["RscText", 1001];
_RscText_1001 ctrlSetText _ammocount;
_RscText_1001 ctrlSetPosition [0.783594 * safezoneW + safezoneX, 0.082 * safezoneH + safezoneY, 0.128906 * safezoneW, 0.044 * safezoneH];
_RscText_1001 ctrlCommit 0;


this addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    _veh = uiNamespace getVariable 'vehiclelol';
    _dis = uiNamespace getVariable 'thecurrentdis';
    _ammocount = _veh ammo (currentWeapon _veh);
    _ammocount = str(_ammocount);
    systemChat _ammocount;
    (_dis displayCtrl 1001) ctrlSetText _ammocount;}];
drifting portal
open fractal
#

this doesn't make sense

#

where does your getIn expression end

drifting portal
#

the code is too long

#

assume it ends at

(_dis displayCtrl 1001) ctrlSetText _ammocount;}];

open fractal
#
this addEventHandler ["Fired",

this is not defined here

#

you're also trying to modify local variables within the "Fired" event handler

#

oh my bad

#

you got a system

drifting portal
#

yep

#

its too long to send

#

can't send files here too

open fractal
drifting portal
#

go to line 107

open fractal
#
_vehicle addEventHandler ["Fired", {
kindred zephyr
# drifting portal https://sqfbin.com/edarofofofeyuberonoj

for the sake of sanity, i would suggest to have everything inside the eventhandlers to be a different script/function, but answering your question, no, every event handler has to be removed manually as they do not follow any kind of hierarchy. afaik, only displays do and they are removed if the display get deleted/destroyed The EH will be removed unless persistent if something is destroyed.

drifting portal
open fractal
#

I think there's some redundancy with adding the "Fired" event handler when someone gets in

#

since that event handler isn't going to fire unless someone is in the vehicle

drifting portal
#

yeah

#

which is what I exactly need

open fractal
#

?

drifting portal
#

since I'm making a weapon system

#

for a Casear

open fractal
#

a new eventhandler will be added every time someone gets in

kindred zephyr
#

^

little raptor
# kindred zephyr for the sake of sanity, i would suggest to have everything inside the eventhandl...

they do not follow parent hierarchy, afaik, only displays do and they are removed if the display get deleted/destroyed
it has nothing to do with "parent hierarchy". when something doesn't exist ofc its event handlers don't trigger either. this applies to objects, displays, controls, etc.
and there's no such thing as "parent hierarchy" in the first place. event handlers of a certain type are stacked

drifting portal
#

I didn't finish the code yet

drifting portal
open fractal
#

but why put it there in the first place

#

there's no such thing as parent EHs

drifting portal
#

I want

#

to delete them

#

with getout eh

little raptor
drifting portal
#

yes

drifting portal
#

i meant children

#

ouch

little raptor
#

same difference

open fractal
#

you aren't adding an event handler to the event handler, you're adding both to the vehicle

drifting portal
#

yes

#

at the very end of the code

open fractal
#

if 3 people get in the vehicle you will have 3 fired event handlers

kindred zephyr
open fractal
#

attached to the vehicle

drifting portal
#

I will add a getOut EH

#

that will remove

#

the stacked EHs

open fractal
#

why does it need to be removed?

#

why not just set the ammo count to a variable and call it a day?

drifting portal
#

how would I go about updating it on the gui?

open fractal
#

you can just do that the exact same way

#

it doesn't help you that the eventhandler is added by getIn, it's a separate scope

drifting portal
#

we can go on vc if you want to

#

show you what I mean

open fractal
#

sure

#

i have to make a phone call first

tough abyss
#

How can I make a bullpup rocket? It should be controlled by the principle of an airplane, not by a laser. I have already made a blank for it and there is a camera in it.

drifting portal
tough abyss
drifting portal
tough abyss
#

Yes

drifting portal
#

I think that involves vectors, Leopard20 can help better than me in this case

little raptor
tough abyss
#

I don't even know, apparently a separate script is needed.

little raptor
#

the game already has several missile flight modes

kindred zephyr
#

to have a manually flown missile (if i got this right?) you probably have to create a new missile type that allows for control. #arma3_config might be better.

Probably looking for

cameraViewAvailable
and
manualControl

tough abyss
#

Thanks

outer fjord
#

How can I determine if a map building is "dead"?

#

or is there even a dead state for buildings

open fractal
#

I believe you can use “alive” condition and “killed” eventhandlers on buildings

#

If not you can fall back on this

#

You can store the building object to a variable during init by placing a game logic entity in the building and using nearestTerrainObjects

#

Mightve gotten the command wrong

outer fjord
#

Thank you!

hallow mortar
#

How do I get the camera direction of a player who's using a vehicle's commander's optics? getCameraViewDirection and eyeDirection don't seem to work properly in this case

hallow mortar
#

It seems like it might be possible to use animationPhase with "obsturret" and "obsgun" to get the camera direction in degrees, but I'm really struggling with the process of converting that to a usable vector

granite sky
#

Looks like it's a vehicle-relative angle in radians, and counter-clockwise for some reason.

#

Not sure if it's possible to get the pitch angle or just the yaw.

hallow mortar
#

obsturret is yaw, obsgun is pitch

#

I found a thing describing a yaw relative-to-world conversion, but I'm not sure how it could be done for pitch since there's no vertical getDir

#

For now I'm settling for cursorObject, which is adequate if imperfect. It would have been mighty convenient if getCameraViewDirection worked here, but oh well

granite sky
#

pitch is possible but you'd need to work from vectorDir

#

kinda surprised that eyeDirection and getCameraViewDirection are busted.

hallow mortar
#

It seems like they "work" but don't take into account the turret, like they're returning a fixed forward view

granite sky
#

Yeah, just returning vehicle direction I think.

drifting portal
#

how to attach an object to a player model selection so that when I attach it to their head for example, when they go prone the object will follow the head and not just float above the model?

warm hedge
#
thing attachTo [player,[0,0,0],"head"]```
winter rose
#
  • true to follow rotation I believe
warm hedge
#

B-but he didn't asked that

winter rose
#

Thou art forgiven, son

coarse dragon
#

So I want to make a 2 stage attack in different areas. I'm curious is it possible to hide everyone and everything at the 2nd location and have them reappear with a trigger?

Other than syncing everything to the two hide show modules

little raptor
coarse dragon
tough abyss
warm hedge
#

Use selectionNames

winter rose
#

(it might be spine1, spine2, spine3)

tough abyss
#
_RscButtonMenu_2400 buttonSetAction 'remoteExec [uiNamespace getVariable "www32",(uiNamespace getVariable "zeusplayerarray") select (lbCurSel ((uiNamespace getVariable "displayforzeus") displayCtrl 1603))]';
 ```remoteExec expects a string, not a code, problem is, how do I string the script???
little raptor
#

(uiNamespace getVariable "zeusplayerarray") select (lbCurSel ((uiNamespace getVariable "displayforzeus") displayCtrl 1603))
you can store text and values into list box items

little raptor
#

what?

tough abyss
#

was asking this question for troalnism talk to him about other questions

winter rose
tough abyss
#

wait autocorrect or im too tired to type

winter rose
#

better 👀 👀 👀

drifting portal
#

he took the plunge for me

little raptor
tough abyss
#

been VERY tired with helping a guy make a script work and school

drifting portal
#

I have made a variable

#

with a code value

#

using setVariable

#

how can I run that code through remotexec?

#

since orders is string

little raptor
#

remoteExec ["variableName",...]

#

assuming it also exists on the target machine

velvet merlin
#

is there a projectile tracing for 2d map?

warm hedge
#

You mean is there any way to do, or ready-to-use function?

#

Guess that's possible though, using drawLine or some commands

drifting portal
drifting portal
winter rose
little raptor
#

remoteExec ['addAction',(lbCurSel (_display displayCtrl 1500))]
also what guarantee is there that the lb selection is the correct target?

drifting portal
#

how can I make it accurate ?

little raptor
#

¯_(ツ)_/¯

drifting portal
little raptor
#

what does your list box contain anyway?

little raptor
drifting portal
drifting portal
copper raven
real epoch
#

I am currently running this code on an empty mission file with 1 player placed in the debug menu.

    private ["_display", "_mapCtrl"];
    disableSerialization;
    
    waitUntil {_display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; !isNull _display};
    _mapCtrl = _display displayCtrl 101;
  
    _mapCtrl ctrlAddEventHandler ["Draw", {
    (_this select 0) drawIcon [
        "iconStaticMG",
        [1,0,0,1],
        getPos player,
        24,
        24,
        getDir player,
        "Player Vehicle",
        1,
        0.03,
        "TahomaB",
        "right"
        ]
    }];
};```

It works until I spawn a helicopter or jet in the debug menu.

```createVehicle ["B_Heli_Transport_01_F", position player, [], 0, "NONE"];```

When I get in as a (co)pilot nothing is shown on the minimap, when I get out it is shown again.

If I spawn a flight object first and then execute the code for the minimap it is the other way round, when I am in the plane it is shown and when I get out it is no longer shown.

Can someone explain to me why this is the case and how it can be fixed?
real epoch
winter rose
#

shouldn't matter

little raptor
#
createVehicle ["B_Heli_Transport_01_F", getPosATL vehicle player, [], 0, "NONE"] setPosATL getPosATL vehicle player;
#

it'll probably explode tho meowsweats

drifting portal
#

I commented on the issue inside the code

#

problem being I'm getting a zero divisor (aka the game can't get the variable) but It doesn't make much sense to me?

#

can someone explain it lightly? I have placed two comments where I made the variable in question and where its throwing the error

#

Lines 21 and 60

ebon citrus
#

playMoveNow, despite being global effect, doesnt seem to work if executed server-side

little raptor
ebon citrus
#

hmmm, something else

ebon citrus
#

it seems some animations do work and some dont

little raptor
#

well it should be local arg

ebon citrus
#

the plot thickens

ebon citrus
little raptor
ebon citrus
#

it works with some animations but some not

little raptor
#

as the wiki says it's local arg. effect is irrelevant (ofc it's global...)

ebon citrus
#

well, i'll jsut remoteExec it

#

flatout some animations work server-side executed, some dont

#

but everything seems to work if executed where the unit is local

real epoch
little raptor
#

that makes zero sense

#

you're probably doing something wrong elsewhere

devout surge
#

hello, i'm having a problem, I deleted my Diary records in favor of a diary.sqf, but i can't see the briefing in the game(not in the briefing state or in the map), can someone point to where to learn how to do this right?

little raptor
devout surge
#

I was fallowing a video tutorial. can i paste here the link?

little raptor
#

yeah

little raptor
#

what have you done so far?

devout surge
#

I have a diary.sqf with the briefing background and all the information about the mission, a initLocalPlayer.sqf calling diary.sqf in all connected players

little raptor
#

it's initPlayerLocal

devout surge
#

hahaha damn, im bumb

little raptor
#

also make sure Explorer file extensions are on

#

or else you might end up with a .txt file

devout surge
#

yup, those are ok, im actualy using VSC to code

ebon citrus
#

BIS_fnc_typeText is being really slow

#

and i mean like, 0.5 digits per second

#

any ideas?

still forum
#

its scheduled

ebon citrus
#

it shouldnt be?

hollow thistle
#

But it is?

little raptor
# ebon citrus it shouldnt be?

scheduler has a 3 ms per frame limit
when there are too many scripts in the queue the queue takes longer to loop back to a script

hollow thistle
#

Most of the BI stuff is scheduled.

ebon citrus
#

my scheduler is hardly used

hollow thistle
#

Bad mods?

little raptor
hollow thistle
#

In clean game it should work okay.

little raptor
#

see how many active scripts you have

ebon citrus
#

ok, something weird:

while {!isNil {_this}} do {
_this ctrlSetFade random [0.4,0.5,0.6] ;
_this ctrlCommit random [2,3,4","PLP_AnimFuncs\Functions\fn_disabling.sqf",true,39],["<spawn>```
little raptor
#

what's your FPS?

ebon citrus
#

this repeats like.. 36 times

ebon citrus
little raptor
#

while {!isNil {_this}} do {
wat? thonk

little raptor
ebon citrus
#

it looks like it might be caused by polpox art supporter tool

#

let me load without it and see

little raptor
#

40/60 = 0.6

#

if all those 40 scripts are active every iteration of the scheduler

hollow thistle
#

if it's basically a while true loop without any sleep in it will exhaust the 3ms all the time.

ebon citrus
#

yep, that fixes it

#

Polpox animation support tool nibbles away at the scheduler

little raptor
#

@warm hedge 👆

hollow thistle
#

bad code meowtrash

hallow mortar
#

I'm pretty sure it's specifically not intended to be used in actual missions, so performance probably wasn't a major concern

hollow thistle
#

still does not make sense to do the thing multiple times a frame

#

like...

_this ctrlSetFade random [0.4,0.5,0.6] ;
_this ctrlCommit random 
#

this won't be visible until next frame anyway

#

if it absolutely needs to try to execute every frame, something like

waitUntil {
  // do the stuff

  isNil {_this}
};

would be 1e10 times better.

#

or simple sleep 0.01 at the end.

little raptor
#

how can _this become nil all of a sudden? thonk

hollow thistle
#

while {<some form of TRUE>} is 90% of times a BIG code smell.

little raptor
#

I don't see that anywhere thonk

hollow thistle
#

we don't see whole code here so maybe it happens, eventualy.

winter rose
hollow thistle
#

oh wait, ,["<spawn>

#

this is next code.

#

So it does not happen. 💩

winter rose
#

isNull perhaps, isNil nay

hollow thistle
#

I've seen while {true} being badly used by inexperienced scripters quite a few times.

little raptor
#

for now I'll add a warning to the while page

winter rose
little raptor
#

nope

#

it's not

devout surge
#

open question... the briefing supports some basic css... <br/> <font color='' size='' face=''> what else is supported? I'm trying to "redact" some text so it apears like this

winter rose
open fractal
#

I don't think there's a way to strikethrough, but it supports hex color so you can gray out text and stuff

winter rose
real epoch
little raptor
#

yeah that has nothing to do with your problem at all meowsweats

#

actually Lou's answer was about the draw part, not the createVehicle meowsweats

#

I should really read the conversation more carefully... meowfacepalm

#
[] spawn {
    private ["_display", "_mapCtrl"];
    disableSerialization;
    
    waitUntil {_display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; !isNull _display};
    _mapCtrl = _display displayCtrl 101;
  
    _mapCtrl ctrlAddEventHandler ["Draw", {
    (_this select 0) drawIcon [
        "iconStaticMG",
        [1,0,0,1],
        getPosWorldVisual vehicle player,
        24,
        24,
        getDirVisual vehicle player,
        "Player Vehicle",
        1,
        0.03,
        "TahomaB",
        "right"
        ]
    }];
};

so does this not solve your problem?

#

also:

disableSerialization;
this is not needed as far as I see

#

you're not doing any UI serialization

hollow thistle
#

uiSleep is specialized and most of the begginers script stuff that's related to objects/simulation etc. and their scripts should pause when game is paused.

#

But I guess it won't work in this example.

little raptor
hollow thistle
#

The counter will break nootlikethis

little raptor
#

yeah that's why I used uiSleep meowsweats

coarse dragon
#

How does one. Hide a layer then get it to pop up with a trigger?

little raptor
#

this should be executed on the server

#

if you use it in a trigger, use a server-only trigger

coarse dragon
#

There's a way to sync mass amounts of units to the modules?

#

😟

little raptor
#

should be possible afaik

coarse dragon
#

No as units don't have a sync too thing

little raptor
coarse dragon
#

Because.. I've no actual idea how to actually do that 😫

little raptor
#

and I just tried and could sync multiple ones as well

coarse dragon
#

Eh I don't have that option

little raptor
coarse dragon
#

Then wheres the code go?

little raptor
# coarse dragon Then wheres the code go?

in 2 places
one in initServer.sqf which hides them:

{
  _x hideObjectGlobal true;
  _x enableSimulationGlobal false;
  _x allowDamage false;
} forEach (getMissionLayerEntities "myLayer"#0)

and one in your trigger which unhides them:

{
  _x hideObjectGlobal false;
  _x enableSimulationGlobal true;
  _x allowDamage true;
} forEach (getMissionLayerEntities "myLayer"#0)
#

change myLayer to the name of your layer

hollow thistle
#

if you're doing this for units you need to disable their simulation too

little raptor
#

right good point

hollow thistle
#

and could disable their damage as explosions in the area can still affect hidden units.

coarse dragon
#

Anyway to do it without a server?

#

Oi u said sorry

little raptor
#

you'll be the "server"

open fractal
coarse dragon
#

Here's your chance to do another video 😂

open fractal
#

aha

#

i wish

#

currently procrastinating something

coarse dragon
#

@little raptor thank you kind sir for the help

little raptor
#

np

#

seems like you can just select the units and click on New Layer 😅

#

no need to drag and drop

little raptor
#

oh you already said that 🤣

#

I don't know why I read stuff halfway today... 😅

copper raven
# real epoch If you have time, you can take a look at it and see if you can think of anything...
    waitUntil {_display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; !isNull _display};
    _mapCtrl = _display displayCtrl 101

_mapCtrl here will be the minimap when inside the vehicle, to get the minimap when outside the vehicle, you have to do some uiNamespace looking up:

private _displays = uiNameSpace getVariable "igui_displays";
private _ctrlGPS = _displays select (_displays findIf {!isNull (_x displayCtrl 101)}) displayCtrl 101;
coarse dragon
#

Ever use unit capture Leopard?

#

The script to record your movements and stuff

little raptor
#

yes. why?

coarse dragon
#

I was in an attack chopper but it never recorded me firing my missles. Just the gunner and his machine gun. Any idea why

hollow thistle
#

it records it but the playback function only works for gunner when it comes to firing.

#

You can assign the pylons you've used to the gunner and it should work.

coarse dragon
#

Odd it records me dropping bombs and not that

#

In a jet

little raptor
#

it should blobdoggoshruggoogly
tho there's a locality problem

#

allowDamage is arg local

#
[_x, true] remoteExec ["allowDamage", _x];

with that it should work

copper raven
# wind hedge 👏

if the object changes locality again, you'll have to rerun allowDamage where the object is local, fyi

little raptor
#

really? meowsweats

copper raven
#

yeah

little raptor
#

then why is it "Global Effect"? meowsweats

copper raven
#

well, it is in a way

#

it's global effect if executed on a local machine and locality never changes, i think that's the correct phrase

winter rose
#

I think remoteExec 0 would not need to reapply it

copper raven
#

that needs testing

#

i'd imagine it wouldn't

#

otherwise this issue wouldn't even be a thing

idle jungle
#

Can someone help me with this script?

["Start Training", _start = (getMissionLayerEntities "Layer 1") select 0;
{
allowDamage true;
} forEach _start ];```

On phone sorry for format
#

It's saying its missing a ]

little raptor
idle jungle
#

Perfect thank you mate

somber radish
#

Anyone got an idea on how to get Location-names?
I have tried:

name nearestLocation [getPos player, "NameCity"];

What I am trying to achieve is to get a string with the name of the nearest city

#

Using this command I only get ```sqf
""

ebon citrus
#

Use nearestlocations instead

#

Namecity, namevillage, namecapitalcity

#

It will return an array, pick the first one for closest

#

If you want to be sure, loop the locations till one has a name

#
private _ret = "Wilderness";
private _allLocationTypes = ["NameCity", "NameVillage", "NameLocal", "NameCityCapital"];
{
    if ((text _x) isNotEqualTo "") exitWith {_ret = text _x; _ret};
} forEach nearestLocations [player, _allLocationTypes, 1500];
_ret;```
#

it's not optimal, but it's what i use

#

slap that into a function and call it

#

takes no arguments, returns the name of the nearest named city, including airports

#

doesnt work for airports on tanoa

#

remove "NameLocal" if you dont want airports

#

increase the radius if you need to

#

you know how it works

ruby bronze
#

Howdy all, could someone take a peek at this code: https://sqfbin.com/ikotahenurogivupinay that I made and help me figure out why only the first section out of three is working?

(Expected result: when combined with area markers in-game called pulse_1, pulse_2, and pulse_3 as well as objects called pulseObject_1, pulseObject_2, and pulseObject_3 there should be a pulsing marker on the map over each of these objects.

Actual result: only the first marker "pulse_1" pulses, nothing happens with the others.)

Do I need a different sqf file for each of them or is there a way to get all of them working within a single sqf?

Any help is appreciated =)

somber radish
crude vigil
ruby bronze
#

Thank you 😅 facepalm

ebon citrus
open fractal
#

But if you have what you need already then it isn’t strictly necessary

ruby bronze
#

That would be pretty good, but it's above my current skill at the moment. I think this way will be fine for now at least

coarse dragon
#

Isn't there a module to skip time?

hallow mortar
coarse dragon
#

Does 3eden have one ?

#

Not on atm

hallow mortar
#

I don't know, I'm not in game either. But...either there is, and you use it, or there isn't, and you use skipTime for exactly the same effect and a similar amount of effort.

open fractal
#

scripting is easier than trying to manhandle modules to make things like that work

coarse dragon
#

When one skips time. Will fires and smoke still be burning from bombings?

open fractal
#

should be. skipTime just changes the in-game time

coarse dragon
#

Happy days thanks

warm hedge
ebon citrus
#

what do the different modes for BIS_fnc_camera do?

winter rose
ebon citrus
#

right

#

so it wont have any effect on simulation being disabled in my intro-scene?

#

because this is being a real bumber

winter rose
#

check the code, but I don't think so

ebon citrus
#

im sort of cross-posting here, but i cant really say im getting anywhere

#

simply put, simulation wont work in my intro-scene

#

and music wont play

winter rose
#

« the issue is out there » I would say

ebon citrus
#

that's nearly not helping 😅

winter rose
#

"almost"

#

Copy the mission, remove elements, see when it works

#

but "no simulation", it looks like setAccTime 0 or all objects enableSimulation(Global) false

ebon citrus
ebon citrus
#

rpt doesnt give any script errors

leaden ibex
#

Hey there, I am new to this, so I have no idea if it's even possible... BUT.
What I need:

I'd love to add two (RHS) "RHS_weap_gau19" to A-10, preferably at pylons position. And one to the main turrets position (easily done with addWeapon).
Is there a way to add the gaus at pylons and make them all shoot at once?
I hate that I want to do this, but the group I play with just hates vehicles with bug guns that can hurt something...

hollow laurel
#

How were the animated intros in the TacOps DLC missions achieved? They looked very nice but I have a slight gut feeling they were just .OGV files

warm hedge
#

They aren't OGVs. The same tech with Old Man so you can check it out

fair drum
leaden ibex
hollow laurel
warm hedge
#

OM files are PBO

hollow laurel
#

👍

stark scaffold
#

Hello everyone,
I need your help, please, to create a script for my attack helicopter, I would like a "turbo" action that allows to increase the speed very quickly and that a flame animation comes out of the reactors. The animation already exists, it starts with the user action "Turbo on" and closes with the user action "Turbo off".
Thank you in advance for your help

open fractal
#

and that seems familiar thonk

little raptor
#

it's more like a "bump"

little raptor
stark scaffold
little raptor
#

didn't you say the animation already exists?

animation already exists

stark scaffold
winter rose
little raptor
# stark scaffold Yes indeed, I already created it, but I would like that when the animation is do...

I don't think there's any event handler for vehicle animations...
so I guess you'll have to use some delay or something.
example turbo on:

_veh animate ["reactor_or_whatever", ....];
sleep 3;
_endTime = time + 10; //boost up to 10 seconds
_acc = [0,10,0]; //acceleration vector
while {alive _veh && time < _endTime} do {
  _vel = velocity _veh;
  _vel = _vel vectorAdd (_veh vectorModelToWorld (_acc vectorMultiply diag_deltaTime));
  _veh setVelocity _vel;
  sleep 0.001;
};
pliant stream
#

what's diag_deltaTime

little raptor
#

1 / diag_FPS

#

basically last frame time

pliant stream
#

seems pretty sus

#

better to track yourself. the script is not guaranteed to execute each frame

little raptor
#

and yeah yeah I know that doesn't run every frame 😐

stark scaffold
little raptor
#

it's not a complete script

little raptor
#

didn't you say you already made the "turbo on action"?

stark scaffold
little raptor
#

you can also try it in debug console first to make sure it works the way you want

#

just put your vehicle in eden, change _veh to the var name of your vehicle and execute the code

#

you should also wrap it in [] spawn {} if you use the vanilla debug console:

[] spawn {
    _veh = myHeli;
    _veh animate ["reactor_or_whatever", ....];
    sleep 3;
    _endTime = time + 10; //boost up to 10 seconds
    _acc = [0,10,0]; //acceleration vector
    while {alive _veh && time < _endTime} do {
      _vel = velocity _veh;
      _vel = _vel vectorAdd (_veh vectorModelToWorld (_acc vectorMultiply diag_deltaTime));
      _veh setVelocity _vel;
      sleep 0.001;
    };
}
stark scaffold
finite imp
#

has somebody made some experience with the setMaxLoad command? Im trying to increase vestLoad but im not quite sure how to go about it. the wiki says

container setMaxLoad load

and container is an object. do I just insert the classname of the vest?

little raptor
#

so ofc no

finite imp
#

yeah thats what i thought. so what else then?

little raptor
#

e.g. backpackContainer

finite imp
#

ahhh

#

yeah gimme a second, i saw this earlier

#
hint str vestContainer player;

This command should return the container ID. executing this in the console returns

22f644b2b00# 1174189: dummyweapon.p3d

in my example. I guess dummyweapon is just a placeholder. the numbers belong together or are they separate things?

little raptor
#

wat? why would they matter anyway?

#
vestContainer player setMaxLoad _load
#

that's it

finite imp
#

oh okay. i thought i had to define the maxload for the item itself

#

thank you

pine saddle
#

Hey !
quick question: I added this in an init: this disableAI "Move"; I would like to addthis setUnitpos "UP" . Can i do like: this disableAI "Move", setUnitpos "UP"; Or how do i write it ? Cause it's not working for me :/

little raptor
#

you can only write it the first way you wrote it. there's no other way

winter rose
pliant stream
#

this disableAI "Move", this setUnitPos "UP"; is valid

pine saddle
winter rose
pliant stream
#

yeah

pine saddle
winter rose
pliant stream
#

sure, don't do it. but you can do it. but don't.

pine saddle
#

You are not gonna believe me but i have another problem 😄
I try to use this in multiplayer: this addAction["Sector Targets","popup.sqf",[[target_1,target_2,target_3,target_4,target_5,target_6,target_7,target_8,target_9,target_10,target_11,target_12,target_13,target_14,target_15,target_16,target_17,target_18,target_19,target_20,target_21,target_22,target_23,target_24,target_25,target_26,target_27,target_28,target_29,target_30,target_31,target_32,target_33,target_34,target_35,target_36,target_37,target_38,target_39,target_40,target_41,target_42,target_43,target_44,target_45,target_46,target_47,target_48,target_49,target_50,target_51,target_52,target_53,target_54,target_55,target_56,target_57,target_58,target_59,target_60,target_61,target_62,target_63,target_64,target_65,target_66,target_67,target_68,target_69],0,1,true]];
It's in a laptop and this should pop up targets that have the numbers as variable cause they are down with an init. But in server it just doesn't work.
Is there something important i should know ? I wanna rip off my hairs that i don't have...

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
winter rose
#

+ indent plz

#
this addAction ["Sector Targets", "popup.sqf", [TheBigTargetsArray, 0, 1, true]];
```basically
#

@pine saddle "popup.sqf" is the important part here - what's in there?

pine saddle
#

well a lot of things that i took of a free compo for CQB things. It works fine so i don't know if i need to change things

pine saddle
#

ofc sorry forgot about it

pine saddle
#

Wel i have to remove all the comments but everything is working nice in SP so i don't know what to modify for working in MP

winter rose
#
// Check to make sure this script is executed on the server ONLY
if (!isServer) exitWith {};
#

sooo yeah, here's why

#

addAction is local, so the client is not the server
according to what I see, if you comment this line out, it should still work globally

that or remoteExec it on the server from the client

#

(but they will pop up again if not remoteExec'd)

pine saddle
winter rose
pine saddle
winter rose
ebon citrus
#

Like Lou said, not knowing things isnt stupid, it's having an opportunity to learn. Not askign things is stupid, because you refuse to learn. This channel is for smart people meowtrash

stark scaffold
little raptor
#

it has nothing to do with your model

stark scaffold
little raptor
#

_veh = myHeli

#

or in your case: _veh = h2

little raptor
#

that line does not work and you must fix it yourself

stark scaffold
little raptor
stark scaffold
little raptor
stark scaffold
little raptor
stark scaffold
stark scaffold
# little raptor how do you want to control the turbo?

this is a script : []spawn {
_veh = h2;
_veh addaction [ "Turbos Go",
_veh animate ["Turbos",3]];
sleep 3;
_endTime = time + 30;
_acc = [0,10,0];
while {alive _veh && time < _endTime} do {
_vel = velocity _veh;
_vel = _vel vectorAdd (_veh vectorModelToWorld (_acc vectorMultiply diag_deltaTime));
_veh setVelocity _vel;
sleep 0.001;
};
}

winter rose
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
little raptor
# stark scaffold this is a script : ...

you can do:

h2 addAction ["Turbo On", {
    params ["_veh"];
    _veh animate ["Turbos",3];
    _veh setVariable ["disable_turbo", false];
    [
        {
            params ["_veh", "_endTime"];
            if (!alive _veh || time > _endTime || {_veh getVariable ["disable_turbo", false]}) exitWith {true};
            if (_endTime - time > 27) exitWith {false};
            _vel = velocity _veh;
            _vel = _vel vectorAdd (_veh vectorModelToWorld [0, 10 * diag_deltaTime, 0]);
            _veh setVelocity _vel;
            false;
        },
        {_this#0 animate ["Turbos",0];},
        [_veh, time + 30]
    ] call CBA_fnc_waitUntilAndExecute;
}];

h2 addAction ["Turbo Off", {
    params ["_veh"];
    _veh setVariable ["disable_turbo", true];
    _veh animate ["Turbos",0];
}];
#

needs CBA

stark scaffold
hollow laurel
#

It should work in MP too, right?

winter rose
#

it is local effect so I expect it to yes

hollow laurel
#

thank you

pulsar vigil
ivory lake
#

because whoever wrote the classname wrote rnd instead of Rnd

pulsar vigil
#

So there is no real reason for it?

little raptor
pulsar vigil
#

Yeah but i would have thought that they would have followed the trend that they used before with the 75Rnd

ivory lake
#

it's a mistake

#

casing of classnames generally does not matter as good practice is to toLower them anyway for string comparisons

pulsar vigil
#

true tho, i just forgot it, and was wondering why the RPK mags where the only ones to make problems

little raptor
#

so you can just ignore the case

pulsar vigil
#

This one came from magazinesDetail

winter rose
little raptor
pulsar vigil
#

Sorry i meant the normal magazines command

little raptor
#

the case is the same the one in config for magaiznes too

pulsar vigil
#

And another bug i found, is that the Ifrit HMG windshield doesnt have a hitbox

opaque grail
pulsar vigil
#

you can just one hit though it with any weapon

stark scaffold
little raptor
stark scaffold
opaque grail
little raptor
opaque grail
#

Ok, but where do I put it?

little raptor
#

use a debug console and run in during the mission

#

what I wrote only works in SP

opaque grail
#

It works

finite imp
#

I have a question regarding Unit Insignias. I've been running into a brick wall in the past few weeks.

AFAIK if you want to apply unit insignias (doesnt matter if its the ones from vanilla or custom ones), you have to remove and reapply them (if you have applied an insignia before).

What I'm trying to achieve is set unit insignias for different squads on mission start and if players JIP (because, afaik, players who join AFTER a patch has been applied, its invisible for the JIP).

In my initPlayerLocal.sqf:

[player, ""] call bis_fnc_setUnitInsignia;
[player, "CombatPatrol"] call bis_fnc_setUnitInsignia;

This does not work at all. The insignia is invisible for me and other players. If I try to remoteExec the function globally, it works 40% of the time, but it appears entirely random if it does or not. Anyone got maybe some pointers in the right direction?

little raptor
#

If I try to remoteExec the function globally,
the function already does that

#

don't

finite imp
#

I know, but if I use call, it does not work at all

little raptor
#

like I said, use delay

finite imp
#

like what, sleep 1?

little raptor
#

yeah

finite imp
#

alright, brb

little raptor
#

what you wrote is inefficient

finite imp
#

the respawn thing?

little raptor
# finite imp the respawn thing?

no. this thing:

_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil]; // you can also do [_unit, ""] call BIS_fnc_setUnitInsignia, but this way is faster (plus no network traffic)
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
finite imp
#

alright, ill try this

opaque grail
finite imp
# little raptor no. this thing: ```sqf _unit setVariable ["BIS_fnc_setUnitInsignia_class", nil];...

alright, this works consistent now. thank you. currently I'm using this in a loadout script via AddAction. but I have a follow up question.

If players JIP now, they wont be able to see the insignia I'm guessing, because they were not present when it was applied. correct? so I added this in my initPlayerLocal.sqf, because different squads are supposed to have different insignias. meaning:

{
    player setVariable ["BIS_fnc_setUnitInsignia_class", nil];
    sleep 1;
    [player, "CombatPatrol"] call BIS_fnc_setUnitInsignia;
}
forEach [s_45,s_46,s_47,s_48,s_49,s_50,s_51,s_52,s_53,s_54,s_55,s_56];

Will this work aswell? I guess its way to overcomplicated, but I'm unsure how to go about this

little raptor
little raptor
#

afaik that already supports JIP

finite imp
#

So there is no need to reapply Insignias if someone JIPs, right?

little raptor
#

no

finite imp
#

alright. Meaning I can define this in my loadout script, which is working already, and in my initPlayerLocal for when they spawn with
forEach [_unit];
(we use a persistent loadout so not every mission everyone gets to pull their loadout out of a box). right?

opaque grail
little raptor
#

it's a game bug then

opaque grail
#

Oh hey, it started moving

little raptor
#

put it in a better place

opaque grail
#

The HETMAN Warstories mod does not allow me to become zeus

little raptor
granite sky
#

That RHS RPK magazine issue that @pulsar vigil mentioned is a case mismatch between the magazine well entry and the magazine classname, IIRC. I don't know if that technically counts as a bug but it tripped me up once. RHS would probably fix it eventually if someone reported it.

#

So currently you can't reliably use in to compare the magazine classname with magazine well lists.

winter rose
#

in toLowerANSI

crisp turtle
#

So since the bohemia interactive UGV "Follow" command doesn't work, i'm trying to script it in as an addaction that creates a waypoint on the UGV operator's position. I haven't figured how to turn it off just yet, but right now the follow script looks like this:

_grp2 = group UGV2;
_unit2 = DROP2;

while {true} do {

if (!alive (leader _grp2)) exitWith {};

_wp = _grp2 addWaypoint [position _unit2, 0];
_wp setWaypointType "MOVE";


sleep 35;
};```

So it creates a waypoint on the operator's position every 35 seconds and moves the UGV over, great. If the UGV manages to get to the player's position, the waypoint deletes itself and the next waypoint will be the one the UGV goes to. 

The issue i'm having right now is that if the player moves and the drone isn't able to reach the waypoint in time, a new one gets created and added to the waypoint queue. Does anyone know of a good way of deleting the previous waypoints and make every new waypoint the one the UGV goes to?
radiant siren
finite imp
tranquil cradle
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
winter rose
tranquil cradle
#

"sqf" code

Seems not working for me. It used to in the past... Weird.

winter rose
#

and thank you for editing 🙇‍♂️

finite imp
winter rose
finite imp
#

so how do I go about setting a maxLoad for vestContainer if I equip a player with a new vest (via script, that is)? Do i execute the command via execVM (or remoteExec, i dunno the difference) inside the loadoutscript or does this not work aswell?

winter rose
finite imp
finite imp
#

I will report back! 😎

finite imp
# winter rose correct

Okay so I implemented this into my loadout script after removing all gear and before implementing the new stuff.

[...]
player addWeapon "Rangefinder";

//setMaxLoad Vest
[] remoteExec ["scripts\maxLoadVest.sqf",2,true];

comment "Add items to containers";
[...]

and its not working 🥲
maxLoadVest.sqf

{
  uniformContainer player setMaxLoad 60;
  vestContainer player setMaxLoad 350;
} forEach [s_49,s_50,s_51,s_52,s_53,s_54,s_55,s_56];
hallow mortar
#

player doesn't work on the server

#

pass the player unit to the script like this:
[player] remoteExec ["scripts\maxLoadVest.sqf",2]
then access the passed unit at the start of the script like this:
params ["_unit"];
(to make the unit available as the variable _unit to use in the rest of the script)

#

your forEach is kinda weird, you're just repeating those two setMaxLoad commands once for each of...whatever s_49 etc. is, but that just means you're repeating the same commands on the player like 7 times in rapid succession. Technically functional but seems pointless

finite imp
# hallow mortar pass the player unit to the script like this: `[player] remoteExec ["scripts\max...

will try this.

s_49 til s_56 are player variables, since I only want certain players to increase vestContainer space //instead of// for each and everyone on the server.

Problem is, since we're using a persistent loadout mod, I have to think about two things:

  1. increase vestSize everytime a player pulls out a new loadout from spawn
  2. player does not pull a new loadout and gets the new one from a database init
hallow mortar
finite imp
#

yes exactly

hallow mortar
#

A forEach means "do this one time per item in the array". It doesn't automatically mean "do this one time to each of the items in the array", although that is one of its primary uses. To reference the current item that the forEach is operating on (each time it does the operation) you need to use the magic variable _x.

tepid vigil
#

Which namespace does CBA put the settings values into, missionNamespace?

finite imp
hallow mortar
#

Yes, you don't need params now your forEach is set up properly, and you can remove player from the remoteExec argument.
Note that while I understand what you mean here, init and function have specific meanings in Arma scripting. remoteExec is a command, not a function, and writing a command is not an init.

finite imp
#

update: it did not work. the loadout applies correctly but the containersize does not change unfortunately

copper raven
#

make a function or use execVM (not recommended)

finite imp
#

i will try reading the wiki, but i think this is a little too much for me. im not good with this kind of stuff. thanks for the help anyway so far

finite imp
finite imp
# copper raven how are you doing it?

description.ext

class CfgFunctions
{
    class RNG
    {
        class loadouts
        {
            class maxLoadVest {};
        };
    };
};

mylocalboxloadout.sqf

remoteExec ["TEST_fnc_maxLoadVest",2];
sleep 0.5;

fn_maxLoadVest.sqf

{
  uniformContainer _x setMaxLoad 60;
  vestContainer _x setMaxLoad 350;
} forEach [s_49,s_50,s_51,s_52,s_53,s_54,s_55,s_56];

this seems to work now

granite sky
#

RNG/TEST mismatch?

#

If it works then it's probably not mismatched in what you're running :P

finite imp
#

was initially test

open flume
#

How would i make an object play an MP3 or whatever i need for arma, like 4 meters or so.

open flume
#

ty!
how would i make an add action disappear for a set time?

granite sky
#

Time dependent on what? You could add a time check in the addAction's condition statement.

open flume
#

so basically im trying to make a radio toggleable but i dont wanna keep the action there once enabled because if pressed again it overlays the sound.

sharp grotto
#

set a variable to the object and use it for the condition ^^

distant oyster
open flume
#

(idk how to script so i used google XD)

fair drum
twin fog
#

i'd like a scale of 1 - 10 how blind i'm being here, attempting to do an oldie of putting some custom .ogg tracks into a mission file and i'm getting some errors on line 8 asking for a }

#
{
sounds[] = {01,02};
    class 01
{
name = "01";
    sound[] = {"Music\Chroniko.ogg", db+10, 1.0};
    titles[] = {0,""};
};
class 02
{
name = "02";
    sound[] = {"music\warhorn.ogg", db+10, 1.0};
    titles[] = {0,""};
};


};
#

if this is the wrong spot to ask i'll delete and repost elsewhere

willow hound
#

Try using a letter as the first character for each classname, numbers as classnames are usually a nono 🙂

twin fog
#

i'll give that a shot

#
{
sounds[] = {01,02};
    class chroniko
{
name = "Chroniko";
    sound[] = {"Music\Chroniko.ogg", db+10, 1.0};
    titles[] = {0,""};
};
class warhornspook
{
name = "warhornspook";
    sound[] = {"music\warhorn.ogg", db+10, 1.0};
    titles[] = {0,""};
};


};
#

something more to this effect yes?

willow hound
fair drum
#
class CfgMusic
{
    tracks[] = {};
    
    class chroniko
    {
        name = "Chroniko";
        sound[] = {"music\chroniko.ogg", db+10, 1.0};
    };
    class warhornspook
    {
        name = "warhornspook";
        sound[] = {"music\warhorn.ogg", db+10, 1.0};
    };
};
willow hound
twin fog
#
{
    sounds[] = {};
    
    class chroniko
    {
        name = "Chroniko";
        tracks[] = {"music\chroniko.ogg", db+10, 1.0};

    };
    class warhornspook
    {
        name = "warhornspook";
        tracks[] = {"music\warhorn.ogg", db+10, 1.0};
    };
};
twin fog
#

i think i catch the meaning there hypoxic. i'll throw that in and see what it throws back

#

That works

#

Thank you @fair drum.

grim wing
#

how do you add an addAction to where the player has to hold Enter key

#

like the launch from the carrier

willow hound
weak pagoda
#

I am tryin got add a intro video to my mission

#

yet it will only play after the briefing, and players are able to walk around and shoot during the video.

#

I would like the video to play before the briefing--is this possible?

fair drum
weak pagoda
#

locking down players

fair drum
#

enableSimulation

#

cutText

weak pagoda
#

do i put that in init.sqf

fair drum
#

no, those are the commands you will end up using. i'm assuming now that you've asked that that you have no scripting knowledge so far?

weak pagoda
weak pagoda
fair drum
#

do you want something written for you? or do you want to learn it yourself?

#

either is fine

weak pagoda
#

i will learn by analyzing it

fair drum
#

i actually happen to be working on something similar right now

weak pagoda
#

i just dont know how to disable the players from fucking around during the video

weak pagoda
#

but what happens is that it executes before the briefing preventing anyone from being able to user input during the briefing

fair drum
#

you can simply run on the server:

if (isServer) then {
  allPlayers apply {
    _x enableSimulationGlobal false;
  };
};

then reverse it when you are done with the video.

weak pagoda
#

sorry for noob questions

fair drum
#

wait one

#

i'll just show you what i'm doing when i'm done

#

pm'd

quaint oyster
#

When storing information using profilenamespace, is there a limit to what can be stored? I'm concerned about it possibly bugging peoples accounts.

steel fox
#

Only real limits are that variable names in profileNamespace cannot be commands besides that every data type could be stored to the profileNamespace.
although some aren't useful, like references to objects or group e.g. https://community.bistudio.com/wiki/setVariable

quaint oyster
#

Would you still need to use the third variable in setvariable to make something public while using profilenamespace? For example;

profileNamespace setVariable ["randomvar",1,true];
open fractal
#

I've never used profileNamespace but I presume that would set the variable for every player

#

in their profiles

ebon citrus
#

removeItemFromUniform causing desync issues if run where the unit is not local

#

i open my inventory and an item is still there that was previously removed with removeItemFromUniform

#

if i remoteExecute on the server magazineCargo uniformContainer (allPlayers#0), the item is not listen in there

#

dropping the item and picking it up again makes the item appear serverside aswell

#

if i drop the item, pick it up, then run removeItemFromUniform, the result is updated to both the client and the server

#

hmmm, the plot thickens

#

it seems to be a related to items the unit spawns with

#

if the unit spawns with the items, removeItemFromUniform wont work as intended

#

if the item is picked up, the command works as intended

ebon citrus
#

How can i check if the mission is in intro?

ebon citrus
devout surge
#

hey, is someone online? im trying to rotate a prop to attach to another prop, but setVectorDir[0,0,0]; rotates it and resets to initial position... someone knows anything about this?

ebon citrus
#

Please dont take it too rough, just a bit of humour

crude vigil
crude vigil
# ebon citrus resets in what way?

I had a weird experience that setVectorDir was exclusively causing some positional issue when used on attached objects, although my case was with following bone rotation. Could not recreate it now though and I dont even remember what it actually was. It is actually probably unrelated to this issue actually thinking now. blobdoggoshruggoogly

ebon citrus
#

that's why setVectorDirAndUp

crude vigil
#

hence I wrote the message above comparing setVectorDirAndUp / setVectorDir, but yeah couldnt recreate what I meant now anyways.

#

Wrote setVectorUp + setDir solution additional to setVectordirAndUp as someone else mentioned it already, in case he faces an issue with it too like I did before...

ebon citrus
#

is there a scripted command to get the IP of the currently joined server?

violet gull
#

Which WeaponHolder classname is created when you place/spawn a 3D item, such as "Headgear_H_Bandanna_blu"? Can't seem to find it. The holder appears to be local though -- can't loot on a dedicated server if server spawned the item.

violet gull
#

nearEntities only returns living characters I think

fair pilot
#

Maybe you can try configName configOf cursorObject

#

While looking at WeaponHolder

ebon citrus
coarse dragon
#

Is it possible.
That when the player crosses a trigger it in turns delete everything units and objects?

#

Doing a intro sort of thing at a airport then want to fly off and delete all the clutter

fair pilot
#

Yes it is possible

coarse dragon
#

Interesting

#

Hmm wonder if putting em in thier own layer and deleting that would be better

ebon citrus
#

camCommitPrepared stutters when i give it a long time

coarse dragon
#

Any reason why a Hide module tied to a trigger isn't working?

#

I did synce everything to it. Vehicles objects blueforce civilian

coarse dragon
#

Well only some of em work

#

Yaaay fixed it

real epoch
cursive tundra
#
/* */ private _OBJ1_PEL2 = getMarkerPos "Bat1_OBJ1_PEL2, true";
private _vanguardart = "rhs_D30_msv";
private _vanguardartammo = "rhs_mag_3of56_10";

artstrike = {
    params ["_gun","_targetarea","_ammotype"];
    private ["_gun", "_targetarea", "_ammotype"];
    _gun = _this select 0;
    _targetarea = _this select 1;
    _ammotype = _this select 2;
    _gun doArtilleryFire [[_targetarea], _ammotype, 3];
    TRUE
};

private _vanguardartgrp1 = createGroup east; 
private _vanguardart1 = createVehicle [_vanguardart,  _VangArtPos, [], 0, "NONE"]; 
_crew2a = _vanguardartgrp1 createUnit [_vanguardcrew,  _VangArtPos, [], 0, "FORM"];
_crew2a moveInGunner _vanguardart1;

["_vanguardart1","_OBJ1_PEL2","_vanguardartammo"] call artstrike;

Hey, this is my second attempt at writing a function for my MP-Mission thats supposed to call in an artillery strike on a predefined possible enemy position, however i keep getting the error message "Error: doArtilleryFire: Type string, expected Array,Object". I dont know exactlyl where the error is supposed to be in the script and my attempts to fix it have so far been not successfull. Can someone help me out with this maybe?

coarse dragon
#

There's a easier way to do it

#

Place arty down with a hold waypoint and forced hold fire. Then a fire mission

Then a trigger to skip waypoint. And it will shoot. And be random

#

Then skip waypoint Sync to the Hold waypoint

fair drum
#

that might be "easier" per say but you get a lot more control with scripting it yourself

cursive tundra
#

but fire mission wp always shoots HE-rounds doesnt it? id like to maybe shoot some smokescreens etc. too.. i ideally wanted to keep everything in a modular script that can easily be copied and modified for future missions, so i'd prefer to get it working with a script, but im not that experienced with them

fair drum
#

your error is with _targetarea in the doArtilleryFire

#

right now, after the variable imports it, its going to look like....

_gun doArtilleryFire [["_OBJ1_PEL2"], "rhs_mag_3of56_10", 3];

do you see the issue?

cursive tundra
#

ìs it with the ""?

fair drum
#

aye, you don't put "" around arguments when you go to call something

#

secondly, what does getMarkerPos return? an array doesn't it? so you now have...
doArtilleryFire [[[5,5,5]], "magclass", 3]

#

when it wants
doArtilleryFire [[5,5,5], "magclass", 3]

cursive tundra
#

so remove both the [] from the function and also the "" from the parameters i feed into the function (in front of the call artstrike)?

#

well the _OBJ1_PEL2

fair drum
#

your calls should look like

[_var1,_var2,_var3] call HYP_fnc_something
#

and

_gun doArtilleryFire [_target, _mag, 3];
#

also, something wrong here

getMarkerPos "Bat1_OBJ1_PEL2, true";

see it?

#

you also don't need this nonsense

private ["_gun", "_targetarea", "_ammotype"];
_gun = _this select 0;
_targetarea = _this select 1;
_ammotype = _this select 2;

params takes care of that for you

cursive tundra
#

okay, then i'll remove that part

#

getMarkerPos "Bat1_OBJ1_PEL2, true"; and yeah, i messed that up, should be getMarkerPos ["Bat1_OBJ1_PEL2"; true]; right?

fair drum
#

params already imports the arguments and assigns them to private variables you put there

fair drum
#

i think discord highlighting should use a different color for bools than the string color 😤

willow hound
winter rose
cursive tundra
#

I fixed all the issues you told me and its working very well now, thanks a lot! This is going to make a lot of things a lot easier for me now