#arma3_scripting

1 messages · Page 23 of 1

mortal saffron
#

Is it possible to add scopes to vehicle turret weapons?

tough abyss
#

anyone know if you can use setdamage to deal ace damage

#

or if ace has some special thing

tough abyss
#

k thanks

open hollow
#

It’s fixed, that’s why I need the aiming camera

hallow mortar
#

A custom camera that the player can switch to is probably best. Create one and attach it to the weapon. You can make a basic centre crosshair with cutRsc or something but calibrating it is up to you.

proven charm
#

how can you make __has_include to work with files inside a .pbo?

warm hedge
#

As I wrote in the BIKI, do not binarize the config

proven charm
#

hmm binarization is off in addon builder

warm hedge
#

How's your config?

proven charm
warm hedge
warm hedge
#

Why you need this in a script file? You can use fileExists in SQF

proven charm
warm hedge
#

Are you sure that \fow\initMission.sqf exists? Where's the file, what's the file and which Mod?

proven charm
#

actually nevermind it works after all , was just doing something stupid

#

hmm looks like dedi cant find the files, have to look further into this

warm coral
#

when i use a normal script command for multiplayer it only shows for me as the host

#

but when i use remoteexec

#

for some reason it duplicates itself

#

lets say with subtitles its like the command executes multiple times

#

or addaction theres like 5 copies of the same action

#

is there something im doing wrong?

warm hedge
#

Without looking the code, no

warm coral
#
[
    ["MAN", "Hey1", 0],
    ["MAN", "Hey2", 3]
]  remoteExec ["BIS_fnc_EXP_camp_playSubtitles"];```
#

this for example for some reason executes multiple times when im hosting

#

i was thinking maybe it had to do something with the targeting of remoteexec?

#

this

#

targets (Optional, default: 0):
Number (See also Machine network ID):
0: the order will be executed globally, i.e. on the server and every connected client, including the machine where remoteExec originated
2: the order will only be executed on the server
Other number: the order will be executed on the machine where clientOwner matches the given number
Negative number: the effect is inverted: -2 means every client but not the server, -12 means the server and every client, except for the client where clientOwner returns 12

hallow mortar
#

Where are you putting the code? Object init field, init.sqf, ...?

#

Object inits, init.sqf, and some other fields under certain conditions, are executed on every machine, so if they include a global command or in your case a global remoteExec, the command will be executed for everyone multiplied by the number of connected machines

warm coral
#

i put them in a trigger if i remember correctly

hallow mortar
#

Depending on the trigger condition, a trigger's activation code can run on every machine. Try setting it to Server Only.

warm coral
#

so i should use non-remoteexec commands and run via server only right?

hallow mortar
#

No, either remoteExec and server only, or non-remoteExec and non-server-only

#

If you use server only and non-remoteExec, the command will only run on the server, which isn't very helpful if it's not a global command

warm coral
#

ohhh okay i understand

#

thanks a lot 👍

wispy topaz
#

Hey, I'm pretty new to scripting and have almost 0 idea what I'm doing.
I need an animation to loop and as soon as an alarm sounds the unit quits the animation and enters regular combat mode.
I've done the loop with this:


0 = [this,"_anim"] spawn animLoop;```

and I've managed to make the animation loop.
This is how the trigger looks:

```Var Name: SirenTrigger
Activation: OPFOR
Activation Type: Detected by BLUFOR

nul = [thisTrigger] spawn {while {true} do {(_this select 0) say3D ["Siren",1000,1]; sleep 150;};};

if (triggerActivated SirenTrigger) then { 
 Rifleman switchMove ""; 
};```

The "if" command will make the unit "twitch" for a split second as if he exits the animation, but will get right back to looping.

How do I make him quit as soon as the alarm sounds?
hallow mortar
#

In your loop, have something like while {(alive _unit) && !(triggerActivated SirenTrigger)} ...

#

That will make it so the loop will only proceed if SirenTrigger is not activated. Once it is activated, the condition fails and the loop stops.

#

In your trigger, you don't need the if (triggerActivated ... check - the code in the On Activation field is only run when the trigger is activated, so the check is pointless

south swan
#

it's inside spawned whileTrue though

south swan
#

or am i misreading and it's outside?

hallow mortar
long bloom
#

Hi all - using a barely modified version of an example to play with an idea -


private _cam = "camera" camCreate (player modelToWorld [0,0,0]);
_cam attachTo [(vehicle player),[0,1,0],"head"];

    _Zoom = (
        [0.5,0.5] 
        distance2D  
        worldToScreen 
        positionCameraToWorld 
        [0,3,4]
    ) * (
        getResolution 
        select 5
    ) / 2;

_cam camSetFov _Zoom;
_cam cameraEffect ["internal", "back", "rtt"];
"rtt" setPiPEffect [12];
_cam camCommit 0;
with uiNamespace do {
    private _pic = findDisplay 46 ctrlCreate ["RscPicture", -1];
    _pic ctrlSetPosition [0,0,1,1];
    _pic ctrlCommit 0;
    _pic ctrlSetText "#(argb,512,512,1)r2t(rtt,1.0)";
};

Was wondering - is there a way to create a circle instead of a square with this?

jade acorn
#

how can I reveal a target to player and keep it revealed, without a loop if possible?
player reveal [target, 4] reveals the target for about 1 frame and then knowsAbout goes to 0, having both target and player knowing each other doesn't change that

warm hedge
#

Use forgetTarget along with it

jade acorn
#

but forgetTarget will drop knowledge to 0 anyway, right?

warm hedge
#

But it should work

jade acorn
#

okay, I'll try it out then

warm hedge
#

Oh, somehow I skipped without loop part

#

Uh, I guess no without? I use that with

plucky hornet
#

Hey guys, I am trying to set up a trigger which activates when a APERSMine is placed inside inside the trigger area. I thought setting up a trigger w.
Activation: Game logic
Activation type: Present
Condition: ```sqf
{_x iskindof "APERSMine"} count thislist == 1

On activation (this is just to tell me if it works):```sqf
 hint "You placed an APERS mine!";

But so far it is bust, but the code works fine w. i.e a car

hallow mortar
#

Try changing it from Game Logic to Anyone

plucky hornet
#

Tried, didn't help :/

south swan
#

there seems to be no ammo of class "APERSMine", try to check for "APERSMine_Range_Ammo"

plucky hornet
#

I noticed 🙂 But sadly it still wont work

#

I tried both Game Logic and Anyone

south swan
#

🤷‍♂️ then probably place a "Fired" EH at every unit (player?) that can place a mine and call it a day

hallow mortar
#

Can you try typeOf _x == "APERSMine_Range_Ammo" instead of isKindOf?

#

Actually, first of all, place a mine of the type you want, look directly at it, and run typeOf cursorObject in the debug console. Just to prove the point.

south swan
#

