#arma3_scripting

1 messages ยท Page 661 of 1

cosmic lichen
#

isServer and units player, that will not work

winter rose
cosmic lichen
#

solo hosted or what ? ๐Ÿ˜„

winter rose
#

that and player-hosting, so friends can connect! ๐Ÿ˜› non-dedicated servers don't get the love they deserve notlikemeowcry

cosmic lichen
#

else
{
exitWith {};
};
I just noticed ๐Ÿ˜„

#

That syntax is new ๐Ÿ˜„

#

I like it

#
if (hasInterface) then
{
  while {true} do 
  {
    {_x setdamage (damage _x + 0.1)} apply (units player select {goggles _x != "G_AirPurifyingRespirator_01_F"});
    sleep 10;
  };
};

Maybe something like this (Fully untested) @tough abyss

#

Will definitely break something if two players are in the same group

#

Might make sense to just let it run in one loop on the server for allUnits

tough abyss
#

Hi Ive been using the ORBAT creator to make a custom faction with Iron Front assets, and when I am doing anything with the tanks I dont even get an option for the commander or loader slot, so when I am finished and try to spawn them in they default their commanders and loaders to ones from Iron front.

Is there anyway I can go into the file and edit it so the commanders I made go in there instead?

still forum
#

its compiled to Assembly, which is then interpreted

#

Result:
0.0009 ms
Code:
_a=1

Result:
0.0009 ms
Code:
_aadasdasdasdasdasdasasdasdasdas=1

Very very little. ๐Ÿ˜„

#

yes

#

yes there is

past wagon
#

okie

still forum
#

well you can until you run out of memory and crash..

tough abyss
deft dock
cosmic lichen
#

@tough abyss This will also dmg folks inside of vehicles

tough abyss
#

thats fine

cosmic lichen
#

then this should work

#

Just make sure it only runs on the server

tough abyss
#

how do i do that

cosmic lichen
#

