#arma3_scripting

1 messages · Page 529 of 1

burnt torrent
#

i see, any advice on scripting?

cosmic lichen
#

There are not many editor mods I know of.

#

Advice? Don't get frustrated )

burnt torrent
#

ill try not mate haha

#

so am i correct in saying i can litreally copy and paste a script off the internet and put in and it will work?

burnt torrent
#

ahh sweet any thing with a video is of great intrest my fried

cosmic lichen
#

so am i correct in saying i can litreally copy and paste a script off the internet and put in and it will work? Depends where you copy it from 😄

burnt torrent
#

haha nooby question where do i put it 😅

#

oh as well r3vo when i save a mission it saves as a pbo so i can't open it to insert script how do i change that?

marsh lotus
#

When you save a mission it will save in Documents/Arma 3/missions or Documents/Arma 3/mpmissions (assuming you're on your main profile)

cosmic lichen
#

pbo means it's a packed file, ready to be played. You cannot changed pbos without unpacking them first.

#

That's why it says "Export" instead of "Save".

#

btw you just helped me fix that issue with exporting to sqf not working with 3den Enhanced. Thanks!

burnt torrent
#

i don't have a clue how i helped with that but your more than welcome haha and thanks horner the only ones i can seem to find are the pbo ones, so do i save the scenario then export as single player i plan on doing a singple player one then look in the area for it ?

#

ever so sorry for the nooby questions guys its my first pc only bin on one 8 month so its like learning how to walk to for me tbh

cosmic lichen
#

You can open your scenario folder from within the editor directly

burnt torrent
#

when i save it the mission don't go to that folder for some reason it shows on the video the same location as you said horner but not there for some reason

cosmic lichen
#

no need to search for the folder

#

Scenario -> Open Scenario Folder

burnt torrent
#

just loads said scenario

#

i want the location but to add script if you with me

#

found it

#

guys i seem to have a bigger problem when i right click and try to press new it crashes and dosn't work....

cosmic lichen
#

Press "new" where exactly?

#

and what crashes?

burnt torrent
#

so i go to documents arma 3 mp missions right click go to click new to make new text and it crashes and dosn't create one

cosmic lichen
#

That's a windows related issue.

#

Weird

burnt torrent
#

yeah more common than you think if you google it,conflicting program some where

cosmic lichen
#

hmm

#

I've got no solution for that unfortunately.

bitter bough
#

Random thought, would it be possible to add an internet radio to a vehicle?
(Currently working on vehicle reskins for my group and want to expand my horizons a little bit on various functions)

astral dawn
#

I doubt you can make arma play an audio stream even through Intercept

#

....but you could write a .dll that just plays sounds on its own I guess?

#

of course all players must have this addon

tough abyss
#

anyone know of a way to see what object is currently under a vehicle

#

isTouchingGround returns true while atop of an object

spice axle
astral dawn
#

does arma play audio for you or does your addon play it itself?

burnt torrent
#

@cosmic lichen I've at to make a new user and lose many things 😩 😫 😭 😭 😭 😭

obsidian violet
#

Hello guys.
wanted to check if anyone could help me out.

Basicly I would like to use a object as a autoheal function. When a player stands closer than 5m from the variable/object (In this case KLT_healLocation) he gets automaticly fully healed.

What I´m having problems with is the definition of my local variable _nearby_units. This one needs to define the specific player that is close towards the KLT_healLocation.

This is what I got so far....

while {true} do 
{

    if (player distance KLT_healLocation < 5) then {

        _unit = player;
        _nearby_units = {if (_unit distance KLT_healLocation < 5)};

        hint "works";

        //Ace
            {
                if (local _x) then {[_x, _x] call ace_medical_fnc_treatmentAdvanced_fullHealLocal}
                 else    {[_x, _x] remoteExec ["ace_medical_fnc_treatmentAdvanced_fullHealLocal", _x]
            };
            } forEach _nearby_units;

        //Vanilla
            {
            _x setDamage 0;
            } forEach _nearby_units;
    }

    else {
    hint "Too far away";
    };
};
tough abyss
#

@obsidian violet Is this piece of code executed locally, on the server, both, or within a trigger/gamelogic entity? And when you say specific player, do you mean whoever is closest to the KLT_healLocation?

obsidian violet
#

The code is being run on both server and locally so it would work on a dedicated server.
Afirm, to anyplayer/ players standing closer than 5m from the object KLT_healLocation

tough abyss
#

@obsidian violet this is my take on a solution, hopefully it does what you're looking for

#

while {true} do //Run indefinitely with a delay of 100ms between iterations. Excluding the sleep function can cause performance issues
{
_nearby_units = (getPos KLT_healLocation) nearEntities 5; //_nearby_units will be an unsorted array of objects that exist within 5 meters of KLT_healLocation
{
if (_x isKindOf "Man") then //Filter the object entity array for infantry units, ignore everything else
{
hint "works";
//Ace
if (local _x) then
{
[_x, _x] call ace_medical_fnc_treatmentAdvanced_fullHealLocal
}
else
{
[_x, _x] remoteExec ["ace_medical_fnc_treatmentAdvanced_fullHealLocal", _x]
};

        //Vanilla
        _x setDamage 0;
    };
} forEach _nearby_units;
if (player distance KLT_healLocation > 5) //If the player is more than 5 meters, give them a hint that they are too far away
then
{
    hint "Too far away";
};
sleep 0.1;

};

obsidian violet
#

Damn, this works great!
Thank you sooo much! 😄

versed elbow
#

Hey need a bit of help if someone can spare the time. I'm rather inexperienced with sqf so be gentle :|

Basically I have a turret attached to a vehicle, and I'm trying to figure out how I delete said turret should the vehicle it's attached to be destroyed or deleted. When I run my script the turret is spawned and attached, I don't get any script errors, but when I delete or destroy the vehicle, the turret remains.

if (isServer) then {
params["_Jackle"];
    _Main_Gun = "HE_Turret_TypeX" createVehicle (getPosASL _Jackle);
    _Main_Gun attachTo [_Jackle,[-1,0,-0.5]];
    createVehicleCrew _Main_Gun;
    [_Main_Gun, true] remoteExec ["hideObjectglobal", 0];
    _Jackle addEventHandler ["killed", {deleteVehicle _Main_Gun;}];
    _Jackle addEventHandler ["deleted", {deleteVehicle _Main_Gun;}];
};
tough abyss
#

@versed elbow SQF scripts are executed in a scheduled enviroment. Event handlers execute in a different enviroment (unscheduled) where they cannot access private variables in your SQF. You pass _Main_Gun into the event handler, but when the event handler executes, _Main_Gun is undefined, and due to the nature of event handlers that won't return an error. To resolve this, create and attach a variable of datatype object for _Main_Gun to the object of _Jackle itself, which can then be accessed by the event handler via the parameters that the event handler "killed" provides, which is "params ["_unit", "_killer", "_instigator", "_useEffects"];. For the event handler "deleted, it will be params ["_entity"]; What you'll want to use here is "_unit" for the killed EH, and "_entity" for the deleted EH, which in both instances is the object the event handler is assigned to; which in your case with be the same as _Jackle.

#

This is my take on a solution to the problem, hopefully it does what you're looking for

#

if (isServer) then
{
params["_Jackle"];
_Main_Gun = "HE_Turret_TypeX" createVehicle (getPosASL _Jackle);
_Main_Gun attachTo [_Jackle,[-1,0,-0.5]];
createVehicleCrew _Main_Gun;
[_Main_Gun, true] remoteExec ["hideObjectglobal", 0];
_Jackle setVariable ["mainGun",_Main_Gun]; //Attach a variable of datatype object referencing _Main_Gun to the object _Jackle itself.
_Jackle addEventHandler ["killed",{params ["_unit", "_killer", "_instigator", "_useEffects"]; deleteVehicle (_unit getVariable "mainGun");}]; //Use the _unit parameter provided by the EH to access _Jackle, then access _Main_Gun, deleting it
_Jackle addEventHandler ["deleted",{params ["_entity"]; deleteVehicle (_entity getVariable "mainGun");}]; //Use the _entity parameter provided by the EH to access _Jackle, then access _Main_Gun, deleting it
};

versed elbow
#

Thank you so much for the explanation and solution, as I said I'm fairly new to SQF so detailed stuff like this really helps.

#

Just tested it, works like a charm 😉 Thank you again!

edgy dune
#

does anyone know why

(-1) mod 7;
``` is -1 in arma,when it should be 6?
tough abyss
#

That is some strange behaviour, it may be a bug. I would use this instead for now, it's an equation with the same/correct behaviour as the modulo function (A mod B)

#

(A - floor(A/B)*B)

still forum
#

@astral dawn the extension plays the audio. You are correct that you can't get arma to play it.. Atleast not without alot of work

edgy dune
#

oh ic, daz weird ive never seen that

burnt torrent
#

_MyArument = (_this select 0);
_string = (_this select 1);

hint str _MylocalVariable;

#

getting error code on this why guys?

#

i know its basic but im learning

random crescent
#

Because it's not defined. You never assigned anything to that.

#

Also use params instead of _this select X.

#

Also no need to put that in parenthesis

burnt torrent
#

im new to this baer so im unsure what you mean ive litreally coppied it off this

still forum
#

_this select 0 and similar is old code and is not recommended to be used if params can be used instead

#

in your code above you set the variables _MyArument and _string
And then try to read the variable _MylocalVariable
But you never set the variable _MylocalVariable so it doesn't exist, thus it's an error

burnt torrent
#

myVairable = 0;

hint str myVariable;

#

i can't even figure this one out to just get a 0 to come up at the top right

still forum
#

Again undefined variable.
you set myVairable But try to read myVariable but you have never set myVariable thus it will be undefined and error

burnt torrent
#

so what should it look like dedmen

still forum
#
myVariable = 0;
hint str myVariable;
burnt torrent
#

gives me error code on line 2

still forum
#

No it doesn't.

#

That code is perfectly fine.

burnt torrent
#

sent you screenshot

#

ahh got it

still forum
#

You wrote there
hint str _MylocalVariable
Look again what i wrote

burnt torrent
#

so if i wanted to swap the 0 for text how would i go about that

still forum
#

myVariable = "text";

burnt torrent
#

it works!!!!! thanks so much man!!!

#

it shows the " " as well though is that some thing you cant change?

#

and it stays there how do i make it stay for 5 second thengo

still forum
#

the additional quotes are added by your str call

#

turning a string into a string makes a string inside a string. So you'll see the quotes.

#

hint automatically disappears after some time

burnt torrent
#

okay i see thanks im going to practice

#

so if i wanted a helicopter to fire a certian rocket at a target would i use

#

_handle = this fireAtTarget [groundtarget1,"HellfireLauncher"];

tough abyss
#

needs setVariable.
Error Reserved variable in expression @hollow thistle

still forum
#

commands can't be set as variables

#

nil is a command

tough abyss
#

Obviously, it is just when people say I have seen nil, and nul, and null used... I'm like 🤦

astral dawn
#

What did I just find?

doStuff = {
diag_log str _a;
};

_a = 666;
remoteExecCall ["doStuff"];

And it outputs 666 into RPT? Seriously?!
And dedmen's ade_dumpcallstack can't see _a but SQF can see it?! @ebon ridge

#

(╯°□°)╯︵ ┻━┻

#

if I do remoteExec then stack variables are not being passed

sour drift
tough abyss
#

In case you know: When a player is on a heli and the heli crash on the ground, and the player dies, what is the _source and _instigator returned by the player HandleDamage event handler calls? I can't test now, sorry!

burnt torrent
#

guys ive downlaoded ad script from armaholic where it will randomly generate ai drop offs and reinforcements how do i put that into my game now ?

#

documents arm 3 missions the mission folder?

cosmic lichen
#

Is there a way to set the tooltip a slider has via script?

winter rose
#

@burnt torrent yes

#

and call it as said in the readme

burnt torrent
#

done it mate getting error codes now when i reach the trigger

#

trying to figure that bit ot now

still forum
#

"And it outputs 666 into RPT? Seriously?!"
So... what? What's special on that? remoteExec just calls in current scope

#

ade not seeing it is probably a bug then

#

Maybe it's a seperate callstack but the root node has the script where remoteExec was called as parent

#

ADE doesn't check namespace parents

astral dawn
#

I expected it to call in a clear scope, maybe even in another frame

#

So code executed on local machine and a remote machine gets different environments and variables, wtf :/

still forum
#

it won't execute at all on remote as variable undefined

#

func

astral dawn
#

I have code that relies on isNil of some local variables

#

and i noticed that it was working wrong on my local computer

#

anyway don't you agree that it should not work like this?

#

🐧
well it's some logging macros and it relied on special private variables added, let's say, per each function call

still forum
#

I would execute things that execute locally right there and then.. Just like a normal call

#

Though I think it's definitely possible to make things thing

astral dawn
#

I add stuff to JIP queue and use side as JIP flag

tough abyss
#

anyway don't you agree that it should not work like this?
did someone delete tonnes of messages?

astral dawn
#

? I'm refering to my message above with a piece of code

#
doStuff = {
diag_log str _a;
};

_a = 666;
remoteExecCall ["doStuff"];

tough abyss
#

oh I see.

#

only local will print 666

astral dawn
#

yes

tough abyss
#

or not

#

I think it is not guaranteed

#

you cannot rely on this

still forum
#

are you testing in SP or MP?

astral dawn
#

sp

still forum
#

might be different in MP then

astral dawn
#

let me see in mp actually

#

you are right, in mp it works as expected

#

in SP it's just replaced with plain call I think

burnt torrent
#

keep getting a error undefined variablein expression: _helitype

#

if(typeName _heliType == "ARRAY")then{_heliType = selectRandom _heliType;};

#

thats the script

still forum
#

well. did you define _heliType?

burnt torrent
#

no i thought it randomly generated one

random crescent
#

🤦

burnt torrent
#

hese why it says select random heli type

#

im new bear im trying to learn please please bear with me hahaha

random crescent
#

Your computer does nothing you don't tell it to do.

#

selectRandom selects a random element from a list

#

It does not generate a list.

burnt torrent
#

makes sense

random crescent
#

How would it even know what kind of list you want?

burnt torrent
#

_helitype

random crescent
#

That's just a name.

#

I can name my dog "cat" and it will still be a dog.

burnt torrent
#

so how would i just tell it to pick a PO-30 Orca

random crescent
#

By assigning the class name of the Orca to the variable.

burnt torrent
#

i downladed the script of armaholic i thought it was just a simple case of putting the sqf in mission file placing a trigger and calling the script

still forum
#

did you read the text on the scripts armaholic page?

burnt torrent
#

which text you refering to ded?

still forum
#

"on the armaholic page"

#

where you downloaded the script from

#

there is usually text above the download button

burnt torrent
#

yeah it says to see included documentation ive opened that and it simply says to copy and paste this

#

nul = [this] execVM "LV\heliParadrop.sqf";

#

so i place that in my trigger activation and i have the script for the helidrop in my mission file

#

it gives me error line for 122 as above

still forum
#

"in my trigger activation" no

burnt torrent
#

how come?

still forum
#

this is undefined in trigger activation

#

I assume it's meant for a init script on something

burnt torrent
#

sorry i don't follow

turbid thunder
#

Hey, I'm having problems with vehicle customizations being visible online. Apparently just customizing the vehicle with things being visible isn't visible to people joining and I somehow can't get BIS_fnc_initVehicle to work to do it, so this:

[
    car,
    ["Guerilla_11",1], 
    ["HideDoor1",1,"HideDoor2",1,"HideDoor3",1,"HideBackpacks",1,"HideBumper1",1,"HideBumper2",1,"HideConstruction",1,"hidePolice",1,"HideServices",0,"BeaconsStart",0,"BeaconsServicesStart",0]
] call BIS_fnc_initVehicle;```
doesn't work even when called on all clients.
tough abyss
#

Anyone can help me with my question some messages above?

burnt torrent
#

sorted it guys

tough abyss
#

@turbid thunder how do you do it, works fine for me

turbid thunder
#

@tough abyss Init.sqf. Does it work for those that join your game too?

tough abyss
#

JIP works yes

#

what if you delay it

#

because maybe it is too soon

#

try

[] spawn {
sleep 1;
[
    car,
    ["Guerilla_11",1], 
    ["HideDoor1",1,"HideDoor2",1,"HideDoor3",1,"HideBackpacks",1,"HideBumper1",1,"HideBumper2",1,"HideConstruction",1,"hidePolice",1,"HideServices",0,"BeaconsStart",0,"BeaconsServicesStart",0]
] call BIS_fnc_initVehicle;}
#

in init.sqf

turbid thunder
#

Will try. I'm having some big trouble getting this to work because apparently just setting it to be like that in the editor doesn't work. And my next problem is that if I want to spawn in vehicles with that customization, I have to use the vehicle spawn code coming from the export. At least I couldn't figure out how else I would apply the customization without needing a giant list pre-made functions ready to use for every customized vehicle variant I use

tough abyss
#

My bet is on this executed too soon

turbid thunder
#

Okay so

#

No, it doesn't work

#

But somehow the customization works for the T-140 without any issues

tough abyss
#

does it change texture at all?

turbid thunder
#

But the Offroader and the AAF tank dont work

#

Not for him no

tough abyss
#

for you

turbid thunder
#

Well, yes, it works for me because it works for me without any scripts

tough abyss
#

what do you mean

#

it works for me without any scripts

turbid thunder
#

That any customization done is visible to me as the host

#

But when my friend joins he can't see it

tough abyss
#

wait you test it on hosted?

#

I tested on dedicated

turbid thunder
#

tested on a self hosted server

tough abyss
#

ok let me try that

#

yeah hosted is fine as well

#

you must be doing something else

#

make a simple mission 2 players 1 car

idle obsidian
#

Hi! I'd like to make an object that would be a copy of my drone (x,y,z) but with (x,y,-1) how do I do it?

turbid thunder
#

Also apparently when we respawn our guns make no sounds. Nice

tough abyss
#

what sound the guns should make?

turbid thunder
#

The default sound of the MX rifle?

#

When firing?

tough abyss
#

oh then you definitely have something broken

#

probably overloading network with messages or have lost packets

turbid thunder
#

@tough abyss So apparently, enableSimulation causes that issue

#

If I disable it, it doesn't work

digital hollow
#

Yeah, all that stuff in the game is simulated, not real 😅

tough abyss
#

you disabled simulation on the vehicle?

turbid thunder
#

Yes. They're not supposed to be used

tough abyss
#

did you put it in vehicle init?

turbid thunder
#

No

#

I mean, define "init field". I put a script execution in the init field

#

Btw a simple two player mission with nothing also creates the sound issue

tough abyss
#

you said you added it in init.sqf?

turbid thunder
#

Not the enableSimulation

tough abyss
#

this enablesimulaion false?

turbid thunder
#

yeah

tough abyss
#

oh dear

#

that would break the hell out of it

turbid thunder
#

Hu?

tough abyss
#

You tell the engine "I don't want this object simulated"
Engine: Ok
You: Now update the texture
Engine: U wot m8?

turbid thunder
#

So basically, I can't ever make a vehicle static if I want customization in multiplayer?

#

btw I figured out that switching weapons or reapplying the loadout fixes the sound issue. GG bohemia

random crescent
#

customize it, then disable simulation.

tough abyss
#

You can create it as simple object and customise it no need to disable simulation

turbid thunder
#

Adding in a one second sleep fixed that issue

craggy adder
#

I never figured out why but to get my custom HUD working I had to have a 1 second sleep before initialization

#

I should revisit that

turbid thunder
#

@random crescent

deleteVehicle _veh;
_export = compile ([_car,typeOf _car] call BIS_fnc_exportVehicle);
call _export;```
Believe it or not, but for some reason, THIS works and I can use _veh to reference the vehicle spawned in from the BIS_fnc_exportVehicle
random crescent
#

why are you creating a vehicle and then immediately delete it?

turbid thunder
#

If I don't delete it, I have two vehicles. If I remove the first spawn code, then _veh can't be used as a reference for the vehicle which just spawned in. It throws an error. But for some odd reason, THIS, works.

random crescent
#

it will be null though

turbid thunder
#
 _veh = createVehicle [typeOf _car, [0,0,100000], [], 0, "NONE"];
deleteVehicle _veh;
_export = compile ([_car,typeOf _car] call BIS_fnc_exportVehicle);
call _export;
_veh attachTo [_car, _offset];

Vehicle actually gets attached to the object I wanted it to be attached to

random crescent
#

yeah that's because the code that export function refers to its vehicle

#

its entirely unrelated to spawning a car first

still forum
#

then _veh can't be used as a reference for the vehicle which just spawned in.
🤦
_veh = objNull

#

is the same as creating and deleting

random crescent
#

this is what that export function creates

#
_veh = createVehicle [""gm_ge_army_Leopard1a1a2"",position player,[],0,""NONE""];
[
    _veh,
    [""gm_ge_wdl"",1], 
    [""CamoNet_01_unhide"",0,""CamoNet_02_unhide"",0,""CamoNet_03_unhide"",0,""AmmoBox_01_unhide"",0,""AmmoBox_02_unhide"",1,""FuelCanister_01_unhide"",0,""FuelCanister_02_unhide"",0,""FuelCanister_03_unhide"",0,""beacon_1_1_org_unhide"",0,""sideskirt_unhide"",1]
] call BIS_fnc_initVehicle;
#

so what you want is

private "_veh";
call compile ([_car,typeOf _car] call BIS_fnc_exportVehicle);
_veh attachTo [_car, _offset];
#

no need to spawn stuff.

#

also dont spawn 10k mid air. just spawn at 0 0 0, it has some optimizations.

still forum
#

private _veh = objNull
:U

turbid thunder
#
        //_veh = createVehicle [typeOf _car, [0,0,100000], [], 0, "NONE"];
        //deleteVehicle _veh;
        _export = compile ([_car,typeOf _car] call BIS_fnc_exportVehicle);
        call _export;
        _veh attachTo [_car, _offset];```
Throws an error and the vehicle doesn't get attached
#

¯_(ツ)_/¯

random crescent
#

you forgot my first line

#

it's essential.

#

deenmd, thats one command more 😛

still forum
#

no

#

private x = is not a command

turbid thunder
#

But how would I do that when I'm using the export function?

still forum
#

private "string" is a command

#

So.. I have same number of commands

random crescent
#

mason just copy my three lines and replace your three lines with what i wrote

#

it works.

turbid thunder
#

Well no because it needs to work with any vehicle I attach that script to and not just that one that I have prepared to look that certain way

random crescent
#

and?

still forum
#

🤔

random crescent
#

my code contains no classnames or anything like that

#

whats the problem

burnt torrent
#

any way i can make notepad++ dark theme?

fossil mason
#

C++ Best

still forum
#

yes

turbid thunder
#

@random crescent so "private" in a nutshell does what? I never understood it

queen cargo
#

@burnt torrent options of notepad++

#

There are dark skins

random crescent
#

it defines the variable

#

sort of

#

hold on

still forum
#

my variant would work without private too

burnt torrent
#

thanks @queen cargo

random crescent
#
private _x = 1;
call {
   _x = 2
};
hint str _x; // 2
call {
   _x = 2
};
hint str _x; // error
private _x = 1;
call {
   private _x = 2
};
hint str _x; // 1

makes sense?

#

if the variable exists in an outer scope, and you dont use private, the variable in the outer scope will be changed.
if the variable does not exist in an outer scope, and you dont use private, the variable is undefined, even if it is used in an inner scope.
if the variable exists in an outer scope, and you use private, you prevent accidentally overwriting stuff from an outer scope.

#

if you just use private "_x", the variable won't be undefined, but it will be nil. nil basically means "it exists but has no value".

#

params and param automatically will do privatization, too. it's best practice to always use privatization because of the accidental overwriting.

turbid thunder
#

I see

#

Thx for explaining

random crescent
#

you're welcome

turbid thunder
#

Now I just have the weapon sound issue to deal with

#

I dunno for some odd reason, even on a simple 2 player mission with nothing on it, weapon sounds cant be heard after respawn unless we switch to our pistol and then back to our primary

#

@random crescent Do you know a way to exclude the game automatically spawning in the vehicle while still being able to apply the customization

random crescent
#

use unscheduled

#

so no spawn or execVM

#

then everything happens within a single frame

cold pebble
#

param doesn't make variable private D:

astral dawn
#

use unscheduled so no spawn or execVM then everything happens within a single frame
or wrap the code that must not be interrupted into isNil {}

still forum
#

"param doesn't make variable private D:" it does

peak plover
#

params does

cold pebble
#

^^

peak plover
#

param is like select or #

cold pebble
#

Indeed ^^

random crescent
#

yeah my bad

#

fixed 😄

austere silo
#

JIP is not working anymore. when you want to join you are in the lobby and when you choose the slot and click ready its also loading but then it stays on the loading screen. is there a standard JIP script what i can try?

#

20:26:18 "JIP: Саша (00000) ready."
20:26:18 Performance warning: SimpleSerialization::Write 'JIP0000_aiSetting' is using type of ',NaN' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
20:26:18 Performance warning: SimpleSerialization::Read 'JIP00000_aiSetting' is using type of ,'NaN' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
20:26:18 .: Value type not matching: Number != Not a Number
20:26:20 Error in expression <ime;

astral dawn
#

looks like you tried to transmit a NaN and arma didn't like it?

#

I was messing with remoteExec(Call) today and it works as expected for JIP 🤷

#

Yes I was able to reproduce it with a bad number, it looks like it doesn't execute the function remotely if it can't serialize arguments:

doStuff = {
params ["_value"];
diag_log format ["Value: %1", _value];
};

_a = sqrt(-1);
[_a] remoteExecCall ["doStuff", 2];
#
23:23:51 Performance warning: SimpleSerialization::Write 'params' is using type of ',NaN' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
23:23:51 Performance warning: SimpleSerialization::Read 'params' is using type of ,'NaN' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
23:23:51 .: Value type not matching: Number != Not a Number

so, check what parameters you are transmitting

surreal peak
#

NVM, missed something obvious

tough abyss
#

it does
not

austere silo
#

thx for the quick response

#

helped a lot

spring stone
#

When I have this: random [240,600,1200] can I make it so it only gives me numbers in steps of 60? (so basically minutes)

turbid thunder
#

Use smaller numbers and then multiply the result with 60

still forum
#

Just do smaller random, then round and multiply my 60

winter rose
#
// from 1 to 10 minutes
private _duration = (ceil random 10) * 60;```
spring stone
#

Ah, duh I totally forgot that I could just multiply. Thanks :3

burnt torrent
#

_firstshot = [cam1, cam2, target1, 9, 0.3, 0.1, false, 0, 0, 0,false] execVM"AL_intro\camera_work.sqf";

#

any one see any thing wrong with that ive follwed the video down to t and cant figure it

#

now no error lines just script_AL_intro/camera_work.sqf not found

turbid thunder
#

\ not / maybe used the wrong slash?

burnt torrent
#

on the code?

turbid thunder
#

On the code that runs the script, yeah

burnt torrent
#

no just tried that got same thing

#

ive litreally followed that to the t

keen bough
#

Okay. So far i have a script with which i can shoot grenade from a "thought shoulder weapon" something like a shoulder mounted grenade launcher.

I can dumb fire, dumb mass fire, target on map within range and so on. Near limitless options to make 'cool shoulder mounted weapon'

But immersion is a thing, you know... a script can only do so much. Is there a mod-less solution i can kind of get an object attached to the shoulder with which i can fire then those grenades? Or is a mod unavoidable? Future Setting is awesome but kinda everyone still sticks to ww2, cold war n' stuff... So nobody thinks of the future kind of.

What would a solution look like? Full blown script with all yadda yadda or a straight up mod?

burnt torrent
#

what does |#| in a error line

turbid thunder
#

# highlights where a problem has been found

keen bough
#

i guess generic error if i remember correct.

burnt torrent
#

[150, 90, 400, 1000, restriction] spawn Dan_fnc_CruiseMissile / or ExecVM "fn_cruiseMissile.sqf";

#

got a # at the spawn part

#

and correct @keen bough saying error generic error in exspression

keen bough
#

oof, dont know - the spawn looks correct if its configured exactly like that. The error could be then in the function. Dont know the code before spawn or the function itself

burnt torrent
#

no worries thanks any way

cedar hinge
random crescent
#

Yeah go ahead, let us know when you're done

keen bough
#
  _rng0 = random [-2, 0, 2];
  _rng1 = random [-2, 0, 2];
  _pllX = _plLok select 0 + _rng0;
  _pllY = _plLok select 1 + _rng1;

throws me a zero divisor every now and then, yet i could not tell why that happens. Any clues?

#

It seems it did not worked well with select 0 select 1, so i used () around them and now there is no zero divisor.

still forum
#

Wow! The car script guy is back

tough abyss
#

If a player take one hit and die, the **HandleDamage ** EH is processed to all parts before the **Killed ** EH runs even if the player died on part 2 or 3 of 9?

peak plover
#

good question @tough abyss

#

diag_log or systemChat in the EHs to find out

tough abyss
#

@peak plover thanks!

tough abyss
#

Player doesn’t die during HandleDamage

#

This is why you can override the damage

#

Because it is not applied until after

#

@keen bough look up sqf operator precedence

fossil yew
#

addEventHandler is local command?

burnt torrent
#

what does it mean when i got to launch a script in debug and it says cannot find script ?

#

script AL_intro\time_sev.sqf not found im getting

#

but that sqf is in the mission folder

unique atlas
#

the script is in the folder "AL_intro" within your mission directory?

burnt torrent
#

yes sir

#

tried it with it in folder and with it out @unique atlas

surreal peak
#

I'm trying to use setName to change the name of a dog unit

#

but it is not displaying on the DUI Squad Radar mod

#

is this a problem with the mod or should I use another way of doing this

surreal peak
#
    _grp = createGroup civilian;
    _dog = _grp createUnit ["Fin_blackwhite_F", _pos, [], 0, "CAN_COLLIDE"];
    _names = ["Bella","Lucy","Daisy","Luna","Lola","Sadie","Molly","Bailey","Max","Charlie","Cooper","Buddy","Jack","Rocky","Oliver","Bear","Duke","Tucker","Sophie","Lexi","Pepper","Poppy","Maya","Izzy","Annie","Harley","Belle","Willow","Cali","Marley","Angel","Sugar","Shelby","Nova"];
    _selectedName = selectRandom _names;
    _dog setName _selectedName;
    [_grp] joinSilent _dog;
    player groupChat (format ["name: %1",(name _dog)]);
#

the name of the dog is being outputted, however DUI is not showing it

astral dawn
#

🤷 then we must know how the addon is getting the name

#

I think @digital jacinth made it?

surreal peak
#

Thanks, gonna do some crawling then 😄

astral dawn
#

Just to be sure, does name _dog return the name you have set with setName?

surreal peak
#

yh

digital jacinth
#

@surreal peak you sure the dog is even in your player characters group?

surreal peak
#

it takes orders and the empty group symbol only appears after I get ihim to join

#

Here is the full script for reference:

#
["Dog Modules", "Spawn Friendly Dog",
{
    params ["_pos","_unit"];
    _grp = createGroup civilian;
    _dog = _grp createUnit ["Fin_blackwhite_F", _pos, [], 0, "CAN_COLLIDE"];
    _names = ["Bella","Lucy","Daisy","Luna","Lola","Sadie","Molly","Bailey","Max","Charlie","Cooper","Buddy","Jack","Rocky","Oliver","Bear","Duke","Tucker","Sophie","Lexi","Pepper","Poppy","Maya","Izzy","Annie","Harley","Belle","Willow","Cali","Marley","Angel","Sugar","Shelby","Nova"];
    _selectedName = selectRandom _names;
    _dog setName _selectedName;
    [_grp] joinSilent _dog;
    player groupChat (format ["name: %1",(name _dog)]);
    
    {_x addCuratorEditableObjects [[_dog],true];} forEach allCurators;
    [_dog, 0, ["ACE_MainActions"], petAction] call ace_interact_menu_fnc_addActionToObject;
    _dog setVariable ["BIS_fnc_animalBehaviour_disable", true];    
}] call Ares_fnc_RegisterCustomModule;

petAction = [
"Pet Dog",
"Pet Dog",
"",
{
[_target] joinSilent _player;
_player setDamage 0;
_handle = [{
            params ["_args", "_handle"];
            _args params ["_target"];
            scopeName "handle";
            if (!alive _target) then {
                [_handle] call CBA_fnc_removePerFrameHandler;
                player groupChat (format ["Dog Dead"]);
                breakOut "handle"
            };
            
            _gLeader = leader group _target;
            if (speed _gLeader > 6) then {_target playMove "Dog_Sprint"};
            if ((speed _gLeader > 3) && (speed _gLeader < 6)) then {_target switchMove "Dog_Run"};
            if ((speed _gLeader > 1) && (speed _gLeader < 3)) then {_target switchMove "Dog_Walk"};
            if (stance _gLeader == "PRONE") then {_target switchMove "Dog_Sit"};
            if ((stance _gLeader == "CROUCH") && (speed _gLeader == 0)) then {_target switchMove "Dog_Sit"};
        }, 2, [_target]] call CBA_fnc_addPerFrameHandler
},
{true}
] call ace_interact_menu_fnc_createAction;
digital jacinth
#

hmm i see. i take it no icon and name is shown @surreal peak ?

#

seems to work on my end? Is it a multiplayer issue?

#

my current recommendation for the name to show up is to do this and the setName command

_dog setName _selectedName;
_dog setVariable ["ACE_NAME", _selectedName, true];
surreal peak
#

Will try that out when I get home. Thanks!

velvet merlin
#

how to detect editor testing vs SP mission play?

cold pebble
silver linden
#

I’m a complete idiot when it comes to scripting.
I’m trying to figure out / see if there are any prewritten scripts for a flag.

Idea is to walk up to a flag, scroll wheel with the AddAction and to raise the flag of your own side.

#

Does anyone know anything similar / relatable to this?

velvet merlin
#

@cold pebble ty. but not useful:

true when inside editor environment, false during preview

cold pebble
#

will be true for editor testing but false for mission play? 🤔

velvet merlin
#

so the BIKI info is wrong?

#

uiNamespace getVariable "gui_classes"

#

this seems to have been a way pre Eden editor

cosmic lichen
#

@velvet merlin You need that for a mod or just a script?

velvet merlin
#

mission/game mode

#

with a mod, i could do some onload/onUnload handling

cosmic lichen
#

or just Eden EH

#

Well guess you have to use larrows suggestion

velvet merlin
#

uiNamespace getVariable "gui_classes" is no longer set it seems

#

currently trying to find some other variables

burnt torrent
#

how do i set camera target on vic

cosmic lichen
#

@velvet merlin If the player used the context menu and pressed "Play as this characer" the variable "bis_fnc_3DENMissionPreview_code" is set in uiNamespace

#

Becomes temp mission

#

But whats a mission in SP called which has no author set

velvet merlin
#

@cosmic lichen still working with the 2d editor here

#

i think i need to find a var that is set in SP and not via editor preview

velvet merlin
#

str missionConfigFile

#

seems reliable

blissful phoenix
#

don't forget to camCommit

burnt torrent
#

whats that im a noob to all this

blissful phoenix
#

oh... what are you trying to make right now?

burnt torrent
#

cinematics

#

so trying to learn scripting to get the best out come

blissful phoenix
#

are you using the built-in camera or doing it with scripting?

#

oh okok

#

so if you want to make a camera in script

#

one second

burnt torrent
#

do i just exc them in debug?

blissful phoenix
#

you can do that

blissful phoenix
#

or you can make a .sqf in your mission and run it from there; but for learning, the debug console works great

burnt torrent
#

ive bin trying to do that one but it says cant find al folder with script even though its in my mission directory

blissful phoenix
#

you have the camera_work.sqf?

burnt torrent
#

yes sir

blissful phoenix
#

is it in the same folder as mission.sqm

burnt torrent
#

yeah mate

#

in mp missions

forest ore
#

random [0,0.5,1]; gravitates towards 0.5. What to use/how to get random to gravitate towards 0? And maybe even actually get 0 now and then. Heh, would this work random [0.2,0,1]; ?

burnt torrent
#

@blissful phoenix how ever it is saying script_camera not found

blissful phoenix
#

have you restarted the mission since adding the file to the mission folder

burnt torrent
#

yeah several times

blissful phoenix
#

hmmm

#

im not sure

#

i'd have to see what you're doing

#

what are you putting into your debug console

tough abyss
#

@forest ore yeah that should work

burnt torrent
#

_camera_shot= [cam1, cam2, target1, 13, 0.4, 0.5, false, 0, 0, 0 ,false] execVM "camera_work.sqf";

blissful phoenix
#

Technically, it is a rescaled Bates distribution with n = 4. The distribution is split in two at its midpoint and scaled linearly such that its maximum lies at the specified midpoint. @forest ore

#

so if you want a maximum probability at 0, put 0 as the midpoint and then whatever ranges you want

forest ore
#

Thanks M242, gotta test extensively and see if there's some comprehensible results to be drawn.
Sneakyevil, I've seen the table for sure but haven't quite yet figured it out. In those examples there's no results for 0 but that's probably because there's no example for floor random [5, 0, 10]

blissful phoenix
#

yeah absolutely

#

you can just make an array in a while loop for like 10,000 runs and make your own probability distributions for testing

cosmic lichen
#

Anyone knows a way to add a fine adjustment to slider controls? For example, holding the ALT key modifies the step to 0.01 when the slider is dragged?

#
    onKeyDown = "params ['_slider', '_key', '_shift', '_ctrl', '_alt']; if (_alt) then {_slider sliderSetSpeed [0.01,0.01]}";
    onKeyUp = "params ['_slider', '_key', '_shift', '_ctrl', '_alt']; if (_alt) then {_slider sliderSetSpeed [1,1]}";
#

I tried that, but this does only influence the step size when clicking on the arrows.

tough abyss
#

sliderSetRange?

cosmic lichen
#

Maybe as a workaround. If I get the current position and limit the overall range to +-20 then the user has more space to and the increments become smaller. But that's quite some hack.

#

Another thing I noticed. Pressing the ALT key when a slider is focused seems to trigger the onSliderPosChanged event ?!?

#

I am lost...

#
_slider sliderSetPosition ((sliderPosition _slider) + 0.01 * _scroll);//Scroll very smoothly. Direction is given by _scroll (can be positiv or negativ)
_slider sliderSetSpeed [1,1];
``` I also tried to execute this code onMouseZChanged, but that does not trigger the onSliderPosChanged event.
versed elbow
#

Anyone got a basic towing script they wouldn't mind sharing? Would really help a guy out, looking for something simple using attachto and setdir

final storm
#

Im making a custom main menu and I want to spawn a function onload but it doesn't seem to work. has anyone tried this?

young current
#

why do you need to even run a function in the main menu?

#

is there even anything to run it on there?

peak plover
#

And just modify the thing

#

I would just completely get rid of the normal slider

#

and script the entire thing out of EHs

#

Instead of changing the slider speed or stuff like that, just change the value by using the onmousemove event and keydown

burnt torrent
#

_handle = this fireAtTarget [groundtarget1,"HellfireLauncher"];

#

will this make my apache force fire?

winter rose
#

Well,

  • fireAtTarget returns a boolean
  • if this is the Apache, then maybe
burnt torrent
#

another thing when i try my mission then go back to editor i cant move the camera around it just moves the x,z,y axis at bottom left....

#

if (!loopdone) then <<<< im getting undefined vairable on that line any one help?

#

most unhelpfull discord ever 😆

young current
#

its not 24/7 helpdesk 😛

burnt torrent
#

3 days ive been trying to get this camera script to work 😩

young current
#

you may need to explain that again.

#

what are you trying to do, what does not work etc.

#

because if youre questions are spread over 3 days of chat, no one will scroll through them to understand what your issue is.

burnt torrent
#

this is the script im trying to use

#

i follow him step by step

#

but when i try to exc in debug as he does it get a error line which refers to

if (!loopdone)

undefined vairable

young current
#

well you dont seem to have the loopdone defined anywhere

#

also short description of what the script is supposed to do is better than a long video

#

and by looking at your script you dont have the loopdone variable defined anywhere

cosmic lichen
#

@peak plover Thanks, gonna try that!

burnt torrent
copper raven
#

params 😃

burnt torrent
#

can any one help with the script ive just posted im getting erorr on line 17 for undefined variable

#

_firstshot = [cam1, cam2, target1, 9, 0.3, 0.1, false, 0, 0, 0,FALSE] execVM "AL_intro\camera_work.sqf";

#

that is what ive got in my debug exc

copper raven
#

well, the error is self explaining

burnt torrent
#

not when this is your first time scripting lol

#

this is my 3rd day trying to do this 😩

cosmic lichen
#

!loopDone is not defined anywhere

burnt torrent
#

i though it was in that one

#

line 39

#

thats the intro.sqf. the other one is camera_work.sqf

#

there both in my mission folder

cosmic lichen
#

Open the debug console and put loopdone in one of the watch fields

#

That way you can see the value.

burnt torrent
#

just type in loopdone?

cosmic lichen
#

jupp

burnt torrent
#

nothing happens just same error code

cosmic lichen
#

set loopdone = true; in the debug console and try again.

burnt torrent
#

ahhh ive get some where now im getting script camera_work.sqf not found

#

i removed al_intro out the line in the debug because id removed the scrips from the folder

#

_firstshot = [cam1, cam2, target1, 9, 0.3, 0.1, false, 0, 0, 0,FALSE] execVM ">>>>AL_intro<<<<camera_work.sqf"; i removed that and now no error line just script camera_work.sqf not found

young current
#

well where is the camera_work.sqf?

burnt torrent
#

in the mission directory

young current
#

seems like its not if it cant find it

#

is it directly in the mission directory?

#

did you restart the mission?

burnt torrent
#

yeah several times

young current
#

why dont you have the AL_intro folder and all the scripts in it?

burnt torrent
#

removed them from there to see if it would make a difference as it didnt work with them in the folder

young current
#

you sure thats the right mission folder?

burnt torrent
#

yes sir i saved it then checked the date modified to be sure

young current
#

idk. if its supposed to work with the files provided then you have probably missed a step in the tutorial

burnt torrent
#

god knows thanks any way guys

#

just throws that error line up on 17

fossil yew
#

Is there a function that displays an image full screen?

burnt torrent
#

for the undefined variable

#

how would i install the script of steam workshop as that script got updated recently ?

#

could be script on armaholic is outdated maybe?

young current
#

possibly

#

where did you have this?

#

@burnt torrent

#

because if this does not run

#

then the loopdone never gets defined

#

this part is what you are trying to run from the console right?

#

because to me it looks like your are not using the scirpts as they should be used

burnt torrent
#

yes that is the part im trying to run mate

#

the bit youve pointed at with the arrow is the bit im putting in the debug

#

horrible goat i could kiss you mate!!!!!!!!!!!!!!

burnt torrent
#

_ammo = getArtilleryAmmo [gun1] select 0;
_tgt = getMarkerPos "target1";
gun1 doArtilleryFire[_tgt,_ammo,10];

sleep 2;

_ammo = getArtilleryAmmo [gun1] select 0;
_tgt = getMarkerPos "target1";
gun1 doArtilleryFire[_tgt,_ammo,10];

#

nearly there guys now im trying to get 2 scorchers to fire but 2 seconds apart so it don't look fake but that sleep code is chuckig up a error im putting this into the trigger information the artillery works if i remove the sleep 2;

marsh storm
#

So here's an interesting one - I'm looking to run an Ace Combat inspired mission, based around Stonehenge Defensive from AC7

#

What I really need is a script to have a visible "beam" fire when the countdown is complete

#

Any thoughts?

#

(for those that have played the game, I'm going to have the players be one of the "menhir" defensive positions defending against the incoming Eruseans)

keen bough
#
[_priceCheck] remoteExecCall ["narMoney_fnc_moneySavePMC", 2];

Yet it throws me a "generic error in expression" but i wrote it, no matter if remoteExec or remoteExecCall, exactly as it is stated in here: https://community.bistudio.com/wiki/remoteExec

#

_priceCheck contains a number.

astral dawn
#

Do DayZ scripting commands have 10 position formats used among all functions too, or is it finally unified?

#

i mean ASL/AGL/ALGS/ALSW/ALTWTF and so on xD

young current
#

They all serve different purposes

astral dawn
#

sure, still makes no sense to have drawLine3D use AGL, and lineIntersects to use ASL :/

#

I would expect commands not involved with creating objects just use some unified world coordinates TBH

young current
#

That could make things easier for sure.

astral dawn
#

maybe while we are on it, if I am writing functions like 'find safe position on road', 'check if position is safe', and so on - which format do I use?

#

I hate to think about converting this sh*t before calling any of my algorithms, I would like to have a unified coordinate system

#

for my scripts I mean

keen bough
#

My Problem is solved. I was looking into the wrong script. Could solve the issue.

broken forge
#

is there any way to lock the game to first person, apart from when in vehicles?

keen bough
#

@broken forge I dont know vanilla settings beside the difficulty settings which i would suggest to look into. But when you use ace you have such a setting within the ace-addon settings for missions/server and client.

broken forge
#

okay, thankyou

lost copper
#

@broken forge did you want to allow using 3rd person view in vehicle, but not on foot? Without additional mods)

broken forge
#

yes @lost copper

lost copper
#

@broken forge try this:

  1. Enable 3-rd person view in server config.
  2. Code in init.sqf:
if hasInterface then {
    execVM "disable3rd.sqf"
};
  1. Create file disable3rd.sqf:
waituntil {!(IsNull (findDisplay 46))};

player addEventHandler ["GetOutMan", {
    params ["_unit", "_role", "_vehicle", "_turret"];
  if (cameraOn == _unit && cameraView == "EXTERNAL") then {
    _unit switchCamera "INTERNAL";
    [] spawn {
      hint "3rd view enabled in vehicles only!";
      sleep 3;
      hint "";
    };
  };
}];
(findDisplay 46) displayAddEventHandler ["KeyDown", {
  params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
  if (isNull objectParent player) then {
    if (_key in actionKeys "curatorPersonView") then {
      [] spawn {
        hint "3rd view enabled in vehicles only!";
        sleep 3;
        hint "";
      };
      true 
    }; 
  };
}];
  1. The work in done, check it on server.
broken forge
#

okay, tyvm

#

hmm, that didn't seem to work

lost copper
#

@broken forge works for me now 😁

#

Did you have something else in init?

broken forge
#

nope. just that. the server is running on warlords in multiplayer with zeus and the following mods:
CBA_A3
Achilles
Radio Anim for TFR
TFR
RHSAFRF
@lost copper

#

maybe some of those would mess with it

lost copper
#

Test this script on vanilla, that works on them.

broken forge
#

okay

#

nope, still dont work. it does spawn a BLUFOR init in my group however

lost copper
#

@broken forge any errors?

broken forge
#

nope

#

oh, i'm stupid. the bit about the blufor unit was just me being a rtard

lost copper
#

So it works?

broken forge
#

nope, the script doesn't do anything to my game as far as i can tell

lost copper
#

that is strange, cause it works in my test mission.

broken forge
#

problem solved

#

this script works, anyone can use them if needed

sturdy cape
#

may be me not understanding something and o know it seems simple sqf "nuke" remoteExec ["playsound",-2,true];will play a sound foe every unit on the server,i just need it to play local per player (but the script is server side).wheres my fault?

#

as in "every player can hear the sound as much times as there are players on the server" iand i dont like that^^

winter rose
#

@sturdy cape-2 means "everywhere but the server (and actually, a server can be a player)

Also, maybe not set the JIP param to true

#

According to what you say, it seems that this script may run on every client too

#

And if that is the case, just use "playSound" here

sturdy cape
#

well its executed on the server for sure.i just ended up placing the playsound in a client side file and will check.it was just there to have the absolute timing of the event the script is

#

thanks

keen bough
#

dunnow if i already asked this. If i use the init-field of a unit to give that unit a specific eventhandler, and the player, choosing this unit, respawns, will the event handler be active on that unit again?

My understanding says "Nope, because the object after respawn is a new object" am i right?

lost copper
fleet hazel
#

Guys'. How can I find out the color of the pixel under the mouse cursor?

random crescent
#

you can't

tough abyss
#

Pretty sure -2 stops it executed on the server, if it does then you have some other execution in addition somewhere @sturdy cape

keen bough
#

eh, i disabled "disable negative rating" but i dont get a negative rating. I am independend, switch via zeus to blufor and started to kill blufor enemies - rating stays at 0. Did i forget to turn something off script-wise?

#

So far i figured out that, if you switch side, you cant get a negative rating since you're considered still "original side" which, in my case, is greenFor...

tough abyss
#

Somebody can show me how to increase size of a map marker gradually?

astral dawn
#

most likely you can't

#

maybe drawIcon can do scaling

winter rose
#

You… can

#

@tough abyss

tough abyss
#

@winter rose thanks can u tell me how to increase a-axis, b-axis value gradually?

winter rose
#

depends, what do you want to do?

#

You may want to look at while-do for example, or for

tough abyss
#

i want to increase gradually size of the marker just for like 3/4 secondes

winter rose
#

an area marker?

tough abyss
#

yes

winter rose
#

"analogically" or by steps, etc

private _marker = "myMarkerName";
private _size = markerSize _marker;
private _wantedSize = [_size # 0 * 2, _size # 1 * 2];
private _duration = 4; // seconds
private _step = 0.1;
for "_i" from 0 to _duration step _step do
{
  // something
};```
tough abyss
#

wow thanks

winter rose
#

and in the something, well something like this:

private _w = _size#0 + (_i/_duration) * (_wantedSize # 0 - _size # 0);
private _h = _size#1 + (_i/_duration) * (_wantedSize # 1 - _size # 1);
_marker setMarkerSize [_w, _h];
sleep _step;```

Sorry, coding from my phone ^^
#

Not my best code, but I am going to sleep so others may optimise this :-] @tough abyss

tough abyss
#

thanks, i did not know how to write it, but now i think it's fine.

winter rose
#
private _loumontana = 8 * 60 * 60;
sleep _loumontana;```
#

Perfect - good luck then!

unique atlas
#

stupid question I'm sure, but is it necessary to declare that as private @winter rose ? Isn't the variable already private when prefixed with the underscore?

random crescent
#

no

#

it's local, not private. completely different things.

#

local variables only exist for the current script and any scopes within (so functions you call or anything with curly braces).

#

that is unlike global variables, which exist for all scripts.

#

private variables don't influence outer scopes. going to copy what i wrote a couple days ago

#
private _x = 1;
call {
   _x = 2
};
hint str _x; // 2
call {
   _x = 2
};
hint str _x; // error
private _x = 1;
call {
   private _x = 2
};
hint str _x; // 1
slim oyster
#

Hey bois trying to find that animation trace script, probably going to be an AnimDone EH, anyone know what I am talking about? Cheers

verbal knoll
#

hey guys im having a problem when trying to get my current weapon magazine ammo, im using this code ((currentMagazineDetail player) splitString "(/)") select 1 when i put it in the debug console i do get the amount, but when i use it in a function it doesn't work, i get this error : Error Zero divisor. which i know happens when you try to select element that is not available in the array. but in my case the element is available.

#

also i get this Error in expression <litString "(/)";

still forum
#

select 1 if splitString doesn't return array with 2 elements or more, that will error

#

"but in my case the element is available" made double sure?

#

Maybe it's something before/after your code

verbal knoll
#

this is the return for that ((currentMagazineDetail player) splitString "(/)") - ["5.7 mm 50Rnd ADR-97 Mag","50","50","[id","cr:10000032","0]"]

#

so if i select 1 i get "50"

#

nvm i figured it up

#

thank you anyways..

tender fossil
#

Are there commands to retrieve the acceleration of vehicle? I guess not

#

Or more importantly, commands to set acceleration of vehicle

still forum
#

velocity yes, acceleration no

#

_v1 = velocity _veh
sleep 1;
_acc = _velocity _veh vectorDiff _v1

#

^ Doesn't actually work. Its stupid code that will return wrong results.
But something like that

tender fossil
#

Unfortunately retrieving acceleration from velocity is not enough for me, I would have needed the real acceleration

#

As I'd have used the acceleration in giving speed boost to tanks, which doesn't work on velocity based acceleration (it ends up tanks flying in air lol)

tough abyss
#

If you dress it up in the scheduled environment and run it on each vehicle in a loop and cache the result as a local parameter you could retrieve it and it wouldn't be that bad.

#

Faster sample times will give you closer to the real acceleration and by the time you are running every frame it is going to be as accurate as the game is calculating it too

still forum
#

"As I'd have used the acceleration in giving speed boost to tanks, which doesn't work on velocity based acceleration (it ends up tanks flying in air lol)" I do that too.
I have a multiply by 2 button.
Works fine, if you don't press too often thinking it has no effect..... oops

tender fossil
#
Faster sample times will give you closer to the real acceleration and by the time you are running every frame it is going to be as accurate as the game is calculating it too
``` I ran it every frame and got flying tanks 😄 I guess the problem is when you want to change direction, the "last known velocity" doesn't take it into account
still forum
#

well yeah constantly accelerating every frame is probably bad idea 😄

slim oyster
#

^ combine that with ace g forces

tender fossil
#

@still forum The script had speed limit though, the problem was that eg. when you climbed over an hill, the tank kept rolling "uphill" if you kept your forward key pressed down lol

still forum
#

yeaaaahh....

#

Flying hmmwv's

#

at mach 57

tender fossil
#

A community in Arma 2 gave tanks a speed boost at low speeds, it's really useful feature in Benny's Warfare - the fights are much more dynamic and interesting

#

But you can't use the same script in Arma 3 since the FOV is dependent on vehicle speed, so the camera jerks all the time when the speed limit of the script kicks in

peak plover
#

just interpolate the changes over a couple of frames and don't add velocity immediately

tender fossil
#

@peak plover Could try that out, thanks for tip

fleet hazel
#

Guys. How to remove 1 clip from the container?

still forum
#

"the container" ?
"clip" ?

fleet hazel
#

yes, container

digital jacinth
#

Which BI function is called by the Zeus module named Skip time? I want to use the "x hours later" display players get.

still forum
#

BIS_fnc_setDate

digital jacinth
#

hmm, i was looking at any function starting with "moduleX"

still forum
#

well it's in fn_moduleSkiptime.sqf

digital jacinth
#

it is?

still forum
#

yes

#

that's the code the module calls

digital jacinth
#

Yeah it is in there, must have missed it

still forum
#

not helping dude :u

digital jacinth
#

does not have the functionality i was after

#

i am well aware of both commands, but I wanted the transition effect

still forum
#

Yes setDate has the UI stuff

digital jacinth
#

neat, makes things easier

ruby breach
#

@fleet hazel Take a peek at the biki for clearItemCargoGlobal, addItemCargoGlobal, and getItemCargo. Unless Dedmen has sprinkled some magic around there's no way to remove a single magazine from cargo; you have to cache the inventory, delete it all, and re-add everything less whatever you want to remove.

#

Might be magazineCargo; been a while since I played with those and don't remember if magazineCargo returns removable mags or the turret's mags

fleet hazel
#

@ruby breach I have a container

ruby breach
#

Yes, you made that abundantly clear

#

What I said still holds true

fleet hazel
#

getItemCargo

#

dont work for container

still forum
#

it does

#

unless you don't actually have a container

#

But it seems like you don't actually want to give any details

#

so can't help you any further I guess

craggy adder
#

You need to learn to read minds and be more helpful

#

shame on you

harsh sphinx
#

Using attachTo on a vehicle seems to artificially change the boundary box and cause erratic behaviour for vehicles above it. I'm attaching the vehicle to a HeliHEmpty, so I wouldn't expect this to happen. Anyone got any experience of how I might go about fixing this, without using disableCollisionWith 👀

tough abyss
#

whats helihempty?

harsh sphinx
#

It's an invisible landing pad object, but I think I may have solved it by disabling simulation on the parent, or moving it away from the attached object. Not even sure, but not tested in an MP environment so who knows 🤷

halcyon crypt
#

why are you attaching a vehicle to the landing pad? 🤔

harsh sphinx
#

It's because the wreck is acting like michael j fox otherwise.

#

Attaching it seems to be the only way for it to behave.

fleet hazel
#

Hey. Problem. When the player gets into the car, his animation in the car breaks down.

winter rose
#

Happens in Vanilla?

#

(the car script)

delicate lotus
#

Is it somehow possible to change the selected briefing tab when the mission is loaded?
Like with processDiaryLink but that doesn't really seem to work in the briefing screen.

lofty spade
#

Can anyone help me script for a server? I am willing to pay

#

@everyone If you can script please help I am in need of support willing to pay

still forum
#

🤔

delicate lotus
#

Willing to pay with what exactly?

tough abyss
#

Hey all - Is there a way to get the curator cost a unit, given its class?

#

I'm trying to make an AI wrapper around the zeus interface

#

Doesn't seem possible to make calls to the zeus interface directly, so I'm trying to at least emulate it

#

Failing that, can someone help me with function scopes?

#
private _homeSector = _this select 0;

private _testFunction = {
    hint str _homeSector; //undefined variable
};
#

Why does that not work

still forum
#

because... That's just how it is

#

variables are passed when code is executed, not when it's defined

tough abyss
#

So I can't access variables outside of that function?

still forum
#

Only if they exist where the function is called

#

Like

private _homeSector = _this select 0;

private _testFunction = {
    hint str _homeSector;
};

call _testFunction; //Works
astral dawn
#

You must pass variables to functions when you call them, if you are familiar with that concept 🤔

tough abyss
#

That doesn't work

still forum
#

That does work

tough abyss
#

That's my code

#

basically

still forum
#

Then you are doing something else wrong

tough abyss
#
_homeSector = _this select 1;

_taskCaptureInitial = {
    _sector = [_homeSector] call _nearestUnclaimedSector;
    _vehicle = ["B_MRAP_01_F", position _homeSector] call _spawnUnit;
    _vehicle addWaypoint position _sector;
};

[] spawn _taskCaptureInitial;
#

Is my exact code

still forum
#

spawn is not executing the code right there

tough abyss
#

It's doing it in a scheduler

still forum
#

It creates a new script that runs later

tough abyss
#

Can I omit the [] when doing a call?

still forum
#

later. When your _homeSector variable will have gone out of scope long ago

#

yes

tough abyss
#

How about with execVM and spawn?

still forum
#

they both launch the code sometime later

#

not right now and right here like call does

#

they create a new script instance.

#

Variables carry over from higher to lower scopes.
but spawn creates a new script, with no parent scopes that could have any variables

#

If you want parameters in spawn/execVM then you need to pass them manually

tough abyss
#

Got it

still forum
#

Same for anything else which doesn't execute "right now, right here"
like addAction or eventhandlers of any kind

tough abyss
#

Okay. Are recursive functions allowed?

#

Doesn't seem to be behaving as expected

still forum
#

yes

#

there is a limit to recursion depth though.. like after a couple hundred levels deep you'll get problems

tough abyss
#

I'm only going 1 layer deep

astral dawn
#

are you sure that you are passing your parameters through params?

#

when you make a call

#

should be stuff call code, not _stuff call {_sfuff = _stuff - 1; call code};

tough abyss
#

_driver = [_driverUnit, _pos] call _spawnUnit;

Type object expected code

still forum
#

So what now

#

one of your variables that should be code is an object

#

There is nothing anyone can read out of that generic line of code

tough abyss
#

I haven't set any expected types on that function

still forum
#

commands do that, not you

#

check where the error is actually thrown

tough abyss
#

I assume the "expected code" spans from the call command right?

still forum
#

Might be, might be inside the function, might be in the lines above or below the line you sent

tough abyss
#

The error was that line

still forum
#

maybe _spawnUnit is a object then

tough abyss
#

Yea, that's what I thought. But I know it's a function, which made me think the fact its called recursively might not be working as intended

still forum
#

if you show your actual code people might be able to tell you what you are doing wrong

tough abyss
#

Sure

#
_spawnUnit = {
    _unit = _this select 0;
    _pos = _this select 1;

    _points = curatorPoints _curator;

    if([_unit] call _getUnitCost > _points) exitWith {
        false
    };

    _group = createGroup (_curatorSide);
    _spawnUnit = _group createUnit [_unit, _pos findEmptyPosition [0, 20, _unit], [], 0, "NONE"];
    _curator addCuratorEditableObjects [[_spawnUnit], false];

    if(_spawnUnit emptyPositions "driver" == 0) then {
        _driver = [_driverUnit, _pos] call _spawnUnit;
        _driver moveInDriver _spawnUnit;
    };

    if(_spawnUnit emptyPositions "gunner" == 0) then {
        _gunner = [_driverUnit, _pos] call _spawnUnit;
        _gunner moveInGunner _spawnUnit;
    };

    _spawnUnit;
};
still forum
#

_spawnUnit = _group createUnit
🤔

tough abyss
#

shit

#

ahahahaha

still forum
#

You used private before, why do you stop now

tough abyss
#

Rubber duck

still forum
#

That is a prime example of using private

#

and btw replace your _this select's with params

tough abyss
#

so params["_unit", "_points"]

#

is equivalent

still forum
#

although private won't help much either here

#

is equivalent to what you have PLUS private

#

actually _pos not _points

#

If cost is too high, you exit with false.
but your other code in _driver and _gunner expects to always get back a unit, that will error

tough abyss
#

Yea good spot, I'll just add a check

#

How do I declare a variable to use it later?

#

Something like

_unitGroup;

    if(isNil "_group") then {
        _unitGroup = createGroup (_curatorSide);
    } else {
        _unitGroup = _group;
    };
#

_unitGroup throws an error saying its not defined

young current
#

_unitGroup = X;

tough abyss
#

It has to be defined to something

#

_unitGroup = objNull; ?

#

Got it, thanks

young current
#

👍

tough abyss
#

Okay, I think one final question, The script I'm calling creates the unit I want it to, but it dissapears instantly

#

i want a trigger to execute once a player picks up an item (uniform in specific). how do i go about this?

karmic otter
#

I'm having an issue where my script works as intended locally, but when I test on a dedicated server, portions of it will execute on mission start. ```if (!isServer) exitWith {};

//definitions
mapmarker = [
"m_2",
"m_5"
];
publicVariable "p2";
justplayers = allplayers - entities "HeadlessClient_F";
playerCount = count justplayers;
accounted = {_x inArea "MS"} count justplayers;

//run check to see if players are in area "MS"
while {playerCount != accounted} do {
justplayers = allplayers - entities "HeadlessClient_F";
sleep 5;
accounted = {_x inArea "MS"} count justplayers;
};

//incoming message from HQ
[[west, "HQ"],"Glad you all made it. Rest up, we'll get you some additional support."] remoteExec ["sideChat",2];
sleep 1;

//blackscreen fadeout transition
[0, "BLACK", 2, 1]call BIS_fnc_fadeEffect;
sleep 2;
6 fadesound 0;
titleText ["10 Hours Later", "BLACK FADED", 1, false];
sleep 2;

//skip time 10 hours
skipTime 10;

//trigger condition = true
p2=true;

//blackscreen fadein transition
[1, "BLACK", 3, 1]call BIS_fnc_fadeEffect;
sleep 1;
6 fadesound 1;

//Mapmarkers revealed
{_x setmarkersize [1,1];} foreach mapmarker;
"m_2" setmarkertext "Laboratory";
"m_5" setmarkertext "Eagle's Aerie";

#

sidechat, and transitions were not executing (as intended), everything else was executing at mission start, with players outside the specified area. Any insight would be appreciated! Thanks.

tough abyss
#

What should I waitUntil in a script to be certain the entire mission is initialized

#

and ready to play

winter rose
#

time > 0 ?

tough abyss
#

Can a switch return a value?

winter rose
#

it can, it is not exactly recommended but yes

tough abyss
#

Ah ok

#

I guess a better solution would be use the config

#

How can I filter config for all units belonging to a certain side

astral dawn
#

I have an idea that I want to click on a map marker and receive an event about it getting the map marker I clicked on
How viable is it to achieve this by making controls and moving them when mouse moves in the map view? Will it lag by one frame?

random crescent
#

I'm curious how a control under your cursor was supposed to help you though

astral dawn
#

damn that's cool, why did I discuver this thing so late and have to write all the mouse events myself 🤦 🤦 🤦

#

help me with what? I thought I can attach the more advanced event handlers to these 'control-markers'

#

I want mouse over events too and such things

random crescent
#

uuuh

#

the in game map is just a map control

#

you can add event handlers to it just fine

tough abyss
#

Is there a way I can still simulate objects that are hidden?

astral dawn
#

so how do I implement and event that my mouse has entered an area of a marker?

#

I guess I need to poll the command you gave above

random crescent
#

yeah

astral dawn
#

on the mouse move event of the map control

random crescent
#

that's what i would do, too.

tough abyss
#

Is there an arma equivalent of Javascript || ?

#

To set default values

#

eg

_t = (call _test) || "default";
#

"defualt" will be set if its nil or null

unique atlas
#

for arma i believe || is "or" in a condition.

random crescent
#
private _var = [_maybe] param [0, "default"];
#

regarding your earlier question:

What should I waitUntil in a script to be certain the entire mission is initialized
nothing at all. initPlayerLocal & initServer will run in postInit, all objects exist at that point, functions are compile etc. if you need for some other scripts to finish, you've got to be more specific.

unkempt plover
#

hey does anyone know if there is a way to start terrain builder or object builder with a command line?

karmic otter
#

thanks!

short vine
#

Is there a way to animate a mesh (specifically stretch it) through SQF?

short vine
tough abyss
#

What is the best way to play a random death sound effect upon a unit's death?

zinc rapids
#
<<THE UNIT YOU WANT TO SCREAM>> say3D [<<SOUND FILE>>, <<RANGE IN METERS>>];

//Example

_miller say3D ["superMillerLand", 10];
tough abyss
#

@zinc rapids It also says on the page you linked that your suggestion will not work as units has to be alive

zinc rapids
#

New plan

#

Spawn an empty object near them (helipad invisible) and have that play the sound

still forum
#

@short vine yes. Scripted animation sources

high marsh
#

the animations have to be a part of model config though

#

so it's not cut and dry SQF

still forum
#

ZephyrSouza is model maker tho, so I assume that's not gonna be a problem

young current
#

That would be best achieved with just model.cfg animation and a tube which one end is animated to move.

#

Could be tied to speed animation source for example. @short vine

brave jungle
#

How to return players default colour choice for menus etc.?

queen cargo
#

cannot quite remember which one it was
but you can find the corresponding variable using allVariables profileNamespace

brave jungle
#

Ah cheers 😄

astral dawn
#

Can map markers receive color not in string form but in the array form, somehow?

#

[r,g,b,a]

still forum
#

You can just convert the array to string?

queen cargo
#

uhm ... setMarkerColor is not supporting non-defined (CfgMarkerColors) colors

brave jungle
#

I'm almost sure they don't, but do objects keep variable names while in player inventory?

queen cargo
#

there are no objects in your inventory

#

only strings

brave jungle
#

Thats what I thought

#

That would make my life too easy 😃

#

i'll just need to grab the client that picks up said object, check if classname is in their inventory when they use an action, reset when they drop it.

still forum
#

CfgVehicles are objects, everything in your inventory is CfgWeapons
Weapons have no variables

winter rose
#

backpacks are vehicles though

still forum
#

yes

#

but they are not in your inventory

#

They are a container that you put your inventory inside

winter rose
#

wait, are vests and uniforms vehicles as well?

still forum
#

yes

steel sandal
#

I'm trying to make sense of how scoping and variable binding works in SQF just so I can relate the concepts to my existing programming experience, but:

  1. setVariable and getVariable operate against named namespaces - is the 'default' global namespace as applied to functions executed the "missionNamespace"? (ie: in mission scripts, could I access a global assigned directly foo = 20; via missionNamespace getVariable "foo")? If it's not the missionNamespace, is it an accessible namespace?
still forum
#

defaultNamespace (there is a command for it) is usually missionNamespace

steel sandal
#

ah, awesome.

still forum
#

yes you can access directly

steel sandal
#

the second question is to do with private scope and blocks and closures/bindings - namely - are private variables in blocks closures, or are they rebound in the caller's context?

#

I guess that's a bit more complicated to explain directly...

private "_foo"; _foo = 20;
[] spawn { player globalChat _foo };

Is _foo valid inside that block, and if so, does it resolve to the _foo outside, or would it be reevaluated to a new _foo in the context where it's spawed? (That's not the precise context I'm working in, but close enough)

still forum
#

private variables are bound to the callstack

steel sandal
#

I can see how to not get bitten by spawn for that since spawn permits argument passing, but in the context I'm trying to work out if a compile is necessary or not

#

right - so the context in which it's called.

still forum
#

You can access them from lower in the callstack, but not higher, and also not from different scripts

#

spawn launches a completely new script with new callstack, thus variables don't carry over

steel sandal
#

yup - I presume event handlers are similar

still forum
#

_foo in your above example is undefined

#

btw private "_foo"; _foo = 20; -> private _foo = 20;

#

scripts that get compiled hold absolutely 0 information about where they were compiled

steel sandal
#

yup - it's more that the immediate values are being resolved at the time of compile (they're compile + format combos), and the fact that variables are bound and resolved at call tells me why that's necessary. 😃 thanks!