something like sqf this addEventHandler ["Fired", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; if !(_magazine isEqualTo "APERSMine") exitWith {}; // wrong magazine if !(_projectile inArea namedTrigger) exitWith {}; // not inside the trigger hint "You placed an APERS mine!"; // for local use //["You placed an APERS mine!"] remoteExec ["hint", _unit]; // uncomment if you add EH only on server }]; on every unit

plucky hornet
hallow mortar
#

There's your problem

granite sky
#

I'd still be surprised if mines worked for triggers, given that they're apparently not an entity.

plucky hornet
wispy topaz
#

Trying to make 2 units look as if they are conversing next to their vehicle using this


0 spawn { 
 sleep 20; 
 _unit switchMove ""; 
};

_unit assignAsCargo _vehicle; 
[_unit] orderGetIn true; 
[_unit] allowGetIn true;```

I got an issue tho. When I run the scenario, the units go from facing one another to looking at complete different directions. How can I make them look at each other?
I've tried using the lookAt and doWatch, but none of the 2 seem to work (unless I did something wrong)

(Also a minor issue is that as soon as I run the scenario the squad leader orders his team to enter the vehicle. Is there a way to make him sound the order when the "sleep" is over?
hallow mortar
#

Put the orderGetIn stuff inside the spawn, after the sleep

#

Try using disableAI on them to prevent them from deciding to do things on their own. (Remember to re-enable it when you need them to move!)

#

Also, you need to pass _unit into the spawn or it won't be defined.

_unit spawn {
  params ["_unit"];
  // ...
wispy topaz
hallow mortar
wispy topaz
#

Ah okay gotcha

pseudo ridge
#

Can i set god mode on some of the Atlis city walls?

#

I tried allowDamage false in every way, it not work.

jade acorn
#

you can disable simulation of them, AI might try to walk through them but they won't take any damage

pseudo ridge
#

Thanks!

jade acorn
#

for now I'm just using target's position to display the task destination/3d icon but that's a workaround I don't really like

#

somehow knowsAbout is always 4 for vehicles when i use reveal on them, for units it will dissapear as soon as I can't see the target anymore

drowsy geyser
#

i found this script online, basically it lets you kick a football but there is no sound effect and i wanted to add a kicking sound effect but i dont know where to place it.

addMissionEventHandler ["EachFrame",
{
       {
          if((velocity _x) vectorDistance [0,0,0] < 1) then
          {
            if((velocity player) vectorDistance [0,0,0] > 1) then
              {
                    if((getPosATL player) vectorDistance (getPosATL _x) < 0.5) then
                    {
                     _p = ((velocity player) vectorDistance [0,0,0]) * 2;
                     _v = velocity player;
                     _m = 1.5;
                     _z = 1 + random 2;
                     _v set [0, (_v select 0) * _m];
                     _v set [1, (_v select 1) * _m];
                     _v set [2, _z];
                     _x setVelocity _v;
                    };
               };
          };
     }forEach (entities "Land_Football_01_F");
}];
jade acorn
#

below _x setVelocity _v;, should work

drowsy geyser
#

it starts to loop the sound as soon as i touch the ball

jade acorn
#

do you add the sound as say3d?

drowsy geyser
#

like this
playSound3D [getMissionPath "\sounds\footballKick1.ogg", _x, false, getPosASL _x, 90, 1, 60];

hallow mortar
#

That is an eachFrame event handler so I would not recommend putting the sound generator anywhere in that, because it will cause the sound to be played every single frame

spiral temple
#

is there any scripting function to check if this

23:07:45 NetServer: trying to send a too large non-guaranteed message (len=1348/1353) to 235505265

happens that the specific player is getting kicked?

fringe yoke
#

Are we unable to change the tooltips on inventory items?

I have

_control lbSetTooltip [_index, _tooltip];
_control lbSetText [_index, "test"];

All the items get their text set to test, but all the tooltips remain visually unchanged, the return value of lbTooltip does change

drifting grotto
#

Hi - I'm relatively new to scripting, so apologies if I'm not asking a very useful question. I'm attempting to create a script that smoothly moves a static object between two predefined points when activated, and it has to work on a dedicated multiplayer server. Does anyone have any idea where I would start with this, or any suggestions for documentation/methods to look into?

granite sky
#

To have it working smoothly in multiplayer you need to ensure that the velocity parameters match the velocity that you're actually moving it with.

#

I think there are simpler ways for a fixed object + predefined points but I don't deal with those :P

wary needle
#

hi i want to make a body falling jumpscare, how would i go anout making that?

#

i know i would have a trigger, but im not sure how to make the body fall

blazing loom
#

I found this script online and it works on my MP server but only the person who picks the song can hear it.
I remember playing an exile server years back that had the script but they had it so everyone could hear and as helis flew over you would hear the song they are playing with doppler effect

#

.any idea how to modify this script to make that happen?

winter rose
#

remoteExec

tough abyss
forest crown
#

hi

#

how can i create a civilian population in the city.

winter rose
forest crown
fleet sand
blazing loom
# winter rose remoteExec

So in the init when it calls the script
[] execVM "rscripts\addaction.sqf";
I just use remoteExec instead of execVM? And where should call to script? I

fleet sand
fleet sand
# winter rose stop with this `-2` already

Is something wrong with -2 with remoteExec ? if so can i know what? also it says this on Wiki for remoteExec
[-2] Negative number: the effect is inverted: -2 means every client but not the server

fleet sand
plush belfry
#
{ 
 _myFilledArray = [radio1, radio];
 _myFilledArray say3D "radiomusic1"; 
sleep 151;
 _myFilledArray say3D "radiomusic2";
sleep 211;
_myFilledArray say3D "radiomusic3";
sleep 162;
};

This script works when putting an object before the say3D, but i am trying to make it run on multiple objects, this clearly doesn't work, as only say3D applys to the first element in the array, is there a better way to acheive this, or is there a way to make the say3D script read a whole array and apply to all elements inside an array?

plush belfry
# winter rose `forEach`?

I have looked into that but I can't figure out where the say3D script will go as it requires an object to be before the sound it plays, unless you know how to lay it out properly, would be appreciated

winter rose
#
private _radios = [radio1, radio2];
while { true } do 
{ 
 { _x say3D "radiomusic1"; } forEach _radios;
sleep 151;
 { _x say3D "radiomusic2"; } forEach _radios;
sleep 211;
 { _x say3D "radiomusic3"; } forEach _radios;
sleep 162;
};
#

would that suit you?

plush belfry
#

that works perfectly! You're a magician

#

for learnings sake, "_x" is acting as the object for both radio1 and radio 2 right?

winter rose
#

correct; it is a "magic variable" pointing at the current array element

plush belfry
#

tysm!

wispy topaz
#

How can I make units move to a waypoint after they complete a script?
If I set a waypoint from the editor and run the scenario, they do the script but not the waypoint. Do I need to create a waypoint using a script? If so how?

granite sky
#

What are you doing with them in the script?

wispy topaz
#

0 spawn
{ 
 sleep 20;
 _unit assignAsCargo _vehicle; 
 [_unit] orderGetIn true; 
 [_unit] allowGetIn true;
 _unit switchMove ""; 
};```

I basically have them do this
open fractal
#

that's not your actual code is it?

hallow mortar
#

_unit switchMove "_anim" won't work. You're telling switchMove to look for an animation literally called "_anim", and the chances of that existing are, uh, slim
You also still need to pass _unit into the spawn so that it's defined

forest crown
#

hi

#

How can I switch scenarios in the task, that is, how can I make the screen go black, and a text will appear at that time, and the team will spawn in another place.

wispy topaz
wispy topaz
hallow mortar
#

Replace this:

0 spawn {```
with this:
```sqf
[_unit] spawn {
  params ["_unit"];```
wispy topaz
#

Will do

hallow mortar
#

Oh hold on, if your code doesn't actually use _unit but instead a global variable (Medic) then you don't need to do it, because global variables are available in all scopes

#

This is why it's important to give the actual code :|

wispy topaz
#

Oh oh okay 😅 my bad

blazing loom
granite sky
#

sighs

#

The muzzle parameter of compatibleMagazines is case-sensitive, and of course the first one I try has the wrong case.

#

configName sanity filtering again :/

#

It looked pretty good up until there because it corrects the casing and removes missing classes from the output.

slender gust
#

any idea what this error means

'...ypeof _this) >> 'backpack'); waituntil {|#|sleep 0.2; backpack _this ==
backpack};...'
Error Suspending not allowed in this context

granite sky
#

The script is running in unscheduled context (eg event handlers) and you can't sleep or waitUntil there.

#

If an event handler needs to do something on a delay then use a spawn.

slender gust
#

heres the thing tho

#

im not trying to run any scripts

granite sky
#

Then you're in the wrong channel.

slender gust
#

Oh where do i go

granite sky
#

And you need to remove your broken mods.

slender gust
#

I was using scripts earlier but i took them out of the mission folder

#

could it have left something behind

winter rose
slender gust
#

Where could that be

#

like a regular trigger

#

in the editor

winter rose
#

yeah

slender gust
#

I have 3 triggers down but those werent causing any problems til now

#

theyre just for uh

winter rose
#

that or an init field

slender gust
slender gust
#

but idk how to fix it

winter rose
#

(otherwise, you are not editing the proper mission directory)

#

just empty the init fields

#

at least, wherever you see sleep

slender gust
#

ok i have init.sqf and initplayerlocal.sqf

#

neither have sleep and initplayerlocal is empty cuz i deleted everything in it

#

but this is after i restored them

#

i havent tested yet

#

to see if it will happen again

#

lemme check

#

lemme restore the one initplayerlocal to what i had before

#

cuz earlier i was using scripts to let AI and players respawn with a custom loadout

#

and it was all fine but the problem was they ran out of ammo

#

so i used ALiVE to create custom faction pbo

#

so they would have default loadout

#

and would respawn with full gear that i wanted them to have

#

then i deleted the respawn scripts cuz i figured i dont need them anymore

#

but then its doing the error now so

#

lemme try doing the thing

#

i just wonder if the scripts messed with mission.sqm somehow

#

cuz how could a faction pbo cause a sleep error

#

ok the error is gone now lol but now the AI are spawning with the kit they died with which means they will have the same amount of ammo they died with which i do not want

#

So if i delete the scripts i get the error but i keep the scripts the ai will run out of ammo

#

The specific script i added back is this

#

player setVariable ["TAG_LoadoutStart", getUnitLoadout player];
player addEventHandler ["Respawn", { player setUnitLoadout (player getVariable ["TAG_LoadoutStart", []]); }];

#

lemme try deleting it again

slender gust
#

Ok i fixed it but i have no idea how

#

i literally re-added the scripts and then re-deleted them

proven ember
#

Question, so I have a hostage in the hostage stance, but how do I make it so I can free them & then they join my squad.

robust lichen
#

hello, im trying to get a bit of code to assign cost to vehjicles in zeus

#
ZeusMaster addEventHandler [
    "CuratorObjectRegistered",
    {
        _classes = _this select 1;
        _costs = [];
        
        {    
_cost = if (_x isKindOf "Man" or _x isKindOf "tank" or _x isKindOf "Air" or _x isKindOf "Car") then {
switch (true) do {
case (_x isKindOf "tank"): {[true,0.8]};
case (_x isKindOf "Man"): {[true,0.05]};
case (_x isKindOf "Air"): {[true,0.8]};
case (_x isKindOf "Car"): {[true,0.4]};

};
} else {[true,0.8]};
            _costs = _costs + [_cost];
            
        } forEach _classes;
        _costs
        
    }
];
#

and for some reason its like its ignoring the costs of items

#

im trying to use RHS vehicles specifically

stable dune
#

You aren't passing cost in cases to costs

robust lichen
#

how would i do that?

#

im unfamiliar with Armas code

#

so passing _cost to _costs

stable dune
#

Sorry miss readed

granite sky
#

Have you confirmed that it's called your EH at all?

robust lichen
#

its in my curator module

#

under init

#

should i run it under Init of the mission?

granite sky
#

I dunno, I don't work with object init handlers. I'm not even sure whether the object var is set before the init is called, so maybe try it with this instead of ZeusMaster.

robust lichen
#

does RHS have a diffrent structure?

granite sky
#

For tank/car/air/man? Not that I recall.

robust lichen
#

using "this" didnt work

proven ember
#

Does anyone have a trigger init. Command that makes a squad member leave your squad once they enter?

winter rose
#

yes, join or joinSilent could do (with the proper arguments of course)

proven ember
#

So i if I was Alpha 1-1 and could tell them to join a reserve squad like A 1-5 then?

winter rose
#

the group you like or a new one yes

runic edge
winter rose
#

yes.

hallow mortar
#

Remember it's Local Argument, which means it must be executed on the machine where the vehicle is local, otherwise it won't take effect

runic edge
#

I'm trying it in sp for now and i can't make it work. I've try yunowork lock 2; and with _this lock 2; in the vehicle init

hallow mortar
#

When you use the variable name, make sure it's spelled correctly and the vehicle has that name.
In an init field, the object is referred to with this, not _this.

#

Also if you're using init fields you can just use the lock state dropdown in the attributes.

runic edge
#

When you use the variable name, make sure it's spelled correctly and the vehicle has that name.
Just double checked it, it's the same !
In an init field, the object is referred to with this, not _this.
Neither seems to work.
Also if you're using init fields you can just use the lock state dropdown in the attributes.
I'm testing the command to implement in a script later

open fractal
#
[_yourVehicle,2] remoteExec ["lock",_yourVehicle];
``` is good practice for mid-mission scripts since client ownership of vehicles can frequently change
runic edge
#

I'm also not sure about the difference between lockstate 2 and lockstate 3 !

hallow mortar
#

In state 2 it's locked for everyone. In state 3 it's locked for players but not for AI.

runic edge
drowsy geyser
hallow mortar
hallow mortar
# runic edge I can't make it work !

I'm not able to reproduce the problem; this lock 2 in the init field is working for me.
If you have any mods loaded, try unloading them and testing it.

drowsy geyser
#

the problem is even if i use createVehicle then the lightpoint is visible for me but not for the others so i can see my lightpoints but i cant see the lightpoints from the other players vice versa

hallow mortar
#

Well, don't use createVehicle, because it is the wrong way to create lightpoints.
The best way to handle it would be to put all the light creation stuff, in local form, in a function which is then executed locally by all clients.

hallow mortar
#

Setting it up in cfgFunctions is not strictly required - you could use a script and remoteExec execVM, or define the function in init.sqf or something. But you should use cfgFunctions. It's not difficult and it's best for something that will be run repeatedly and needs to be fast.

brazen lagoon
#

is there a way of figuring out if the current game session is on a dedi?

winter rose
#

isDedicated on the server itself

brazen lagoon
#

Not if the running script is running on a dedicated server

winter rose
#

nothing client-side I believe, but why would it matter?

brazen lagoon
#

fair

winter rose
#

not that you should need it but you could always broadcast the value from the server 🙂

missionNamespace setVariable ["SGT_isDedicated", isDedicated, true];
brazen lagoon
#

true

gray mica
#

Can someone help me find a mod or scripts that allows divers to shoot non uw rifles if the weapon is out of the water?

runic edge
#

The problem is a mod indeed !

winter rose
#

@gray mica wait a bit before upping a 5 minutes request, thanks
using Search on the Steam Workshop could bring results too

gray mica
#

sorry, a script. I am just the end user of the content, I have a hard time understanding wizard

brazen lagoon
#

Any suggestions on how to figure out if a classname is a tank or a tankette?

brazen lagoon
#

that is not helpful both are 'Tank'

proven charm
#

true

brazen lagoon
#

my initial angle is to try and see if I can figure out how much armor they have. or see how big their gun is

#

like if i select the MLRS tank for blufor it has magazines[] = {"12Rnd_230mm_rockets"}; so that's obvious since it's rockets

#

but the IFV Panther is also a "Tank" with armor 500 and its main gun fires 40mms and 50cal which is less obvious

#

oh I guess I could see if it fires a shell.

runic edge
#

problem solved, thanks to you all ❤️

winter rose
south swan
#

last time i've checked algorithmically sorting tanks from APCs took way more effort and lines of code than just manually splitting the list 🤷‍♂️

winter rose
#

if you want consider mods, scripts are a requirement
but also: what makes a tankette?

south swan
#

and then you get RHS and some WW2 mod. And BMP-3 has 100mm cannon and comparable armor to most early-war medium tanks XD

brazen lagoon
#

@winter rose dwbi I figured a decent way of doing it

#

@south swan yeah I would be OK with a bmp w/ a 100mm gun spawning for this I think

#
_filtering_fn = {
    private _armor = getNumber (configfile >> "CfgVehicles" >> _x >> "armor");
    private _is_uav = getNumber (configFile >> "CfgVehicles" >> _x >> "isUAV");
    private _has_gun = isClass (configFile >> "CfgVehicles" >> _x >> "Turrets" >> "MainTurret");
    private _shells = [];
    if (_has_gun) then {
        private _mags = getArray (configFile >> "CfgVehicles" >> _x >> "Turrets" >> "MainTurret" >> "magazines");
        private _ammo = _mags apply {
            getText (configfile >> "CfgMagazines" >> _x >> "ammo")
        };
        _shells = _ammo select {_x isKindOf "ShellBase"};
    };
    (_armor > 500) && (_is_uav == 0) && (count _shells > 0)
};
#

is a bmp tracked? I thought a bmp was wheeled

#

ah yes it is tracked. I mean tbh. the difference between a tank and an IFV is pretty tenuous

winter rose
#

(PS: for perf purpose you could store configfile >> "CfgVehicles" >> _x in a variable (and I am going to shut up about it now ^^))

brazen lagoon
#

ah yes that'd be smart

winter rose
#

(also configOf I believe?)

brazen lagoon
#

its a function that isn't called very frequently so I tend toward readability

#

oh that would also be smart. Hey one quick thing though, and I dunno if this is more for this channel or for #arma3_config but - is there a way to get the size of a shell? Like how many mm across it is

#

you'd think it would be "caliber" but that doesnt work for subcaliber rounds

copper raven
hallow mortar
#

[calibre]
I don't believe such a thing is actually stored anywhere as a specific thing. It might be in the classname but that's up to the creator to do.
Most gun projectiles are just "points" with a tracer model and no real size.

winter rose
#

is there a way to get the size of a shell
I am not exactly good with this, I would say that if there is no config entry then you can try to figure it out of its impact value, but it's as good as a ballpark estimate

brazen lagoon
#

shame. i was hoping for a way to determine the size in mm of a gun

copper raven
#

also an exitWith at line 4 would be really good here, the (_armor > 500) && (_is_uav == 0)

winter rose
#

use the ammo stringtable value and search string "120mm" in it :p

brazen lagoon
#

LOL

#

that is one way of doing it

winter rose
#

an awful one indeed 😄

brazen lagoon
#

and yeah @copper raven i wrote it quick so its not optimized.. but it's also not called very often

copper raven
#

i mean the calibre has nothing to do with the game itself right? 😄 it's literally just for "description" purposes

#

like the way damage works and stuff

brazen lagoon
#

caliber according to the wiki is

#

Acts as penetration multiplier for the projectile.

copper raven
#

maybe you can deduce it from some value in ammo config 😄

brazen lagoon
#

lol yup

hallow mortar
#

caliber (the config value) doesn't really have any connection to the physical calibre of the projectile. A 120mm HE is going to have less caliber than an APFSDS despite being, in theory, physically larger. The game just doesn't actually simulate or care about the physical size of most projectiles. Their physics behaviour is determined by a combination of speed and drag which are just numbers, and what gun they fit is determined by including the magazine in the gun or magwell's config, not by any sort of physical compatibility.

fleet sand
brazen lagoon
#

lmao

#

yeahhhh

hallow mortar
#

mass on magazines is used for inventory space calculations which, IIRC, vehicle magazines don't care about.

brazen lagoon
#

well also you'd ideally want to use cfgammo and see how heavy a single shell is

#

but yeah I think using caliber or just the fact that it's a shell alone is prob the best choice

copper raven
#

nvm yeah

#

there is no "caliber" in arma itself

#

best you can do is just scrap the descriptions/displayNames

#

for vanilla atleast you can maybe get it from the ammo classname, pretty sure all of them have the "caliber" in them

#

but for mods, there is no consistency i'm afraid

proven charm
#

maybe get ammo "hit" (damage) value? and "indirectHit" i think

drowsy geyser
hallow mortar
#

Which of those methods you use shouldn't matter in making it work, as long as the script/function itself is properly constructed (though you still should use a cfgFunctions function, it is better). So there is probably a problem with how you've converted it to local operation.

copper raven
# drowsy geyser i tried with `remoteExec` execVM but unfortunatly it did not work, i had the sam...

you're supposed to create lightpoints locally, fx,

// should use CfgFunctions
my_fnc_createLightpoint = {
  params ["_positionASL"];
  private _lightpoint = "#lightpoint" createVehicleLocal [0, 0, 0];
  _lightpoint setPosASL _positionASL;
  _lightpoint setLightColor ...
};

// usage
[getPosASL player] remoteExecCall ["my_fnc_createLightpoint", [0, -2] select isDedicated]; // create lightpoints on all clients
drowsy geyser
#

i'll test this later, but thank you guys in advance

jade acorn
#

I want to disable manual saves for my scenario as scripted saves/autosaves are frequent and manual save might break something.

I put enableSaving [false, true]; in init.sqf and then first saveGame; is executed some time later, at the end of a different .sqf file exeVMed by a trigger. What the game does tho is making a save right at the start of the game, and then the triggered saveGame does not happen. Should those be used other way to actually work?

copper raven
#

you're passing true so it autosaves immediatly

jade acorn
#

I thought it means create an autosave on saveGame command

#

so I have to execute enableSaving everytime I want to do an autosave, right?

copper raven
brazen lagoon
#

how do you get if waypoints are completed?

jade acorn
copper raven
brazen lagoon
#

hmm. that returns an array? or does it return code

copper raven
brazen lagoon
#

ok so it returns code

#

cool

#

actually that doesn't matter to me thinking about it. a better question is if there's a way to get if a unit has completed all its waypoints @copper raven

#

basically if the unit is idle

copper raven
brazen lagoon
#

is there a reason to do that vs. just unitReady _vehicle

copper raven
# jade acorn I thought it means create an autosave on `saveGame` command
my_fnc_execNextFrame = {
    addMissionEventHandler ["EachFrame", {
        _thisArgs params ["_frameNo", "_code"];
        if (_frameNo > diag_frameNo) exitWith {};
        call _code;
        removeMissionEventHandler [_thisEvent, _thisEventHandler];
    }, [diag_frameNo + 1, _this]] 
};

my_fnc_saveGame = {
    enableSaving [true, false];
    {
        saveGame;
        { enableSaving [false, false] } call my_fnc_execNextFrame;
    } call my_fnc_execNextFrame;
};
// usage 
call my_fnc_saveGame

this works, alternatively if you have CBA, replace the call my_fnc_execNextFrame with call CBA_fnc_execNextFrame

#

maybe someone else knows how to do it properly meowsweats

winter rose
#

huhhh…
just use saveGame?

#

and what's the deal with the Frame EH here really x)

#

isNil is enough if you want to run code unscheduled

copper raven
winter rose
#
enableSaving [false, false];


//...

saveGame; // works? 
copper raven
#

nope doesn't

#

needs to run a frame after the enableSaving

#

oh, i missread, that wouldn't work at all 😅

winter rose
#

why not?

jade acorn
#

it just doesn't, neither enableSaving [false, true] after double false

copper raven
sullen sigil
#

is there any way to disable shadows of an object with script or am i going to be fucked

winter rose
#

I call bug, this should only prevent manual save, not scripted one

jade acorn
#

it also seems impossible to do false,true twice

sullen sigil
winter rose
#

your choice, beware the crust

copper raven
#

XD

copper raven
#

worthy a FT ticket perhaps

sullen sigil
#

i like the end pieces 😳 👉 👈

jade acorn
winter rose
jade acorn
winter rose
#

lies, well, Dedmen is a bot so

copper raven
sullen sigil
winter rose
#

guilty as charged!

sullen sigil
#

dont you mean guilty as charged !

winter rose
#

guilty as charged !*

sullen sigil
#

i am going to stop this before i get muted again 💀

winter rose
#

give me time, I'm on mobile

sullen sigil
#

is there no hacky way to stop objects having shadows or is it a straight engine limitation

copper raven
#

hide the object

#

(kidding)

winter rose
#

@copper raven @jade acorn also isn't there a BIS_fnc_saveGame (might help)?

sullen sigil
jade acorn
#

Evaluates the current battlefield situation 💀

copper raven
winter rose
#

dang, welp

sullen sigil
winter rose
#

make it night when you are inside :p

sullen sigil
#

lights also don't work then 😂

#

dont know why but its a modded map so thats probably the reason

winter rose
#

hm, dunno
you could play with setApertureNew?

sullen sigil
#

hang on i found some game logics in the scenario that work as lights

#

however theres 6k objects present in the scenario which i placed so searching takes a while

winter rose
#

game logics that work as lights
what did you bring upon these cursed lands

sullen sigil
#

i'll let you know when the attributes page loads 😂

#
call{light = "#lightpoint" createVehicleLocal position this; 
light setLightBrightness 0.8; 
light setLightAmbient[0, 0, 0]; 
light setLightColor[10, 10, 10]; 
light lightAttachObject [this, [0,0,0]]; 
light setDir (getDir this);
light setLightDayLight false;}``` this apparently
#

aaaaand doesnt work for where it needs to go

cold pagoda
#

Question, I'm trying to get this to work:

skillspopup = true; publicVariable "skillspopup"; 
_players = allPlayers select {alive _x};
[_players] spawn {    
    params ["_players"];
    _skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000]; publicVariable "_skillstargets";
    { _x animate ["Terc", 1]; } foreach _skillstargets;
    while {skillspopup} do {  
        {  
            if (_x distance _players < 70) then {  
                _skillstargets = _skillstargets - [_x];  
            };
            if (_x distance _players > 200) then {  
                _x animate ["Terc", 1];
            } else {  
                _x animate ["Terc", 0];  
            };  
            if (skillstgtactive distance _players < 80) then {  
                _x animate ["Terc", 0];  
            };   
        } foreach _skillstargets;  
    pltskillstimer = selectRandom [2,5,10];  
    uiSleep pltskillstimer;  
    }  
}```
Everything works except for the if statements to distance. I'm trying to get this to work on dedicated it works in SP with "player" but I was told that "player" doesnt work in MP Dedicated.
Am I calling _players correct here? What is a better solution if I am not?

Thanks for any help!
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
sullen sigil
#

pls sqf syntax

copper raven
cold pagoda
#

thanks fixed!

copper raven
#

_x distance _players OBJECT distance ARRAY does not exist

cold pagoda
#

So I should do InAreaArray instead of nearestObjects?

copper raven
#

yes you also need to provide x and y axes

cold pagoda
#

so I should do that to _players?

_players = allPlayers inAreaArray trigger```
copper raven
#

no i meant your distance checks

#

fx, you can write, _x distance _players < 70 as count (_players inAreaArray [ASLToAGL getPosASL _x, 35, 35, 0, false, 35]) == count _players

sullen sigil
#

any way to check if player has access to zeus or not btw

copper raven
sullen sigil
cold pagoda
#

in x y z?

copper raven
#

half the distance

cold pagoda
#

ahh, so i need to change those numbers for the other checks?

copper raven
#

yes

cold pagoda
#

for the greater then 200 would be:

count (_players inAreaArray [ASLToAGL getPosASL _x, 100, 100, 0, false, 100]) == count _players

As Im writing this lol how does it know which is greater and less than?

copper raven
#

greater than 200, you'd be comparing to an empty array

#

_players inAreaArray [ASLToAGL getPosASL _x, 100, 100, 0, false, 100] isEqualTo []

sullen sigil
#
this addAction ["Open Dock Door", {
 0 spawn {
 params ["_target","_caller"];
 if (isNull getAssignedCuratorLogic _caller) exitWith {}; 
 DDDoor enableSimulationGlobal true;
 DDDoor animate ["open_left", 1, 0.2];
 DDDoor animate ["open_right", 1, 0.2];
 sleep(40);
 DDDoor animate ["open_left", 0, 0.2];
 DDDoor animate ["open_right", 0, 0.2];
 DDDoor enableSimulationGlobal false;
 }
}]``` arma complaining _caller is undefined ![thonk](https://cdn.discordapp.com/emojis/700311400152825906.webp?size=128 "thonk")
copper raven
#

0 spawn { params ["_target","_caller"];

#

you're passing 0

sullen sigil
#

ah

#

that'd be it thanks

open fractal
#

_this spawn

copper raven
#

also stay in unscheduled for aslong as you can

#

you first 5 lines could be before the spawn

sullen sigil
#

i could just wrap the sleep in the spawn could i not

copper raven
#

actually, action code is schd by default meowsweats

#

so you don't even need the spawn

open fractal
#

does it actually

copper raven
#

wiki states so

open fractal
#

oh gosh

copper raven
#

The script, whether it is a file or a code, will run in scheduled environment, i.e. it is ok to use sleep

sullen sigil
#

bruh moment

open fractal
copper raven
#

i actually didn't know that thonk

sullen sigil
#

cool i blow up if im not zeus

#

perfect

cold pagoda
cold pagoda
copper raven
#

player returns the player controlled unit on the current machine

#

your code returns all alive players in the mission

cold pagoda
#

yea, to my understanding, player shouldn't be used in MP Dedi because its objNull?

copper raven
#

correct

hallow mortar
#

You can use it in an MP game that's being hosted on a dedicated server, you just can't use it on the dedicated server machine itself, only on clients that actually have players

cold pagoda
#

So, if I was to put this in a trigger onact:

count (player inAreaArray [ASLToAGL getPosASL _x, 100, 100, 0, false, 100]) == count player```
with Server Only Checked, that shouldn't work? Because its only be evaluated on the server?
But if I did the same code above without Server Only Checked, it should work?
#

I understand the concept of Locality, but then I dont lol

hallow mortar
#

It would """work""" but it's not the right way to do it. player only returns the local player unit on the current client that the code is being executed on. count player would always be 1. It doesn't return every player, just this player.

cold pagoda
#

ahh, okay

hallow mortar
#

Actually count player probably would cause a script error because player returns object, not an array or anything else that can be counted

winter rose
#

yep

cold pagoda
#

So the correct way in MP Dedi is to use sqf allPlayers

hallow mortar
#

for this purpose it appears that way. But it's not a universal answer, sometimes there are things you want to use player for in a DS mission. Just not this.

copper raven
cold pagoda
#

yea, I was wanting the code to be affected by any player near a target to prevent it from popping up again.

#

so it seems yours will work the best.

#

pretty cool

#

so another question, because this is a while do loop, would it be better to do it via a trigger onact with a spawn block or would it be better to execVM via a function or file? Just thinking performance.

cold pagoda
#

okay, I've been looking into functions, but I'm just not there yet lol

cold pagoda
#

yea I was reading it, but calling a function is where I'm confused lol like would I do: sqf execVM Tag_fnc_thing;?

cold pagoda
#

ahh okay spawn it

sullen sigil
#

could you make the time of day as night time for the local player? 🤔 cant test if it'd work or not atm

open fractal
sullen sigil
open fractal
#

you could always try but I would imagine that's the case

sullen sigil
#

seeing as the mission is hovering around 8k 3den objects i think it'd be smarter to keep performance up :p

open fractal
#

setting time isn't the quickest engine function

cold pagoda
#

Only looking to get players that are in a current list to add an addAction from a trigger. Would this work:

_players = allPlayers select {alive _x}; 
{ maingatecac = _x addAction ["Show CAC", "mgate.sqf"];} foreach thislist select _player```
open fractal
#

no, addaction is local

#

wait

cold pagoda
#

well, I want to add the addAction to only the players in the trigger and no one else.

open fractal
#

if the trigger runs locally for every client then yeah, if you got select right

#

I don't know what you're doing specifically but it seems like it's being overcomplicated

#

is a trigger strictly necessary?

cold pagoda
#

Yea, I wanted to do an addAction only on an object, but while in a vehicle, players aren't able to activate the addAction sometimes. So my work around is to use a trigger so that when a player enters the trigger, it will force the addAction on the player. But the way had it before, which was sqf player addAction <code>; it would place the code on every player in the server.

open fractal
#

maybe you're looking for arrayIntersect?

#

wait _player and _players meowsweats

cold pagoda
#

i mean _players lol

open fractal
#

array select array is not correct syntax

hallow mortar
#

You would want thisList select {_x in _players}

#

But I can't shake the feeling the better approach would be to add the action to everyone, and give it a nice condition that makes it only appear when the player is in the relevant area

open fractal
#

are dead players even counted in thisList?

cold pagoda
#

I tried:

{ maingatecac = _x addAction ["Show CAC", "mgate.sqf"];} foreach thislist select {isPlayer _x}```
But it would also assign it to the vehicle and wouldn't remove it when I did ```sqf
player removeAction maingatecac;```
cold pagoda
open fractal
#
"player inAreaArray yourTrigger" //wrong, i meant inArea
``` would be appropriate for the action condition yeah?
cold pagoda
open fractal
#

or even list

hallow mortar
#

Not the trigger condition, the action condition

copper raven
#

thisList select {_x in _players}
use arrayIntersect

cold pagoda
#

hold on looking it up lol

hallow mortar
open fractal
#

yeah just looked it up, my bad

#

inArea returns bool

cold pagoda
#

so do:

_players = allPlayers select {alive _x}; 
{ maingatecac = _x addAction ["Show CAC", "mgate.sqf"];} foreach (thisList arrayIntersect _players);```?
hallow mortar
#

That may work.
However, I still think it's probably better to add the action to everyone, and give it a condition that makes it only available when the player is in the area. Much less of a pain in the ass.

cold pagoda
#

I have two gates, im all about learning so Ill do both! lol

open fractal
#
player addAction ["Show CAC", "mgate.sqf", nil, 1.5, true, true, "", "_target inArea yourTriggerVariable"];
#

run this on every client and you should be fine unless I missed something again

cold pagoda
#

so that would be good to use in the init.sqf?

#

also, will it remove the addAction when they leave the trigger area?

open fractal
#

it wont show the action unless the condition is met, just like how a trigger constantly checks the condition

cold pagoda
#

ahh, okay

open fractal
#

this is the easiest way for conditions that are not performance-intensive

cold pagoda
#

ahhh

#

okay

#

makes sense

worthy igloo
#

when there is a script error is there a way to make that black box bigger or something so I can read it fully?

open fractal
cold pagoda
#

I can't run this in a trigger because this is a local variable right?

_players = allPlayers select {alive _x};```
open fractal
#

you can define local variables as much as you want

#

so that would work

cold pagoda
#

youre gonna make me cry lol

open fractal
#

you can't reference local variables you defined outside the trigger

cold pagoda
#

So this is working on Dedicated but when I added it to my mission it doesnt work...

skillspopup = true; publicVariable "skillspopup";  
_players = allPlayers select {alive _x}; 
[_players] spawn {
    params ["_players"];
    _skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000]; 
    { _x animate ["Terc", 1]; } foreach _skillstargets;   
    while {skillspopup} do {   
        {   
            if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {   
                _skillstargets = _skillstargets - [_x];   
            };   
            if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {   
                _x animate ["Terc", 1];   
            } else {   
                _x animate ["Terc", 0];   
            };   
            if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) == count _players then {   
                _x animate ["Terc", 0];   
            }    
        } foreach _skillstargets;   
        pltskillstimer = selectRandom [10,15,20];   
        uiSleep pltskillstimer;   
    }   
}```
#

the targets pop down, but its like the while loop isn't running. But the "skillspopup" is set to true.

worthy igloo
hallow mortar
#

The RPT has a lot of things in it. Only some of them are relevant to what you're after. Try scrolling to the end and working from there, or if you remember some keywords from the script error ctrl+f for them.

open fractal
#

did you write this script?

cold pagoda
worthy igloo
open fractal
#

make sure logging is enabled

#

some performance guides tell the masses to disable logging (to our peril)

#

just because it bothers me

pltskillstimer = selectRandom [10,15,20];   
uiSleep pltskillstimer;
``` is redundant, you just need 
```sqf
uiSleep (10 + random 10);
#

unless you're referencing that variable elsewhere

hallow mortar
cold pagoda
#

so that will do like a random range?

open fractal
#

random 10 will return a random number between 0 and 10

#

add 10, there's your 10-20 range

cold pagoda
#

ahh

cold pagoda
# open fractal add 10, there's your 10-20 range

okay, going to test with this, lol hopefully itll give me something...

skillspopup = true; publicVariable "skillspopup";
_players = allPlayers select {alive _x};
[_players] spawn {
    params ["_players"];
    _skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000];
    { _x animate ["Terc", 1]; } foreach _skillstargets;
    systemChat "Loads before while loop.";
    while {skillspopup} do {
        systemChat "Loads loop start.";
        {
            if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
                _skillstargets = _skillstargets - [_x];
            };
            if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {   
                _x animate ["Terc", 1];   
            } else {   
                _x animate ["Terc", 0];   
            };   
            if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) == count _players then {   
                _x animate ["Terc", 0];   
            }    
        } foreach _skillstargets;
        systemChat "Loads before timer";  
        uiSleep (10 + random 10);
        systemChat "Loads after timer";  
    }   
}```
open fractal
#

bear in mind that systemChat is local, so this will only show chat if you run it on your client

cold pagoda
#

ahh, okay, so ill need to do remoteExec with sideChat

#

to test in MP Dedi

open fractal
#

or just remoteExec systemChat

cold pagoda
#

tru

open fractal
#

or log to dedi rpt

open fractal
cold pagoda
#

im the R word

#

lol

#

no way

#

it should be
((count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) == count _players)

#

ugh and its in every one lol

#

I think that might be the problem

hallow mortar
#

You have only solved part of the problem with that

#

Take a moment to go through the logic of what each step is doing. Here's a hint: one of your layers is redundant.

cold pagoda
#

hmm

open fractal
cold pagoda
# hallow mortar Take a moment to go through the logic of what each step is doing. Here's a hint:...

so my thought process:

if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {  
                _skillstargets = _skillstargets - [_x];  
            };```
This removes the target from the list so that it doesnt popup if a player is within 70m of the target. If they are not, it should be skipped and they should popup.
```sqf
if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {  
                _x animate ["Terc", 1];
            } else {  
                _x animate ["Terc", 0];  
            };```
this block checks to make sure any target greater then 200m of a player, is not popped up so that only some sections are active at a time as they progress.

```sqf
            if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) then {  
                _x animate ["Terc", 0];  
            }; ```
This part, there is a section of the course that the targets are greater then 200m but I need it to popup only when they get to that section. So the skillstgtactive variable object once they get within 80m of the target, it pops up the further targets that are around 500m.
hallow mortar
#

Okay, no, it's simpler than that, I am only talking about in the context of the if condition

hallow mortar
cold pagoda
#

hmm, im trying to see it lol but I'm lost. something is redundant.

hallow mortar
#

You have == count _players twice. You only need one. The second one is...not good

cold pagoda
#

so it should be = count _players

open fractal
#

does count even need to be there?

#

== can compare arrays directly right?

#

oh guess not

hallow mortar
cold pagoda
open fractal
cold pagoda
#

Okay, the testing block:

skillspopup = true; publicVariable "skillspopup";
_players = allPlayers select {alive _x};
[_players] spawn {
    params ["_players"];
    _skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000];
    { _x animate ["Terc", 1]; } foreach _skillstargets;
    ["Loads before while loop."] remoteExec ["systemChat", 0];
    while {skillspopup} do {
        ["Loads loop start."] remoteExec ["systemChat", 0] ;
        {
            if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
                _skillstargets = _skillstargets - [_x];
            };
            if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {   
                _x animate ["Terc", 1];   
            } else {   
                _x animate ["Terc", 0];   
            };   
            if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) then {   
                _x animate ["Terc", 0];   
            }    
        } foreach _skillstargets;
        ["Loads before timer"] remoteExec ["systemChat", 0] ;  
        uiSleep (10 + random 10);
        ["Loads after timer"] remoteExec ["systemChat", 0] ;  
    }   
}```
hallow mortar
# open fractal oh guess not

isEqualTo can do it, but I'm pretty sure it would require the arrays to be in exactly the same order, which I don't think can be guaranteed in this context

  • without adding a sort which would be a waste of performance
open fractal
#
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {  
                _skillstargets = _skillstargets - [_x];  
            };
``` @cold pagoda I don't quite follow the logic here. If all players are near the target, it is permanently removed from the list of targets?
#

shouldn't it be ```sqf
(count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) > 0)

cold pagoda
#

well, I just want at least 1 player near the target. Once at least 1 person is near it, it will remove that target from the variable.

open fractal
#

and the _skillstargets should be refreshed after the loop, right?

cold pagoda
#

well, doesnt it technically refresh it with:

_skillstargets = _skillstargets - [_x]; ```
open fractal
#

all that does is subtract the target from the array. How does it get added back in?

cold pagoda
#

ahh, yea, so it gets added back in when they leave the trigger area and go back in to restart it.

open fractal
#

okay

cold pagoda
#

now... I assume, when we do false on the while loop, it destroys the spawn?

open fractal
#

yeah it skips the loop and terminates the spawned script

cold pagoda
#

okay, I thought so lol

#

okay, about to test it.

#

lol it works! it was because of that ")"

#

and it having the double "=="

open fractal
#

epic

cold pagoda
#

@open fractal @hallow mortar you two are awesome!

#

thank you!

dusk gust
#

Anyone have an idea on how to return all applied .bisurf materials to each hit point of a vehicle, or something that can give me a step in the right direction?

#

Being a pain trying to abuse the "HitPart" event handler applied to either bullets or the object itself

worthy igloo
#
{
_x setCombatMode "RED"
} forEach allUnits;
``` would this work or does it need to be for group
robust lichen
#

add points to a zeus every 60 seconds if zeus team owns the sector

#

anyone have an idea on how i could do that?

robust lichen
#

how could i do this but loop it where when owning the sector it would generate points on the sector ```cpp
{
[ _x, "ownerChanged", {
params[ "_sector", "_owner", "_ownerOld" ];
if ( _owner isEqualTo EAST ) then {
ZI addCuratorPoints 0.5;
};
if ( _owner isEqualTo WEST ) then {
ZO addCuratorPoints 0.5;
};
if ( _owner isEqualTo independent ) then {
ZI addCuratorPoints 0.5;
};
}] call BIS_fnc_addScriptedEventHandler;
}forEach ( true call BIS_fnc_moduleSector );

#

im afraid of it getting caught in a loop if i use a loop to generate points

south swan
#

then run adding the EH after all the points are created 🤷‍♂️

#

add points to a zeus every 60 seconds if zeus team owns the sector
or actually write in SQF what you've asked initially

while {true} do {
  sleep 60; // every 60 seconds
  if (east call BIS_fnc_moduleSector > 0) then {ZI addCuratorPoints 0.5}; // if team owns any sectors - add zeus points
  if (west call BIS_fnc_moduleSector > 0) then {ZO addCuratorPoints 0.5};
  if (independent call BIS_fnc_moduleSector > 0) then {ZI addCuratorPoints 0.5};
};``` 🤷‍♂️
robust lichen
#

i appriciate it

pseudo ridge
#

What is the maximun visible distance of a laser draw with drawLaser?

#

I know it's is not draw if you is too far away.

warm hedge
#

It should be getObjectViewDistance

pseudo ridge
#

@warm hedge i found 1700 meters by visual inspection, i will check getObjectViewDistance. Thanks!

stable dune
south swan
#

|| is logical OR, it needs two booleans to its side. So you either go for the _owner isEqualTo east || _owner isEqualTo independent, or go for _owner in [east, independent] to check a variable against the list 🤷‍♂️

stable dune
#

Thanks

proven charm
#

also you can use == instead of isEqualTo

copper raven
#

isEqualTo is fine, in some cases it's a tiny bit faster than == even

proven charm
#

just less to type 🙂

warm coral
#

one with addaction

south swan
#

just run addaction in the Init, it would get executed on all machines by default 🤷‍♂️

warm coral
#

and then the functions inside of it as remoteexec right?

south swan
#

🤷‍♂️ if the code of action needs to be executed on every machine - you make it remoteexec. If it doesn't - you don't

stable dune
robust lichen
#

my sector respawn expression seems to of just stopped working 8:19:00 Error in expression <sectorRespawn call BIS_fnc_removeRespawn> 8:19:00 Error position: <sectorRespawn call BIS_fnc_removeRespawn> 8:19:00 Error Undefined variable in expression: sectorrespawn

#
sectorRespawn call BIS_fnc_removeRespawnPosition;  sectorRespawn = [(_this select 1), (_this select 0)] call BIS_fnc_addRespawnPosition;
#

am i doing something wrong?

south swan
#

if that's exactly what you're running - you are using the variable before you give it any value 🤷‍♂️

robust lichen
#

i see its backwards lmao

#

same issue, same error hmm

scenic shard
#

I have a display that I change the texture of by script. the first time a texture gets applied there is a brief flash.

Im guessing the texture gets cached or something because the flashing stops after the first loop, any way to do that manually from start?

copper raven
south swan
#

or aren't showing the entirety of situation

#

i.e. the map had a "sectorRespawn" assigned, say, in-editor and script is intended to replace it 🤷‍♂️

robust lichen
#

actually i did mess with a script using sectors i wonder if its killing that

#

i remember now lemme disable that

#

disabling it seems to of not changed anything

#

is there anywhere other then rpt log that say any errors ?

#

actually its strange so the error its self disappears when i have it the right way round but it still says respawn disabled?

#

i guess ill put my rpt log

robust lichen
winter rose
#

yes?
on the server, use time and do your calculations?

willow fable
#

I'm quite new to mission making and scripting. I'm trying to spawn enemies and have a task start upon a trigger. But since I'm using !alive to check if the units are alive it checks that before they spawn so nothing works. Just wondering if anyone could help me out

stable dune
willow fable
#

I just have the enemies spawn from a trigger since I'm just testing things out

#

they do have variable names as well

#

and then the task is is just started from the trigger as well but the !alive is already active so nothing spawns. So is there a way to delay it or a wait until?

open fractal
willow fable
#

yes

open fractal
#
(triggerActivated trigger1) && (_yourUnitArray findIf {alive _x} == -1)
willow fable
#

And should I be putting that in the trigger for the task that checks if they are alive

open fractal
#

triggerActivated checks if another trigger has been activated, and the && operator checks if both conditions are true

#

for the condition on the right I just made something up because you haven't shared what your trigger condition is

willow fable
#

Okay, I'll give it a test and my trigger condition is just triggerActivated task1_complete but I'll let you know if it works when I put what you wrote in

open fractal
#

i thought you said your trigger condition checks if they are alive?

#

there's nothing wrong with the trigger that spawns them right?

willow fable
#

My bad I actually meant I'm unhiding the units with trigger instead of spawning them

warm hedge
#

How do I estimate the angle/vector regarded to the zeroing offset?

(disclaimer: I'm not a math guy)

winter rose
#

shoot and compare

warm hedge
#

🔨

hallow mortar
#

You can get the zeroing distance from currentZeroing and then something something cfgAmmo ballistics maths? Or make a general assumption that x distance is probably roughly y degrees elevation, depending on how accurate you need to be

warm hedge
#

If I can get the vector that the bullet should fly (aka final vector minus the dispersion) that's much better

jovial robin
#

is there a way to script trigger for a heli to come offmap into the map to drop something off

open fractal
#

yeah

sonic sage
#

so I'm trying to give an aircraft Infinite fuel

#

and i came up with this to put into its Init

#
 params ["_vehicle", "_hasFuel"];
 if (_hasfuel == false) then 
  { 
     hint "refueled";
    _vehicle setFuel 1; 
  }; 
}];
#

