#arma3_scripting

1 messages ยท Page 731 of 1

brazen smelt
#

Sorry if I'm not picking it up. So I need to define UFA_fnc_skillSet somehow?

little raptor
#

just wrap it in ""

brazen smelt
#

I figured that too as I remembered about the whole string thing from yesterday's conversation with Lou.

But when I try running it, I get another error:

Error 1 elements provided, 2 expected

copper raven
#
  1. default value is missing
brazen smelt
#

Oh so I just need to make it like:

forEach (allUnits select {(side _x == east || side _x == west) && !(_x getVariable ["UFA_fnc_skillSet",false])});
little raptor
#

yeah

brazen smelt
#

Or would it be true in this case? concern

little raptor
#

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

brazen smelt
little raptor
#

depends what you want to happen

copper raven
#

looking at the code, false is what you want as the default value

brazen smelt
#

That when it runs, it applies a variable (which by default is false) and any unit with that variable as false gets their skills set and then their variable changed to true. If its true, it skips that units. It then checks every 10 seconds to see if any units have that variable set as false, then repeat.

#

Atleast that is what I think I'm trying to do

willow hound
#

You can delete the block that was once the first forEach-loop ๐Ÿ™‚

brazen smelt
#

Tho I guess that does make sense.

[] spawn 
{
while {true} do
    {
        {
            _x setSkill ["aimingAccuracy", 0.12];
            _x setSkill ["aimingShake", 0.1];
            _x setSkill ["aimingSpeed", 0.1];
            _x setSkill ["commanding", 1.0];
            _x setSkill ["courage", 1.0];
            _x setSkill ["reloadSpeed", 1.0];
            _x setSkill ["spotDistance", 1.0];
            _x setSkill ["spotTime", 1.0];
            _x setSkill ["general", 0.0];
            _x setVariable ["UFA_fnc_skillSet",true];
        } forEach (allUnits select {(side _x == east || side _x == west) && !(_x getVariable ["UFA_fnc_skillSet",false])});
    sleep 10;
    }
};
#

considering the east || west thing

manic sigil
#

Kinda late to this party, but does it have to be 3 letters, or is that just for conformity?

brazen smelt
#

The wiki says 3-4 letters

#

But y'know ยฏ_(ใƒ„)_/ยฏ

manic sigil
#

I know, but I've done with two :x

willow hound
manic sigil
#

Or at least, I got something to work with SR_fnc_nameHere, dunno if I accidentally blew up Malaysia or anything.

brazen smelt
#

So I like how I started with this:

[] spawn 
{
while {true} do
    {
    sleep 10;

        {
        _x setSkill ["aimingAccuracy", 0.13];
        _x setSkill ["aimingShake", 0.1];
        _x setSkill ["aimingSpeed", 0.1];
        _x setSkill ["commanding", 1.0];
        _x setSkill ["courage", 1.0];
        _x setSkill ["reloadSpeed", 1.0];
        _x setSkill ["spotDistance", 1.0];
        _x setSkill ["spotTime", 1.0];
        _x setSkill ["general", 0.0];
        } 
    forEach allUnits;
    }
};
#

And got to that.

copper raven
#

that code will do "nothing"

#

ah wait, the braces are weirdly placed ๐Ÿ˜„

brazen smelt
#

Exactly.

#

So you can def see how it changed :D

brazen smelt
hallow mortar
#

at that point just do !(side _x == civ)

brazen smelt
#

Like so?

forEach (allUnits select {!(side _x == civ)) && !(_x getVariable ["UFA_fnc_skillSet",false])});
#

Or am I brain dead?

#

Not brain dead, cause even reading this I know its wrong.

copper raven
#

side _x isNotEqualTo civilian

hallow mortar
#

you have a mismatched ) after civ (which would indeed be civilian not civ)

brazen smelt
#
forEach (allUnits select {(side _x isNotEqualto civilian) && !(_x getVariable ["UFA_fnc_skillSet",false])});

Like so?

#

Or is 'isNotEqualto' just English for an actual code piece?

hallow mortar
brazen smelt
#

Fair enough

manic grail
#

hey does anyone know a script that plays a static weapons animation?

#

i want to make a mortar fire for a screenshot

hallow mortar
#

If you're just making screenshots, POLPOX's Artwork Supporter mod has a lot of useful tools, including a function to make weapons fire continuously, and the ability to convert something to a Simple Object which you can manually play with the animations on

#

I would recommend it over custom-making a script because of all the other useful things it can do as well

manic grail
#

im using POLPOX stuff, the PLP_fnc_fireWeapon thing didnt work for statics so i thought i needed some other script for static / vehicles

#

plus i get some weird error when i try loading ammo with the Simple Object Placer

hallow mortar
#

This is not the place for a full tutorial on that. I'll just say that you don't need to load ammo, just rightclick -> transform -> convert to simple object, rightclick -> transform -> simple object editor, turn on "zazleh" in the selections tab, and browse the animations tab for recoil animations etc.

manic grail
#

ah thanks

tidal idol
#

Need some help on a simple parameter-pass to an sqf. My pseudocode is below:

    _TrackList = [/*trimmed*/"];
};elseif param == 1{//OST + Menu
        _TrackList = [/*trimmed*/];
};elseif param == 2{//ATD
        _TrackList = [/*trimmed*/];
};

_TrackDelay = p2;
[_TrackList, _TrackDelay] call BIS_fnc_music;```

How can I set this up such that the required call is something that looks like `null=[p1,p2] execVM "ScriptName.sqf";`?
willow hound
#

Quite simple:

params ["_trackListIndex", "_trackDelay"];
//Rest of the script ...
#

Additionally, since SQF has no else-if I recommend using a switch-statement instead.

warm swallow
#
_genpos1 = marker1;
_genpos2 = marker2;

General setPosATL selectRandom [_genpos1, _genpos2];```
#

is this code concise or is it bloated, I'm to start scripting by myself and was wondering if I need to define _genpos1 and 2 to variables,, or if I can use the variable names on the markers init in the array

little raptor
warm swallow
#

i thought since the general was a physical thing in the mission, it would need to have it broadcasted. thank you though

little raptor
warm swallow
#

๐Ÿ˜ฎ

#

@little raptor

#

error type object, expected number

#

when using setposATL

little raptor
warm swallow
#

if its guy setposATL [m1, m2]; how does that not work?

warm swallow
#

n

copper raven
warm swallow
#

gen setPosATL selectRandom [getPosATL marker1, getPosATL marker2];

#

so this would work?

copper raven
#

yes, but what you're doing is not the best

warm swallow
#

oh ok

#

how would i improve it/.

copper raven
#

by getting the position of the selected object instead of first getting every position and then selecting

warm swallow
#

how would i write that..?

copper raven
#

getPosATL selectRandom [marker1, ...]

#

this way you only call getPosATL once, instead of getting it for every object, and then selecting it

warm swallow
#


genpos = getPosATL selectRandom [marker1, marker2];

gen setposATL genpos;```
#

so that would work>

copper raven
#

yes, but you should use tags for the global variables

warm swallow
#

ok

copper raven
warm swallow
#

are there any further resources on how I know what variables should be local/private or global?

warm swallow
#

thank you

tidal idol
#

So I put a switch into my code, but it still doesn't seem to work (I used the example call that is commented)

//null = [0,5] execVM "\b47_wz_music\scripts\SoundtrackPlayer.sqf";

params ["_trackListIndex", "_trackDelay"];

switch (_trackListIndex) do{
    case 0: {_TrackList = ["/*trimmed*/"];};
    case 1: {_TrackList = ["/*trimmed*/"];};
    case 2: {_TrackList = ["/*trimmed*/"];};
    //All, OST, ATD
    //default All
};

[_TrackList, _trackDelay] call BIS_fnc_music;```

Here is the error I get: https://drive.google.com/file/d/1ToxqRAk98gEU3CwxJBY0RijZN7zIcWV5/view?usp=sharing
crude vigil
#

Yes, this is the way of SQF (response to deleted comment ;))

copper raven
crude vigil
#

yeah this code is unnecessarily complicated. Regardless to say.

#

but yeah I never comment on these, using different stuff, building experience is good.

formal sentinel
#
if (alive player) then {
    0 = ["DynamicBlur", 400, [10]] spawn 
    {
        params ["_name", "_priority", "_effect", "_handle"];
        while {
            _handle = ppEffectCreate [_name, _priority];
            _handle < 0
        } do {
            _priority = _priority + 1;
        };
        _handle ppEffectEnable true;
        _handle ppEffectAdjust _effect;
        _handle ppEffectCommit 1;
        waitUntil {ppEffectCommitted _handle};
        systemChat "My head hurts, it should pass soon...";
        uiSleep 60; 
        _handle ppEffectEnable false;
        ppEffectDestroy _handle;
        systemChat "I'm feeling better already.";
    };
};

if (playerside isEqualto civilian) then {
    player switchmove "AinjPpneMstpSnonWnonDnon";
    player setDamage 0.9;
};

How do I turn _handle into a global variable?
When running in another script, I want to remove the blur effect.

winter rose
#

and here you go!

formal sentinel
# winter rose first, `0 = `is not needed second, `BETA_ppEffectHandle = _handle` is enough to ...

Thank you so much for your reply.
is this right?