if (isServer) then {

tough abyss
#

i can cobble together script ok ask me to make it multiplayer compatibal and i aint got a clue

cosmic lichen
#
if (isServer) then
{
 while {true} do {
  {
   if (goggles _x != "G_AirPurifyingRespirator_02_black_F") then {
             _x setdamage (damage _x + 0.1);
          };
    } forEach AllUnits;
        sleep 10;
  };
};
tough abyss
#

was just about to right that thanks @cosmic lichen

little raptor
cosmic lichen
#
class respawnClass
{
    displayName = "BadAss Guy";
    icon = "Idont know any path";
    role = "SpecialOperative";
    show = "true";
    uniformClass = "U_B_CombatUniform_mcam_vest";
    backpack = "";
    weapons[] = {"arifle_MX_GL_Hamr_pointer_F","hgun_P07_F","Binocular","Throw","Put"};
    magazines[] = {"30Rnd_65x39_caseless_mag","30Rnd_65x39_caseless_mag","Chemlight_green","30Rnd_65x39_caseless_mag","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_mag_Tracer","16Rnd_9x21_Mag","16Rnd_9x21_Mag","MiniGrenade","MiniGrenade","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","SmokeShell","SmokeShellGreen","SmokeShellBlue","SmokeShellOrange","Chemlight_green","1Rnd_Smoke_Grenade_shell","1Rnd_Smoke_Grenade_shell","1Rnd_SmokeBlue_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","1Rnd_SmokeOrange_Grenade_shell"};
    items[] = {"FirstAidKit"};
    linkedItems[] = {"V_PlateCarrierGL_rgr","H_HelmetSpecB","G_Tactical_Clear","ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGoggles","","acc_pointer_IR","optic_Hamr","","","","",""};
};
// Visit https://community.bistudio.com/wiki/Arma_3_Respawn for detailed information```
@deft dock  

```sqf
[get3DENSelected "Object" # 0, "respawnClass", "BadAss Guy" ,"Idont know any path", "SpecialOperative"] execVM "exportRespawnInv.sqf";
little raptor
#

I think it always works in the other way around (at least in my experience)

deft dock
#

Thanks!

still forum
little raptor
#

if you mean "internally" (creating objects and stuff), well yeah
but at the end it is interpreted

still forum
little raptor
#

oh

#

now I get it! meowtrash

tough abyss
#

hmmm huston we has a problem my frames have tanked now going to try altering my hazard script

tough abyss
#

would an overlay be a local thing

#

like the contact gasmask overlays

winter rose
#

yes

#

a display is local, it interacts with player's UI

tough abyss
#

so if i tried running it from the server it wouldnt work

#
if (isServer) then
{
    {
     _x addgoggles "G_AirPurifyingRespirator_02_black_F";
    } forEach units east;
     call {
        {
         {
         _x cutRsc ["RscCBRN_APR_02", "PLAIN", -1, false];};
        } forEach allUnits;
          };  
};```
#

explains why the overlays not working anymore

winter rose
#

correct, also because cutRsc does not take an object ๐Ÿ‘€

tough abyss
#

its not throwing an error and works in sp

#

well before i made it server based

winter rose
#

you would only need it to be running once

#

because cutRsc goes over the current camera, that's it

cosmic lichen
#

cutRsc does nothing one the server

#

except hosted

sacred slate
#

how can i reach the 3CB BAF apache flare launcher? its name should be UK3CB_BAF_CMFlareLauncher. for other vehicles it works with: [vehicle player, "CMFlareLauncher"] call BIS_fnc_fire;

winter rose
tough abyss
#

it dosnt even throw an erro in mp it just odsnt work

#

hold up im gunna rip this bit out and run it local se if it works

cosmic lichen
#

there is also a stray {

tough abyss
#

it threw the error before the stray

cosmic lichen
#

wait

#

of course no error

#

because cutRsc is just wrapped in {} but never excuted

tough abyss
#

ok how would i get

 
{"YourLayerName" cutRsc ["RscCBRN_APR_02", "PLAIN", -1, false];};```

i cant just use player
#

or would that work```sqf
{"player" cutRsc ["RscCBRN_APR_02", "PLAIN", -1, false];};

cosmic lichen
#

no

#

why { } ?

#

and cutRsc needs to be remotely executed with remoteExec

tough abyss
#

idk thats what the video say

cosmic lichen
little raptor
sacred slate
#

thx.i am not quite good at scripting. do i have to use somthing else as a class name? or maybe the ammo name?

little raptor
cosmic lichen
#
if (isServer) then
{
  {
    _x addgoggles "G_AirPurifyingRespirator_02_black_F";
  } forEach units east;
  {
    ["RscCBRN_Overlay", ["RscCBRN_APR_02", "PLAIN", -1, false]] remoteExec ["cutRsc", _x];
  } forEach allPlayers;
};

@tough abyss Not tested but might work

little raptor
#

@sacred slate something like this:

_mags = magazinesAllTurrets _veh;
_cfgMags = configFile >> "cfgMagazines";
_hasFlare = -1 != _mags findIf {
    getNumber(_cfgMags >> _x#0 >> "type") == 256
};
#

I copy pasted it from my mod

#

it's not exactly what you should use

#

but close

#

(the main difference is getting all vehicle weapons and checking their supported mags)

tough abyss
#

@cosmic lichen it works thank setting up for multiplay is the part i struggle with the most

#

ok i think i set this one up right for a server

if (is server) then 
{
    if !(allPlayers in list shelter1 || allPlayers in list shelter2) then
      {
           {_x setdamage (damage _x + 1);
       } forEach unit allPlayers;
     };
};```
#

and this is the one other script i need help with to make mp compatiblesqf while {alive player} do { sleep (selectRandom [600,900,1200,1320,1980,300, 450]); b1 sideChat "ALL forces be advised, emission detected! Seek shelter immediately!"; sleep 1; [1] spawn BIS_fnc_earthquake; sleep 30; b1 sideChat "Emission will hit in thirty seconds!"; sleep 1; [2] spawn BIS_fnc_earthquake; sleep 15; b1 sideChat "Emission in fifteen seconds!"; sleep 1; [3] spawn BIS_fnc_earthquake; sleep 10; b1 sideChat "FIVE SECONDS! GOD HELP YOU IF YOU ARNT INSIDE YET!"; sleep 1; [4] spawn BIS_fnc_earthquake; b1 sideChat " EMISSION INCOMING"; sleep 3; [4] spawn BIS_fnc_earthquake; shelter = execVM "shelter.sqf" sleep 10; b1 sideChat "The emission has passed";

#

or is this ok as is

#

since SideChat and earthquake are both local only

cosmic lichen
#

The first script is completly wrong

slim oyster
#
if (isServer) then {
    allPlayers select {!(_x in list shelter1) && {!(_x in list shelter2)}} apply {
        _x setdamage (damage _x + 1)
    };
};
#

although can't you just set the trigger to server only

#

idk how you are activating it

#

your second script confuses me, while {alive player} do seems wrong, do you want multiple earthquakes to occur?

#

and you want the random timing coming from the server or else you will get locally timed earthquakes

tough abyss
#

@slim oyster in order

  1. im not sure?
  2. the first script is activated by the second one its the shelter.sqf
    3)yes i want multiple earthquakes that ramp up in speed and intensity to mimic as best i can the blowout events of the stalker games
  3. from what im learning yes i will want the random time to come from the server as all players are supposed to feel it at same time
winter rose
#
_x setdamage (damage _x + 1)
```![meowhuh](https://cdn.discordapp.com/emojis/700311721784377405.webp?size=128 "meowhuh")
tough abyss
#

@winter rose hey hey dont look at me youtube gave me that

winter rose
#

๐Ÿ‘€

#

since 1 is the max damage, no need to "add" it, just set damage to 1 ^^

tough abyss
#

@winter rose oh yeah that was me mostly going if it aint broke dont fix it to the script

#

when i copy pasted that section from my hazards script

#

oh well i still got the radiation and gasmask scripts working for mp so huzzah

slim oyster
#

uh I assume he wanted _x setdamage (damage _x + 0.1) instead

#

or yes, setdamage 1

#

setdammmmage 1

winter rose
#

you forgot one m

tough abyss
#

any way its moot now im scraping the emission scripts

slim oyster
tough abyss
#

i have deadly radiation that effect any opfor unit even ai stupid enough to take off their masks now

fresh wyvern
#

Anyone who knows how to ad the turret from the "B_Heli_Attack_01_F" on to the "B_Heli_Transport_01_F"?

winter rose
tough abyss
#

is the transport 1 f the ghost hawk if so you could script the miniguns to fire the ammo from the attack heli

spark turret
#

Attach attack heli above transporter, hideobject, let it fire

#

Cheesing

tough abyss
#

or take an orca you can fit it with 20mm auto cannon from the AAF jet

fresh wyvern
tough abyss
#

at that point just giv em a kajman

#

and paint it black say its "surplus equipment"

fresh wyvern
tough abyss
#

just change the weapons on the kajman

#

be easier than scripting a whole turret onto a ghost hawk

fresh wyvern
tough abyss
#

anythings possible if you just use your.....

fresh wyvern
#

I have been looking into the animations to do it without success yet.

tough abyss
#

id assume that to script a different gun it needs to have a gun in the first place

#

i mean ive sen kajmans with the turret gun scripted to 7.62

fresh wyvern
#

I know how to do that.

tough abyss
#

and to fire mortar flare rounds instead of rockets

fresh wyvern
#

What I want to do is script a turret on to another vehicle.

tough abyss
#

yeah idk like i said i think it might be imposible to add a turret to a different vehicle if it dosn't have a turret to begin with

#

still best of luck in your endeavors

broken steppe
#

Can anybody give me a hint what is wrong with this piece of my script ? I get a "generic error" message when I try to run it :

_var1 = [getMarkerPos "enemy_infantry1", side east, (configfile >> "CfgGroups" >> "East" >> "CUP_O_RU" >> "Infantry_EMR" >> "CUP_O_RU_InfSquad_EMR")] call BIS_fnc_spawnGroup;
winter rose
#
_var1 = [getMarkerPos "enemy_infantry1", side east, (configfile >> "CfgGroups" >> "East" >> "CUP_O_RU" >> "Infantry_EMR" >> "CUP_O_RU_InfSquad_EMR")] call BIS_fnc_spawnGroup;

// a.k.a

private _pos = getMarkerPos "enemy_infantry1";
private _class = configfile >> "CfgGroups" >> "East" >> "CUP_O_RU" >> "Infantry_EMR" >> "CUP_O_RU_InfSquad_EMR";
private _side = east; // not side east
private _var1 = [_pos, _side, _class] call BIS_fnc_spawnGroup;
#

@broken steppe sqf side eastis not valid, east is enough ๐Ÿ˜‰

broken steppe
#

Thanks a lot !

fresh wyvern
#

How do does a script that selects allied AI within 50 meters weather they are in your group or not look?

#

I know this isn't a finished script, but it gives an idea about how far I have come.

_veh = "B_CTRG_Heli_Transport_01_tropic_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addAction [
        "Force nearby AI to enter", {
            player(!=player) assignAsCargo _veh;
        }, nil, 0, true, false];
_veh addAction [
        "Force nearby AI to exit", {
            player(!=player) assignAsCargo _veh;    
        }, nil, 0, true, false];
winter rose
#

player(!=player)
what is this ๐Ÿ˜…

rough heart
#

I think you need to perform a search for AI in a X radius around the players first and actually attach that AI to a _var to be used

spark turret
fresh wyvern
rough heart
spark turret
#

Yeah its very wrong. The syntax is
(Variable1 comparator variable2) and then you can mix that

#

Like (1 == 2)
Or ("blue" isEqualTo "green")
Or (vehicle player != player)

#

Since we re at it, is there documentation about sqf compiler/interpreter/reduction?

fresh wyvern
#
_veh = "B_CTRG_Heli_Transport_01_tropic_F"createVehicle (player modelToWorld [8,0,0]);  
_man = player nearEntities ["Man", 20];
_veh addAction [
        "Force nearby AI to enter", {
            _man assignAsCargo _veh;
        }, nil, 0, true, false];
fresh wyvern
spark turret
#

_men = player nearEntities ["Man", 20]; //returns an array of all entities that match description. => [unit1,unit2,unit3]

#

also, if you add an action, it is seen as "a separate script" -> it does not have any (local) variables you have declared before, like _men.

#

instead, put the men declaration code inside the addAction code.

#

this also makes sense, because the complete code is run (probably) at mission start. thats when your code is looking at units around the player and saving it. the _men variable does NOT auto update. (variables never do, unless specifically told to do so in special cases)
so even if your actions code would know the _men variable, it would have super outdated info in it. instead run the code at the moment the action is called.

#

@fresh wyvern

#

next error you will get is "expected object, got array".
you have to assign every unit as cargo individually because assignAsCargo takes 1 (one) unit as input, not multiple.

#

so a foreach loop will do

fresh wyvern
#

Thanks a lot! I will try to make it work ๐Ÿ™‚

dreamy kestrel
#

hello, Q: when you invoke ctrlMapAnimAdd you can specify the zoom... is there a way to get the current zoom?

#

or is this ctrlMapScale that would return that number?

cosmic lichen
#

But I guess you are using a custom map control?

dreamy kestrel
#

@cosmic lichen does this work on a specific map control?

#

^^ yes ๐ŸŽ

cosmic lichen
#

NOpe, since you can't pass a control to the function

#

You could however check out the code and see how they calculate the zoom in there

dreamy kestrel
#

anyway from a UI perspective, I'd like to shift the position, but not necessarily change the zoom, or at least maintain the current zoom

fresh wyvern
# spark turret so a foreach loop will do

Do you know where I go wrong?

_veh = "B_Heli_Transport_01_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addAction [
        "Force nearby AI to enter", {
            _man = player nearEntities ["Man", 20];
            {_man assignAsCargo _veh;
            [_man] orderGetIn true;}
            forEach _man; 
        }, nil, 0, true, false];
dreamy kestrel
#

_x is the element forEach provides, also _forEachIndex

fresh wyvern
#

?

winter rose
#

no

dreamy kestrel
winter rose
#
{ _x setDamage 1 } forEach _men; // _x = 1 man
fresh wyvern
winter rose
#

yes
for readability sake, rename _man to _men (plural)

dreamy kestrel
#

^^ yep, self documenting

#

and for your own sake ๐Ÿ˜‰

winter rose
#

you can also do this```sqf
_veh addAction [
"Force nearby AI to enter", {
_men = player nearEntities ["Man", 20];
{
_x assignAsCargo _veh;
} forEach _men;
_men orderGetIn true;
}, nil, 0, true, false];

#

also I believe using "CAManBase" is better

fresh wyvern
#

What is "CAManBase"?

winter rose
#

the "real" "Man" base class

#

I believe there are some animals under "Man" as well

fresh wyvern
#

Ah "CAManBase" instead of "Man"

dreamy kestrel
#

so... @fresh wyvern, open the map editor, drop a "man" anywhere, right click or select, I forget which, there is an option somewhere there to view the config. very informative.

spark turret
dreamy kestrel
#

tells you an awful lot about the model, including the class hierarchy

#

well, technically, aren't we all, depending on family... maybe less so after this mrna v4x, but we'll see

fresh wyvern
dreamy kestrel
#

@fresh wyvern yep, no worries. I'm somewhat seasoned at it, but continually learn.

spark turret
#

the config lowest line tells you its hirarchy/heritage. so if you know the abrahams tank is derived from "tank" -> "land", selecting all "Land" will also select the abrahams

dreamy kestrel
#

yes, I think "Land" will select a lot of other things as well

tough abyss
#

oh that was a good fire fight, i tell you the key to playing with ai is to get a good map that actualy works with the ai

#

4 v atleast 12 and i didnt lose a man, and i was spetznas so noooo armour

dreamy kestrel
#

@fresh wyvern hope all this was helpful

fresh wyvern
#

It was.
Is still haven't gotten the code to work though.
I get an error on the "_veh" in:
_x assignAsCargo _veh;

_veh = "B_Heli_Transport_01_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addAction [
        "Force nearby AI to enter", {
            _men = player nearEntities ["CAManBase", 20];
            {
                _x assignAsCargo _veh;
            } forEach _men; 
            _men orderGetIn true;
        }, nil, 0, true, false];
spark turret
#

_veh also does not exist anymore in the actions code. it has forgotten all variables at that point

#

but the action provides you with info about who called it and where it is attached to, in the "_this" variable

dreamy kestrel
#

oh right, true; yes, have to be careful of scopes and of variable life times.

fresh wyvern
#

"this moveInCargo (nearestObject [this,""B_Heli_Transport_01_F""])"

dreamy kestrel
spark turret
#

params ["_target", "_caller", "_actionId", "_arguments"]; // = _this

#

i remember addactions when i first started scripting. damn they were so complicated and it was awful

fresh wyvern
#

agree..

fresh wyvern
#

Whit this the error is on the
|x|_target

                _x assignAsCargo _target;
spark turret
#

well you have declare the _target variable first. thats what params ["_target", "_caller", "_actionId", "_arguments"]; // = _this
does. the only variable that is available by default is _this.

#

and params takes _this and splits it up into pieces and attaches the vallues to the names you gave it (target, caller, etc)

fresh wyvern
#

?
_x assignAsCargo _this(_target);

wind hedge
#

Guys, what was the way to find if a player was damaged by an explosion inside a HandleDamageEH?

spark turret
#

params ["_myVar"] is the same as _myVar = _this select 0; it does the same thing.

fresh wyvern
fresh wyvern
spark turret
#

there you go ๐Ÿ™‚
the correct tactic in such "nested" scripts (actions, eventhandlers, functions)
is to

  • declare the available variables at the top with params
  • use these variables
fresh wyvern
#

Thanks a lot!

spark turret
#

if you want to refine your script, you could sort out any units that are not the same faction as the player, so you dont load up on enemies or civs

distant oyster
fresh wyvern
spark turret
#

nope, you have to test every single unit again.
also your test is not a test.

#

(variable comparator variable), what you want is
(side _caller isEqualTo side _unit) and do this for every unit in your _men array

spark turret
#

the easiest way right now is to add the if statement in the foreach loop. that way, you can test every unit before it is loaded.

#
_veh = "B_Heli_Transport_01_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addAction [
        "Force nearby AI to enter", { params ["_target", "_caller", "_actionId", "_arguments"];
            _men = player nearEntities ["CAManBase", 20];
            {
                _unit = _x;
                if (side _caller isEqualTo side _unit) then 
                {
                   _unit assignAsCargo _target;                      
                };
            } forEach _men; 
            _men orderGetIn true;
        }, nil, 0, true, false];
fresh wyvern
#

Ah, you have to apply code at two places

spark turret
#

you could test the unit for being blufor, but maybe you want to play as opfor one day, so comparing player faction to unit faction is more dynamic

#

ah wait no

#

sorry i corrected it.

past wagon
#
sleep 1080;
_endZoneSize = getMarkerSize "EndZone";
while { true } do
  {
    sleep 0.05;
    _endzoneSize - 1 = _endZoneSize;
    setMarkerSize "EndZone" _endZoneSize;
  };
#

how does this code look?

spark turret
#

it wants some tabs

past wagon
#

my goal is that it decreases the size of an ellipse marker over time

past wagon
#

indents?

spark turret
#

ร h yeah

past wagon
#

Im not really familiar with how to indent

#

i will do my best

spark turret
#

tabulator

#

every scope gets its own additional tabulator

past wagon
#
sleep 1080;
_endZoneSize = getMarkerSize "EndZone";
while { _endZoneSize >= 30} do
  {
    sleep 0.05;
    _endzoneSize = _endZoneSize - 0.0125;
    "EndZone" setMarkerSize [_endZoneSize, _endZoneSize];
  };
spark turret
#

so basically everything between two code brackets is +1 indetation { }

#

yeah exactly

past wagon
#

ok

#

so will that code decrease the size of the ellipse by 0.0125 every 0.05 seconds? or am i trippin?

distant oyster
spark turret
#

oh yeah lol missed that

past wagon
#

ok

spark turret
#

can i interest you in a good old syntax highlighter:
visual studio code + sqf lint extension

past wagon
#

okay

#

yeah i probably need that

#

@spark turret

spark turret
#

.

past wagon
#

@distant oyster this better:

sleep 1080;
_endZoneSize = getMarkerSize "EndZone";
while { _endZoneSize >= 30} do
  {
    sleep 0.05;
    _endZoneX = _endZoneSize select 1;
    _endZoneY = _endZoneSize select 2;
    _endZoneX = _endZoneX - 0.0125;
    _endZoneY = _endZoneY - 0.0125;
    "EndZone" setMarkerSize [_endZoneSize select 1, _endZoneSize select 2];
  };
distant oyster
#

point (1) is still not fixed

past wagon
#

oh yeah

#

is there a way to get around that or do I have to rewrite everything?

distant oyster
#

just use select?

past wagon
#

oh yeah

#

that better?

spark turret
#

nope, you try to do math on an array at line 6

past wagon
#

oh yeah

spark turret
#

so you have to split the endzoneSize into x and y before you do the math

past wagon
#

yeah

spark turret
#

if you use the same length for x and y anyways, you can just select x in line 2 and work with that, use it as x and y in line 7

#

also, arrays start at index 0, not 1

#

[imEntry#0, imEntry#1, imEntry#2] etc

past wagon
#

im not quite sure what that means

#

but is this any better?

sleep 1080;
_endZoneSize = getMarkerSize "EndZone";
_endZoneXY = _endZoneSize select 0;
while { _endZoneX + _endZoneY > 30} do
  {
    sleep 0.05;
    _endZoneXY = _endZoneXY - 0.0125;
    "EndZone" setMarkerSize [_endZoneXY, _endZoneXY];
  };
spark turret
#

yeah, now you just have to use the x and y in setMarkerSize ๐Ÿ˜„

dreamy kestrel
#

if you want deconstruct, _endZoneSize params ["_endZoneX", "_endZoneY"], with or without type checking

spark turret
#

what i meant is this:

sleep 1080;
_endZoneSize = getMarkerSize "EndZone";
_endZoneX = _endZoneSize select 1; //same value as Y
_endZoneY = _endZoneSize select 2;  //same value as X
while { _endZoneX >= 30} do
  {
    sleep 0.05;
    _endZoneX = _endZoneX - 0.0125; //same math operation as Y
    _endZoneY = _endZoneY - 0.0125; //same math operation as X
    "EndZone" setMarkerSize [_endZoneSize select 1, _endZoneSize select 2];
  };


//so instead:
sleep 1080;
_endZoneSize = getMarkerSize "EndZone";
private _endZoneX = _endZoneSize select 0; //same value as Y

while {_endZoneX >= 30} do
  {
    sleep 0.05;
    _endZoneX = _endZoneX - 0.0125; //same math operation as Y
    "EndZone" setMarkerSize [_endZoneX, _endZoneX]; //pass x into x,y 
  };
past wagon
#

ohhh

#

that makes sense

dreamy kestrel
#
getMarkerSize "EndZone" params ["_endZoneX"];
while {_endZoneX >= 30} do {
  sleep 0.05;
  _endZoneX = _endZoneX - 0.0125;
  "EndZone" setMarkerSize [_endZoneX, _endZoneX];
};
past wagon
#
sleep 1080;
_endZoneSize = getMarkerSize "EndZone";
_endZoneXY = _endZoneSize select 0;
while { _endZoneXY > 30} do
  {
    sleep 0.05;
    _endZoneXY = _endZoneXY - 0.0125;
    "EndZone" setMarkerSize [_endZoneXY, _endZoneXY];
  };
#

will that ^ work as well?

spark turret
#

while { _endZoneX + _endZoneY > 30} do //both variables are not defined.

past wagon
#

oh yeah

#

there we go

spark turret
dreamy kestrel
#

Arma does not know what to do with [_x, _y] > _z

past wagon
#

yeah

#

an array isnt a number

#

cant do math with it

dreamy kestrel
#

no matrix operations to my knowledge anyway

spark turret
#

apply ๐Ÿ‘€ ๐Ÿ˜„

dreamy kestrel
#

^^ yep, I am deconstructing more and more using params. very useful technique.

past wagon
#

okay

#

thanks guys

#

also where should I put this code? init.sqf?

spark turret
spark turret
past wagon
#

I would like the code to start running as soon as the mission starts

spark turret
#

if its a mp mission, initServer.sqf

past wagon
#

for MUTIPLAYER

#

ok

#

wait I already have code in the init.sqf file

#

should I move it to initServer.sqf?

spark turret
#

its easier to learn scripting in SP, in multiplayer stuff is more complicated.

past wagon
#

well yeah but rn I am working on an mp mission project

spark turret
#

yeah. init runs for every player, so 10 players = marker gets resized 10 times as often as intended.

past wagon
#

ok

#

that would be a short battle royale game

spark turret
#

if (!(player in endzonemarker)) then {setDamage 1} ?

past wagon
#

I already have that code

#

but does the ! basically make it the reverse?

spark turret
#

i have to admit that i never played a battle royal mode so i dont really know how it works lol

#

yeah

past wagon
#

ok

spark turret
#

!true == false

#

!false == true

#

_myBoolean = !_myBoolean //button which inverses each press

past wagon
#
//ENDZONE DAMAGE
sleep 60;
    while { true } do {
      waitUntil { sleep 1; alive player };
      if !(player inArea "EndZone") then
      {
        player setDamage (damage player + 0.05);
      };
    };
#

that is the code I have for the damage

worthy willow
#

addDamage doesnt exist ?

past wagon
#

oh yeah

spark turret
#

^

past wagon
#

I was testing something

worthy willow
#

^

past wagon
#

i know

surreal peak
#

and do some maffs

past wagon
#

ik ik ik

spark turret
#

quick maffs

worthy willow
#

btw is damage ๐Ÿ™‚ not getDamage

past wagon
#

someone said to change it to addDamage a little while ago and i never got to changing it back

spark turret
#

well addDamage does not exist

past wagon
#

but there is a problem with that code

#

it doesnt actually damage the player by 0.05 every second when they are outside the endzone

#

it works when I set the damage to 1

worthy willow
#

player setDamage (damage player + 0.05);

#

๐Ÿ™‚

spark turret
#

you get the damage, you increase it by 0.05, you set the new damage

past wagon
#

oh

#

ok

#

oh

#

setting damage doesnt add damage

#

that was why that guy wanted me to use addDamage

#

but there is no such thing

surreal peak
#

yup

spark turret
#

same thing for adjusting positions. player setPos ([0,10,0] vectorAdd getPos player) will teleport the player 10 meters up

past wagon
#
//ENDZONE DAMAGE
sleep 60;
    while { true } do {
      waitUntil { sleep 1; alive player };
      if !(player inArea "EndZone") then
      {
        player setDamage (damage player + 0.05);
      };
    };
#

how does this look?

spark turret
#

hmmmmmmmmm not sure if the ! can be outside a bracket ()

#

test it, if it breaks, let us know

past wagon
#

its always worked correctly when I had the damage set to 1

#

i have used that code for a long time

spark turret
#

well then thats good

past wagon
#

but i never messed around with the damage values, just had it instantly kill players outside the zone

#

also at what point does a player start limping?

spark turret
#

touch car, physixs catapults you 1 m outside of marker, dead

#

lol

past wagon
#

lol

spark turret
#

dont know, only use ace

past wagon
#

ok

hushed tendon
#

Maybe try it out yourself with some sleep and showing your current damage with a hint

past wagon
#

okay

#

or I could just time it

#

because I take 0.05 damage each second

#

see how many seconds it takes

spark turret
#

20

past wagon
#

nah just 20

#

0.05 x 20 = 1

#

but I could see at what point I start limping, I mean

winter rose
#

0.5 iirc

past wagon
winter rose
#

limping starts @ 0.5 damage

past wagon
#

ok

#

so 10 seconds

spark turret
#

Could slow the damage additon after 0.5 to torture them longer bc they cant run away

#

๐Ÿ‘€

past wagon
#

THE ZONE SHRINKING SCRIPT IS WORKING

past wagon
#

thanks

winter rose
#

you could also setDamage while keeping the legs damage to a non-limping level

past wagon
#

yeah

#

but I think its okay if they limp

#

hey does anyone know how fast walking speed and running speed are?

fresh wyvern
#

How do I eject only the infantry which is in the cargo position?

_veh = "B_Heli_Transport_01_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addAction [
        "Force passengers to eject", { params ["_target", "_caller", "_actionId", "_arguments"];
            _men = player nearEntities ["CAManBase", 7];
            {
                _x unassignVehicle _target;
            } forEach _men; 
            _men action ["Eject", vehicle _men];
        }, nil, 0, true, false];
wind hedge
#

Guys, what was the way to find if a player was damaged by an explosion inside a Handle Damage Event Handler?

spark turret
#

i dont see any examples on data types in the docu, is that the way?

params [
    ["_unit",player,[Object]]
];
#

or does it take a string? also the "data type list" is not very helpful

tough abyss
#

hey guys! im doing this scenario where its pvp/pve and the team with the most "points" wins, you get points by completing objectives, killing bots and killing enemy players, how do i set up a points system?

#

i also want it so that theres a zeus on both sides with limited resources and when players take out bots spawned from that zeus they still count as points

winter rose
spark turret
#

aha, let me guess, i could also create a goat and pass that as the object type

#

nothing as intuitive as arma. thanks lou

winter rose
#

usually use *null values
except ofc for sides

signal kite
#

I'm trying to create a duel situation with players starting 10 m apart looking away from each other. problem is they should not be able to leave their position or change their stance only look and turn around - any idea how to script that?

spark turret
#

also, it does not let me recompile my function during mission. the button in the functions viewer is greyed out.

distant oyster
winter rose
signal kite
distant oyster
signal kite
winter rose
distant oyster
#

better to use the inputAction command

winter rose
#

and maybe lean left/right things

distant oyster
signal kite
distant oyster
#

@fresh wyvern

_veh = "B_Heli_Transport_01_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addAction [
        "Force passengers to eject", { params ["_target", "_caller", "_actionId", "_arguments"];
            _cargo = fullCrew [_target, "cargo"] apply {_x select 0}; // thanks @Aebian
            {
                _x unassignVehicle _target;
                _x action ["Eject", vehicle _men];
                
            } forEach _cargo ; 
        }, nil, 0, true, false];
hollow lantern
#
 _cargo = (fullCrew [_target, "cargo"]) apply {_x select 0}; ``` is needed to make it work with unassignVehicle
#

otherwise the array has other parts of the unit in

distant oyster
#

whoops yeah i have never used that command before just reading the BIKI

spark turret
wind hedge
#
player addEventHandler ["Explosion", {
    params ["_vehicle", "_damage"];
    if !(isNull objectParent _vehicle) exitWith {};
    if !(local _vehicle) exitWith {};
    if !(alive _vehicle) exitWith {};
    if !(_damage > 0) exitWith {};
    if (lifeState _vehicle == "INCAPACITATED") exitWith {};
    
    private _currentLegDamage = 0;
    _currentLegDamage = _unit getHit "legs";
    
    call {
        if (_damage < 0.1) exitWith {_unit setHit ["legs", (_currentLegDamage + 0.1)];};
        if (_damage < 0.2) exitWith {_unit setHit ["legs", (_currentLegDamage + 0.2)];};
        if (_damage < 0.3) exitWith {[_unit,2,true] spawn vTempIncapacitation; _unit setHit ["legs", (_currentLegDamage + 0.3)];};
        if (_damage < 0.6) exitWith {[_unit,4,true] spawn vTempIncapacitation; _unit setHit ["legs", (_currentLegDamage + 0.4)];};
        if (_damage < 0.9) exitWith {[_unit,6,true] spawn vTempIncapacitation; _unit setHit ["legs", (_currentLegDamage + 0.5)];};
        if (_damage >= 0.9) exitWith {[_unit,8,true] spawn vTempIncapacitation; _unit setHit ["legs", (_currentLegDamage + 0.6)];};
    };
}]; ```
past wagon
#

I want these other two markers to be in the same location as the endzone marker, which is random. I am getting an error "undefined variable in expression setmarkerpos"

_endZoneLocation = getMarkerPos "EndZone";
_endZoneLocationX = _endZoneLocation select 0;
_endZoneLocationY = _endZoneLocation select 1;
setMarkerPos "InnerBorder" [_endZoneLocationX, _endZoneLocationY];
setMarkerPos "OuterBorder" [_endZoneLocationX, _endZoneLocationY];
#

oh nevermind I got it

#

I had the marker names and setMarkerPos reversed

fresh wyvern
winter rose
#

[_x] @fresh wyvern

fresh wyvern
#

This gets an error on:
|x|unassignVehicle

_veh = "B_Heli_Transport_01_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addAction [
        "Force passengers to eject", { params ["_target", "_caller", "_actionId", "_arguments"];
             _cargo = (fullCrew [_target, "cargo"]) apply {_x select 0}; 
            {
                _x unassignVehicle _target;
                _x action ["Eject", vehicle _men];
                
            } forEach _cargo; 
        }, nil, 0, true, false];
                [_x] unassignVehicle _target;

Does get the same error.

little raptor
#

crazy question
If I have a global marker, can I change its size, etc. locally?

#

"marker" setMarkerSizeLocal blabla

#

does it work on global markers or only local ones?

hollow lantern
#

because the syntax is sqf {unassignVehicle _x} forEach _cargo;

willow hound
#

@little raptor A global marker? They're all (secretly) local.

past wagon
#

how can I make text appear on screen for all players during a mission?

willow hound
#

Multiplayer optimisation: Global marker commands always broadcast the entire marker state over the network. As such, the number of network messages exchanged when creating or editing a marker can be reduced by performing all but the last operation using local marker commands, then using a global marker command for the last change (and subsequent global broadcast of all changes applied to the marker).
The global marker commands all have this note ๐Ÿ™‚

willow hound
little raptor
#

that's exactly what I wanted to do (modifying the marker by dragging, etc.)
only updating it when the user releases mouse button

anyway, thnx! ๐Ÿ˜„

past wagon
#

not sure

fresh wyvern
# hollow lantern because the syntax is ```sqf {unassignVehicle _x} forEach _cargo;```

Thanks a lot!! Finally got the script right!

_veh = "B_Heli_Transport_01_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addAction [
        "Force passengers to eject", { params ["_target", "_caller", "_actionId", "_arguments"];
             _cargo = (fullCrew [_target, "cargo"]) apply {_x select 0}; 
            {
                 {unassignVehicle _x} forEach _cargo;
                _x action ["Eject", vehicle _target];
            } forEach _cargo; 
        }, nil, 0, true, false];
willow hound
#

There are many forms of text on screen @past wagon, you should choose one first before worrying about multiplayer ๐Ÿ˜‹

hollow lantern
#

you actually don't need the foreach in the foreach. @fresh wyvern sqf _veh = "B_Heli_Transport_01_F"createVehicle (player modelToWorld [8,0,0]); _veh addAction [ "Force passengers to eject", { params ["_target", "_caller", "_actionId", "_arguments"]; _cargo = (fullCrew [_target, "cargo"]) apply {_x select 0}; { unassignVehicle _x; _x action ["Eject", vehicle _target]; } forEach _cargo; }, nil, 0, true, false];

hollow lantern
#

welcome

#

anyone can maybe tell me why the aircraft does not limit the speed? Pilot doesn't seem to be affected at all. However I know the if-clause will be reached because if I add a hint it will be printed each second lmao

 waitUntil {(_aircraft distance _destination) < 2000};
                previousSpeed = 3.6 * (velocityModelSpace _aircraft select 1);
                
                while {previousSpeed > 5} do 
                {
                    scopeName "landingCycle";
                    sleep 1;
                
                speedCache = previousSpeed - 10;

                if (( 3.6 * (velocityModelSpace _aircraft select 1)) < previousSpeed - 1) then
                {
                    _aircraft limitSpeed previousSpeed;
                    previousSpeed = speedCache;
                };

                };```
willow hound
#

And what's up with the scopeName?

hollow lantern
#

the issue is not with the speed command. and scopeName is just a way to name a while-clause so you can kill it with breakOut

willow hound
#

break ๐Ÿ™‚

hollow lantern
willow hound
#

No, mean you can just use break ๐Ÿ™‚

hollow lantern
#

that breaks all code blocks in the while. However neither was part of my question

#

I guess the problem lies with _aircraft limitSpeed previousSpeed;

manic sigil
#

What type of vehicle is _aircraft?

hollow lantern
#

a chopper

manic sigil
#

Ah. Ive made a similar attempt to temper the AIs death flare, though mine was a bit more crude.

hollow lantern
#

mine is just so that the helo slows down gradualy before reaching the landing site

#

because AI does not do that by default :/

#

instead it goes full collective and then at the last meters vertically sky-rocket into the air to slow down

manic sigil
#

Yeah , exactly. So they dont pull up suddenly, i getcha.

My attempt wasuch the same, just no maths or mucking with velocity vectors, just getSpeed.

willow hound
#
waitUntil {(_aircraft distance _destination) < 2000};
private _previousSpeed = speed _aircraft; //Assume speed is 10

while {_previousSpeed > 5} do { //10 > 5? Yes.
  sleep 1;
  private _speedCache = _previousSpeed - 10;

  if (speed _aircraft < _previousSpeed - 1) then { //10 < 9? No.
    _aircraft limitSpeed _previousSpeed;
    _previousSpeed = _speedCache;
  };
};
manic sigil
#

Yeah, kinda like that

hollow lantern
#

well yeah my math thing is kinda the speed thing lol .

willow hound
#

That's his code, just modified so that I can actually read and comprehend it.

hollow lantern
#

speed is not 10 though, speed is more like 150 :D

willow hound
#

Same thing though...

manic sigil
willow hound
#

150 < 149? No.

hollow lantern
#

I was more referring to //Assume speed is 10

manic sigil
#

I think he did that for demonstration purposes

willow hound
#

You're not slowing down the helicopter until the AI is already slowing it down is what I'm saying.

#

Because you never enter the if-statement.

hollow lantern
#

I do

#

lol

#

if I do a hint "debug" in the if-clause it gets executed

willow hound
#

Doesn't make a lot of sense to me.
Then I guess the AI does not care about limitSpeed.

little raptor
hollow lantern
#

you do. If you do it without you have more then just the unit object in the array

#

top is with apply. Bottom is without @little raptor

spark turret
#

yeah gotta access the nested array

manic sigil
#
While {speed _Aircraft >20} do {
Sleep .5;
_currentSpeed = speed _aircraft;
_aircraft limitSpeed _currentSpeed-3;}
willow hound
#

No, that's not it, just tested it, helicopter pilot AI does care about limitSpeed.

manic sigil
#

They do, though, ive been testing as well.

#

Did you disable his AI at all?

#

Hell, ive been graphing speed vs reduction per cycle vs height gained xD

hollow lantern
#

I did actually. but nothing with move: sqf { _x disableAI "AUTOCOMBAT"; _x disableAI "AUTOTARGET"; _x disableAI "TARGET"; } forEach [driver _aircraft];

manic sigil
#

Fun fact, the huron is smooth af

spark turret
#

maybe it depends on the kind of chopper

#

also ai is dumb with helis. they wouldnt accept full passenger with me, they always kicked out two dudes who had to walk

hollow lantern
#

probably gonna look at my speeding stuff later. gtg almost 1am here sleep. Thanks for the help so far.

willow hound
#

@hollow lantern Tested my variant of the code, the if-statement is only entered once the AI is already slowing down for landing anyways.

hollow lantern
#

maybe I then miss interpreted the while execution. So the if statement once it gets activated then runs "forever" until the condition is satisfied

#

and that activation only happens when it is already too late

#

I see

spark turret
#

what

spark turret
little raptor
spark turret
#

Pls gib alternativ

tribal lark
#

Whenever someone gets a chance; how I set up a pbo with pbo manger to add sounds?

spark turret
#

You wanna make it a mod or use it for one missopn only?

tribal lark
#

For an addon sorry yeah

spark turret
#

I assume the same way like description ext but into an addon

#

Thats how my module at least worked

tribal lark
#

Already went there

spark turret
#

And Its dead?

tribal lark
#

well the one guy who did help didn't fix what I needed fixing

spark turret
#

Ah

tribal lark
#

I have the description ext thing in a config.bin inside my pbo

spark turret
#

That sounds correct

tribal lark
#

along with a folder inside the pbo with the audio

#

Doesn't work

spark turret
#

Is the pbo inside a folder called @MyMod or sth?

tribal lark
#

It's inside an addon folder which is inside a mod folder yes

spark turret
#

Thats a requirement afaik.

#

Okay

#

Do you see if the mod is loaded in the log file?

tribal lark
#

You mean the rpt or something else

spark turret
#

Yeah

#

It states what mods are loaded, look for yours in there

#

Hm also you can search ingame in the config browser for your mod to make sure it was loaded

#

Sorry i dont know a lot about mods, i once made a module and it barely worked

#

Try #arma3_config if you cant figure it out, also try to follow the biki on addons

little raptor
# spark turret Pls gib alternativ

@hollow lantern

_cargo = fullCrew [_target, "cargo"]; 
{
  _unit = _x#0;
  unassignVehicle _unit;
  _unit action ["Eject", vehicle _target];
} forEach _cargo; 

you might be wondering what's the difference?
the difference is, when you use apply you're doing two loops
this is just one
and sqf loops are slow
avoid them as much as possible

spark turret
#

Agreed but not as pretty

#

I got points taken away last comp sci homework for wrtitng my own loop that does three things instead of having 3 loops with prebuilt functions. ๐Ÿ™„

fresh wyvern
#

Anyone who know how to make these fire simultaneously?

_veh = "B_CTRG_Heli_Transport_01_tropic_F"createVehicle (player modelToWorld [8,0,0]);  
_veh addMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Red", [-1]];
_veh addWeaponTurret ["LMG_Minigun_Transport", [-1]];

_veh addMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Red", [-1]];
_veh addWeaponTurret ["LMG_Minigun_Transport2", [-1]];
little raptor
little raptor
#

sqf is not the same as other languages

#

apply is almost the same as forEach in terms of performance

#

not as pretty

#

there's literally no difference at all ๐Ÿ˜•

outer fjord
#

Is there a script way I can make AI look at a specific angle on the verticle axis?

#

Like reference point A then look 45 degrees up?

little raptor
#

you'll have to make the AI target a fake target

outer fjord
#

Dang, was hoping to avoid that.

#

Thanks for letting me know, was crawling through the wiki since I posted that.

hollow lantern
#

new more like "wasn't in Arma 2"

tough abyss
#

okay just want to check if im getting somthing right here the setDate command is technicaly local but if used on the server at mission start all the clients will have their date changed to server correct

fresh wyvern
fresh wyvern
tough abyss
#

also i believe i have this written correctly

if (isServer) then
{
  waitUntil {time < 0};
  {[2021, 3, 11, 19,23] remoteExec ["setDate"];
   [30, .6] remoteExec ["setWaves"];
   [300, 0.75] remoteExec ["setOvercast"];
   [300,0.5] remoteExec ["SetGust"];
  } forEach playableUnits;
  setWind [5, 0, true];
  time setRain 0.5;
  300 setLightnings 0.3;
  300 setFog [0.4, 0.3, 50];
};```

edit: think this is right now
digital jacinth
#

Is there a way to use CfgCloudlets with particle sources if the class it self has expressions as such in them?

interval = "0.003/((-(speedY interpolate [-16,0,-9,0])) - 1)";
#

usually when uses setParticleClass on those, nothing shows up.

winter rose
#

why would you remoteExec global variables, why

tough abyss
#

acording to the wiki there local

#

L for local

winter rose
#

https://community.bistudio.com/wiki/setDate

Clients' local date is automatically and periodically synchronised with the server date.
In order to change the date without waiting for automatic synchronisation, use remote execution: ```sqf
[[2001,6,22,12,0]] remoteExec ["setDate"];

tough abyss
#

so the put a damn G on the wiki then

winter rose
#

here, you are remoteExec'ing it as many times as there is a playable!!

winter rose
#

but on the server, hence the doc pain

tough abyss
#
if (isServer) then
{
  waitUntil {time > 0};
 setDate [2021, 3, 11, 19,23];
 300 setWaves 0.6;
 300 setOvercast 0.75;
 300 SetGust 0.5;
 setWind [5, 0, true];
 time setRain 0.5;
 300 setLightnings 0.3;
 300 setFog [0.4, 0.3, 50];
};```

better @winter rose
#

nvm ive deleted somthing

winter rose
#

waitUntil {time < 0}; > no?

tough abyss
#

yeah i hit the wrong one and in my defence Lou i was going of the advice you gave for the wiki before L for local G for global

#

it had an L so i had to remote it for every clent

little raptor
#

what do you mean?!

tough abyss
#

the wiki

little raptor
#

I know
what do YOU mean?!

#

it had an L?

warm hedge
#

Local, he meant

tough abyss
#

the wiki for the comands i executed had
LELocal a local effect means that the effect will only happen on the machine where the command is executed

little raptor
#

ok. I thought you meant a literal L meowsweats

winter rose
tough abyss
#

i didnt know that i just had your advice from earlier L for local G for global

winter rose
tough abyss
#

@winter rose all g but i fixed up the script, so this new script will over the corse of 5 min change the weather to a fairly crappy day right

winter rose
#

almost

little raptor
#

it won't even work meowsweats

#

"setDate" [2021, 3, 11, 19,23];

#

compiler error

winter rose
#
if (isServer) then
{
  waitUntil {time > 0};
 "setDate" [2021, 3, 11, 19,23]; // you kept the quotes
 300 setWaves 0.6;
 300 setOvercast 0.75;
 300 SetGust 0.5;
 setWind [5, 0, true];
 time setRain 0.5; // why time?
 300 setLightnings 0.3;
 300 setFog [0.4, 0.3, 50];
};
tough abyss
#

oh i for got to remove the ""

#

doh

#

also will sqf random [0, 0.5, 1]

#

work

winter rose
#

itโ€ฆ will?

#

between 0 and 1, with a centre closer to 0.5

tough abyss
#

so it means it will try to stick around the middle more

winter rose
#

yes

#

if you want a "perfect" random, use random 1 ๐Ÿ™‚

tough abyss
#

ah ok then what i put might be a bit better for what i want but cool thanks lou

cosmic lichen
#

waitUntil {time > 0};
๐Ÿ”ฅ

winter rose
#

sleep .1;? ^^

cosmic lichen
#

yes

fresh wyvern
#

Is there a way where one vehicle player can fire two vehicle weapons simultaneously?

cosmic lichen
cosmic lichen
#

Not really an issue for time > 0 but for time > 10

tough abyss
#

it was what was on the wiki for setdate

cosmic lichen
#

Thanks, will be fixed

fresh wyvern
winter rose
fresh wyvern
winter rose
tough abyss
#

ok that might be a little to random made the fog so thick i cant see the gun in front of me

tough abyss
#

still it works made a completely randomized weather script

if (isServer) then
{
 _randomN = random 1; //Used for everything but fog and time
 _randomH = random 24; //Random hour
 _randomM = random 59; //Random minute
 _randomF = random 50; //random fog altitued between 1 and 50
 _randomF1 = random 0.2; //Random fog decay any hire and good luck seeing an inch infront of you
 _randomF2 = random 0.6; // Random Fog base 
 
 waitUntil {time > 0};
 setDate [2021, 3, 11, _randomH,_randomM]; 
 0 setWaves _randomN;
 0 setOvercast _randomN;
 0 SetGusts _randomN;
 setWind [5, 0, true];
 0 setRain _randomN; 
 0 setLightnings _randomN;
 0 setFog [_randomF2, _randomF1, _randomF];
};```
little raptor
# winter rose `sleep .1;`? ^^

time will be > 0 exactly in the next frame (unless the game is paused, which can't happen in MP). So it's pointless.
In fact it can work better without sleep (if time is already larger than 0 waitUntil is skipped)

hollow lantern
#

@little raptor does this make sense?



_troops = fullCrew [_aircraft, "cargo", false];
{
_unit = _x#0;
unassignVehicle _unit;
} forEach _troops;

vs.

_troops = (fullCrew [_aircraft, "cargo", false]) apply {_x select 0};
{unassignVehicle _x} forEach _troops;```
I guess based on your suggestion the first is faster.
little raptor
hollow lantern
#

sorry I messed that up

little raptor
#

also select = #

#

this is even faster (not creating _unit and _troops because they're used once):

{
  unassignVehicle (_x select 0); //or unassignVehicle (_x#0);
} forEach fullCrew [_aircraft, "cargo", false];
hollow lantern
#

ah cool

#

thanks!

little raptor
#

@hollow lantern you could even use apply:

fullCrew [_aircraft, "cargo", false] apply {unassignVehicle (_x select 0)};
#

I'm assuming there won't be any big difference performance-wise

hollow lantern
#

that's neat. Removes the need for forEach

little raptor
#

(but it returns an array of "null")

tough abyss
#
if (isServer) then 
{
_gasMask =["G_AirPurifyingRespirator_02_black_F", "G_AirPurifyingRespirator_02_black_F", "G_AirPurifyingRespirator_02_sand_F", "G_AirPurifyingRespirator_02_olive_F", "G_RegulatorMask_F" ]
 
 while {true} do 
 {
  if 
  (_x in list Radiationzone || goggles _x != _gasmask or _x !( in "B_APC_Tracked_01_CRV_F")) then
    {_x setdamage (damage _x + 0.1);};
      } forEach units east;
   sleep 10;
 };
};```

just spit balling here and im pretty sure some one posted a script for this the other day but i wanted to try for my self does this work?

edited
little raptor
#

no

#

;|| meowsweats

#

;or

#

if {}

tough abyss
#

@little raptor that better if not can i get a hint for 100

little raptor
#

@tough abyss also _x !( in "B_APC_Tracked_01_CRV_F")

tough abyss
#

yeah was unsure about that i wanted it so that if their not in a bobcat it will hurt them

tough abyss
#

can you show how it would be then please

heady quiver
#

Hi is there a way to spawn a random weapon on the floor from the CfgWeapons classes?

little raptor
#

@tough abyss sqf 101:
understanding some confusing data types

  1. anything with {} around it is called code
  2. anything with [] around it is called array
  3. anything with "" around it is called string

how do commands work? there are 3 types of commands:

  1. nullar (no arguments): like player
  2. unary (1 argument, which is always on the right): e.g. ! condition, alive _unit, createVehicle []
  3. binary (2 arguments, one on left one on right): e.g. player setPos _pos, "type" createVehicle [0,0,0], 1+2

you can simply look at the description of the command on wiki to understand everything now:

Syntax:
unit in vehicle
Parameters:
unit: Object - entity person
vehicle: Object - entity vehicle
Return Value:
Boolean
this is a binary command
left argument: object
right argument: object

object in object

#

@tough abyss now what is wrong with what you're doing?
_x !( in "B_APC_Tracked_01_CRV_F")

  1. you're using in as a unary command (in "...")
  2. your right hand argument is a string (notice the "...")
tough abyss
#

_x !in "B_APC_Tracked_01_CRV_F" ?

little raptor
#

no

#

let's forget about ! for now

#

focus on the data types

tough abyss
#

ok part of the problem is i dont know how to call for a type of vehical

little raptor
#

what is _x?
what is "B_APC_Tracked_01_CRV_F"?

cosmic lichen
tough abyss
#

"B_APC_Tracked_01_CRV_F" is the class name for the vehical type i want

little raptor
#

well yes
but it's a STRING

#

trust me

#

it'll help you

heady quiver
#

Hey R3vo ^^

tough abyss
#

so take the "" away then

little raptor
#

do you have an object named B_APC_Tracked_01_CRV_F?

tough abyss
#

noooooooo thats what im trying to say i dont want to kname every bobcat i want the script to recognise that vehical class i dont know how to do that tho

heady quiver
#

_wpList = (configFile >> "cfgWeapons") call BIS_fnc_getCfgSubClasses;

This gets all the weapons right ๐Ÿ™‚ ?

little raptor
#

@tough abyss
ok since this is gonna take forever like this I'll just give you the answer
but try to review this stuff meowsweats

!(vehicle _x isKindOf "B_APC_Tracked_01_CRV_F")
tough abyss
#

im sorry i haven't go thru and read every wiki page and know every bit of syntax

#

i was working with what i knew

little raptor
little raptor
#

@heady quiver btw that's not tested

heady quiver
#

I see.. what about this i want to ONLY spawn pistols:

_pistolConfigs = "((configName (_x)) isKindof ['Pistol', configFile >> 'cfgWeapons']) && (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons"); 

How would i pull this off ?

#

selectRandom[_pistolConfigs];
and then createVehicle on it?

little raptor
heady quiver
#

Yes

little raptor
heady quiver
#

no need to wrap it again then

little raptor
#

also what I wrote gives you rifles

heady quiver
#

Mmm

#
_pistolConfigs = "((configName (_x)) isKindof ['Pistol', configFile >> 'cfgWeapons']) && (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons"); 
private _weaponHolder = createVehicle ["Weapon_Empty", getPosATL player, [], 0, "CAN_COLLIDE"];
_weaponHolder addWeaponCargo [selectRandom _pistolConfigs, 1];
#

This spawns a inventory action on the ground but no weapon x)