this doesn't seem to work, I'm guessing I'm just not using the EH correctly or there's a scope issue but could someone explain to me what's wrong here?

jade acorn
winter rose
#

isn't there an engineOn true way?

jade acorn
#

ah right, can be added after setfuel

#

and for planes you could add setAirplaneThrottle, not sure what for helicopters if anything at all

sonic sage
#

worked perfectly

#

thank you

worthy igloo
#

how to export gui editor to something that can be run in debug

violet gull
#

Pretty sure there's a GUI button in the debug console

#

If you have a premade GUI or one in progress you're working on, you can import it through the GUI editor to continue working on it. Otherwise, no way to just execute in debug since it likely requires a defines.hpp and config.hpp

worthy igloo
#

how do I make it sqf I mean not hpp or anything like that

violet gull
#

Example:

test = true;
waitUntil { !isNull (findDisplay 42) };
private _myDisplay = findDisplay 42 createDisplay "RscDisplayEmpty";

private _b1 = _myDisplay ctrlCreate [ "RscButton" , 0506661]; //ID is whatever you want, has to be unique
_b1 ctrlSetPosition
[
  (0.325*safezoneW+safezoneX),
  (0.38*safezoneH+safezoneY),
  (0.09*safezoneW),
  (0.025*safezoneH)
];