if (alive player) then {
    player switchmove "AinjPpneMstpSnonWnonDnon";
    player setDamage 0.9;
    BETA_ppEffectHandle = _handle
    0 = ["DynamicBlur", 400, [10]] spawn 
    {
        params ["_name", "_priority", "_effect", "_handle"];
        while {
            _handle = ppEffectCreate [_name, _priority];
            _handle < 0
        } do {
            _priority = _priority + 1;
        };
        _handle ppEffectEnable true;
        _handle ppEffectAdjust _effect;
        _handle ppEffectCommit 1;
        waitUntil {ppEffectCommitted _handle};

        uiSleep 60; 
        _handle ppEffectEnable false;
        ppEffectDestroy _handle;
    };
};

winter rose
#

no

winter rose
formal sentinel
#
if (alive player) then {
    player switchmove "AinjPpneMstpSnonWnonDnon";
    player setDamage 0.9;
    ["DynamicBlur", 400, [10]] spawn 
    {
        params ["_name", "_priority", "_effect", "_handle"];
        while {
            _handle = ppEffectCreate [_name, _priority];
            _handle < 0
        } do {
            _priority = _priority + 1;
        };
        _handle ppEffectEnable true;
        _handle ppEffectAdjust _effect;
        _handle ppEffectCommit 1;
        waitUntil {ppEffectCommitted _handle};
        BETA_ppEffectHandle = _handle;

        uiSleep 60; 
        _handle ppEffectEnable false;
        ppEffectDestroy _handle;
    };
};
#

I edit it like this:

#

thank you. Now how do I remove the blur from another script file?
or switchmove stop

winter rose
#

the same as here, using BETA_ppEffectHandle instead of _handle

formal sentinel
#
BETA_ppEffectHandle ppEffectEnable false;
ppEffectDestroy BETA_ppEffectHandle;

Is this right? Sorry for my stupid script skills.

winter rose
#

it is

still forum
#

If you wanted to you could also just use a emoji

#

But they only work in get/setVariable strings

formal sentinel
winter rose
#

(originally posted by @graceful kelp)

graceful kelp
#

Thx

formal sentinel
#

Hey gyus,
What is the switchmove code for prone position?

winter rose
pliant stream
#

Prefer playAction to playMove or switchMove

#

And even if you need to switch, you can easily do "switchAction" by reading the correct move from the config

azure portal
#

Would someone be able to give me a hand with fixing a script? It's meant to half the weapon reload time of a tank cannon, however, when another gun on the vehicle fires, it resets the cannon, so if the commander is firing their weapon, the cannon is continuously set to reload while they're firing. I was thinking of trying to set it so that it just checks if the cannon has been fired instead of all of them, but I'm not sure how to sort it

this addEventHandler ["Fired",{
 _this#0 setWeaponReloadingTime [gunner (_this#0),currentMuzzle gunner (_this#0),0.5];
}];๏ปฟ
winter rose
azure portal
#

Well, my issue with the event handler info is that I don't quite understand how they're meant to be interpreted and then utilised. I'm just kinda getting into SQF, so it's a bit confusing for me. Could it just be a matter of checking for the specific weapon? If so, how would you write it out in the EH?

vague geode
#

Is there a way to dis-/re-enable tactical pings for specific players?

I would like to disable a player ability to make a tactical ping himself and to see those of his teammates.

PS: I am talking about the HUD. I know about the ability to disable the tactical ping visibility on the map via the disableMapIndicators-command.

plush nova
#

is there a way to create a scripted camera without blocking player input?

#

like to have the player still be able to move their character while the scripted camera is "running"

final sun
#

Hello, I have a simple question regarding HashMaps. I'm trying to create one and see how they work but nothing happens. I also noticed that the command "createHashMapFromArray" is not highlighted as a command, nor it seems to exist in the auto complete. Am I doing a mistake syntax wise? there is no error though.

private _WeapsArray= createHashMapFromArray [["arifle_TRG21_F",800] , ["arifle_Mk20C_plain_F", 900], ["arifle_MXC_F",1000], ["SMG_03_black", 1100],["arifle_AKM_F",1200]];

test1= _WeapsArray getOrDefault ["arifle_TRG21_F","Does not Exist"];
systemChat format ["Test%",test1];
formal sentinel
#

If swing at a player while trying to place an object, that player will take damage.
How can I avoid taking damage?

still forum
final sun
still forum
#

That's probably because the syntax highlighting Plugins are out of date, doesn't mean anything about ingame

#

Well did it work in console or not?

#

I think your code looks alright

final sun
# still forum Well did it work in console or not?

I wrote three lines in the debug console:

_WeapsArray getOrDefault ["arifle_TRG21_F","Does not Exist"];--> No result

_WeapsArray get "arifle_TRG21_F"; --> No result

createHashMapFromArray [[1000,"Test1"],[200,"test2"]]; ---> Result: [[1000,"Test1"],[200,"test2"]]
winter rose
final sun
winter rose
#
private _hashmap = createHashMapFromArray [
  ["arifle_TRG21_F", 800],
  ["arifle_Mk20C_plain_F", 900],
  ["arifle_MXC_F", 1000],
  ["SMG_03_black", 1100],
  ["arifle_AKM_F", 1200]
];

private _result = _hashmap getOrDefault ["arifle_TRG21_F", "not found"];
systemChat format ["Result = %1", _result];