#

[well, actually, block scoped even! it's all making sense anyway - just hard to get that direct answer from the wiki]

young current
#

actually vest is not a vehicle. its an item that is drawn on the character vehicle via proxy

#

as in vest doesnt have cfgvehicles class

still forum
#

the container is a vehicle though

young current
#

that it is

cosmic lichen
still forum
#

nearestLocations over the whole map? is there no command to just get all locations?

cosmic lichen
#

Not that I know of.

#

The script runs only once when eden loads a new map/scenario so that's not gonna be a big of a deal.

tranquil shoal
#

is it possible to make the pawnee 7.62 minigun use the same bullet on the cheetah anti aircraft tank?

young current
#

you can remove the original weapon with scripts and add new weapon and new ammo

delicate lotus
#

Will AI actually use those new weapons?

young current
#

should yes

#

depends how some animations and fire effects are set up you might lose some of those

delicate lotus
#

okay. Sounds nice. I always wanted to have an AI pawnee shoot HMG bullets at me

#

One small question about JIP and respawning.
If I disable AI in the slots that the players use, will JIPs use the respawn system so their unit is created?
If I disable respawning, would that cause the JIP player to not spawn at all and only play as a spectator?

winter rose
#

@delicate lotus the Pawnee might shoot rockets from its hull then; if so, you can fix this with a fired EH to place the rockets properly

zealous jungle
#

Scripting noob here, I was wondering if you guys could help me write a script that prints the weaponDirection of the Katyusha (lib_us6_bm13) from ifa3 to the bottom of the screen of the player, both azimuth and elevation

burnt torrent
#

how would i script my helictoper to have its engines running but not take off?

digital hollow
burnt torrent
#

thank you ampersand most appreciated

zealous jungle
#

And how would it be displayed on the hud every frame?

digital hollow
#

onEachFrame and hintSilent for prototyping. If you want it to look fancy, that's way more involved.

burnt torrent
#

how to i get units to fast rope ive got a helicopter put the units in it set it a way point and made the waypoint fast rope (achiles mod one) it reaches the waypoint but they don't fast rope

zealous jungle
#

I'm a bit confused now because I'm not so sure on how to use them, keep in mind that I haven't written a single code before so you'll have to go easy mode with me

digital hollow
#

Try to get onEachFrame Example 1 to work first.

winter rose
digital hollow
#

ah, yeah. that's much easier for the primary turret.

zealous jungle
#

Something like this? onEachFrame { hintSilent weaponDirection currentWeapon};

tough abyss
#

No

digital hollow
#

look at weaponDirection Example 1

zealous jungle
#

I've looked at it but I don't understand it

digital hollow
#

It may be more clear to do _yourVehicle weaponDirection (currentWeapon _yourVehicle). currentWeapon _yourVehicle gets the weapon name as a string, and then weaponDirection gets the direction

#

In the debug console there are 5 Watch boxes. put your weaponDirection code in there to make it quicker to check

zealous jungle
#

Where do I check it?

digital hollow
#

below each watch box is the evaluation result

#

Try putting 1+1 into one of them

zealous jungle
#

Returned 2

#

Did you say I should put _yourVehicle weaponDirection (currentWeapon _yourVehicle) into one of the watch boxes?

#

Or is there anything in that I need to alter?

digital hollow
#

I was mostly showing the execution order with the parentheses. _yourVehicle probably doesn't exist in your test mission, so change that to your mlrs vehicle

zealous jungle
#

lib_us6_bm13 weaponDirection (currentWeapon lib_us6_bm13)?

digital hollow
#

try it. does it work?

zealous jungle
#

Nope

young current
#

is your mrls vehicle named lib_us6_bm13

cosmic lichen
#

It seems like the height is uncorrectly returned when a linebreak is added.

zealous jungle
#

Yeah that's the classname @young current

digital hollow
#

You need to give that particular vehicle a variable name and use the variable name.

zealous jungle
#

You mean I should do something like _katyusha = obj lib_us6_bm13; in debug and _katyusha weaponDirection (currentWeapon _katyusha); in watch?

digital hollow
#

Set the variable name in the attributes of the vehicle in editor

zealous jungle
#

Oh

#

I set it to "katyusha", still not working for me

#

Nvm changed a minor mistake in there

#

Shouldn't it return degrees?

digital hollow
#

Look at the return value of weaponDirection

winter rose
#

a normalised vector iirc

zealous jungle
#

Says [0.672274,0.713409,0.197725]

#

Should I use animationSourcePhase or animationPhase for degrees?

digital hollow
#

If you want degrees traverse and elevation you'll have to do vector math against the whole vehicle's vector direction (or a horizontal/vertical vector)
Alternatively you can go back to animationPhase and then convert the phase decimal number which is probably in radians to degrees.
You picked a real doozie for your first project =p

young current
#

question

#

oh there it is

#

xD

#

it also has the math in the example

#

for degrees

verbal knoll
#

hey guys, i've made a function to check how many available magazines the current player has in him inventory that he can use with his current weapon, it work for all of the weapons but not i tried it on MX SW with 100Round magazines and it returns me 0 : sqf if ((weaponState player select 0) isEqualto "") exitWith {""}; _weaponClass = weaponState player select 0; _availableMagsWeapon = getArray (configFile >> "CfgMagazineWells" >> (getArray (configFile >> "CfgWeapons" >> _weaponClass >> "MagazineWell") select 0) >> "BI_Magazines"); if (isNil "_availableMagsWeapon") exitWith {""}; _availableMags = 0; for "_i" from 0 to ((count _availableMagsWeapon) - 1) step 1 do { _toAdd = {_x == _availableMagsWeapon select _i } count (magazines player); _availableMags = _availableMags + _toAdd; if (_i == ((count _availableMagsWeapon) - 1)) exitWith {_availableMags}; };

#

when i run this code : sqf _weaponClass = weaponState player select 0; _availableMagsWeapon = getArray (configFile >> "CfgMagazineWells" >> (getArray (configFile >> "CfgWeapons" >> _weaponClass >> "MagazineWell") select 0) >> "BI_Magazines");
i only get this array["30Rnd_65x39_caseless_mag","30Rnd_65x39_caseless_khaki_mag","30Rnd_65x39_caseless_black_mag","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_khaki_mag_Tracer","30Rnd_65x39_caseless_black_mag_Tracer"] without the 100rnd magazines class names..

#

why is that?

zealous jungle
#

What does bob mean?

spice axle
#

bob is a player

#

Or a KI but a man

zealous jungle
#

Does vectorMultiply 100 make it degrees?

#

It's weird because straight north is 0, east is 90 and south is also 0

#

The other side is just the same but negative

digital hollow
#

Right, but weaponDirection is relative to world. To get traverse and elevation you'd have to do find the vector projection of _wepDir onto the vehicle normal plane, then do ϕ=arccos(a⋅b/ (|a||b|) ) for both a=_vicDir; b=_wepDirProj and then a=_wepDir; b=_wepDirProj
... I think

zealous jungle
#

I want it to be relative to world

digital hollow
#

Oh ok, then much easier xD

zealous jungle
#

For sure

digital hollow
#

Look at the note by HWM mainframe

zealous jungle
#

I don't know what any of that means

#

So atan2 is arctangent

digital hollow
#

(_array select 0) atan2 (_array select 1) substitute_array with the output from the weaponDirection code

keen bough
#

_var1 = 0;
_var1++
now _var1 = 1;? Would that be correct?

random crescent
#

no

#

there is no ++ in sqf.

zealous jungle
#

How do I check _dir_degrees?

#

I so far have
onEachFrame { _array = katyusha weaponDirection (currentWeapon katyusha) vectorMultiply 100; _dir_degrees = (_array select 0) atan2 (_array select 1); }

digital hollow
#

you shouldn't need to vectorMultiply, and you should private _var = both those things, but otherwise looking good. Now add hintSilent str _dir_degrees;

zealous jungle
#

Yeah I forgot to remove that part

#

onEachFrame { private _var _array = katyusha weaponDirection (currentWeapon katyusha); private _var _dir_degrees = (_array select 0) atan2 (_array select 1); }?

#

Wait I forgot the =

#

onEachFrame { private _var = _array = katyusha weaponDirection (currentWeapon katyusha); private _var = _dir_degrees = (_array select 0) atan2 (_array select 1); }

#

Idk what I'm doing anymore

digital hollow
#

just private _array = ...

zealous jungle
#

Like this?
onEachFrame { private _array = katyusha weaponDirection (currentWeapon katyusha); private _var = (_array select 0) atan2 (_array select 1); }

digital hollow
#

Sure, the _variableName can be whatever

zealous jungle
#

Btw what does the _ imply?

#

Type?

zealous jungle
#

Is the code fine?

#

I put _var in watch and it doesn't return anything

still forum
#

_var is a local variable

#

watch field cannot read random local variable that might be anywhere or nowhere

zealous jungle
#

So it will still work?

#

Also, should they be onEachFrame?

digital hollow
#

Right now your code is calculating it on each frame. It's not showing it yet, so add hintSilent str _var;

zealous jungle
#

Holy shit

#

It works

winter rose
#

yeah, it sometimes happens 😄

digital hollow
#

That's only the azimuth though. Elevation is gonna be a little more complicated.

wraith solstice
#

trying to make an addaction only useable within 2 meters, //Land Nav Course toLandNav addAction ["Move to Course", "scripts\teleports\returntostart.sqf", [],1,false,true,"","_this distance _target < 2"];

#

am I doing it vastly wrong? Its not working in editor

summer flax
#

private _elevation = (_array select 2) atan2 ((_array select 0)^2+(_array select 1)^2);

zealous jungle
#

Why all three coordinates for the elevation?

queen cargo
#
private _elevation = (_array select 2) atan2 ((_array select 0) ^ 2 + (_array select 1) ^ 2);

Please make it pretty and readable .. urgh

random crescent
#

would make that even more readable

queen cargo
#

no

#

just no

random crescent
#
private _elevation = _array#2 atan2 (_array#0 ^ 2 + _array#1 ^ 2);

perfect

queen cargo
#
private _elevation = _array # 2 atan2 (_array # 0 ^ 2 + _array # 1 ^ 2);```*
random crescent
#

looks like an accumulation of random characters

zealous jungle
#

How do I hintSilent two variables like A, B?

queen cargo
#

thats why you use select

#

the # looks like you just puked all over the place and randomly hit the # button

random crescent
#

i agree, !! would have been a much better choice.

#

i mean haskell uses it, so it's already perfect

queen cargo
#

urgh ... all ugly

#

[ and ]

#

where [ is an unary operator and ] is a nular one, just for the lulz

#

though ... no wait

#

i once actually had a working concept idea of that 🤔

astral dawn
#

Be grateful that it doesn't start array indices with 1

queen cargo
#

nah ... forget it ... mixing up stuff here right now

keen bough
#

i would not have a problem starting with 1 ^^ yet it would confuse me since i am working with 0 as start already for some time

#

XD

#

Heresy is fun!!

zealous jungle
#

Nvm I figured it out now

#

Is coding this hard or am I just retarded?

still forum
#

Noone could answer the second part as it would violate #rules

zealous jungle
#

Where do I save scripts to run later?

random crescent
#

C:\

zealous jungle
#

Yeah but what folder

winter rose
#

…Windows

zealous jungle
#

So I cant save it on the game files and then execute it?

winter rose
#

or [missionRoot]\Scripts\myScript.sqf

#

the script you create can only go in a mission or a mod, not a "execute where I want"

#

else you could ruin MP for others, by cheating 😄

#

@random crescent crash by attaching a static object?

#

or having a too long rope?