_b1 ctrlSetBackgroundColor [ 0 , 0 , 0 , 1 ];

_b1 ctrlSetText "TEST";

if ( test ) then {
  _b1 ctrlSetTextColor [ 0 , 1, 0 , 1 ];
  }else{
_b1 ctrlSetTextColor [ .5 , .5 , .5 , 1 ];
};

_b1 ctrlSetTooltip "Test tooltip";

_b1 ctrlAddEventHandler [ "ButtonClick" , {
if ( test ) then {
  (_this#0) ctrlSetTextColor [ .5 , .5 , .5 , 1 ];
  test = false;
  }else{
  (_this#0) ctrlSetTextColor [ 0 , 1 , 0 , 1 ];
  test = true;
  };
}];

_b1 ctrlCommit 0; //Required for changes to actually work
worthy igloo
#

@violet gull where do I see the other display numbers like for escape menu and stuff

violet gull
cold pagoda
#

@open fractal @hallow mortar I'm back.. So, I was able to test this on dedi with more then just myself on the server. So, I have to find a better way to represent "player".

So sqf _players = allPlayers select {alive _x};
When a player would get near a target, it wouldn't remove the target from the target variable:

_man242targets = nearestObjects [man242center, ["TargetBase"], 50];```
```sqf
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 20, 20, 0, false, 20]) == count _players) then { 
    _man242targets = _man242targets - [_x];
}```

it seems that its random as to when it wants to remove a target from the variable and it doesn't seem that it evaluates allPlayers as a player. Do you know of a better way to represent player with multiple players in MP Dedicated?
open fractal
#

allPlayers returns an array of all players and headless clients

#

allPlayers as a player
apples and oranges

#

i already wrote you an example of evaluating if any player is nearby

violet gull
#

I'd recommend creating a separate array of nested arrays like this:

private _players = [];

{
_players pushBack [ _x distance _badboi , _x ];
}forEach (allPlayers select {alive _x});
_players sort true;

private _nearestPlayer = ( _players # 0 ) # 1;
#

Sorts players based on distance from _badboi in a separate array, then selects nearest player

open fractal
#

why do that instead of inAreaArray

violet gull
#

Then it'll be random

cold pagoda
# open fractal i already wrote you an example of evaluating if *any* player is nearby

well, Im using your example:

(count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players)```
This is the entire code which uses your example:
```sqf
skillspopup = true; publicVariable "skillspopup";
_players = allPlayers select {alive _x};
[_players] spawn {
    params ["_players"];
    _skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000];
    { _x animate ["Terc", 1]; } foreach _skillstargets;
    while {skillspopup} do {
        {
            if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
                _skillstargets = _skillstargets - [_x];
            };
            if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {   
                _x animate ["Terc", 1];   
            } else {   
                _x animate ["Terc", 0];   
            };   
            if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) then {   
                _x animate ["Terc", 0];
            }    
        } foreach _skillstargets;
        uiSleep (10 + random 10);
    }   
}```