_result;
```I don't see any issue here
final sun
still forum
#

Does Singleplayer show systemChat?

winter rose
#

yes afaik, and at least Eden does (confirmed)

final sun
# winter rose

Weird, I tried my debug console, but nothing comes through, Even when launched without mods the result is the same.

warm hedge
#

What does productVersion return?

graceful kelp
warm hedge
#

I'm not asking for the document. I'm asking the duck

winter rose
#

๐Ÿฆ†

#

(HD version)

little raptor
little raptor
#

vanilla debug console's button code is spawned

pliant stream
#

Yikes

winter rose
pliant stream
#

More like... bugifier

winter rose
#

Spooky Scary Scheduler
Send shivers down your spine
All your threads are now waiting
And can't wait of dying

little raptor
#

otherwise stuff like createDialog or display would crash the game

final sun
little raptor
#

Maybe

#

Does debug console output anything at all?

winter rose
little raptor
final sun
winter rose
#

then check your game files cache, for something is very wrong if this doesn't work.

wicked roostBOT
#

Steam file verification process:
Right Click on game -> Local Files -> Verify Integrity of game files
Mod repair process:
Open Launcher -> Right Click on mod -> Repair

final sun
hollow thistle
final sun
winter rose
little raptor
astral bone
#

Hmm... I'm having a little trouble. How would I force the crew of a vehicle to stay inside the vehicle?
It's a modded AAT tank. Locked doesn't work.
I think it's the gunner and commander seeing the vehicle without a driver and that it was damaged, so it's disabled and they should abandon it? but idk...

little raptor
#

if you want proof just try:

for "_i" from 0 to 10000 do {
  [] spawn {
    while {true} do {
      for "_i" from 0 to 1000000 do {
        true
      }
    }
  };
}

good luck ๐Ÿคฃ

astral bone
#

I have code that works, but they still sometimes get out. It's-

#

The senario save is still loading one sec xD

astral bone
#

For the vehicle or the unit inside

little raptor
#

vehicle

astral bone
#

one sec, I have to spawn a civi again and give em a gernade xD

#

oh ok

#

Welp, that's new

final sun
#

I understand that you guys are busy people, but is there a chance I can screenshare with someone to check if I'm doing something wrong or the hashmap just doesn't like me?

astral bone
#

Arma crashed. So fun

winter rose
little raptor
winter rose
little raptor
#

I was gonna post the link too

astral bone
#
this addEventHandler ["GETOUT",{_this select 2 moveindriver (_this select 0);_this select 2 moveincargo (_this select 0);_this select 2 moveInCommander (_this select 0)}]

this seems to work though... Just curious if anyone had any better ideas

final sun
little raptor
little raptor
little raptor
#

is it half destroyed or something? thonk

astral bone
#

Well it's modded, so- I don't actually know xD

final sun
little raptor
#

did you verify the game like Lou said?

little raptor
winter rose
#

Oo
damage

#

you monster

final sun
little raptor
final sun
winter rose
#

slap a waitUntil { time > 0 }; before it

#

or sleep 0.00000000000000000000000000000000000000001;

little raptor
winter rose
#

let me have my daily laugh

little raptor
#

I know just saying so people don't actually do it ๐Ÿ˜…

final sun
#

I do not know what emotion to feel, should I feel anger that the script needed a sleep to print the systemchat? ,relief that its finally over, or shame that This is what I dragged two people into

little raptor
#

all 3 ๐Ÿ˜›

final sun
#

Can't wait to stop scripting in Arma , its not my expertise as you can see

umbral oyster
#

The command deleteVehicle for locally created objects causes an error Ref to nonnetwork object, what are the solutions to the problem?

umbral oyster
#

Ignore the error?

winter rose
#

you can
1/ ignore the error
2/ not do the action

astral bone
#

I mean, you could check if it's the server

#

Then if it is, continue. Otherwise, skip

#

You can do isServer right? Or am I remembering another API

still forum
#

isServer is a thing, but that won't help here

astral bone
#

oh

astral bone
winter rose
astral bone
#

(I assume this is satire... Yay not being able to detect jokes sometimes!)

#

Also, I am not good with 3D movement when it comes to position and rotation. How might I have something that auto places stuff?
Basically, I have scifi doors and I think the attached image looks really cool!

#

oh wait I can't attach images...

pliant stream
#

It's okay, except for the scheduler

#

Not terrible for what was probably someone's first attempt at language design

astral bone
#

Oh wait- If I tell the debug console to place something- will it do it... (In editor, not while testing the senario)

#

I am experiencing the ADHD laziness. I don't wanna place 2 tent lamps above each door. So instead I wanna spend double the time and double the frustration (atleast) trying to make something that does it for me! :D xD

little raptor
astral bone
winter rose
#

you can refer to player, which is a command

astral bone
#

I'm playing playing, I'm in the editor. With Senario, Edit, View and such on the top of the screen

winter rose
#

aaand what is your createVehicle?

astral bone
#

Land_TentLamp_01_suspended_red_F

winter rose
#

no like, its code

astral bone
#

Land_TentLamp_01_suspended_red_F createVehicle [0,0,0]

proven charm
#
"Land_TentLamp_01_suspended_red_F" createVehicle (getposATL player); 
winter rose
#

@astral bone โ†‘
otherwise, you create it at terrain's bottom-left ([0,0,0])

astral bone
#

I mean- it's not making it in the entity list

#

unless it doesn't do that when createvehicle

#

If I play senario, it will spawn it when i run the command

#

oh

#

well it still isn't putting it in the entity list :P

winter rose
astral bone
#

ok now how to I remove em... xD

winter rose
#

you don't ๐Ÿ˜„ start and stop the mission, they will get removed

#

to create an Eden entity, use create3DENEntity

astral bone
#

oh yea that makes more sense

#

And uh- How would I make it so it translates and rotates?
Basically, I know I can translate it to be offset by 1,0,0 but then if I want it to be offset and it's rotated, it wouldnt translate properly

#

Idk if that makes any sense xD

winter rose
#

setDir?

#

offset, then change the creation position

astral bone
#

Can I set dir around an object?

winter rose
#

@little raptor , no!! ๐Ÿ˜„

#

it's a legit getPos usage!! ๐Ÿ˜‚

little raptor
#

I went like nootlikethis for a sec ๐Ÿคฃ

astral bone
#

wait is variable names with an underscore inheritly private? I assume no now...

#

oh huh

astral bone
#
private _rot = (position this) getPos [1,(getDir this)];
_rot set [2,0];
private _lamp = createVehicle ["Land_TentLamp_01_suspended_red_F",_rot];
[_lamp, (3.5+((getPosATL this) select 2)), _rot,"ATL"] call BIS_fnc_setHeight;
_lamp setDir (getDir this);

probably horribly inefficient but

#

It sorta works... xD Only issue is- How to I do getPos?

astral bone
#

No, I mean the first line. I am giving it the position and offset. But I must be doing the direction wrong

winter rose
astral bone
#

Rotate around a center point.

#

wait

#

Lets say I have an object facing south. Then I want an object to be infront of it by 1 meter. So it'd be 1 meter to the south of the main object.
However if I rotate the main object so it's facing southeast, I want the sub object to still be 1 meter infront of it.

winter rose
#

so you want to find "a position 1m in front of an object, whatever its direction is"
this is what you do here with getPos

astral bone
#

Well, when i try it...

#

oh I can't show you b/c I cant post images... Can I post links?

#

Well, it's not where I want it to be

#

wait

winter rose
astral bone
#

might want to add 90 degrees oh yeeee

winter rose
#

that's because it might be offset
createVehicle can take a "CAN_COLLIDE" argument to avoid "other objects check"

astral bone
#

[_lamp, (3.5+((getPosATL this) select 2)), _rot,"ATL"] call BIS_fnc_setHeight; this actually gets around that :P

#

Yay! It's kinda far off the door, but I can change the distance

winter rose
#

the "bruteforce" best way to be sure is to use setPos setPosATL after that

astral bone
#

I think BIS_fnc_setHeight does setPosATL?

winter rose
#
private _positionInFront = this getPos [1, getDir this];
_positionInFront set [2, 3.5];
private _lamp = createVehicle ["Land_TentLamp_01_suspended_red_F", _positionInFront];
_lamp setPosATL _positionInFront;
_lamp setDir getDir this;
#

_posATL may have been another name

astral bone
#

It does need to include the this z, as it might be in the air. Err... Does yours do that?

winter rose
#
private _posATL = this getPos [1, getDir this];
_posATL set [2, getPosATL this select 2 + 3.5];
private _lamp = createVehicle ["Land_TentLamp_01_suspended_red_F", _posATL];
_lamp setPosATL _posATL;
_lamp setDir getDir this;
```here you go
little raptor
#

that's wrong...

#

also what's the question?!

astral bone
#

I want lights above my scifi doors to show if it's locked or not (Locked as in static)

little raptor
#

I guess Lou's code will do then (although I wouldn't do it like that, but it should work)
after the error is fixed