#

Ah got it.

#

or not.

#

It spawns spectrums x)

#

Is there a way to 'exlude'

cosmic lichen
#

add the class of the spectrum devise into your condition before configClasses

#

&& configName _x != "spectrumSomething"

heady quiver
#
_pistolConfigs = "((configName (_x)) isKindof ['Pistol', configFile >> 'cfgWeapons']) && configName _x != 'Weapon_hgun_esd_01_F' && (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons"); 
private _weaponHolder = createVehicle ["Weapon_Empty", getPosATL player, [], 0, "CAN_COLLIDE"];
_wpn = configName selectRandom _pistolConfigs;
_weaponHolder addWeaponCargoGlobal [_wpn, 1];
cosmic lichen
#

' instead of "

heady quiver
#

mmm

#

Can i array that?

#

['Weapon_hgun_esd_01_F', 'another-item'] etc?

cosmic lichen
#

!(_configName _x in [array])

heady quiver
#
_exludedPistols = ['Weapon_hgun_esd_01_F', 'Weapon_hgun_esd_01_antenna_02_F', 'Weapon_hgun_esd_01_antenna_03_F', 'Weapon_hgun_esd_01_antenna_01_F'];
_pistolConfigs = "((configName (_x)) isKindof ['Pistol', configFile >> 'cfgWeapons']) && !(configName _x in _exludedPistols) && (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons"); 
private _weaponHolder = createVehicle ["Weapon_Empty", getPosATL player, [], 0, "CAN_COLLIDE"];
_wpn = configName selectRandom _pistolConfigs;
_weaponHolder addWeaponCargoGlobal [_wpn, 1];
cosmic lichen
#