Because it is launching via a trigger onAct with Server only unchecked, could that be causing anything? Would it be better do do an execVM with server only checked?
cold pagoda
#

?

open fractal
#

yes

cold pagoda
#

ahh, sorry about that

distant belfry
#

Is there a good way to test if a OnPlayerRespawn.sqf is written correctly/firing? I use sublime and have the SQF formatting but don't know how to test it and I think mine isn't working properly. Pretty amateur/new to this sorry!

violet gull
#

You can create a mission in the editor, Export to MP, then try MP hosting it yourself and just respawn in the mission. If your code does the things on respawn, it works.

distant belfry
#

Ah okay, it's not working then 😢

worthy igloo
#

@violet gull I kind of got it working the stop animation button works but im not sure how to make the list buttons do something

violet gull
#

You can use ctrlAddEventHandler, think that's what I use

#

The example I gave makes the button text color change when you click it

copper raven
copper raven
worthy igloo
harsh vine
#
am_list ctrlAddEventHandler ["LBDblClick",{
params ["_idc", "_Index"];

if (_idc lbText (_Index) == "dance" ) then {
player switchmove"";
player switchmove "Acts_Dance_01";
_idc ctrlSetTooltip "dancing :)";

};
if (_idc lbText (_Index) == "KO" ) then {
_idc ctrlSetTooltip "Nice Hit :)";
player switchmove"";
player switchmove "acts_miller_knockout";

};
}];
worthy igloo
harsh vine
#