#
_posATL set [2, getPosATL this#2 + 3.5];
winter rose
astral bone
#

I think lou and I spotted it at the same time xD

#

Also, direction isn't fixed ;P

#

heading*

astral bone
astral bone
#

Is there a way to have multiple functions in a single file?

#

So I can have a value that is persistent...

#

oh wait

bitter jewel
#

value that is persistent?

astral bone
#

Like set up stuff. constant values

bitter jewel
#

like immutable?

astral bone
#

And also-

#
Alarms = [
    [false,false,"ven_alarm",(getMissionLayerEntities "AlarmEmitters_Alarm0" select 0)],
    [false,false,"luk_alarm",(getMissionLayerEntities "AlarmEmitters_Alarm1" select 0)]
    ];
    // isOn, isRunning, alarmname, AlarmObjects

ALARM_LoopSound2 = {
        params["_CurAlarm","_pos"];
    
        while { _CurAlarm select 0 } do {
                _source = _pos say3D [(_CurAlarm select 2),250];    
                waitUntil {(isNull _source || not (_CurAlarm select 0))};
                if((_CurAlarm select 0)==false && not isNull _source)then{
                    deleteVehicle _source;
                };
            };
        };

ALARM_LoopSound = {
    params["_alarmnumber"];
    _CurAlarm = Alarms select _alarmnumber;
    _CurAlarm set [1,true];
    {
    [_CurAlarm, _x] spawn ALARM_LoopSound2;
    } forEach (_CurAlarm select 3);
    _CurAlarm set [1,(false)];
};

ALARM_Toggle = {
    params["_alarmnumber"];
    _CurAlarm = Alarms select _alarmnumber;
    _CurAlarm set [0,not (_CurAlarm select 0)];
    if(_CurAlarm select 0)then{
        _alarmnumber call ALARM_LoopSound;
    };
};

#

cfgFunctions seems to be only for ALARM_Toggle , not to initilize and allow the functions inside to be visible

#

when you don't even know what you wanna ask for...

#

oh

bitter jewel
#

sqf does not have constants

#

use #define

#

or dont since you wont be able to refer to the value after compiling

#

in Description.ext you can define constants

#

you can maybe do constants in SQF with using compleFinal on a function that only returns the constant value

#

i just learned

rough heart
# winter rose you can 1/ ignore the error 2/ not do the action

Did you know that what @umbral oyster described here is most likely ( if done repeatedly ) the cause of Exile servers with high player numbers getting masskicks where the server just is like; oh no, to much in jip, to much ref to nonnetwork object and starts kicking half the server?

bitter jewel
#

that you can compliefinal an expression

#

maybe that makes final variables

astral bone
#

err

#

So, I have to make a seperate file for each function I want?

bitter jewel
#

i feel like you have 2 questions but talk about them simultaneously

astral bone
#

I am used to lua, python, c#... If I want a function/method, I can put several into a single file. I can then have a value defined outside those functions, but inside the file, so I can share the value's data between the functions.

#

With sqf, is that possible even?

rough heart
#

Is possible.

bitter jewel
#

use a global variable?

hallow mortar
#

A global variable (variable vs _variable) is accessible to all scripts on the current machine

astral bone
#

And each function needs it's own file?

#

sqf file

winter rose
hallow mortar
#

That would be the right way to define a function in cfgFunctions, but you can just save a function as a global variable in any file, and you can do that however many times you like

astral bone
#

And wait, when I do the function inside cfgFunctions, how would I use them?

rough heart
# winter rose no, did not (are you sure of it?)

Pretty sure now that @umbral oyster pointed out that he found that behaviour. I know for a fact that it's happening because i've been discussing that problem with @sharp grotto. He is having that issue with his server. Some clients can create within Exile, cuz of the loot system and more, more then 6-10K local objects. Eventually the server jip gets 18mb and higher, server starts to get fps issues and randomly kicks like 30/40 players. Server with 65 player slots.

https://gyazo.com/c76a0fc29ec602d7b205941041de8312

astral bone
#

Is it making them visible or actually calling them?

#

sorry if I sound like a noob...

bitter jewel
#

making them visible

hallow mortar
#

When you define a function in cfgFunctions, all you're doing is defining it. CfgFunctions is a good place to do it because it's one of the first things that's done when the mission is loaded (so the function is available as soon as possible) and because it happens on all machines.

#

You then call the function with call, spawn, or remoteExec.

astral bone
rough heart
#

@winter rose Not quite sure who Rabito already had contacted here, but from what he told me Dedmen and KillzoneKid are 2 people here that he reached out to. Most given answer to fix it was: go fix ur scripts in this discord while it's a command issue from what i can understand here now.

bitter jewel
#

description.ext is not sqf

astral bone
#

i know- i am confused... :(

bitter jewel
#

i know

#

so am i

#

i hate it

hallow mortar
astral bone
#

Yes

hallow mortar
#

Second, I'm just trying to figure out how your code is supposed to work

astral bone
#

Do you know lua?

hallow mortar
#

Could've started with something simpler :U

#

No, I don't know lua at all

astral bone
#

oh

astral bone
rough heart
hallow mortar
#

What's the overall objective of this script? Like, what's it trying to accomplish in the mission? A looping alarm sound?

astral bone
#

Yes. Multiple. and from multiple locations

#

I have any numbers of objects that I add this action too

#

this addAction ["Toggle Alarm", {<ALARM NUMBER> call ALARM_Toggle},[],1,true,true,"","_this distance _target < 10"];

#

So the enemy carrier can have an alarm, enemy HQ on the ground can have an alarm, and so can the friendly carrier and friendly HQ.

#

They are all independent of each other. Enemy HQ alarm isn't sounding when another of the other 3 should be.
And then it can play from multiple locations.

#

So multiple speakers?

#

Then I have a layer called AlarmEmitters_Alarm<ALARM NUMBER> for each alarm.

#

Any object inside will act as a speaker and broadcast the audio

winter rose
rough heart
astral bone
rough heart
astral bone
#

Then I could expand it somewhat easily if I wanted another carrier and HQ. Or say an air raid siren for a city

#

I shall look into this more later... for now...

#

How do I change a tent light's power? :P

hallow mortar
astral bone
#

I've moved on b/c adhd wee
how do I set a tent lamp's lightpower

hallow mortar
#

Well that was a waste of 15 minutes then

astral bone
#

sorry...

#

I'm saving it

#

But I need to look at something else b/c my brain hurts xD

hallow mortar
#

I'm not sure if it's practically possible to change the properties of an object light source like that. If you want custom lights you'll need to create some #lightpoints.

astral bone
#

[_this,_value] execVM 'a3\Props_F_Enoch\Military\Camps\scripts\setTentLamp.sqf' seems to work? <:D

hallow mortar
#

That's probably just about the only object in the game it works on, that looks very custom-coded for a specific purpose

astral bone
#

thats ok xD

#

aww yesh

#

Can add sqf this spawn { [_this,0,0] call DOORACCESS_PlaceAccessLight; }
to an object and it will add lights. _this being a door, first 0 being the door type, and second 0 is if it's locked or not. (1 means it's unlocked)

astral bone
#

@hallow mortar B/c I was getting side tracked on a task that had already taken me about 3 hours ๐Ÿ™ƒ

hallow mortar
astral bone
#

DOORACCESS_PlaceAccessLight is a custom fuction

astral bone
#

So, ye, I spent- about 3-4 hours on making a dumb function I'll never use again :)

hallow mortar
#

Be careful of locality. If you just run that in an object init field you'll create one light object for every connected client

astral bone
#

oh..

#

darn it..

#

i dont suppose i could just add 'isServer' or something?

hallow mortar
#
if (isServer) then {
  [this,0,0] call DOORACCESS_PlaceAccessLight;
};```
astral bone
#

And I just change call with spawn?

hallow mortar
#

Why?

astral bone
#

I have to wait until the object is present and stuff. I think..

hallow mortar
#

if it's in an init field it won't run until the object is present

#

what is the exact error you are getting?

astral bone
#

nothing

#

it just isn't spawning

hallow mortar
#

Where is the function defined?

astral bone
#

init.sqf now

hallow mortar
astral bone
#

๐Ÿฅฒ

#

cfgFunctions confuse me so so much... :)

hallow mortar
#

It's really not that difficult. A description.ext with defined functions is included in the file I linked earlier. If you look at it, you should be able to spot how it works.

astral bone
#

Ah ok, and I see I can make a 'constant' value too. (Not really constant, but not meant to be changed either)

astral bone
hallow mortar
#

fn_alarmToggle.sqf contains a comment describing how to use it. All the files also contain comments explaining how they work (with the assistance of looking up commands on the wiki)

astral bone
#

oh

#

wait, no, I don't wanna use it that early

#

I wanna wait until the object is spawned in. B/c I don't think it's registering the fact the object isn't at 0,0,0
or something... idk

#

I got it so the cfgFunction works for the status light, I still needa use spawn but eh

hallow mortar
# astral bone wait, no, I don't wanna use it that early

Use what how early?
For Editor-placed objects, the object will exist in its Editor-placed position at the time the init field is run. (Some special aspects may not be fully initialised but the position will be correct). For this script, you do not have to "wait until the object is spawned in".

astral bone
#

Idk what to tell you, if I dont have spawn it gives no errors, and it doesn't call it

hallow mortar
#

You said the script was modified from Lou's example. Modified in what way?

astral bone
#
params["_door","_doortype","_unlocked"];
if (isServer) then { 

private _item = doorlocked select _unlocked;
private _values = doortypes select _doortype;
private _val1 = _values select 0;
private _val2 = _values select 1;
private _posATL = _door getPos [(_val1 select 0), (getDir _door)+(_val1 select 2)];
_posATL set [2, (((getPosATL _door) select 2) + (_val1 select 1))];
private _lamp = createVehicle [_item, _posATL];
_lamp setPosATL _posATL;
_lamp setDir ((getDir _door) * (_val1 select 3));
[_lamp,2] execVM 'a3\Props_F_Enoch\Military\Camps\scripts\setTentLamp.sqf';
private _posATL2 = _door getPos [(_val2 select 0), (getDir _door)+(_val2 select 2)];
_posATL2 set [2, (((getPosATL _door) select 2) + (_val2 select 1))];
private _lamp2 = createVehicle [_item, _posATL2];
_lamp2 setPosATL _posATL2;
_lamp2 setDir ((getDir _door) * (_val2 select 3));
[_lamp2,2] execVM 'a3\Props_F_Enoch\Military\Camps\scripts\setTentLamp.sqf';
}
rugged fox
#

So I am making my first mission, to put it simply the map is a small island off the coast of the main land, you spawn at camp on the small island, brief and gear up, travel by boat to man land, kill bad guys, leave.

The distance between both island is unfortunately very large and I don't want to have players waste 15 minutes literally just sitting in a boat. What I have been trying to do is have it so the players walk up to the boat next to camp, scroll onto the action "head inland", and then have it (for all players simultaneously) fade to black, fade out, and then have all players on a boat moving towards the main island. A nice smooth transition that still keeps them immersed.

Now I don't know much about scripting but from literally spending 5 hours today searching across YouTube and old forums, I have a script that makes the players teleport, but its super sudden, and they don't spawn in the boat they just get instantly thrown on top. It does it so fast the fade to black happens when you're already on the boat.

so yeah this is a cry for help

hallow mortar
# astral bone ```sqf params["_door","_doortype","_unlocked"]; if (isServer) then { private _...

Okay, so...that's almost unreadable. Actually, mostly unreadable.
But it looks like it's relying on the doorlocked and doortype variables, which I assume are being defined in init.sqf. So I guess you do need spawn, then. And you only need if (isServer) either here or in the init field, not both (won't break it but is redundant).
There is probably a better, cleaner, way of writing that function, though.

astral bone
#

I know. And also, I actually put isServer in the main function and not in each object init

#

since it's slightly less code

rugged fox
#

_tele =_this select 0;
_caller = _this select 1;

[1, "BLACK", 5, 1] spawn BIS_fnc_fadeEffect;
_caller setPos (getPos (mine));

#

and that fade looks super janky as well

#

looks like you woke up after being knocked out

hallow mortar
rugged fox
#

so replace _callet setPos (getPos (mine)) to like _caller moveIncargo (mine); or something similar?

hallow mortar
# astral bone since it's slightly less code

It's slightly more efficient (not by a lot, but it could matter another time with a larger script) to do the server check in the init field before calling the function. That way, clients never call the function at all, rather than calling it then skipping most of it.

astral bone
#

What I used, although I am also extremely new to this, is-

this addAction ["To Venator", {player setPosATL getPosATL LAAT_Venator_Teleport},[],6,true,true,"","_this distance _target < 20"];
``` then an object with variable name of 'LAAT_Venator_Teleport'
astral bone
hallow mortar
little raptor
hallow mortar
#

They aren't going to use setPos and getPos (or any kind of setPos/getPos type command) because those aren't the right commands for what they want to do.

rugged fox
#

I see I see

little raptor
hallow mortar
#

They want to teleport the caller into a boat, and I don't mean clipping into it

rugged fox
#

omg it worked

#

you're a legend!

#

its funny how simple the syntax actually is

#

I just over complicate it and over think it

hallow mortar
#

It's simple until you want to do something that should be simple, but BI didn't think of it in 2013 and now it takes 3 separate functions

rugged fox
#

ahahaha

#

I do want to learn it more to do mission creations for friends and stuff

#

its a lot of fun when everything works together after hours of composition

hallow mortar
#

Do note that this script could fail if the number of players exceeds the number of seats available in the boat. Taking that into account would be more complex.

rugged fox
#

The max players for the mission is 4 players

#

and the boat has I think 6 seats so we're safe

#

I'm trying to add sleep into the fade effect

#

so its a lot of cinematic

little raptor
#

just call it

#

(if it doesn't spawn another loop itself...)

rugged fox
#

call it?

hallow mortar
#

There was a need because the fade effect isn't synced with the teleport - the teleport was happening before the fade was fully blacked out

#

If you want to use sleep you can't do it directly from the action code, because of things to do with the scheduler (it's complicated). So your action code needs to do something like:

[] spawn {
  [1, "BLACK", 5, 1] spawn BIS_fnc_fadeEffect;
  sleep 1; // however many seconds needed to line up, trial and error
  {
    _x moveInCargo mine;
  } forEach playableUnits;
};```
little raptor
#

action code is scheduled

hallow mortar
#

Are you sure about that? Because I'm pretty sure trying to do sleeps in action code has bit me before

little raptor
#

no, just going from memory

#

will run in scheduled environment,

#

yes, I was right

hallow mortar
#

In that case you don't need the [] spawn { and the last };. Everything else will work fine, just tune the sleep value to whatever you need to sync it up.

little raptor
hallow mortar
#

There is a need for the sleep because it hasn't finished fading to black by the time the teleport happens. Since the purpose is to obscure the teleport........

little raptor
#

it will be

#

again depends how that thing works

#

I haven't used that function before so blobdoggoshruggoogly

hallow mortar
#

Execution: spawn
๐Ÿค”

copper raven
#

yes but you can call it from scheduled, and depending how it's written you might not have to do any additional suspending

little raptor
#

doesn't have to be spawned

rugged fox
#

how do you manipulate the fade effect such as taking away blur, fading into black then out?

#

I see the commands on the wiki but I'm not sure how to implement them, theres only one example

little raptor
#

and make sure the types match

rugged fox
#

oh so its in that order?

little raptor
#

and if you want to skip something you have to put in the default value

low sierra
#

I set a AI unit unconscious withsqf _ai setUnconscious true;after some time a set it conscious withsqf _ai setUnconscious false; but he never get up again.

#

The unit is still alive, but stay lying down on the ground.

manic sigil
#

@low sierra

_ai playmove "UnconsciousOutProne"
#

I had a similar issue while trying to make a basic revive script; beyond just making sure it's called everywhere, sometimes you have to force the animation to free them up

low sierra
#

I will make a dead AI turn into a zombie after die.

#

So his death is fake.

manic sigil
#

Good luck ๐Ÿ˜›

low sierra
#

๐Ÿ˜›

winter rose
teal turret
#

hello guys, whassup ๐Ÿ˜„

#

I have a problem with my script, i spawned a heli in the script like this :

_GG1 =[];
_heliback2 =[];
_heliback3 =[];

_GG1 = creategroup WEST;
_heliback2 = [getMarkerPos "paddi", 140,"B_Heli_Transport_01_F", _GG1] call BIS_fnc_spawnVehicle;

but the heli spawns in the air, how do I make it so it spawns on the ground? i am really noob at scripting,

#

i tried flyInHeight 0 but then it does not want to go to the location i just stays there

little raptor
winter rose
#

because crew I suppose

teal turret
little raptor
teal turret
#

ok, i will try that, thank you

teal turret
hallow mortar
#

It creates an empty group for later use. Then it creates a vehicle. Then it creates a crew for the vehicle (createVehicleCrew automatically detects the vehicle and creates its default configured crew) then adds the new crew to the group.

winter rose
little raptor
little raptor
winter rose
#

you copy*cat* leopard ๐Ÿ˜„

little raptor
teal turret
#

what the underscore means? _ or what it does?

#

like _heli

winter rose
#

local variable

hallow mortar
winter rose
#

will be deleted after the scope ends, but be sure to use private

teal turret
#

ok, thank you ๐Ÿ™‚

woeful sundial
#

does someone has a script to decrease the viewdistance by fps laying around?

plush nova
#

is there a good way to check if, e.g. the player has pressed the "throw grenade" button that respects the player rebinding those keys?

#

like e.g. in the above case having it still work if the player has rebound the button to "H" instead of "G"

little raptor
cunning oriole
#

like if fps is this then set view distance this and so on?

somber radish
#

any way to extract a jpg version of the vanilla maps?

#

I am trying to build a admin tool that shows locations of units / vehicles in a web-browser

#

however to get the coordinates right I need a jpg / bmp file with the same dimensions as the original map

#

I have found some jpg files googling but they do not have the correct dimensions hence skewing all of the coordinates (making shit unusable)

plush nova
#

if a vehicle is destroyed, is the wreck the same object?

somber radish
#

(which is why I conclude YES)

#

Buildings however is different

rugged fox
#

does anyone know how to make AI stay in an area?

#

for example I have some enemies guarding an outpost but when they are in combat they just run out into the open which looks really dumb

#

I've already tried setting it to guard, but I don't want to have to resort to complete removing their movement

#

I just want them to stay in an area

fervent kettle
#

in which file does setObjectViewDistance goes?

pliant stream
#

whatever file you like

fervent kettle
#

that's unfortunate because in desciption.ext it aint working

warm hedge
#

Who said it goes to description.ext? meowsweats

#

It is a script command. A SQF file accepts

fervent kettle
#

That's why I was asking, I sadly couldnt find the wiki page stating the different file types

fervent kettle
#

I was on that one, but wasn't there one with just a table where it stated the different file names and usages?

warm hedge
#

Different file names and usages, what does this mean?

#

SQF, CPP, EXT etc...?

fervent kettle
#

na like description.ext, init.sqf

#

and on the rigt side a short explenation

warm hedge
fervent kettle
#

sadly not the one I meant :/

warm hedge
#

Wha...

fervent kettle
#

It was just a basic table, left side the file name and right side a pin-point explenation

warm hedge
fervent kettle
#

Yes ๐Ÿ˜„

#

thanks man

warm hedge
#

If you have a big question about this one, you can contribute in #community_wiki with how it is confusing and what is needed

fervent kettle
#

about what now?

warm hedge
#

I mean you've struggled with this

#

We can consider this is a very, very simple thing, so might not really documented in a straightforward way

fervent kettle
#

It might be cool for beginners to state where such commands could go into

#

like for real woodie newbies

formal sentinel
#

veiculo = _ambulancia addAction ["medic", {call action_colocar;}];
How can I add color to code like this?

warm hedge
#

Like what?

formal sentinel
#

I want the message that appears when I roll the wheel to be colored instead of white.

warm hedge
formal sentinel
#

veiculo = _ambulancia addAction ["<t color='#FF0000'>MEDIC</t>", {call action_colocar;}];Is this right?

warm hedge
#

Seems fine

formal sentinel
#

Thanks

#
action_levar = {
    _fe = nearestObjects [player, ["C_man_1"], 5];
    _obj = nearestObject [player, "Land_Stretcher_01_F"];
    _ferido = _fe select 0;
    _ferido attachTo [_obj, [0, 0.20, 0.25] ];
};

action_soltar = {
    _obj = nearestObject [player, "Land_Stretcher_01_F"];
    _ambulancia = nearestObject [player, "Car"];
    _obj = nearestObject [player, "Land_Stretcher_01_F"];
    detach _obj;
    ativo = false;
    pegar = _obj addAction ["<t color='#9B111E'>lifting a stretcher</t>", {call action_carregar;}];
    levar = player addAction ["<t color='#9B111E'>Lay the patient down</t>", {call action_levar;}];
    _ambulancia removeAction veiculo;
    player removeAction soltar;
};

How can I get the action to show for the cursor man?

#

To put it simply, it's not just displayed, it's displayed when you hover over a man.

#

levar = player addAction ["<t color='#9B111E'>medic</t>", {call action_levar;}];

#

isPlayer cursorTarget this command?

#

Sorry for the lack of English explanation.
I want to modify it so that the action only appears when looking at a person.
You will see the phrase "Lay the patient down" even if you are not looking at the person at the moment.

formal sentinel
#

man at cursor

#

, yes

winter rose
#

cursorObject isKindOf "CAManBase"

formal sentinel
#

thank you. How do I add that code?

winter rose
woeful sundial
#

If someone has a better way of calculatin a value to set as view distance based by performance of the player ...

pliant stream
woeful sundial
pliant stream
#

so you set limits

copper raven
misty trail
#

How can I reduce gun sway ?

little raptor
winter rose
winter rose
little raptor
#

yeah true meowsweats

misty trail
#

So there is no way to remove it from a mission or server ?

little raptor
misty trail
#

ok thanks ๐Ÿ™‚

winter rose
#

R3vo made a mod at one point

little raptor
misty trail
#

thanks all for your help ill investigate now !

drowsy geyser
#

hey, is there a fisheye effect in arma 3?

winter rose
#

you can change FOV but that's about it

drowsy geyser
#

thank you, and is there a way to display the black vignette screen effect via script?

winter rose
#
private _emptyDisplay = findDisplay 46 createDisplay "RscDisplayEmpty";
drowsy geyser
#

no xD i mean this effect
call BIS_fnc_fatigueEffect;

winter rose
#

well, you just did

drowsy geyser
#

make it stay permament

winter rose
#

see BIS_fnc_fatigueEffect's content in the Functions Viewer, that should put you on track

tidal ferry
#

Hey

#

Need some help

#

How does one go about adding music to the Zeus module?

#

I know how to use CfgMusic but no clue why it's not showing up in Zeus

vague geode
#

Is there a way to force/fix the range of a mortar meaning that you can e.g. only use the "close" setting and can't switch?

little raptor
#

afaik no

vague geode
#

Basically I have seen this (https://youtu.be/0TvGSqpuRP8) and am now wondering if there's any way to make "smoke rockets" in Arma. I thought about adding a Mortar with Smoke shells only to a Ceasar but since you can't see the setting I would need to lock it to make the impact are predictable.

hallow mortar
#

You can use regular rockets and a Fired event handler to replace them with smoke shells after firing

#

(Or just attach smoke shells to the rockets if you don't care about collateral damage)

vague geode
# hallow mortar (Or just attach smoke shells to the rockets if you don't care about collateral d...

That was my first thought too but the smoke shell doesn't seem to work. (Spawned one on the ground and triggered which worked but when I tried to attach it to the rocket it doesn't work anymore.)

this addEventHandler ["Fired", {
  params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
  _smoke = "Smoke_82mm_AMOS_White" createVehicle (position (_this select 0));
  triggerAmmo _smoke;
  _smoke attachTo [(_this select 6),[0,0,0]];
}];
hallow mortar
#

First of all, why are you doing params and then ignoring all the params and using this select instead

vague geode
#

The real question is why it is no getting attached to the projectile...

hallow mortar
#

Well, you're triggering it before you attach it, so it might not exist any more

#

Created shells are still impact-triggered, so you can just leave it alone and it will go off when the rocket hits

vague geode
hallow mortar
#

How do you know it doesn't attach?

vague geode
hallow mortar
#

It sounds like it's colliding with something at its initial position and counting that as an impact. Find somewhere else to spawn it, where you can guarantee it will spawn in clear air with no obstacles (e.g. a position high in the sky in a corner of the map)

vague geode
hallow mortar
#

Can you try using Smoke_120mm_AMOS_White instead? I had some kind of problem with trying to use 82mm smoke before and I ended up just using the bigger shells instead.

vague geode
crude vigil
tidal ferry
#

But we got it fixed regardless

crude vigil
vague geode
tidal ferry
#

We didn't have CfgMusicClasses or musicClass entries set

vague geode
rugged fox
#

anyone know how to make Ai stick to one area and guard it? for example holding an outpost when under attack instead of just running out into the open

#

is there a way to restrict their movement in a small area without entirely removing it?

winter rose
rugged fox
#

do I attach that to a trigger? or sync the unit to the trigger?

winter rose
plush nova
#

hmm so when i use switchCamera while in 3p view it seems to "lock" me into the wrong external camera view distance

#

even if i switchCamera player again after

#

is that normal/expected or am i just using it wrong

little raptor
plush nova
#

hmi have also tried player switchCamera "external";

#

which seems to have the same issue although i could have fucked it up

little raptor
#

I don't know what you're talking about meowsweats
it works fine for me

plush nova
#

well i should mention that i have really nonstandard external camera settings

#

on a custom unit that isn't a normal infantryman

winter rose
#

yes please
you should definitely mention that

plush nova
#

it seems like hitting switchCamera player actually just assumes default infantryman camera settings regardless of the unit type

#

so it is, in this case, too close (since i defined the camera position to be much farther back)

#

hmm if i do switchCamera _unit (where _unit is just the player unit) it works, but via very slowly interpolating the camera backwards

#

i guess that's actually good enough though

winter rose
#

i defined the camera position to be much farther back
through mod?

plush nova
#

yeah

#

via extCameraPosition in the config

#

(also by moving the camera bone in RTM but i'm not sure which one is more important)

plush nova
#

hmm setVelocityModelSpace doesn't need to be remoteexec'd right

copper raven
formal sentinel
#

How can I prevent the player from being damaged by objects?
Arbitrarily using a script to place an object and then if the player touches the object, the player is damaged and dies.

fair drum
real tartan
#

how to use #define to set variable name and then use it as string ?

#define VARIABLE_NAME "TAG_var"
player getVariable [VARIABLE_NAME, 0];
pliant stream
real tartan
#

no

pliant stream
#

what is it exactly that you want to achieve?

winter rose
little raptor
#

you should use # and ##

manic sigil
#

Is there any way to fire off a smoke launcher, like a tank's, from a set position? Ive tried using camp_guidedProjectile, but the closest I could get was creating some 82mm smoke rounds which can work, but arent quite as impactful.

Im trying to set up a thing where a player has a smokescreen on a triggered action.

vague geode
#

Quick question: On the Community wiki it says that if the "Fired"-Event handler is added in multiplayer on a remote object it only fires when the vehicle is within range of the camera. What happens if I add the event handler on the server itself, does it always fire or never because the server technically has no camera?

formal sentinel
plush nova
#

so it seems like unit init code is run before the unit is actually assigned to the "correct" client for e.g. player units

#

what's the best way to initialize a player unit on the client (from a mod rather than a mission)?

pliant stream
#

local?

plush nova
#

local?

plush nova
#

does that always happen for player units at the beginning too?

pliant stream
#

it fires on change of ownership

plush nova
#

wait what is this supposed to be added to

#

the unit that's getting changed?

pliant stream
#

right

plush nova
#

hmm so in this case i'd do something like remoteexec addeventhandler to get that eh on every client in init

#

or is there a way to know which client a unit belongs to at init and i could remoteexec only that one client?

umbral comet
#
[intelUAV] call BIS_fnc_initIntelObject;

if (isServer) then {
    intelUAV setVariable ["RscAttributeDiaryRecord_texture", "Images\UAV.jpg", true];
    [intelUAV, "RscAttributeDiaryRecord", ["UAV Log", "4:00 โ€“ Fuel low, return to base recommended, 5:00 โ€“ Fuel critical, emergency landing initiated near 065-101, 5:10 โ€“ Touchdown near 042-084 shutting down."]] call BIS_fnc_setServerVariable;
    intelUAV setVariable ["recipients", west, true];
    intelUAV setVariable ["RcsAttributeOwners", [west], true];
    };

Hi, what do I need to add so the object WON'T be deleted when a player will pick up the intel?

tidal ferry
#

Question

#

Is it possible to add simple objects to mission laters after mission start?

#

For example, we're looking to hyperoptimize our mission

#

So current plan is to delete unused layers of missions once players move on

#

However

#

With our current system, objects replaced with bis_fnc_replacewithsimpleobject aren't included in the layer and thus aren't deleted

#

Any way to add a returned simpleobject into a mission layer, or do we have to rig up a system to do it with arrays?

fair drum
#

Yes, you'll have to grab the objects position and it's 3d model path then you can delete your original object and create a new one with createsimpleobject.

tidal ferry
#

We're using BIS_fnc_replacewithsimple object :P

rough heart
tidal ferry
#

Relative hyperoptimization

#

Also

pliant stream
rough heart
#

Purely within the scope of the script.

tidal ferry
pliant stream
tidal ferry
#

I want to be able to add new objects to that global array

rough heart
#

And yet it only does something with a _private or global var

tidal ferry
#

Assuming I'm using things like publicVariable, what would be the best way to do that?

pliant stream
#

depends. who mutates?

tidal ferry
#

Goal is, I want to have a script I can place in object inits of objects in a large composition to make them simple objects

#

But have the array retrievable later on so I can delete

rough heart
#

Why does it need to be public to all clients ?

tidal ferry
#

I mean it techncioally doesn't, kind of only needs to be on the server I guess ๐Ÿ˜†

#

Hmm

#

Although

#

If I onnly have it execute on server

#

What's the locality of BIS_fnc_replaceWithSimpleObject?

rough heart
#

Then write it to mission namespace

tidal ferry
#

Good idea

rough heart
tidal ferry
rough heart
#

If you use on a a global var, its global on x machine, if you use it on a private var, its within the scope of that script, if you use it on a public var its known to the whole server / clients

rough heart
#

Commands only do stuff within the scope of said script you're using

pliant stream
#

you don't really know what you're talking about, do you mr snail?

rough heart
#

Maybe i'm describing it wrong.

copper raven
rough heart
#

English isnt my main language

tidal ferry
#

Also, is there a way to quickly check what 3den layer an object is in (if any) from object init?

rough heart
copper raven
#

i'm not familiar with the 3den commands, but that seems to be a nice starting point

acoustic abyss
#

Hi-
I'm a little unfamiliar with event handler scripting. I want to have multiple event handlers (doesn't matter if it's serverside or global) be able to trigger a script, but I don't want multiple executions. So "OR", in other words. What's an elegant way of doing this, besides several deletions of event handlers upon first execution?

little raptor
acoustic abyss
#

MPKilled

little raptor
#

and what exactly do you want to do?

acoustic abyss
#

I am makign this sound more complicated than it is ๐Ÿ˜†

#

OK. Players start a mission at an enemy base, where they can take the vehicles (cars) to the next objective. However, chances are reasonable they will lose the vehicle. Instead of a regular vehicle respawn, I want civilian cars to drive by, that are easily hijacked, once either of their first base vehicles have blown up.

#

The civilian vehicle drive by part is straightforward (literally).

#

And I have done things like this with triggers in the past. But I want to improve mission performance/reduce bugs, so I thought trying eventhandlers would be better.

#

Triggers delete themselves once executed, so that cleans up loose ends. But how do you wrap up multiple conditions of event handlers simply?

little raptor
#

what multiple conditions?

acoustic abyss
#

Either of their vehicles being destroyed.

little raptor
#

you just add the EH to the vehicle. once blown up, you order the civilians do drive their cars to the objective

acoustic abyss
#

Yes, but then you have multiple event handlers for each vehicle

#

so that creates multiple executions of the same code.

little raptor
#

just one (per vehicle)

acoustic abyss
#

I have 2 vehicles, and I add an eventhandler to both of them, and I activate both handlers, I will ahve 2 executions of the code, yes?

little raptor
#

so you mean you want the civilian to only do that once?

acoustic abyss
#

I don't know how long the players will take for the mission, so my civilian car spawn will create new cars and drivers every few minutes or so.

little raptor
#

why?

acoustic abyss
#

Long story short: I want ONE script activated by Multiple eventhandlers arranged in OR.

little raptor
#

just create the vehicles when the original ones are destroyed

acoustic abyss
#

I understand that magically respawning the cars in the same spot is programatically the simplest solution. But just like the many ambient civilian scripts, I think it adds immersion to a mission if civilian cars and drivers are added in a pseudorandom fashion. I can make the pseudorandom car script. But I want this one script, executed once. How do I tie together multiple event handlers to start the script only once in an OR ?

little raptor
#

just use a global variable

#
car addMPEventHandler ["MPKilled", {
  if (!isServer || {missionNamespace getVariable ["alreadyActivated", false]}) exitWith {};
  params ["_car", "_killer", "_instigator", "_useEffects"];
  alreadyActivated = true;
  //call your script here
}];
acoustic abyss
#

Ah, of course, a global variable. Thank you.

pliant stream
#

how about you keep track of the number of vehicles available to the player, and if it goes too low you create more?

#

so the starting vehicles count, as well as any active civilian vehicles that are driving around. when any of them is disabled, you count that one out

acoustic abyss
#

@pliant stream OK. So I create function that periodically checks how many members an array has, or were you thinking of something in particular?

pliant stream
#

you can still use events, though you have to decide what it means for a vehicle to be disabled

#

is it only when the vehicle is killed? does destroying a wheel count?

acoustic abyss
#

Hmmmmm. Interesting idea, but I can think of many situations where players will abandon vehicles, where I would have to program extra conditions. I don't mind if the (rather large) mission (that will take 90 mins tops) will get a lot of leftover cars.

#

But interesting idea! I just repeated myself ๐Ÿ˜†

pliant stream
#

okay, alternatively you could just keep track of active civilian vehicles driving around

little raptor
pliant stream
#

when one is disabled you create a new one

acoustic abyss
#

But good point.

acoustic abyss
# pliant stream when one is disabled you create a new one

Yeah, I'm lucky that my mission takes place on the coast of Altis. Players make their way down from Fotia to Kavala. It's mostly a single road. So I just spawn and despawn units from end or the other. So I am afraid I will be lazy (๐Ÿฅธ ).

round blade
#

Is there any solution out there for IR flashlights/illuminators?

still forum
#

Yeah

#

Either just make a IR flashlight as a mod.
Or spawn a reflector and attach it to gun

jaunty salmon
#

was recommended to post this over from the editor and mission making threads - Hi all, would anyone have a solution for this - while creating a mission on a custom map with Ravage, everything works well (loot, gear, AI, etc.), but this crazy annoying bug happens - in towns/villages, this caravan model "Land_Caravan_01_green_F" keeps spawning in random and absolutely buggy locations. This seems to be an attempt to generate "lootable" buildings, but fails. My question is, how would I approach to ensure this model gets deleted around a reasonable distance from the player? This is SP, btw.

round blade
still forum
#

IR lasers were added in 2.06 update

#

No brain messup
IR lights*

round blade
#

haha I was wondering

#

very cool

still forum
#

2.08 gets non-IR lasers

round blade
#

sick

#

cheers! Making a gen-1 NV with a big old IR illuminator on the top of it

still forum
#

Yeah you'd probably have to script that.
Spawn a #lightReflector or.. #reflectorLight or smth don't remember.
Then attachTo with followbonerotation to head, and setLightIR to make it a IR light

round blade
#

Oh I'd just have the IR illuminator as a separate attachment

#

in the flashlight slot

#

so you can choose to have with/without

still forum
#

Ah I thought you meant attached to the NVG item :D

round blade
#

aha lol

still forum
#

Which I'm pretty sure doesn't support having lights on it

#

Tho headlamp would be neat

round blade
still forum
#

ACE mod is working on IR flashlights, I think RHS and CUP too

round blade
#

cool

#

aha found the details. This is so cool. One last follow up - is there a setViewDistance equivalent command for PiP view distance?

still forum
#

Afaik no

round blade
#

ok, no problemo. Thanks!

acoustic abyss
#

Hi again. It turns out I have forgotten how to script waypoints (in newly created units). I want to create a civilian car and make it drive to a waypoint.This is my code:

newcivgroup = creategroup civilian;
newcar = "C_Hatchback_01_F" createVehicle (getposATL civstart1);
createVehicleCrew newcar;
newcar setDir (getDir civstart1);
newcivgroup addWaypoint [(getposATL civend1), 5, 0, "endpoint1"];
newcivgroup setWaypointBehaviour "CARELESS";
newcivgroup setWaypointSpeed "FULL";
newcivgroup setWaypointType "Move";
newcivgroup setCurrentWaypoint [newcivgroup, 0];```
civstart1: an invisible nonsimulated car object
endpoint1: an invisible nonsimulated car object
The result is a fully crewed new hatchback, that does not move. Note: I *can* script new waypoints for cars already placed in the Editor. It's just ones created by script. What step am I missing?
little raptor
#

also why on earth do you use so many global variables?

acoustic abyss
#

ha! you're right

#

I'm using global variables for troubleshooting. Thanks

#

Of course end result will not use global variables

little raptor
acoustic abyss
#

yes, you're right; I was doing things double. Had been messing around for 30 mins and just decided to cover every base I could think of.

real tartan
#

can I put picture to notification (CfgNotifications) where description is ?

plush nova
#

does forEach support doing stuff like appending to or deleting from the array inside the loop?

little raptor
#

appending = infinite loop

#

deleting = skipping next element

plush nova
#

ok so it's just an iteration over an index into the array

#

not some fancy iterator construct that copies the state or whatever

still forum
#

It iterates by index

plush nova
#

is there a "batch delete" function anywhere, in that case?

still forum
#

deleteRange

plush nova
#

well for non-adjacent indices

little raptor
#

or -

plush nova
#

like if i know i want to delete indices [0, 4, 5, 8]

#

and i only want to perform the "move" once instead of 4 times

little raptor
#

if the array is not large just use -

#

it's fast (enough)

#

ofc if you have duplicate elements then it will delete all instances

plush nova
#

does A-B calculate the set difference between the arrays, preserving order in A?

little raptor
#

yes

plush nova
#

hm ok sounds perfect

#

thanks

little raptor
plush nova
#

is this just because it cares about reference-equality and nested arrays tend not to be actually the same reference

#

or is there an additional layer of special-case logic on arrays

little raptor
#

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

plush nova
#

kek

#

fair enough

little raptor
#

I'm not a dev.... meowsweats

still forum
#

It does value equality but not recursive

plush nova
still forum
#

It only removes element X from array.
Not element X from array in array

plush nova
#

oh i get it

#

sorry i was thinking about the case where X was itself an array

#

so e.g. [[1],2] - [[1]] would work, right

little raptor
#

no

plush nova
#

hmm ok

#

makes sense, thanks

little raptor
#
_result = [0, [0], [[0]]] - [[0]]; // [0, [[0]]] - Since Arma 3
_result = [0, [0], [[0]]] - [[[0]]]; // [0,[0]] - Since Arma 3
plush nova
#

ah

#

well that's nice

little raptor
#

pretty sure it didn't use to work tho (you had to set the elements to a non-array value to delete them)

still forum
pliant stream
#

doesn't work in A2, no

still forum
#

Don't know what A2 did differently there blobcatgooglythink
Maybe related to the isEqualTo stuff

pliant stream
#

it just doesn't have any array equality

#

in, find, set difference, none of it works in A2

plush nova
#

makes sense

#

so you can send anonymous functions over as remoteExec params right? how does the scoping for those work

#

like if i do [{ SomeVariable; }, SomeVariable ] remoteExec ["foo"]; that would call foo with the remote value of somevariable, then the local value of somevariable, right

plush nova
#

and that just gets executed in the global namespace/scope?

little raptor
plush nova
#

well in that case (i assume) { SomeVariable; } gets executed on the remote machine, returning the value of it there, but SomeVariable gets executed on the local machine and that local value is then passed to the remote machine

#

so foo gets two arguments when it's called on the remote machine, that can be different

#

does that seem right?

little raptor
#

unless foo is a function that executes the code

plush nova
#

yes assume in this example that i have defined a function in the global namespace called foo, somehow

plush nova
#

are preinit functions called in the order they're listed in CfgFunctions? or is the order undefined/random

still forum
#

Yes

#

CfgFunctions and load/parse order

plush nova
plush nova
#

can initPlayerLocal.sqf be provided in a mod

#

and if not, is there a good alternative for it

still forum
#

postInit

#

With !isNull player

plush nova
#

ahh

#

and i assume player is guaranteed to be defined by then

#

makes sense

#

thanks

still forum
#

If it's a non player postInit (server) player will be null, otherwise it shoooooould be set

#

Can also check !isServer

#

That's probably smarter bird_woah

sharp peak
#

Got an issue, trying to make a hold action for a PvP mission, but it doesn't seem to work on a dedicated server, but shows in editor & local hosted

#

The action doesn't show up at all

#

initServer.sqf sqf [] execVM "DNRWin2.sqf";

#

DNRWin2.sqf ```sqf
_flag = flagObj;
_afterCommand = {};
_fncOwnFlag = {
params ["_winSide"];
_flagPath = "%1.paa";
_fileFlag = switch _winSide do {
// case west: {"flag_nato_co"};
case east: {"\rhsafrf\addons\rhs_main\data\flag_dnr_co"};
case independent: {"\po_main\data\ui\flags\flag_ukr_co"};
default {"\po_main\data\ui\flags\flag_ukr_co"}
};
format [_flagPath,_fileFlag];
};
_actionParams = ["_flag", "_caller", "_actionId", "_arguments"];

_flag setflagAnimationPhase 1;
_flag setFlagTexture (independent call _fncOwnFlag);
_flag setVariable ["TER_flagSide",independent];
_icon = "\a3\ui_f\data\igui\cfg\holdactions\holdaction_takeoff2_ca.paa";
_duration = 10;```

#
_addID = [_flag, "Set up DNR flag", _icon, _icon,
    "_target getVariable [""TER_flagSide"",independent] != side _this && _target distance _this < 4",
    "_target getVariable [""TER_flagSide"",independent] != side _this && _target distance _this < 4",
    {},
    {
        params ["_flag", "_caller", "_actionId", "_arguments","_progress","_maxProgress"];
        _arguments params ["_actionParams","_fncOwnFlag","_afterCommand"];
        _relProgress = _progress/_maxProgress;
        if (_relProgress < 0.5) then {
            _flag setFlagAnimationPhase (1-(2*_relProgress));
        } else {
            if (_relProgress == 0.5) then {_flag setFlagTexture (side _caller call _fncOwnFlag)};
            _flag setFlagAnimationPhase ((2*_relProgress)-1);
        };
    },
    {
        params ["_flag", "_caller", "_actionId", "_arguments"];
        _arguments params ["_actionParams","_fncOwnFlag","_afterCommand"];
        _flag setVariable ["TER_flagSide",side _caller];
        [] call _afterCommand;
        sleep 5;
        ["DNRWin2", true] remoteExecCall ["BIS_fnc_endMission", 0];
    },
    {
        params ["_flag", "_caller", "_actionId", "_arguments"];
        _arguments params ["_actionParams","_fncOwnFlag","_afterCommand"];
        _flag setFlagAnimationPhase 1;
        _side = _flag getVariable ["TER_flagSide",independent];
        _flag setFlagTexture (_side call _fncOwnFlag);
    },
[_actionParams,_fncOwnFlag,_afterCommand], _duration, 1.5, true, false] call BIS_fnc_holdActionAdd;
_addID```
#

Followed some help on the BI forums and asked about this in the past here, but didn't get around to trying on a dedicated server until now

still forum
#

Adding hold actions on server doesn't make sense, actions are client side, and I'm not aware of holdActionAdd doing remoteExec

sharp peak
#

So I should run it in the init.sqf instead?

still forum
#

Aka, not in initServer, but initPlayerLocal

sharp peak
#

Alright, will try that

plush nova
still forum
#

ahh dang..

#

isServer is bad, because if you self host, you are the server but also a player.

#

isDedicated would filter server and HC

plush nova
#

wait are headless clients isDedicated?

still forum
#

Yes

#

Headless == no UI

plush nova
#

oh i see

#

well that's nice actually

#

hm i guess maybe if (!isDedicated && !isNull player) to be safe

#

actually ill just try only the isdedicated check for now, that looks like the right thing Blurry_eyes

sharp peak
#

I currently have vehicle player in thisList, for detecting players in a trigger, and later also executing a script on them, is there an equivalent of player for player+ai?

#

I tried object, anything, & anybody but that didn't do anything, and didn't find anything else on biki

#

Through I might've looked poorly

little raptor
sharp peak
#

So I want to replace the player with something that affects AI too

little raptor
#

I later excecute a script on them:
use thisList like you did before

sharp peak
sharp peak
little raptor
#

you have to iterate over its elements

#

see forEach

sharp peak
#

Alright, will do

#

{_vehicle setdamage 1} forEach vehicle thisList;
{_player setdamage 1} forEach vehicle thisList;
{player setdamage 1} forEach units thisList;

#

Tried these, and some other combinations, all give same error that thisList is undefined

#

I don't understand why, since as far as I see it's defined in the trigger activation

little raptor
#

they're not defined there

#

also you're using them wrong

sharp peak
#

Don't know how to use them right, first time I try it

#

Also wdym 'in the spawn'?

sharp peak
#

ah, so I should re-define it all with vehicle player in thisList inside the spawn too?

little raptor
#

depends what you mean by "redefining"

sharp peak
#

The error I kept getting before was that "thisList is not define", so I assume I have to define it again by grabbing all of the units that enter my trigger

#

The code was so short & worked perfectly with only players.. how come it gets so much more confusing when I try to make it detected AI too?(

little raptor
#

because you're making it complicated unnecessarily

sharp peak
#

Well, I don't know how not to do it))

#

I assumed there was a single word I could replace player with and it would work just like before

#

I have just a little over 0 knowledge of mission scripting, so I have no idea whats being done wrong here or how I go about fixing it

#

So please excuse my possibly awful questions)

little raptor
little raptor
#

neither for other players

#

so this should only show the hint to the player that exited

sharp peak
#

Currently it does that

little raptor
#

it doesn't

sharp peak
#

Only I saw the hint when I tested it on a dedicated server, but I'll take your word for it

sharp peak
little raptor
#

well it's because of that condition

sharp peak
#

Alright, got it

plush nova
#

is there a way to "block" on a remoteexec? like if i wanted to do

[_x, owner player] remoteExec ["setOwner"];
selectPlayer _x;
#

but i wanted to make sure it worked and didn't go in the wrong order

little raptor
little raptor
sharp peak
#

Set to anypresent & server only already

little raptor
plush nova
#

well i want to switch the player to a remote unit

little raptor
#

also that code is wrong

plush nova
#

since selectPlayer only works on local units

little raptor
#

setOwner is serverExec

sharp peak
little raptor
#

you're executing for all

plush nova
#

how does one use a callback

sharp peak
#

_players = _list select {isPlayer _x};
this selects the specific player in the trigger rather than giving the hint to the entire server I assume

plush nova
#

or by "callback" do we just mean "have the remoteexec'd target send you a remoteexec back"

little raptor
sharp peak
#

{_x setDamage 1} forEach _list; & this damages everything in the thisList because of the params above?

sharp peak
#

& the rest I understood

little raptor
sharp peak
#

Well, understood enough to be able to copy-paste it where needed I hope)))