no

#

now it's [[pistols]]

heady quiver
#

What do you mean?

#

oooh

#

i see.

tough abyss
#
if (isServer) then 
{
 _gasMask =["G_AirPurifyingRespirator_02_black_F", "G_AirPurifyingRespirator_02_black_F",  "G_AirPurifyingRespirator_02_sand_F", "G_AirPurifyingRespirator_02_olive_F", "G_RegulatorMask_F" ];
 
 while {true} do 
 {
  if 
  (_x in list Radiationzone || goggles _x != _gasmask or  !!(vehicle _x isKindOf "B_APC_Tracked_01_CRV_F")) then
    {_x setdamage (damage _x + 0.1);}
      } forEach units west;
   sleep 10;
 };

};```
getting an error on line 14 missing {
cosmic lichen
#

@heady quiver Also, you are writing _configName instead of configName

#

@tough abyss Then check the braces

jade abyss
#

The format is also awful to read

tough abyss
#

3x { 3x } all braces accounted for

#

hold up let me check noticed a !! in there

little raptor
#

@tough abyss two !

jade abyss
#

"!!"

little raptor
#

reverts it to the original

#

true -> false -> true

cosmic lichen
#
_exludedPistols = ['Weapon_hgun_esd_01_F', 'Weapon_hgun_esd_01_antenna_02_F', 'Weapon_hgun_esd_01_antenna_03_F', 'Weapon_hgun_esd_01_antenna_01_F']; 
_pistolConfigs = "((configName (_x)) isKindof ['Pistol', configFile >> 'cfgWeapons']) && !(configName _x in _exludedPistols) && (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons");  
private _weaponHolder = createVehicle ["Weapon_Empty", [getPosATL player # 0, getPosATL player # 1, 0.04], [], 0, "CAN_COLLIDE"]; 
_wpn = configName selectRandom _pistolConfigs; 
_weaponHolder addWeaponCargoGlobal [_wpn, 1];

@heady quiver You need to add a little offset in Z otherwise the pistols disappear in the ground

tough abyss
#

yeah fixed that still throwing the missing brace error

heady quiver
#

Yeaa i just realised that

cosmic lichen
#

Then check where it is missing

tough abyss
#

its the close } brace for the do loop

heady quiver
#

How would i do that ๐Ÿ˜› ?

tough abyss
#

but the open { is thre

little raptor
#

always properly indent your code

cosmic lichen
#

Start formatting your code

#

Then you will see where a brace is missing

heady quiver
#

What editor is that?

cosmic lichen
#

A decent ide will also show you where it's missing if you hover over it

#

Visual Studio Code

heady quiver
#

cool

little raptor
tough abyss
#

screw that noise use notepad like a boss

cosmic lichen
#

yep

tough abyss
#

XD

cosmic lichen
#

Waste our time like a boss...

tough abyss
#

im kiding

heady quiver
#

How would i offset getPosATL player ?

cosmic lichen
#

Check the code I posted

little raptor
cosmic lichen
#

dirty but simple

spark turret
#

.

tough abyss
#

ok where do i get those add on @spark turret

spark turret
#

In visual studio code

tough abyss
#

what the sqf parts

heady quiver
#

Thanks got it working.

#

One more question, prob very easy for you guys.

#

How would i get the weapon to spawn with mags.

little raptor
#

addWeaponWithItemsGlobalSomething ๐Ÿ˜›

#

addWeaponWithAttachmentsCargoGlobal meowsweats

#

that sure is a mouthful

cosmic lichen
#

be happy that it's not written with 5 t

#

like getDammmmage

little raptor
#

๐Ÿคฃ

heady quiver
#

Only one problem, i need to define the mags myself but i want it to be random from whats available with that weapon

little raptor
#

maybe it had a "get"?

#

I don't know

heady quiver
#

yes it does

#

ty

little raptor
heady quiver
#

currentWeapon player call BIS_fnc_compatibleMagazines;

#

oh.

little raptor
# heady quiver oh.

I mean I wasn't sure if it's called BIS_fnc_getCompatibleMagazines or just BIS_fnc_compatibleMagazines

little raptor
#

yeah I did notlikemeow
I was just mentioning that off the top of my head at first

tough abyss
#

hmm also this bit dosnt work either goggles _x != _gasmask
_gasmask is an array with the different gasmask class names

cosmic lichen
#

yeah

#

how is that supposed to work ๐Ÿ˜„

little raptor
#

it's also case sensitive

tough abyss
#

do i have to manuall put conditions for each mask type

#

also script is huring me outside trigger area

little raptor
#

also why units west + in list?

#

simply use forEach list RadiationZone

#

even this is faster than that ( I mean west + in list):
forEach (units west inAreaArray RadiationZone)
(but just use the above code, not this one, since you already have a trigger)

heady quiver
#
// Spawn mags
_getRandomMag = _wpn call BIS_fnc_compatibleMagazines;
_mgsHolder addMagazineCargoGlobal [_getRandomMag, 1];

Im stupid?

tough abyss
#

ok and how do i work that into an if condition sqf foreach (units west inAreaArray Radiationzone || !(goggles _x in _gasMask) or !(vehicle _x isKindOf "B_APC_Tracked_01_CRV_F"))

little raptor
heady quiver
#

Its fine that it wont load in the gun.

little raptor
heady quiver
#

Got it working nice

#
_exludedPistols = ['Weapon_hgun_esd_01_F', 'Weapon_hgun_esd_01_antenna_02_F', 'Weapon_hgun_esd_01_antenna_03_F', 'Weapon_hgun_esd_01_antenna_01_F'];
!(configName _x in _exludedPistols)

This doesnt work btw it still spawns the weird antenna's

cosmic lichen
#

maybe there are more classes then just the few

heady quiver
#

Just 4 items.

#

Weapons -> Pistols -> Weapon_hgun_esd_01_F

#

etc

little raptor
#

there is no _x here

heady quiver
#
    // Spawn random pistol
    _exludedPistols = ['Weapon_hgun_esd_01_F', 'Weapon_hgun_esd_01_antenna_02_F', 'Weapon_hgun_esd_01_antenna_03_F', 'Weapon_hgun_esd_01_antenna_01_F'];
    _pistolConfigs = "((configName (_x)) isKindof ['Pistol', configFile >> 'cfgWeapons']) && !(configName _x in _exludedPistols) && (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons"); 
    private _weaponHolder = createVehicle ["Weapon_Empty", getPosATL player vectorAdd [0,0,0.1], [], 0, "CAN_COLLIDE"];
    _wpn = configName selectRandom _pistolConfigs;
    _weaponHolder addWeaponCargoGlobal [_wpn, 1];


    // Spawn mags
    _getMag = _wpn call BIS_fnc_compatibleMagazines;
    _getRandomMag = selectRandom _getMag;
    _weaponHolder addMagazineCargoGlobal [_getRandomMag, random 5];
little raptor
#

there is no _x

cosmic lichen
#

configClasses

little raptor
#

the simplest and fastest way to exclude is this:

_exludedPistols = _exludedPistols apply {configFile >> "cfgWeapons" >> _x};
_pistolConfigs = _pistolConfigs - _exludedPistols;
#

and remove that from inside the configClasses condition

#

just use what I wrote earlier

#

100 times faster

#
_pistolConfigs = "getNumber (_x >> 'scope') == 2 && getNumber (_x >> 'type') == 2" configClasses (configFile >> "cfgWeapons");
heady quiver
#
// Exclude items
_exludedPistols = ['Weapon_hgun_esd_01_F', 'Weapon_hgun_esd_01_antenna_02_F', 'Weapon_hgun_esd_01_antenna_03_F', 'Weapon_hgun_esd_01_antenna_01_F'];
_exludedPistols = _exludedPistols apply {configFile >> "cfgWeapons" >> _x};

_pistolConfigs = "getNumber (_x >> 'scope') == 2 && getNumber (_x >> 'type') == 2" configClasses (configFile >> "cfgWeapons");
_pistolConfigs = _pistolConfigs - _exludedPistols;
private _weaponHolder = createVehicle ["Weapon_Empty", getPosATL player vectorAdd [0,0,0.1], [], 0, "CAN_COLLIDE"];
_wpn = configName selectRandom _pistolConfigs;
_weaponHolder addWeaponCargoGlobal [_wpn, 1];

// Spawn mags
_getMag = _wpn call BIS_fnc_compatibleMagazines;
_getRandomMag = selectRandom _getMag;
_weaponHolder addMagazineCargoGlobal [_getRandomMag, random 5];
little raptor
#

move this part below the configClasses: _pistolConfigs = _pistolConfigs - _exludedPistols;

#

should work now

heady quiver
#

Yea works nice

#

'type') == 2" means pistol ?

little raptor
#

yes

heady quiver
#

is there a list of all the types?

tough abyss
#

hey for my code should the trigger to be server only or not

little raptor
tough abyss
#

its just there for the list

little raptor
#

then it won't matter

#

actually I think it should not be server-only
depends where that code was being executed
if it was being executed on the server then yeah it should be server only

still forum
tough abyss
#

ok then somhing is still wrong then the code isnt throwing errors any more but im still taking damage now even with mask on.```sqf
if (isServer) then
{
_gasMask =["G_AirPurifyingRespirator_02_black_F", "G_AirPurifyingRespirator_02_black_F", "G_AirPurifyingRespirator_02_sand_F", "G_AirPurifyingRespirator_02_olive_F", "G_RegulatorMask_F" ];

while {true} do {
{
if (!(goggles _x in _gasMask) or !(vehicle _x isKindOf "B_APC_Tracked_01_CRV_F")) then
{_x setdamage (damage _x + 0.1);}
} forEach list Radiationzone;
sleep 10;
};

};```

little raptor
#

solved already! ๐Ÿ˜›

heady quiver
#

Hey Leo, is there also a way to do it the other way arround instead of exclude only include?

little raptor
#

makes no sense

#

since your array is smaller and you're getting all weapon configs just use the smaller array

#

if it may contain some classes not found in cfgWeapons (e.g because of mods, dlcs) etc., use arrayIntersect

heady quiver
#

Well i want for example only 2 weapons: M4, AK

tough abyss
#

@little raptor any reason im taking damage with this code even with mask on

little raptor
#

fix your indents

#

I can't even read that meowsweats

still forum
tough abyss
#

whats the proper way to indent the thing then

little raptor
#

use the tab key
an IDE will help with keeping the indents
like vscode or npp

little raptor
still forum
#

no

little raptor
#

๐Ÿฅฒ

tough abyss
#

@little raptor ```sqf
if (isServer) then
{
_gasMask =["G_AirPurifyingRespirator_02_black_F", "G_AirPurifyingRespirator_02_black_F", "G_AirPurifyingRespirator_02_sand_F", "G_AirPurifyingRespirator_02_olive_F", "G_RegulatorMask_F" ];

while {true} do
{
{
if (!(goggles _x in _gasMask) or !(vehicle _x isKindOf "B_APC_Tracked_01_CRV_F")) then
{
_x setdamage (damage _x + 0.1);
}
} forEach list Radiationzone;
sleep 10;
};

};```
better

little raptor
#

yeah

#

it could be a case sensitivity issue

#

convert all of those gas mask classes to lower case

#

then use this

#

!(toLowerANSI goggles _x in _gasMask)

#

@tough abyss if you use np++ just select the array and press ctrl+u

heady quiver
#

Is there also a addAttachentCargo thingy

#

x) ?

tough abyss
#

you mean like this ```sqf
if (isServer) then
{
_gasmask =["g_airpurifyingrespirator_02_black_f", "g_airpurifyingrespirator_02_black_f", "g_airpurifyingrespirator_02_sand_f", "g_airpurifyingrespirator_02_olive_f", "g_regulatormask_f"];

while {true} do
{
{
if (!(toLowerANSi goggles _x in _gasmask) or !(vehicle _x isKindOf "B_APC_Tracked_01_CRV_F")) then
{
_x setdamage (damage _x + 0.1);
}
} forEach list Radiationzone;
sleep 10;
};

};