Nice👍

leaden ibex
#

If I get a missionNamespace variable

_omtk_wu_is_completed = missionNamespace getVariable ["omtk_wu_is_completed", false];

and use it as a while loop condition running on clients waiting for it to be true, set by server, do I need to get it all the time in the loop, or will it automatically update once server pushes the update?

south swan
#

_omtk_wu_is_completed wouldn't update by itself (unless it's an array, but it would be a dodgy territory)

leaden ibex
worthy igloo
#

is it possible to make ctrlSetBackgroundColor match whatever the player color is

distant belfry
#

Does anyone here have much experience with onPlayerRespawn.sqf? I am trying to implement some help someone gave me with ACRE2 but I think I've done something wrong with that particular file.

warm hedge
worthy igloo
warm hedge
#

Try not to use a global variable only for that, use local variable

#

Or, simplysqf am_search ctrlSetBackgroundColor (["IGUI", "BCG_RGB"] call BIS_fnc_displayColorGet);

fleet sand
#

Hi guys question. How can i detect when player is using UAV or Plane camera. Is there EH or something like that ?

warm hedge
#

Targeting pod you mean?

fleet sand
warm hedge
fleet sand
# warm hedge Maaaybe try this? https://community.bistudio.com/wiki/cameraView

Ty i manage to get it working.
Also a question is this code MP friendly ?
here is code if anybody else is interested:

onEachFrame {
    private _veh = vehicle player;
    private _uav = getConnectedUAV player;
    if(_veh isKindOf "Air" || _uav isKindOf "Air") then {
        if(cameraView == "Gunner") then {    
             {
                _center = positionCameraToWorld [0,0,3];
                _x params ["_letter", "_color", "_offset1", "_offset2"];
                drawIcon3D [
                    "",
                    _color,
                    _center vectorAdd _offset1,
                    0,
                    0,
                    0,
                    _letter,
                    2,
                    0.05,
                    "PuristaMedium"
                ];      
                drawIcon3D [
                    "",
                    _color,
                    _center vectorAdd _offset2,
                    0,
                    0,
                    0,
                    ".",
                    2,
                    0.05,
                    "PuristaMedium"
                ];
            } count [
                ["N",[1,1,1,1],[0,1,0],[0,0.5,0]], 
                ["S",[1,1,1,0.7],[0,-1,0],[0,-0.5,0]], 
                ["E",[1,1,1,0.7],[1,0,0],[0.5,0,0]], 
                ["W",[1,1,1,0.7],[-1,0,0],[-0.5,0,0]]
            ];    
        };
    };
};
warm hedge
#

onEachFrame is always not recommended to be used in your actual code

#

And... I don't think this somehow wouldn't work in MP game. Everything should be local, yes? Then this is fine, except onEachFrame

fleet sand
winter rose
#

yyyyep

warm hedge
#

Oh yeah, true

winter rose
#

^

south swan
#