#

Alright, worked perfectly, thanks alot!

#

& if I want to make it side specific, I just change the activation to e.g. OPFOR and nothing else?

little raptor
#

yeah

little raptor
#

so other objects can roam freely...

#

altho not for long in this case

#

that object will die in 5 seconds...

sharp peak
#

Yeah, I noticed that since the vehicle I was in died in 5 seconds, and I did 5 seconds later

#

I guess I can either reduce the timer or extend the trigger zone so nobody can slip through it in those 5 seconds

little raptor
#

you could use loops instead

sharp peak
#

I also have a trigger before that one which warns them to turn around, so there should be enough time to rethink before dying in a huge ball of flame

#

If it does cause problems however, how would I go about making it loop?

#

I guess making the loop after the trigger activation until after all objects inside are dead?

#

Would smth like this work?sqf [thisList] spawn { params ["_list"]; _players = _list select {isPlayer _x}; ["You have exited the operations area. You are about to die."] remoteExec ["hint", _players]; sleep 5; {if (alive _x) then {while {alive _x} do {{_x setDamage 1} forEach _list;}; }; }; };

#

Nvm, that broke it(
I guess I'll just lower the cooldown to make sure nothing can slip through

little raptor
sharp peak
#

ah, well that is probably way out of my knowledge then))