little raptor
#

no

#

I said convert the gas masks to lower case

tough abyss
#

but why they are the class names

little raptor
#

because in is case sensitive

little raptor
tough abyss
#

so i have to retype all them in lower case in vcs

little raptor
#

use the command palette

#

ctrl+shift+P
type lowercase
press enter

heady quiver
#
_getAttachment = _rndRifle call BIS_fnc_compatibleItems;
_getRandomAttachment = selectRandom _getAttachment;
_weaponHolder addMagazineCargoGlobal [_getRandomAttachment random 2];
#

This not working for some reason ๐Ÿค”

tough abyss
#

done that now

heady quiver
#

x)

heady quiver
#

omg..

#

ty boss

little raptor
#

let me take a look

heady quiver
#

Seems to spawn a invisible attachment ๐Ÿค”

tough abyss
#

@little raptor done

little raptor
little raptor
tough abyss
#

@little raptor negative damaging me even with gasmask on

heady quiver
#

Yep... ty.

little raptor
tough abyss
#

"G_AirPurifyingRespirator_02_black_F"

#

on global and local

#

testing in multiplayer btw

little raptor
#

did you exit to eden or just go back to lobby?

heady quiver
#

I added the vectorAdd to the weapon spawn but when the mags spawn after it they will be in the ground anyway to fix that?