in my (limited) testing "EachFrame" behaved better than "Draw3D" for a geometry/coordinate task (imitating a visible laser pointer with drawLaser, though 🤔

warm hedge
#

Hmm, we may use if (!isGameFocused) exitWith {}; then

#

But it's your call after all

winter rose
#

or your spawn, we don't judge

fleet sand
south swan
#

we'd judge execVM inside the EH, though 🍿

south swan
copper raven
fleet sand
#

Hi another question is there a way to detect zoom level of a targeting pod / camera.

proven charm
#

why does arma read input anyway when in background? sometimes alt-tab causes editor stuff , for example, to move around

#

no one else has this problem 😵‍💫

south swan
#

everybody is "meh, this is arma. Nothing exploded - then everything is good"

winter rose
#

we have flying tanks, I mean

proven charm
fleet sand
winter rose
#

it's a still image, what is the actual angle?

fleet sand
#

So this is when the plane is stationary: https://gyazo.com/2af068d27c46f6e0bfa2223110b67071 and this is when the plane is moving: https://gyazo.com/15a2a3da40cf05dab9602d59cf61d317
Also i have a problem once i enter in camera then when i exit and control the guy and use the guns optics then it also shows the compass but i want it to only show in targeting pod / camera code:

addMissionEventHandler ["EachFrame", {
    if (!isGameFocused) exitWith {};
    private _veh = vehicle player;
    private _uav = getConnectedUAV player;
    if(_veh isKindOf "Air" || _uav isKindOf "Air") then {
        if(cameraView == "Gunner") then {    
             {
                _center = positionCameraToWorld [0,0,3];
                _x params ["_letter", "_color", "_offset1", "_offset2"];
                drawIcon3D [
                    "",
                    _color,
                    _center vectorAdd _offset1,
                    0,
                    0,
                    0,
                    _letter,
                    2,
                    0.05,
                    "PuristaMedium"
                ];      
                drawIcon3D [
                    "",
                    _color,
                    _center vectorAdd _offset2,
                    0,
                    0,
                    0,
                    ".",
                    2,
                    0.05,
                    "PuristaMedium"
                ];
            } count [
                ["N",[1,0.1,0.1,1],[0,1,0],[0,0.5,0]], 
                ["S",[1,1,1,0.7],[0,-1,0],[0,-0.5,0]], 
                ["E",[1,1,1,0.7],[1,0,0],[0.5,0,0]], 
                ["W",[1,1,1,0.7],[-1,0,0],[-0.5,0,0]]
            ];    
        };
    };
}];
winter rose
drifting portal
copper raven
#

shouldn't be a concern, you should always be doing AI stuff locally (imho)

south swan
jade acorn
copper raven
winter rose
drifting portal
#

basically if its GE

south swan
#

shownUAVFeed doesn't seem to work, but UAVControl getConnectedUAV player can work, i.e.sqf _control = (UAVControl getConnectedUAV player); if ((_control find player) + 1 == _control find "GUNNER") then {hintSilent "Player is currently gunning UAV"};

winter rose
#

how so?

south swan
#

single interlaced array of ["unit1", "role1", "unit2", "role2"]. Are there many other operators with returns like that?

#

fullCrew, for example (which has similar enough intent), returns array of array-per-unit-s

winter rose
south swan
#

yep. I can see it's the extension of previous single-unit-only version. But the output format is still bizarre

winter rose
#

bizarre but understandable 😉
another way would have been [unit1, "role1", [[unit1, "role1"], [unit2, "role2"]]
but, hey, "it is how it is" now

south swan
worthy igloo
#

when importing config into gui editor where does the path have to be from?

fleet sand
lime coral
#

Looking for a script or mod that allows you to fill out a card, like a casualty or capture card with details of time, injury etc. Does anyone have anything like that?

hallow mortar
#

That feels like something ACE would have, but I don't use ACE so I can't prove it

nimble star
#

ace got a list of injurys in his medical menu but no card or something like that

#

script called by this eventhandler player addEventHandler ["Dammaged", { if (lifeState player == "INCAPACITATED") then { execVM "Wiederbeleben.sqf"; } }];

#

Wiederbeleben.sqf script ```[player] remoteExec ["removeAllActions"];
[
player, // Object the action is attached to
"Wiederbeleben", // Title of the action
"A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa", // Idle icon shown on screen
"\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa", // Progress icon shown on screen
"true", // Condition for the action to be shown
"true", // Condition for the action to progress
{ hint "Started!"; _name0 = name _target; _name1 = name _caller; format ["%1 wird von %2 Wiederbelebt", _name0 , _name1] remoteExec ["systemChat", 0]; _caller playAction "MedicOther";}, // Code executed when action starts
{}, // Code executed on every progress tick
{["#rev", 1, _target] remoteExecCall ["BIS_fnc_reviveOnState", _target]; [_target] remoteExecCall ["BIS_fnc_reenableRevive"]; _target setUnconscious false;
[_target] remoteExecCall ["ace_medical_treatment_fnc_fullHealLocal"]; [_target] remoteExec ["removeAllActions"];
_name3 = name _target; _name4 = name _caller; format ["%1 wurde von %2 Wiederbelebt", _name3 , _name4] remoteExec ["systemChat", 0]; }, // Code executed on completions

{ hint "Abgebrochen"; _name2 = name _target; format ["Das Wiederbeleben von %1 wurde abgebrochen", _name2] remoteExec ["systemChat", 0];}, // Code executed on interrupted
[],     // Arguments passed to the scripts as _this select 3
6,      // Action duration in seconds
9999,    // Priority
true,   // Remove on completion
false   // Show in unconscious state

] remoteExec ["BIS_fnc_holdActionAdd", 0, player]; ```

granite sky
#

You need to detect a transition between lifeStates. Otherwise you'll be firing that script several times each time a player is downed.

#

So setVariable a lastLifeState var on the player or something like that.

copper raven
tough abyss
#

running into an issue somewhere with _position1 not being set properly resulting in _weaponholder being in an undefined position ive tried a few things and cant see why it isnt working https://sqfbin.com/minuxudedusadofopaqa any ideas?

#

around line 102-107 and line 32-34

winter rose
#

indeed.

granite sky
#

Not all buildings have positions.

tough abyss
south swan
#

and how does "not set properly" and "in an undefined position" look like?

tough abyss
#

bottom left corner of the map

drifting portal
granite sky
#

or diag_log if you need more persistent tracing.

drowsy geyser
# copper raven you're supposed to create lightpoints locally, fx, ```sqf // should use CfgFunct...

sorry for ping
the lightpoints won't appear regardless how i do it.

//CfgFunctions via description.ext
class CfgFunctions
{
    class PARADOX
    {
        class missionFunctions
        {
            class setBulletLight1 {};
        };
    };
};
//setBulletLight1.sqf
my_fnc_createLightpoint1 = 
{
params ["_bullet1"];

_light1 = "#lightPoint" createVehicleLocal [0,0,0];
_light1 attachTo [_bullet1,[0,0,0]]; 

_light1 setLightIntensity 300;  
_light1 setLightAmbient [0,0,0];
_light1 setLightColor selectRandom [[1,1,1],[1,0,0],[1,0,1],[1,1,0],[0.5,0.5,1],[0,1,0]]; 
_light1 setLightUseFlare true;
_light1 setLightDayLight true; 
_light1 setLightFlareSize 1; 
_light1 setLightFlareMaxDistance 500;

waitUntil {isNull _bullet1};
deleteVehicle _light1;    
};

how it is called:
https://sqfbin.com/eyajadagovukiwonepun

south swan
drowsy geyser
#

im like redchain XD

copper raven
south swan
#

with the CfgFunctions you've sent ArmA will try to find a function at <missionRoot>/functions/missionFunctions/fn_setBulletLight1.sqf

#

the name of the function would be PARADOX_fnc_setBulletLight1

drowsy geyser
#

yes thats true

#

i can see it in debug consol if i type PARADOX_fnc_setBulletLight1

south swan
#

so for it to work via CfgFunctions you'd need to move and rename the souce file accordingly and either a) remove my_fnc_createLightpoint1 = { ... } wraparound from your function and then remoteExec the PARADOX_fnc_setBulletLight1 (and remoteExecCall wouldn't work, because waitUntil {...} wouldn't work there

copper raven
#

if _bullet is a projectile indeed, you can use ammo event handlers over polling whether it's null or not

south swan
#

or b) run PARADOX_fnc_setBulletLight1 at least once at every machine for it to create a my_fnc_createLightpoint1 function at every machine and then remoteExec it (remoteExecCall still wouldn't work);
or c) run PARADOX_fnc_setBulletLight1 at least once on any machine (i.e. server) and publicVariable "my_fnc_createLightpoint1" for it to get transferred to other machines. And then remoteExec it

#

and pray that _bullet1 would be global enough for it to work, yes

drowsy geyser
#

okay i just tried method a. and it seems to work for me atleast i can see the lightpoints now

drifting portal
#

a bit of a technical question, what is the largest value of serverTime possible?

copper raven
drifting portal
#

isn't there like a integer limit or something?

#

assume it runs indefinitely

copper raven
#

float max

drifting portal
#

that is for sqf?

copper raven
#

yes

drifting portal
#

yeah how much?

copper raven
#

3.4e38 something

drifting portal
#

i assume its the same thing for time too

copper raven
#

nothing you should worry about

#

you're never reaching that anyway

#

😄

drifting portal
#

well

#

its not because I'm reaching it

#

I have a section in game where a character mentions how long the mission has been running for

#

just needed to make sure what is the max value so it can comment probably on it

winter rose
#

serverTime is the server's uptime

slender gust
#

is there a way to make music play during ticket bleed gamemode when the tickets reach a certain point

drifting portal
open fractal
granite sky
#

I'm not sure what happens with time & serverTime once they run into float accuracy problems. At one-second precision you'd get about 200 days of uptime.

#

One would hope that they're translating a higher-precision accumulator per frame, rather than doing some time = time + frametime thing which would break after a few days.

violet gull
#

diag_tickTime may have more precision

worthy igloo
#

where does a path need to be from to import config into gui editor

leaden ibex
#

Is there a way to create a public variable, like public public.
I know I can use missionNamespace and get/setVariable and broadcast it, but is there something that will do it "automagicaly", mainly so I don't have to get it every time I use it in a loop

winter rose
#

well, use the public flag to do so

#
missionNamespace setVariable ["TAG_myVariable", 42, true /* aka publicVariable */];
#

so I don't have to get it every time I use it in a loop
if this is a very fast loop, refreshing the var every loop seems a bad idea

leaden ibex
#

so I can use TAG_myVariable anywhere else without the need to getVariable?

winter rose
#

I don't get your question

hallow mortar
#

A missionNamespace global variable doesn't require getVariable to retrieve unless you need the default value thing

leaden ibex
leaden ibex
#

Ok, for instance.
I have two files - warmupServerStart and warmupClientStart

I need to define some variables in the server part that I need to "wait for" in the client part and then I can continue further.

Let's say somewhere in warmupServerStart there will be missionNamespace setVariable ["IMF_warmupState", 1, true];
So in warmupClientStart I can just do waitUntil {sleep 1; !isNil IMF_warmupState};
and once it get's set in warmupServerStart the code will continue in warmupClientStart.
No need to do _warmupState = missionNamespace getVariable ["IMF_warmupState"]; and then check that, for instance

_warmupState = missionNamespace getVariable ["IMF_warmupState"];
while {isNil _warmupState} do {
  sleep 1;
  _warmupState = missionNamespace getVariable ["IMF_warmupState"];
};
#

hope this makes more sense

#

Last try:
is

_warmupState = missionNamespace getVariable ["IMF_warmupState"];
while {isNil _warmupState} do {
  sleep 1;
  _warmupState = missionNamespace getVariable ["IMF_warmupState"];
};

equivalent to

waitUntil {sleep 1; !isNil "IMF_warmupState"};

?

hallow mortar
#

That getVariable implementation wouldn't work because that syntax requires the default value to be specified. But yes, the second example appears to be correct

leaden ibex
winter rose
#

server: publish the variable
client: wait until it is not nil
that's enough

outer ocean
#

I noticed there is difference when using trigger condition to check for player in a vehicle between SP and MP.

Vehicle variable name: car

in SP, trigger condition:
player in car

My question is, what do I need to adjust/change for MP (dedicated server) ?

warm hedge
#

What is the goal? I don't know if it is car or car1, but you want to detect if everyone is in the car or not?

outer ocean
#

correct, any player in car

warm hedge
#

Everyone is not anyone, though

outer ocean
#

just any player (not all players)

warm hedge
#

Do you want to execute the trigger in the server or anyone can trigger it?

outer ocean
#

anyone

warm hedge
#

Then player in car is enough

outer ocean
#

it did not work.

warm hedge
#

Did not work how?

outer ocean
#

I have my friend (playing as playable unit) got into the car. The trigger was not triggered. Then he got out, Then when I am in the car, trigger was triggered

warm hedge
#

Does your friend triggered it?

outer ocean
#

negative

warm hedge
#

In their end, not your end

outer ocean
#

He played from a different country.

warm hedge
#

What?

outer ocean
#

I don't understand your question clearly. Please specify

warm hedge
#

If the trigger is activated in your friend's game, it is working properly

outer ocean
#

it was not activated neither their end nor mine

warm hedge
#

Then check that if the trigger has “Server Only” checkbox or whatever its called

outer ocean
#

To confirm, if "Server Only" box is unchecked. It does not work during dedicated server MP?

warm hedge
#

It does work. Just not for everyone, but only server If unchecked, it will work for everyone, regardless if it is dedicated/local host MP/SP

outer ocean
#

unchecked, correct ?

warm hedge
#

Uncheck it, then

outer ocean
#

Ok. On the related topic of using "player" on MP dedicated server

I assigned each playable-object with variable name as Soldier1, Soldier2....

I noticed that when the player died and respawned, the playable-object variable name gets refreshed and variable value gets deleted.

Is that correct ?

warm hedge
#

I forgot about this thing, sorry. My half part of brain said yes other half said no

outer ocean
#

Ok. Is there a way to make the variable name not changed after respawned ?

copper raven
#

reassign it

outer ocean
#

Is there a way to script it ?

copper raven
#

respawn event handler

winter rose
#

@outer oceanis your only goal just "check if a player is in a vehicle"?

winter rose
#

then```sqf
call BIS_fnc_listPlayers findIf { _x in theSuperVehicle } != -1

outer ocean
#

place in the trigger condition, correct ?

winter rose
#

yes

outer ocean
#

theSuperVehicle is the vehicle variable name ?

winter rose
#

hopefully 😄

outer ocean
winter rose
outer ocean
winter rose
#

okidoki 😉 just wanted to make sure the goal was not a "big array of players"

outer ocean
copper raven
#

initplayerlocal

outer ocean
#

initPlayerLocal.sqf , correct ?

winter rose
#

ye

outer ocean
#

To confirm, the reassign by using Respawn Event Handler, will reassign exact variable name after respawned, correct ?

copper raven
#

if you just add the handler without doing anything it will do nothing

#

(obviously)

#

then if it's the correct unit, set the varname onto the new unit and also broadcast it

outer ocean
#

the vehicleVarName

copper raven
#

it returns a varname, the one you set in 3den

#

use that and check if it's the correct one, like _varname select [0, 7] == "soldier"

outer ocean
#

Do we place it in the playable-object init OR .sqf ?

copper raven
#

... in the respawn event

#

the unit respawns, you get the varname of the corpse, see if it's one of the SoldierX, if it is, you set the exact varname onto the new unit and also broadcast the new value, like missionNamespace setVariable [_varname, _newUnit, true]

outer ocean
#

Your level of understanding is higher than I do, I am having a hard time to realizing the script

naive needle
#

Hey guys, is there a way to check what options are activated per script? I want to see if the client got dynamic lights activated

outer ocean
copper raven
# outer ocean Your level of understanding is higher than I do, I am having a hard time to real...

respawn event handler
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Respawn
okay, the snippet is right there, so

this addEventHandler ["Respawn", {
    params ["_unit", "_corpse"];
}];

params ["_unit", "_corpse"];
_unit here is the newly respawned unit, while _corpse is the dead previous unit
the unit respawns, you get the varname of the corpse
private _varname = vehicleVarName _corpse;
see if it's one of the SoldierX
if (_varname select [0, 7] != "soldier") exitWith {};
if it is, you set the exact varname onto the new unit
_unit setVehicleVarName _varname;
and also broadcast the new value
missionNamespace setVariable [_varname, _unit, true];

copper raven
outer ocean
#

the 0,7 mentioned is the soldier0 to soldier7, correct ?

copper raven
#

no

#

its start index and length of a substring

#

"Soldier1" select [0, 7] gives "Soldier"

outer ocean
#

"Soldier8" select [0, 7] gives "Soldier7"

#

correct ?

copper raven
#

?

#

no

outer ocean
outer ocean
#

Thank you @copper raven

open hollow
#

hello, i want to limit the charge you can use on mortars ( disable the last one), how i can do it?

#

without the artillery computer

granite sky
#

hmm. Probably config only.

open hollow
#

how does ACE to unable you to fire when weapon is jammed

winter rose
#

no idea - ask them?

granite sky
#

is reading the code :P

#

They do a mid-burst stop with setAmmo 0, but that's not the permanent method.

winter rose
#

they change the mag perhaps

granite sky
#

nah, they override the DefaultAction on the weapon :P

sullen sigil
#

is there any way to find out the offset of a memory point from the players origin? i.e players muzzle from players origin

south swan
sullen sigil
#

ah

#

thanks 🙂

#
    _muzzlePos = ace_player selectionPosition "usti granatometu";
    _initialRopeHelper = createVehicle["CBA_B_InvisibleTargetVehicle", _muzzlePos, [], 0, "CAN_COLLIDE"];
    _initialRopeHelper attachTo [ace_player, [], "usti granatometu", true];``` game complaining of nothing being passed to attachTo..?
#

0 elements provided, 3 expected

#

or is it because i left the offset blank -- if so how do i keep it as automatic?

winter rose
#

getRelPos perhaps

sullen sigil
#

but needs to be between two objects :p

#

ah having the same issue as I was before with physx objects not liking this and ropes not liking non physx objects

#

welp

sullen sigil
#
    params["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    //rope shit starts here
    _playerPos = getPosASL ace_player;
    _playerHelperObj = createVehicle["Pole_F", [0,0,0], [], 0, "CAN_COLLIDE"];
    _playerHelperObj setObjectTextureGlobal[0, ""];
    _playerHelperObj setObjectTextureGlobal[1, ""];
    _playerHelperObj setPosASL _playerPos;
    _playerHelperObj attachTo [ace_player];
    _firstRope = ropeCreate [_playerHelperObj, [0,0,0], _projectile, [0,0,0], (player distance cursorObject)];```
#

pole creates fine, texture is set fine, position and attachment is also fine.... but rope doesn't work thonk

#

weirdly i cannot create a rope between two cones either...

#
ropeCreate [jennifer, [0,0,0], bob, [0,0,0], 5];``` doesnt work
#

no error message, nothing happens

#

returns <NULL-object>

green acorn
#

Hi, I think I'm going mad. Can anyone tell me why I get
Error in expression < [c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11] ; _unit setUnitLoadout (getUnitLoadout _u> Error position: <_unit setUnitLoadout (getUnitLoadout _u> Error Undefined variable in expression: _unit

The code is this


if !(isserver) exitWith {};

_unitToCopy = selectRandom [c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11] ;
_unit setUnitLoadout  (getUnitLoadout _unitToCopy) ;
lockIdentity _unit;
[_unit, (speaker _unitToCopy)] remoteExec ["setSpeaker", 0, true];
[_unit, (face _unitTOCopy ) ] remoteExec ["setFace", 0, true];```
open fractal
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
green acorn
#

Found the problem, I've called it from the Init box of the Civilian Precense model instead of the Code on Unit Created

#

@open fractal

drowsy sparrow
#

(new to scripting so please be gentle)

does anyone know what I am doing wrong here? I am trying to declare my variable "Hackable" and then set it to equal 1 when the player performs this add action.

private _variable = Hackable;
player addAction ["Hack Door Control Panel",{Hackable = 1;_building = cursorObject;_owner = player;_init = [_building,_owner] call GOM_fnc_initBuildingDoors; call GOM_fnc_HackState;},[],-1,false,true,"","((unitBackpack _this isKindof 'B_AssaultPack_blk'))"];

Then this function which is also called in the add action is supposed to print a hint on screen that says "Invalid Target"; however, it does not print that or anything else. I know the Variable is working though because if I put hint str Hackable after the IF Else statement it does print the number 1.

GOM_fnc_HackState = {

    if (Hackable == 1);
    {
    hint "Invalid Target"
    }
    else
    {
    hint "Hacked!"
    };
};

so basically the addaction should be setting Hackable to 1 and then printing a hint that says "Invalid Target" (the later intention is to use getCursorObjectParams to detect if the player is looking at a specific object). I don't understand why this isn't printing the hint though because I get no errors and if I put hint str Hackable after the IF Else statement inside the HackState function it prints a hint in game containing "1" so I know that Hackable is getting set to 1 I just don't understand why the IF statement can't seem to understand that's true/false.

willow hound
#

if (Hackable == 1);
You have an excess semicolon here.

#

private _variable = Hackable;
What are you doing here?

drowsy sparrow
#

private _variable = Hackable; is just me declaring the variable, I think lol again i'm a bit new to all of this

#

are you sure that semi colon is excess because when I remove it I get errors saying it is expected?

willow hound
#

Oh, yes, sorry, replace the semicolon with then.

drowsy sparrow
#

Oh my god

#

it fucking works now

#

why the fuck do you need to state then

#

Why isn't that just implicit in the if statement?

willow hound
drowsy sparrow
#

I see

#

that makes sense lol

#

So follow question if you would be so kind! If I assign Hackable = str getCursorObjectParams then when I am not looking at an object it should always equal [<NULL-object,[],1e+10] which means if I plug that into my if statement like this

GOM_fnc_HackState = {

    if (Hackable == "[<NULL-object,[],1e+10]") then
    {
    hint "Invalid Target"
    }
    else
    {
    hint "Hacked!"
    };
    systemchat str Hackable
};

then it should end up outputting "invalid target" when I am not looking at anything and "hacked!" when I am looking at an object; however in practice it's always outputting the hint "Hacked!" even though systemchat is saying that Hackable indeed is "[<NULL-object,[],1e+10]"

#

oh hold on

#

is it because the str is spitting out that string with "" on it

#

instead of just a string?

willow hound
drowsy sparrow
#

I thought that would work but I wasn't sure how to do it

#

Oh yeah that works great lol

#

I think I tried that at one point but gave up because of my if else statement issues

#

which I now know was just caused by the "then" bit and not that isNull argument

#

thank you!

granite sky
copper raven
#

an if is made up of two commands (or three if you add else), if and then, if is a unary command which takes a BOOL and returns a special IF type, then is a binary command, which takes that IF as it's left argument and CODE as it's right argument, it can also take an ARRAY type, an array of two CODE values (which is what else command generates), fx., hint str ({} else {}) would give [{},{}]

sullen sigil
#

Is it possible to output my own debug stuff into an RPT or own log file? 🤔

torpid pewter
#

_a=nearestObjects [_this select 0, ["Man"], _d];

I believe this line is causing an issue in a mission I'm playing because it's only supposed to apply to AI and not players, but I think the "Man" doesn't differentiate. Is there a way I can replace that with something that's only a player? Having trouble finding something on the wiki, I feel like I'm missing something obvious.

granite sky
#

@sullen sigil diag_log

sullen sigil
#

I could swear wiki said it did nothing in retail version lemme check history

granite sky
#

It certainly does.

sullen sigil
#

Oh it was textLogFormat nvm 😛

#

Thanks :)

granite sky
#

@torpid pewter You'd need a secondary filter, like:

nearestObjects [_this select 0, ["Man"], _d] select { !isPlayer _x };
#

In some cases _units - allPlayers would be preferable.

willow glade
#

anybody have any idea why my 'find' isn't working on this search?
if I pipe in the whole string it works just fine and returns the item in the array.

"('MyClassSubString' find (configName _x)) != -1" configClasses (configFile >> "CfgVehicles") apply {configName _x}
warm hedge
#

Is MyClassSubString the search word?

copper raven
#

also use in (also case sensitive, but more suitable here)

#

but Substring, if you want to search for a substring indeed, you need to swap operands here

willow glade
#

I actually got it using the code below

("['substringHere',configName _x] call Bis_fnc_instring && {getNumber (_x >> 'scope') in [1,2]}" configClasses (configFile >> "CfgWeapons") apply {configName _x});
copper raven
#

use in

#

that function is probably optimized by now and uses in anyway (wrapper)

willow glade
#

yeah not too miffed about performance anyways.

Its being used to fill out some stuff in the ace arsenal dynamically

#

but trying to figure out the syntax to read configs in SQF was a pain

copper raven
#

it's like any other sqf expression

willow glade
#

it was pretty much trying to find the variables tied to the config, which the params redirected to the generic variables page and didn't really help

#

also @copper raven ty for the help anyways! its much appreciated

still forum
#

Did VSCode do something new on its variable preview?
I didn't remember it being this awesome.
Can drill down into arrays so easily now, amazing

tulip ridge
#

I've been trying to do some work with ACE Fortify, and was trying to make just a simple script that gets called whenever you place something with ACE Fortify, it plays a hint, but the script doesn't seem to get called. I was reading on the Fortify Framework on the ACE wiki and as far as I can tell everything is correct.

// initServer.sqf
[west, 5000, [
  ["3AS_HeavyRepeater_Armoured", 0] // Turret
]] call ace_fortify_fnc_registerObjects;
// test.sqf
this addEventHandler ["acex_fortify_objectPlaced", {
  params ["player", "side", "objectPlaced"];
  if (typeOf objectPlaced == "3AS_HeavyRepeater_Armoured") then {
    // setAmmo [objectPlaced, 0]; // Old Line
    objectPlaced setVehicleAmmo 0;
  };
}];
#

I did just realize that the setAmmo part itself it wrong, but I tried displaying a hint (instead of the ammo part) and nothing was displayed (Should be) fixed

copper raven
#

also global variable is not allowed in params

tulip ridge
#

Ah alright, yeah first time working with events so I had the fortify wiki pulled up along with the Arma 3 event handlers, I'll give the CBA handler a shot, thanks!

#
_whenPlaced = ["acex_fortify_objectPlaced", {
    // code
}] call CBA_fnc_addEventHandler;

So something more like this correct?