#

Throwing 4 tanks to charge through the trigger at full speed resulted in none surviving, so it's good enough for now)

sharp peak
#

Can that be fixed somehow, should I use smth other than initPlayerLocal, or am I out of luck?

#

This is for codeProgress, codeCompleted, & codeInterrupted

plush nova
#

hm does anyone know if there's a good way to make ACE stamina/medical not apply to a specific unit

copper raven
royal spruce
#

is there any way to hide city names in the map?

past wagon
#

Does this look okay for defining functions in description.ext? Do I need the extra sub-class? or is this fine?

class CfgFunctions {
    class TRI { 
        class lootSpawn {
            file = "functions\lootSpawn.sqf";
        };
        class vehicleSpawn {
            file = "functions\vehicleSpawn.sqf";
        };
        class gameFlow {
            file = "functions\gameFlow.sqf";
        };
    };
};
#

also is the way I formatted this frowned upon in any way or does it look good?

warm hedge
#

If is recognized properly, should be shown in Functions Viewer

past wagon
#

oh right

#

thanks

pale glacier
#

Hey guys!
I want a civilian counter so if x amount of civilians are killed, something happens.
Now I have a code from BI forum that works and I just need to refine the EH of the civilians..

This is what we came up with

if isServer then {
{_x addMPEventHandler ["MPKilled", {
 params ["_unit", "_killer", "_instigator", "_useEffects"];
if (isplayer _killer) then {
    call fnc_countCivDeaths
    };
}];
}foreach allunits- allplayers;
};

Problem - foreach allunits- allplayers

Includes Opfor, I know
I need to define it so it'll be ONLY civilians, and I'm concerned that Arma treats animals as well as civilians. How can I make sure it count ONLY civilians and not rabbits / snakes..?

Thanks a lot!

tough abyss
#

You should try forEach (units civilian) :)