heady quiver
#

ty

tough abyss
#

@little raptor went bvack to eden just now tried again still damaging

little raptor
heady quiver
#

Just to spawn it with the weapon.

#

on the ground

#
_rifles = ['rhs_weap_hk416d145', 'rhs_weap_akm', 'rhs_weap_ak103','rhs_weap_m4'];
_rndRifle = selectRandom _rifles;

private _weaponHolder = createVehicle ["weaponHolderSimulated", getPosATL player vectorAdd [0,0,0.1], [], 0, "CAN_COLLIDE"];
_weaponHolder addWeaponCargoGlobal [_rndRifle, 1];

_getMag = _rndRifle call BIS_fnc_compatibleMagazines;
_getRandomMag = selectRandom _getMag;
_weaponHolder addMagazineCargoGlobal [_getRandomMag, random 5];

_getAttachment = _rndRifle call BIS_fnc_compatibleItems;
_getRandomAttachment = selectRandom _getAttachment;
_weaponHolder addItemCargoGlobal [_getRandomAttachment, 1];
little raptor
# tough abyss <@!360154905148653568> went bvack to eden just now tried again still damaging

try this:
remove the script
make sure you don't take any damage
now execute this in debug console:

[] spawn 
{
    _gasmask =["g_airpurifyingrespirator_02_black_f", "g_airpurifyingrespirator_02_black_f", "g_airpurifyingrespirator_02_sand_f", "g_airpurifyingrespirator_02_olive_f", "g_regulatormask_f"];
 
 while {true} do
    {
        {
            if  (!(toLowerANSi goggles _x in _gasmask) or  !(vehicle _x isKindOf "B_APC_Tracked_01_CRV_F")) then
            {
                _x setdamage (damage _x + 0.1);
            }
        } forEach list Radiationzone;
        sleep 10;
    };
             
};
little raptor
heady quiver
#

ty

tough abyss
#

global or local

little raptor
#

server

tough abyss
#

nope took damage

little raptor
#

but you didn't take damage without that?

tough abyss
#

yes

#

no damage till i ran script

#

moment i ran it my guy started making grunting sounds

little raptor
#

your condition is wrong

tough abyss
#

would me spawning in the gasmask be causing it

little raptor
#

replace or with and (or &&)

tough abyss
#

okay ** returned an error but && seems to be working

little raptor
tough abyss
#

ok yeah i can see how or was rong

#

also why spawn

#

should i change it to [] spawn in my script or keep it to while

little raptor
#

it was for something else

#

debug console is unscheduled

#

you can't use sleep in it

tough abyss
#

ahh k

#

gods damn it all that work for two damn letters

heady quiver
#

How do i add holdAction function to all classes with the type Land_PortableCabinet_01_closed_black_F

heady quiver
#

yea?

little raptor
#

do you?

heady quiver
#

yea

little raptor
#

specifically this example

class Extended_Init_EventHandlers {
    class Land_PortableCabinet_01_closed_black_F {
        class My_Cabinet_init_eh {
            init = "call some_fnc_addHoldAction";
        };
    };
};
heady quiver
#

Just realized i might nog even need it

little raptor
#

๐Ÿ˜

heady quiver
#

x)

#

Not sure....

#
createVehicle ["Land_PortableCabinet_01_closed_black_F", getPosATL player vectorAdd [0,5,0], [], 0, "CAN_COLLIDE"];

i got this right.

#

and i want this:

[milBox,
"Search","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",    
"container distance _target < 3",                        
"_caller distance _target < 3",                        
{},                                                    
{},                                                    
{_this call spawnItem },                
{},                                                    
[],                                                    
3,                                                    
0,                                                    
true,                                                
false                                                
] remoteExec ["BIS_fnc_holdActionAdd", 0, container];

on all of those.

little raptor
#

for event handler

heady quiver
#

The plan is to create them (dynamic loot) but i want that action on all of them

#

so i can basically just merge those together and its not heavy to load?

little raptor
#

that's what I said ๐Ÿ˜•

little raptor
heady quiver
#

how would this work ?

#
spawnLootableMillCrate = {
    _lootCrate = createVehicle ["Land_PortableCabinet_01_closed_black_F", getPosATL player vectorAdd [0,5,0], [], 0, "CAN_COLLIDE"];
    [_lootCrate,"Search","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa","_lootCrate distance _target < 3","_caller distance _target < 3",                        
    {},{},{_this call spawnWeapons },{},[],3,0,true,false                                                
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, _lootCrate];

};
#

nvm got it.

spark turret
tough abyss
#

would

if (isServer) then
{
  while {true} do 
    {
      if (east KnowsAbout group T1 <=1.4 ) then 
        {
        QRF addWaypoint [(getPos T1),100];
        };
    };
};
``` work
spark turret
#

=< will break, use <=

tough abyss
#

ok

spark turret
#

other than that, yes. but it will only check once.

tough abyss
#

@spark turret what bout that

#

thats where the fun begins and you map every key to throw grenade

wind hedge
#

which one is faster: 1) SQF private _allRealPlayers = (allPlayers - entities "HeadlessClient_F"); if (_allRealPlayers findIf {(_x distanceSqr _zombie <= 1200^2)}) isEqualTo -1) then {deletevehicle _zombie;}; OR 2) ```SQF

if (({_x distance2D _zombie <= 1200} count _allRealPlayers) isEqualTo 0) then {deletevehicle _zombie;}; ```

winter rose
#

most likely 1)
(without the ; after -1)

#

the findIf being the key

wind hedge
#

Thanks!

heady quiver
#
     // Allowed items in Loot Table 
     _items = [ 
     'Item_FirstAidKit'
     ]; 
     
     
     // Select random weapon from loot table 
     _rndItem = selectRandom _items; 
     
     // Create item on ground after search 
      private _itemHolder =  createVehicle [_rndItem, getPosATL player vectorAdd [0,0,0.1], [], 0, "CAN_COLLIDE"];
     _itemHolder addItemCargoGlobal [_rndItem, 5]; 

For some reason this only creates 1 first add kit anyone knows wqhy?

cosmic lichen
#

Does this even work?

#

You should be creating a weapon holder with createVehicle and then add items to it

heady quiver
#

it creates one medical thingy x)

cosmic lichen
#

Yes

heady quiver
#

mmm

cosmic lichen
#

Because the kit is not a weapon holder but an object the player can pick up

heady quiver
#

yea i want to spawn like 3 for example ๐Ÿค”

cosmic lichen
#
_holder = createVehicle ["weaponHolderSimulated", getPosATL player vectorAdd [0,0,0.1], [], 0, "CAN_COLLIDE"];
_holder addItemCargoGlobal [_rndItem, 5];
#

Now there will be 5 first aid kits in the weapon holder

heady quiver
#

Nope

#

Not doing anything now

#
searchMedical = { 

     // Allowed items in Loot Table 
     _items = [ 
     'Item_FirstAidKit'
     ]; 
     
     
     // Select random item from loot table 
     _rndItem = selectRandom _items; 
     
     // Create item on ground after search 
     _holder = createVehicle ["weaponHolderSimulated", getPosATL player vectorAdd [0,0,0.1], [], 0, "CAN_COLLIDE"];
     _holder addItemCargoGlobal [_rndItem, 5];
     

};

current code

#

trying it with a pistol works but not with medical kit.

cosmic lichen
#

the classname is wrong

#

Item_FirstAidKit is an item you can place

heady quiver
#

oh..

cosmic lichen
#

FirstAidKit is the classname for the inventory item.

heady quiver
#

thats it

#

TY

#
searchCivBackpacks = {

     // Allowed items in Loot Table 
     _items = [
        'B_FieldPack_blk',
        'B_FieldPack_cbr',
        'B_FieldPack_ghex_F',
        'rhs_sidor',
        'rhs_assault_umbts'
     ]; 
     
     
     // Select random item from loot table 
     _rndItem = selectRandom _items; 
     
     // Create item on ground after search 
     _backpackHolder = createVehicle ["weaponHolderSimulated", getPosATL player vectorAdd [0,0,0.3], [], 0, "CAN_COLLIDE"];
     _backpackHolder addBackpackCargoGlobal [_rndItem, 1];

};

Why does this work when i execute it in the game but when i call the function to it, it doesnt?

#

Seems to work again

#

weird.

tough abyss
#

how do i finish this sqf if (_x isKindOf "Land_FMradio_f") then { my code here }forEach......};

winter rose
#

proper indentation saves lives ๐Ÿ˜‰

tough abyss
#

huh actualy now that i think about it my plan isnt going to work i dont think

#
{
    _Radios =["land_fmradio_f", "land_survivalradio_f"]
    while {true} do
    {
        if (toLowerANSI _x isKindOf in _Radios) then
        {
            playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset]
        };
        
    }forEach _Radios;
        
};
``` i dont belive this is correct or will work
winter rose
#

Correct, it won't work ^^

tough abyss
#

cause it wants the object for sound source

#

right

#

sod it il just run the play sound through the objects int field

#

sigh

#

wait wont wwork dam it all

winter rose
#

Stahp

Write on paper or notepad:

  • what do you want to do?
  • what are the logical steps?
  • what are the corresponding commands?
#

And don't you jump a step of that list ๐Ÿ‘€

spark turret
#
  1. Set goal way out of own ability: code arma 4 in sqf
  2. Try object init: executeArma4.init();
  3. Doesnt work
  4. Go to discord and ask Lou to write the script for you.
sacred slate
#

plz halp. this is not working:

{
    _x disableAI โ€œAUTOCOMBATโ€;
} forEach (allUnits select {playerSide isEqualTo side _x});
spark turret
#

Is playerSide a command?

sacred slate
#

well at least this works

spark turret
#

Ah okay, unfamiloar with it

sacred slate
#
{
    addSwitchableUnit _x;
} forEach (allUnits select {playerSide isEqualTo side _x});
spark turret
#

The code is fine then

sacred slate
#

error, invalid number in expression, for autocombat

tough abyss
#

hmm its not throwing any errors ```sqf
if (isServer) then
{

while {alive Radio} do
{
    playSound3D ["\sounds\Dirge.wav", Radio]; 
    sleep 263;
};

};```

i think my file adress is wrong

#

@winter rose sorry to be a pain can i get a hand with this

dark pecan
#

Guys hello, recently i've tried to make a sequence of 3 animations i've put them into an sqf file and made a trigger do the job, the problem is that the unit only do one animation.

Inside SQF file:
bot1 switchMove "acts_millerChooper_in";sleep 3.966;
bot1 switchMove "";
bot1 switchMove "acts_millerChooper_loop";
sleep 23.100;
bot1 switchMove "";
bot1 switchMove "acts_millerChopper_out";
sleep 3.599;
bot1 switchMove "";

tough abyss
#
 bot1 switchMove "acts_millerChooper_in"; #sleep 3.966;
bot1 switchMove "";
bot1 switchMove "acts_millerChooper_loop";
sleep 23.100;
bot1 switchMove "";
bot1 switchMove "acts_millerChopper_out";
sleep 3.599;
bot1 switchMove "";``` you didnt space the sleep perhaps
#

hold up le me check

dark pecan
#

at first i did spaced, but it still happened

winter rose
#

now das weird

#

(spacing should not matter; you can write ;player setDamage 1;hint "OK";)

dark pecan
#

yep, i used it in the trigger

#

the 1st animation the unit did, but the 2nd freezed and at the 3rd it did the correct animation

#

at the beginning i thought it was because of the loop timming from sleep command but then i've added the correct time wich is "23.100" and it still happened

#

does the animation "loop" have something to do with it ?

tough abyss
#
bot1 playMove "acts_millerChooper_in";
sleep 3.966;
bot1 playMove "";
bot1 playMove "acts_millerChooper_loop";
sleep 23.100;
bot1 playMove "";
bot1 playMove "acts_millerChopper_out";
sleep 3.599;
bot1 playMove "";``` tested
#

it works

dark pecan
#

the 3 animations ?

tough abyss
#

yup

dark pecan
#

ok, i will copy it and test it out

tough abyss
#

il show you jump to genral chat

dark pecan
#

copy that

dark pecan
#

Solved

#

thanks dark ๐Ÿ‘

tough abyss
#
if (isServer) then
{
    
    while {alive Radio} do
    {
        playSound3D ["sounds\Dirge.wav", Radio]; 
        sleep 263;
    };

};``` 

little help anyone this isnt throwing an error and isnt playing the audio
dark pecan
#

remove the \

#

before sounds

#

and see what happens

#

"sounds\Dirge.wav"

heady quiver
#

nearestObjects [player, ["house"], 200]; <-- how would i loop over this and get random positions inside the houses?

winter rose
heady quiver
#

<this ^>; what the hell is this

#

x)

winter rose
#

your above code :p

heady quiver
#

oh

#

How would i get the pos of that house?

winter rose
#

getPosATL _x?

spark turret
#

he means AI positions inside the house

heady quiver
#

well..

tough abyss
#

IM going to bed

past wagon
#

is there a way to completely randomization player locations, and spawn them anywhere over land?

heady quiver
#

This you mean @past wagon ?

past wagon
#

maybe

heady quiver
#
_randomPosMapNoWater = [] call BIS_fnc_randomPos;
#

And yea i mean random spawn also insdie the house

#
private _houses = nearestObjects [player, ["house"], 200];
{ systemChat format['%1', getPosATL _x] } forEach _houses;

This gives me 3 positions back (from the houses i manually placed in VR, which works fine but i also want inthose houses a couple locations for loot or AI

past wagon
heady quiver
#

np, glad i can help someone instead always asking for help ๐Ÿ˜„

past wagon
#
_randomPosMapNoWater = [nil, ["water"]] call BIS_fnc_randomPos;
#

in this script would "water" just be water if it is a trigger instead of a marker?

winter rose