#arma3_scripting

1 messages Β· Page 74 of 1

hallow mortar
#
// Include this in the mission as a configured function, or define it on the fly from debug console.
// If in cfgFunctions, this line and the last }; are not needed.
TNRGN_fnc_missileStrike = {

    // Specify your firing pos here, use getPosASL on a reference object, etc.
    private _firingPos = [0,0,0];
    {
        private _position = [_x] call BIS_fnc_gridToPos;
        private _target = createVehicle ["laser_target_classname",_position];
        private _missile = createVehicle ["cruise_missile_classname",_firingPos,[],200,"FLY"];
        sleep 0.1;
        _missile setMissileTarget _target;
    } forEach _this;
    
    // Trigger your SAM launch, idk how you implemented it
    [] spawn TNRGN_fnc_SAMlaunch;
};
/*
To use: local execute in debug or execute code module. Specify grid refs as strings. Can be used more than once.
["123456","768910"] spawn TNRGN_fnc_missileStrike
*/```
sage heath
#

holy shit man this looks great

#

so, how does this work in detail?

#

and what do i need to do to install this?

sage heath
hallow mortar
# sage heath and what do i need to do to install this?

You can put it in the mission as a configured function: https://community.bistudio.com/wiki/Arma_3:_Functions_Library
Or you can define it from the debug console as the comments describe.
However you define it, it's designed to be run from the debug console or an execute code module, so you can tell it the list of grid references. (I could write a chat event handler so you can just type grid refs in chat but ehhhhhhhhhh)

hallow mortar
hallow mortar
# sage heath so, how does this work in detail?
  • receives list of grid references from you
  • iterating through the list:
    -- converts grids to real positions
    -- creates laser targets on those positions
    -- spawns a missile for each position way off yonder
    -- sets that missile's target as the laser target that was created
sage heath
#

sweeeeet

#

imma give this a shot, ill report back

sage heath
#

also heads up, my notifs are off, so please do enable ping when you reply to me

hallow mortar
sage heath
# hallow mortar Well...how do these SAM launch triggers work?

so basically each trigger has the code to execute an sqf which will let that individual launcher start firing, there are 6 launchers in a battery, each trigger has a countdown of min 1 mid 10 and max 20 seconds so the launchers dont all fire at the same time

#

and also one of them which has a missile programmed to launch and smash into the ground in front of it, because its a russian s-300 XD

#

the code inside this trigger is quite simple of course

#

its just WR_VIC = [S3001] execVM "WR-VIC-Shoot.sqf"; i got the code from white raven

#

albeit slightly modified

#

but i dont think thats super relevant

hallow mortar
#

Alright, so in my script where it has the function spawn for fnc_SAMlaunch, put this instead:

    // Trigger your SAM launch
    [] spawn {
        {
            sleep (random 5);
            [_x] execVM "WR-VIC-Shoot.sqf";
        } forEach [s3001,s3002,s3003,s3004,s3005];
    };
    // and here's where you put the code that blows up s3006
    // ...```
#

WR_VIC_Shoot.sqf should really be turned into a function, but since this is the only time it's used (....right?) this will be fine.

#

@sage heath forgot to ping

sage heath
#

yeah np was just about to check anyways

sage heath
# hallow mortar Alright, so in my script where it has the function spawn for fnc_SAMlaunch, put ...

so put together that would be...

// Include this in the mission as a configured function, or define it on the fly from debug console.
// If in cfgFunctions, this line and the last }; are not needed.
TNRGN_fnc_missileStrike = {

    // Specify your firing pos here, use getPosASL on a reference object, etc.
    private _firingPos = [0,0,0];
    {
        private _position = [_x] call BIS_fnc_gridToPos;
        private _target = createVehicle ["laser_target_classname",_position];
        private _missile = createVehicle ["cruise_missile_classname",_firingPos,[],200,"FLY"];
        sleep 0.1;
        _missile setMissileTarget _target;
    } forEach _this;
    
    // Trigger your SAM launch, idk how you implemented it
        [] spawn {
        {
            sleep (random 5);
            [_x] execVM "WR-VIC-Shoot.sqf";
        } forEach [s3001,s3002,s3006,s3004,s3005];
   // This is the code where the failed launch occurs
            [s3003] execVM "WR_VIC_Shoot2.sqf";
    };
};
/*
To use: local execute in debug or execute code module. Specify grid refs as strings. Can be used more than once.
["123456","768910"] spawn TNRGN_fnc_missileStrike
*/```
#

correct? @hallow mortar

hallow mortar
#

You don't need to [attempt to] forEach the failed launch code, since there's just the one of those.

[s3003] execVM "WR_VIC_Shoot2.sqf";```
sage heath
#

also uhm im really sorry but...i dont know how to put this in the cfgfunctions in the description.ext

hallow mortar
#

Does your description.ext already have a cfgFunctions?

sage heath
#

nope

hallow mortar
#

Okay, simples then

#

First, take out the TNRNG_fnc_missileStrike = { line at the start, and the very last };. Those are only used for on-the-fly defining the function.

#

Now save the whole thing as fn_missileStrike.sqf in a folder called functions, inside your mission folder.

#

Then in your description.ext:

class CfgFunctions
{
  class TNRGN
  {
    class functions
    {
      file = "functions";
      class missileStrike{};
    };
  };
};```
sage heath
#

and thats it?

hallow mortar
#

yarp

sage heath
#

so to run this in the op, i do what in the debug editor?

hallow mortar
#

Do you see the comment at the bottom of the script?

sage heath
#

ahhhhh this
["123456","768910"] spawn TNRGN_fnc_missileStrike

#

right XD i completely missed that

hallow mortar
#

Make sure you hit local execution

sage heath
#

also i assume i need to fill out laser_target_classname and the cruise missile one

sage heath
#

btw

sage heath
#

how many missiles does this spawn per target?

hallow mortar
#

One

sage heath
#

im aiming for 2 per if possible

#

is that easy to do?

hallow mortar
#

Yep, just a minute

sage heath
#

cuz if not im down to skip that part

#

thanks! meanwhile ill get that classname figured out

#

hey btw, you should publish this on the workshop people would love it

#

also in the classnames in cfg vehicles, there are 2 weapon classnames, LaserTargetEBase and LaserTargetE do you know whats the difference between these two?

hallow mortar
#

Not really, but base classes are usually designed to be logistical elements that are just used internally for config inheritance. To be sure, use the one that's not base.

sage heath
sage heath
hallow mortar
#

You can probably just use the base game cruise missile, no one will notice. Unless you want the missiles to get shot down.

sage heath
#

i do

#

which this mod handles

#

so basically

#

but honestly

#

lets just get it to work first

#

we'll worry about this later

#

since if its not possible, ill try to figure it out, or ill fake it

hallow mortar
#

Replace the appropriate forEach with this:

    {
        private _position = [_x] call BIS_fnc_gridToPos;
        for "_i" from 1 to 2 do {
            private _target = createVehicle ["laser_target_classname",_position];
            private _missile = createVehicle ["cruise_missile_classname",_firingPos,[],200,"FLY"];
            sleep 0.1;
            _missile setMissileTarget _target;
        };
    } forEach _this;```
sage heath
#

what does that do?

hallow mortar
#

Makes it fire two missiles per target

sage heath
#

ah, gotcha

hallow mortar
#

Also, whichever dev decided back in like 2012 to have LaserTargetE be BLUFOR and LaserTargetW be OPFOR is an actual maniac

sage heath
#

so this is the .sqf file in total

// Specify your firing pos here, use getPosASL on a reference object, etc.
    {
        private _position = [_x] call BIS_fnc_gridToPos;
        for "_i" from 1 to 2 do {
            private _target = createVehicle ["laser_target_classname",_position];
            private _missile = createVehicle ["cruise_missile_classname",_firingPos,[],200,"FLY"];
            sleep 0.1;
            _missile setMissileTarget _target;
        };
    } forEach _this;
    
    // Trigger your SAM launch, idk how you implemented it
        [] spawn {
        {
            sleep (random 5);
            [_x] execVM "WR-VIC-Shoot.sqf";
        } forEach [s3001,s3002,s3006,s3004,s3005];
   // This is the code where the failed launch occurs
            [s3003] execVM "WR_VIC_Shoot2.sqf";
    };```
#

is this correct?

hallow mortar
sage heath
# hallow mortar Missing the line defining the launch position

whoops

// Specify your firing pos here, use getPosASL on a reference object, etc.
    private _firingPos = [0,0,0];
   {
        private _position = [_x] call BIS_fnc_gridToPos;
        for "_i" from 1 to 2 do {
            private _target = createVehicle ["laser_target_classname",_position];
            private _missile = createVehicle ["cruise_missile_classname",_firingPos,[],200,"FLY"];
            sleep 0.1;
            _missile setMissileTarget _target;
        };
    } forEach _this;
    
    // Trigger your SAM launch, idk how you implemented it
        [] spawn {
        {
            sleep (random 5);
            [_x] execVM "WR-VIC-Shoot.sqf";
        } forEach [s3001,s3002,s3006,s3004,s3005];
   // This is the code where the failed launch occurs
            [s3003] execVM "WR_VIC_Shoot2.sqf";
    };```
#

also

#

is it ok if i switch out the firing pos to anywhere on the map?

#

say my VLS is in 222,222,100 instead

#

i just plug that in correct?

hallow mortar
#

Yes

#

The missiles are created in a ~200m radius around the specified position to provide a nice spread

sage heath
#

good, TLAMs are usually programmed to come in from different directions to blindside enemy radars

#

also i have no idea what the classname for the cruise missile is

hallow mortar
#

ammo_missile_cruise_01, I believe

sage heath
#

btw i figured out how the mod works, it basically creates a UAV which is embedded inside the TLAM everytime one is fired, which allows for it to be shot at, so the base game classname should do(?)

#

if im reading the code right

hallow mortar
#

I don't know, maybe

sage heath
#

btw im testing it out now

#

btw does the code work with 8 digit grids?

hallow mortar
#

No idea. Grid-to-real is handled by a BIS function.

sage heath
#

rip @hallow mortar
sqf

// Specify your firing pos here, use getPosASL on a reference object, etc.
    private _firingPos = [15441,10577,203];
   {
        private _position = [_x] call BIS_fnc_gridToPos;
        for "_i" from 1 to 2 do {
            private _target = createVehicle ["ammo_missile_cruise_01",_position];
            private _missile = createVehicle ["LaserTargetE",_firingPos,[],200,"FLY"];
            sleep 0.1;
            _missile setMissileTarget _target;
        };
    } forEach _this;
    
    // Trigger your SAM launch, idk how you implemented it
        [] spawn {
        {
            sleep (random 5);
            [_x] execVM "WR-VIC-Shoot.sqf";
        } forEach [s3001,s3002,s3006,s3004,s3005];
   // This is the code where the failed launch occurs
            [s3003] execVM "WR_VIC_Shoot2.sqf";
    };```
#

wait

#

oh im dumb

#

i swapped the laser and cruise missile classnames

hallow mortar
#

Not the source of the error though

sage heath
#

on a plus side the s-300 works like a charm

hallow mortar
#

I'm thinking. I haven't spotted it yet.

#

oh I know what it is. Wacky output from BIS_fnc_gridToPos. Ugh.

#

Do you use CBA?

sage heath
#

i thoight that was a given XD

hallow mortar
#

Okay, instead of [_x] call BIS_fnc_gridToPos, use _x call CBA__fnc_mapGridToPos

#

That will provide a functional return, and also definitely works with whatever length of grid you like.

sage heath
#

sick

#
// Specify your firing pos here, use getPosASL on a reference object, etc.
    private _firingPos = [15441,10577,203];
   {
        private _position = [_x] call CBA_fnc_gridToPos;
        for "_i" from 1 to 2 do {
            private _target = createVehicle ["LaserTargetE",_position];
            private _missile = createVehicle ["ammo_missile_cruise_01",_firingPos,[],200,"FLY"];
            sleep 0.1;
            _missile setMissileTarget _target;
        };
    } forEach _this;
    
    // Trigger your SAM launch, idk how you implemented it
        [] spawn {
        {
            sleep (random 5);
            [_x] execVM "WR-VIC-Shoot.sqf";
        } forEach [s3001,s3002,s3006,s3004,s3005];
   // This is the code where the failed launch occurs
            [s3003] execVM "WR_VIC_Shoot2.sqf";
    };```
this should be correct
#

testing now

hallow mortar
#

Not [_x], just _x

sage heath
#

oops

#

shit

#

and thats why i send these code samples back XD

#

@hallow mortar i dont believe i see a cruise missile spawned, and its been about 90 seconds (usual flight time of the missiles) and one hasnt hit yet

#

ill wait a bit more

#

wait!

#

nope! they do spawn...but uhm

#

they're heading the wrong way

hallow mortar
#

Right, well, that's a start

#

I hoped they would be smart enough to lock on no matter the direction, since they can do vertical launch, but hey ho

#

Add this immediately before the setMissileTarget line:

            private _dir = _missile getDir _target;
            _missile setDir _dir;
            _missile setVelocityModelSpace [0,200,2];```
sage heath
sage heath
#
// Specify your firing pos here, use getPosASL on a reference object, etc.
    private _firingPos = [14681,10889,477];
   {
        private _position = _x call CBA_fnc_mapgridToPos;
        for "_i" from 1 to 2 do {
            private _target = createVehicle ["LaserTargetE",_position];
            private _missile = createVehicle ["ammo_missile_cruise_01",_firingPos,[],200,"FLY"];
            sleep 0.1;
            private _dir = _missile getDir _target;
            _missile setDir _dir;
            _missile setVelocityModelSpace [0,200,2];
            _missile setMissileTarget _target;
        };
    } forEach _this;
    
    // Trigger your SAM launch, idk how you implemented it
        [] spawn {
        {
            sleep (random 5);
            [_x] execVM "WR-VIC-Shoot.sqf";
        } forEach [s3001,s3002,s3006,s3004,s3005];
   // This is the code where the failed launch occurs
            [s3003] execVM "WR_VIC_Shoot2.sqf";
    };```
code check
hallow mortar
#

Yep

#

Even if they appear to head the right way, watch them all the way to the target. This will make them go the right way even if they don't lock, so you need to verify they do actually dive and hit on target.

sage heath
#

btw this is the code i put into the console

["12191270"] spawn TNRGN_fnc_missileStrike```
hallow mortar
#

Yeah you're invoking the function fine, it's obviously a valid position since they're going the right way

sage heath
#

but why arent they hitting...

hallow mortar
#

They're not acquiring the laser target.
They should be able to, since it's, you know, how they work...

sage heath
#

hmmm

hallow mortar
#

Try adding some sleep after setVelocityModelSpace and before setMissileTarget. At least 1, up to...most of whatever the flight time to target is (like 15 seconds before they arrive over the target)

sage heath
#

imma try 10

hallow mortar
#

oh uhhhh...this is going to cause each subsequent missile to be delayed by that much. That can be fixed later, just test the guidance on the first one for now.

sage heath
#

im just cycling through the numbers from 10 to 1 in descending order

#

this'll take a whiel

hallow mortar
#

Start at 10 and go higher if it doesn't work. The closer they get to the target before the setMissileTarget happens, the better the chances of successfully locking.

#

(If this is indeed the problem)

sage heath
#

flight time is about atleast 10 to max 16 seconds, thats from one end of the airfield to the other

#

nah, tried 10, 12, 14, thing just flew right by

#

the flight time to that target was 14 seconds

willow hound
#

In my experience, the laser target has to be on the data link for the entire flight duration. Otherwise the missile heads towards the laser target (or where it used to be) but it never attacks the target; just passes over it and continues in the direction indefinitely.
However, I only have experience with cruise missiles that were actually launched by a VLS, not created with createVehicle.

sage heath
hallow mortar
#

Can you add systemChat str missileTarget _missile; right after the setMissileTarget? And tell me what it says

sage heath
#

sure doing it now

willow hound
#

Ah and I also just remembered: Laser targets don't exist for long if they don't belong to a laser designator. Attach the laser target to something (and manually delete it once you no longer need it) to keep it from despawning automatically.

hallow mortar
#

How long is the sleep on that?

sage heath
#

14 seconds

hallow mortar
#

Okay, try it with like 1. The target could've despawned by then / missile could be too close

sage heath
#

gotcha

hallow mortar
#

If we can get a positive return on this, then the missile can do it but the target is despawning before it gets there, and that's an easy fix

willow hound
#

Yes, that's what I mean.

hallow mortar
#

That's probably the next missile

sage heath
#

yep

hallow mortar
#

Okay, so it seems like the missile can't remotely acquire laser targets, which is uhhhhhh a pain in the ass

#

You would think that a laser-guided missile would be able to have its target set to a laser target, using the dedicated target-setting command, but oh well

sage heath
willow hound
#

The VLS is just special πŸ˜›

sage heath
#

guess so

#

so what now

hallow mortar
#

I'm borrowing some of Marko's previous code to modify this to use a real VLS

#

Go ahead and place a VLS somewhere convenient, and give it a variable name

sage heath
#

πŸ‘€ already did

hallow mortar
#

actually I have this mostly done but can you do something for me first

#

change laserTargetE to laserTargetW and test it

sage heath
hallow mortar
#

If you can find it in the world and look directly at it with your man eyes, you can use typeOf cursorObject

#

If you have a rough idea of what it might be called, you can open the Config Viewer from the Editor tools menu and browse CfgVehicles for it

#

You can also try looking for the mod's functions in the Functions Viewer; if you can find where it's created, the classname will be there.

sage heath
#

also im in the mods config.cpp

hallow mortar
#

Then it would be in CfgAmmo

sage heath
#

would it be kosher if i post it here?

#

also

#

im not even sure if its a cruise missile

#

since the mod may work on the basis of attaching a target to a base game missile

sage heath
hallow mortar
#

I suspect it modifies the event handlers of the ordinary missile rather than introducing a new one

willow hound
sage heath
sage heath
hallow mortar
sage heath
sage heath
hallow mortar
#

well you're supposed to replace that with the actual variable name of your VLS (or change the name to that)

sage heath
#

OHHHHHHHHHHHHHHHHHHHHH

#

alright well now here's an actual error

hallow mortar
#

that's my fault

sage heath
#

its fine~

willow hound
hallow mortar
# sage heath its fine~
[TNRGN_veh_VLS,[_target]] remoteExec ["fireAtTarget",TNRGN_veh_VLS];```
I think you can figure out which line this replaces
sage heath
sage heath
#

but

#

i assume its like this?

/*
Function for causing a VLS to shoot at grid references. Hopefully.
To use: local execute in debug or execute code module. Specify grid refs as strings. Can be used more than once.
["123456","768910"] spawn TNRGN_fnc_missileStrike
*/

{    
    // Create target at position converted from grid
    private _position = _x call CBA_fnc_mapGridToPos;
    private _target = createVehicle ["LaserTargetW",_position];
    // Create a dummy object to attach the laser target and force persistence
    private _dummy = createVehicle ["Land_InvisibleBarrier_F",_position];
    _target attachTo [_dummy];
    sleep 1;
    // Make sure everyone knows about the target
    west reportRemoteTarget [_target,300];
    _target confirmSensorTarget [west,true];
    for "_i" from 1 to 2 do {
        [gunner TNRGN_veh_VLS,_target] remoteExec ["doTarget",TNRGN_veh_VLS];
        sleep 3;
        [gunner TNRGN_veh_VLS,_target] remoteExec ["fireAtTarget",TNRGN_veh_VLS];
        [TNRGN_veh_VLS,[_target]] remoteExec ["fireAtTarget",TNRGN_veh_VLS];
    };
    
    // Clean up targets and dummies after a reasonable delay
    [_target,_dummy] spawn {
        sleep 180;
        {
            deleteVehicle _x;
        } forEach _this;
    };
    
} forEach _this;

// Trigger your SAM launch
[] spawn {
    {
        sleep (random 5);
        [_x] execVM "WR-VIC-Shoot.sqf";
    } forEach [s3001,s3002,s3006,s3004,s3005];
};
// Oops!
[s3003] execVM "WR_VIC_Shoot2.sqf";```
hallow mortar
#

It's line 21. It looks different because it's showing it after going through the remoteExec.
And you did not replace the right one :U

sage heath
#

i was close, its line 22

#
/*
Function for causing a VLS to shoot at grid references. Hopefully.
To use: local execute in debug or execute code module. Specify grid refs as strings. Can be used more than once.
["123456","768910"] spawn TNRGN_fnc_missileStrike
*/

{    
    // Create target at position converted from grid
    private _position = _x call CBA_fnc_mapGridToPos;
    private _target = createVehicle ["LaserTargetW",_position];
    // Create a dummy object to attach the laser target and force persistence
    private _dummy = createVehicle ["Land_InvisibleBarrier_F",_position];
    _target attachTo [_dummy];
    sleep 1;
    // Make sure everyone knows about the target
    west reportRemoteTarget [_target,300];
    _target confirmSensorTarget [west,true];
    for "_i" from 1 to 2 do {
        [gunner TNRGN_veh_VLS,_target] remoteExec ["doTarget",TNRGN_veh_VLS];
        sleep 3;
        [TNRGN_veh_VLS,[_target]] remoteExec ["fireAtTarget",TNRGN_veh_VLS];
        [TNRGN_veh_VLS,1] remoteExec ["setVehicleAmmo",TNRGN_veh_VLS];
    };
    
    // Clean up targets and dummies after a reasonable delay
    [_target,_dummy] spawn {
        sleep 180;
        {
            deleteVehicle _x;
        } forEach _this;
    };
    
} forEach _this;

// Trigger your SAM launch
[] spawn {
    {
        sleep (random 5);
        [_x] execVM "WR-VIC-Shoot.sqf";
    } forEach [s3001,s3002,s3006,s3004,s3005];
};
// Oops!
[s3003] execVM "WR_VIC_Shoot2.sqf";```
#

lets give this a shot?

hallow mortar
#

I recommend not posting the whole thing here every time you change a couple of lines, it does clog up the channel. That's why I sent it as a file once it started getting large.

sage heath
#

ah sorry

#

HOLY SHIT HOLY MOLY SHIT @hallow mortar IT WORKS

hallow mortar
#

Outstanding

sage heath
#

πŸ₯³

sage heath
#

at this point

#

you deserve to see it

agile flower
#

Hello party people

Bit of weird one, please can anyone help:

(Abridged code)

InitPlayerLocal.sqf

player addAction ["Readbox", {
["Func\read.sqf"] remoteExec ["execVM",2];
}];

player addAction ["SaveBox", {
["Func\Save.sqf"] remoteExec ["execVM",2];
}];```

save.sqf
```SQF
containerIDs = [TOC_1]; // Define container/box variable names
vehicleIDs = []; // Define vehicle variable names

containerData = []; //Init storage array
vehicleData = [];

{
    _x params[ "_vehicle" ];
containerData pushBack [ _vehicle ];
    format ["%1", _vehicle] remoteExec ["hint", 0];
}forEach containerIDs;

profileNamespace setVariable ["TertioSavedContainers", containerData];

copyData = containerData joinString ", ";
copyToClipBoard copyData;```

read.sqf
```SQF
containerData = profileNamespace getVariable "TertioSavedContainers";

{
    _x params[ "_vehicleID" ];
    format ["%1", _vehicleID] remoteExec ["hint", 0];
    }forEach containerData;```

InitServer.sqf
```SQF
containerData = profileNamespace getVariable "TertioSavedContainers";
copyData = containerData joinString ", ";
copyToClipBoard copyData;
{
    _x params[ "_vehicleID" ];
    format ["%1", _vehicleID] remoteExec ["hint", 0];
}forEach containerData;```

When I action SaveBox I get hinted the variable name of the box as pegged out "TOC_1", and my clipboard data shows all of the stuff I want
When I action Readbox I get hinted the variableName of the box as saved to the profileNamespace var

**BUT** when I reload the mission, I get hinted <NULL-object> and my clipboard data shows <NULL-object> but shows the correct values in the rest of the array - why is this happening?
stark fjord
#

Ah so you gave up on spawned missiles and went for actual vls in the end πŸ™‚ ?

hallow mortar
#

It turned out the spawned missiles could not be manually given new targets. Why? It is a mystery.

stark fjord
#

I might add, i had issues with reportRemoteTarget and confirm sensor target. Was unreliable in multiplayer (it fired/didnt lock). My solution was to remote exec the whole shebang where vls was local.

#

No remote target was found by vls, when these commands were called on remote client

hallow mortar
#

urgh.

#

Line 16 and 17 replacement:

    [west,[_target,300]] remoteExec ["reportRemoteTarget",TNRGN_veh_VLS];
    [_target[west,true]] remoteExec ["confirmSensorTarget",TNRGN_veh_VLS];```
sage heath
#

btw @hallow mortar i put the S300 code in first, cause, realistically the S300 is gonna try and intercept and degrade the strike package milesssssssssss away, before that so how does that look?

#

cuz i put it in and uh

#

TLAMs never fired

willow hound
agile flower
#

Object

sage heath
#

also btw you would not believe this, when i initially started recording, no fewer than FOUR S-300 missile flew into a civilian village πŸ’€ and that was completely random, on the mod's part

hallow mortar
hallow mortar
#

Correct

sage heath
#

great!

hallow mortar
#

Consider your timing on this btw. In this layout, the SAMs will begin firing as soon as you execute the function. Presumably, the missiles won't be detected by air defence radar the exact second they launch, so if you tell the players "just launched" and the SAMs begin firing that exact second, that will seem odd. That was why it was originally the other way around, to give a delay (albeit not a very long one) between execution and when the SAMs detect the incoming and start to engage.

sage heath
#

then the sams launch

#

then the missiles hit

willow hound
sage heath
#

but honestly i could and probably would just put sleep ahead of that, but rn, i actually reduced the sleep 60 to 1 to expedite testing

#

@hallow mortar then this happened...

stark fjord
#

Put , after _target

agile flower
sage heath
hallow mortar
#

Yes. My fault again 🀦

agile flower
sage heath
#

the fact that this works

willow hound
agile flower
#

yes

#

correct

#

<NULL-object>

sage heath
#

ok so @hallow mortar there's an issue, the VLS refuses to fire if i put in too many targets, problem this is isnt even that many compared to what the op might look like

#

this is what i put in

["12251280,12231284,12151279,12171275,12271277,12191272,12291273,12141269,12221262,12171264,12061289,12031287,11991285,11961283,11921282,11861280,11791296"] spawn TNRGN_fnc_missileStrike```
agile flower
#

TertioSavedContainers contains [ "_vehicleID", "_vehicleType", "_vehiclePos", "_vehicleDir" ], all are maintained except the "_vehicleID"

hallow mortar
sage heath
#

oh

#

well thats why

#

OHHHH YEAH

hallow mortar
#

["12251280","12231284","..."]

sage heath
#

fuck

#

i see now

#

GOSH DARN IT

hallow mortar
#

Stay cool.

sage heath
#

yeah im cool just yelling in the absurdity of all this XD

#

i found it humorous honestly

stark fjord
#

Also you may wanna delay inputting another target before missile is away. Otherwise launcher might get confused.

Hey, you imagined this absurdity.

hallow mortar
#

There's a delay built in immediately after creating the laser target, which places it between firing and assigning next target in the loop. If it becomes an issue that can just be increased.

stark fjord
#

And also force hold fire on launcher, otherwise it will continue firing on known targets untill they are removed

#

Or it runs outta ammo

willow hound
# agile flower yes

Well, you store a reference to a specific object in the profileNamespace. However, the original TOC_1 object no longer exists once you restart the mission. Instead, a new object of the same type and with the same variable name is created.
Thus, the reference that was stored in the profileNamespace is no longer valid, i.e. it no longer points to a valid object.
Do you understand what I mean?

agile flower
#

gotcha

#

Ooof this is gonna be interesting then

#

Back to the drawing board here.

sage heath
# hallow mortar `["12251280","12231284","..."]`

ok well, im either dumb or blind cuz i punched this in

["12251280","12231284","12151279","12171275","12271277","12191272","12291273","12141269","12221262","12171264","12061289","12031287","11991285","11961283","11921282","11861280","11791296"] spawn TNRGN_fnc_missileStrike```
still nothing
#

grids are all solid too

hallow mortar
#

Does it work if you only put one or two in?

sage heath
#

yes

#

im just gonna bench mark it

#

see how high it could go

hallow mortar
#

I don't know why it would be different for larger arrays of targets. It iterates through sequentially, so even if it was getting lost or confused it should get through the first few before that happens.

#

If something was completely broken by having multiple targets, it should be just as easily be broken by having 2 as by having 20.

sage heath
#

wait…

#

ok i probably made a typo somewhere cuz suddenly it worked

#

btw @hallow mortar would it be possible to randomise the number of missiles fired? to simulate the potential number the S-300 could intercept, im thinking of randomizing it to anywhere from 1-4

hallow mortar
#

Line 29: for "_i" from 1 to (round random [1,3,5]) do {

sage heath
#

enjoy

sage heath
agile flower
# willow hound Well, you store a reference to a specific object in the profileNamespace. Howeve...

Here we go:

save.sqf

containerIDs = [TOC_1]; // Define container/box variable names
vehicleIDs = []; // Define vehicle variable names

containerData = []; //Init storage array
vehicleData = [];

{
    _x params[ "_vehicle" ];
_vehicleID = vehicleVarName _vehicle;
containerData pushBack [ _vehicleID ];
    format ["%1", _vehicle] remoteExec ["hint", 0];
}forEach containerIDs;

profileNamespace setVariable ["TertioSavedContainers", containerData];

copyData = containerData joinString ", ";
copyToClipBoard copyData;```

InitServer.sqf
```SQF
containerData = profileNamespace getVariable "TertioSavedContainers";
copyData = containerData joinString ", ";
copyToClipBoard copyData;
{
    _x params[ "_vehicleID" ];
    _vehicle = call compile _vehicleID;
    format ["%1", _vehicle] remoteExec ["hint", 0];
}forEach containerData;```


Done and working
sage heath
#

wait

#

ooh i see where i fucked up

willow hound
agile flower
#

I see what you mean, however I am compiling the first element of an array, and it is the array that is the namespace variable,

The vehicleID is not the namespace variable itself.

sage heath
#

@hallow mortar ok everything looks to be working now fully, no errors, and operational, i'd like to thank you, so so much man, thank you!

hallow mortar
#

You're welcome

pastel crater
#

Hello, I'm using call BIS_fnc_infoText to make a small intro message for my mission

#

Is there any way in which I can modify the text size, font and others through this?

#

or in the other hand what other functions could I use to make cool mission intro texts?

stark fjord
#

And you could animate it i guess

molten yacht
#

Can anyone give me even a passing example of the correct syntax to RemoteExec a createDiaryEntry?

#

The wiki has many examples of how to invoke it locally but I need it globally for coop.

stark fjord
#

I mean, you could do that. But you are sending shitloads of text over net for no reason.

#

Suggest you use cfg function and define all parameters there. If you dont wanna mess with cfgFunctions you could use initPlayerLocal.sqf and define function over there eg.: my_unique_function = { player createDiaryRecord [...]; //your parameters };

And then when you wanna add record, use
[] remoteExec ["my_unique_function", [0, -2] # isDedicated, true];

molten yacht
#

okay, so, hm

stark fjord
#

But if you really wanna remote exec then { [_x, [subject, text, task, taskState, showTitle]] remoteExec ["createDiaryRecord", _x]; } forEach allPlayers;

molten yacht
#

does this unique function support sleep?

#

like is it scheduled even though remoteexec isn't scheduled

stark fjord
#

Yes

molten yacht
#

okay cool

stark fjord
#

RemoteExec is

molten yacht
#

so basically I need to take my current intel.sqfs and transpose them into functions

#

and I could somehow include them from initPlayerLocal

#

so they can be in their own file

#

thanks again marko

#

I think that's all the puzzle pieces

#

ok almost all of them

#

can I somehow have cfgFunctions just be its own file or does it need to be physically inside of description.ext

#

I need to do the same with respawninventories at this point tbh

granite sky
#

You can #include anything from description.ext.

stark fjord
#

You could make it into one function that can add all eg: my_unique_function = { params["_s"]; switch (_s) do { case 1 : { player createDiaryRecord [...]; //your parameters }; case 2: .... };
[1] remoteExec ["my_unique_function"...

#

This will add first record to player when called

#

[2] will add second and so on

#

And yes you can include in description.ext, so make a new file, like CfgFunctions.hpp
That contains class CfgFunctions {...
Then in description.ext do #include CfgFunction.hpp
Or you could fragment it further, eg each tag in separate file. (Filename doesnt matter)

molten yacht
#

hpp instead of sqf?

stark fjord
#

Wait are you trying to include into sqf?

hallow mortar
#

description.ext is a config file (vaguely similar to C++) not an SQF script file, so it (and files included into it) don't use the .sqf file type

molten yacht
#

I'm not trying to do anything yet.

#

Okay.

#

That makes sense.

#

I'm gathering as much info as I can before I do anything.

stark fjord
#

This will only work for includes into description. Im not sure you can include into sqf without some sort of precompiler.
Please dont include sqf scripts into description

molten yacht
#

So, if I have, say

JES_intel_secSysDone = {
jesterDummy sideChat "Uplink Established to Security System.";
sleep 3;
jesterDummy sideChat "Security archives downloaded.";
}``` and 4 other basic commands like that inside of **`configIntel.hpp`**

I can just `#include scripts\configIntel.hpp` and have remoteExec `JES_intel_secSysDone` work?
stark fjord
#

Ah. No

molten yacht
#

You can see I'm having troubles from my experience in other script languages, I'm having to suss out equivalent acts with things I already know

stark fjord
#

I meant the includes of cfgFunctions etc.
With what you are doing you could use compile, and make them sqf again

hallow mortar
#

You use CfgFunctions to define functions as described here: https://community.bistudio.com/wiki/Arma_2:_Functions_Library
The actual function code is located in sqf files, and CfgFunctions tells the game how to detect and handle those files.
The use of #include would be so you can have your CfgFunctions in a separate file to description.ext, purely for ease of logistics and tidiness.

molten yacht
#

Okay. Hm.

#

Any way to have mulitple/modular cfgFunctions?

#

one for the intel functions, one for the other functions, etc

stark fjord
#

Ye, new tag

hallow mortar
#

You can't have multiple CfgFunctions, but you can have multiple categories within it

stark fjord
#

The way you did it you could put compileScript ["my_func1.sqf"]; etc into initPlayerLocal.sqf

#

But i suggest learning the cfgFunctions way

hallow mortar
#

So in description.ext you might have something like this:

class cfgFunctions
{
  #include "taskFunctions\config.hpp"
  #include "eventFunctions\config.hpp"
};```
and each of those files would contain tag, category etc layers of function config
#

So sorry, I just realised I linked the A2 functions page by mistake

stark fjord
#

And that way you also have scripts separated by files

#

And you dont have to do my_unique_function ={.. as cfgFunctions will append tags to them anywho

hallow mortar
stark fjord
#

Go finger... you are right

SQF script - parsed when preprocessFile, preprocessFileLineNumbers, compileScript or execVM is used.

hallow mortar
#

Interesting factoid: I don't believe #include actually cares what the file type of the included file is, as long as it's readable as plain text. It's treated as if it was part of the main file. So you can #include .txt files and they'll work fine. Using the right file types for things that are going to be included is mostly just for your IDE/syntax highlighting.

stark fjord
#

That is true, but its nice to stick to format. I just warned ash not to include sqf into description. Not cause of extension but well... sqf wont fare well in there.
I did mention file can be named anything.

hallow mortar
stark fjord
graceful juniper
#

How do I change this to _unit setVariable ["ACE_Medical_MedicClass", 1, true]; to MenuObj addAction would I do
MenuObj addAction {"Give Medic Perms", _unit setVariable ["ACE_Medical_MedicClass", 1, true}];

stark fjord
#

You kinda screwed up the whole syntax of addAction

But menuobj addAction ["blah", {params["_obj"]; _obj setVariable ["ACE_Medical_MedicClass", 1, true];}];
Also suggestion, you could use ace menu instead of addaction

graceful juniper
#

whats the ace menu code?

graceful juniper
stark fjord
#

Google shall answer your thirst for knowledge

graceful juniper
#

Thank you kind sir

molten yacht
#

this is fascinating.

molten yacht
#

uh, question actually

#

if there's guaranteed to be a unit named jester, can I have the command jester sideChat "Stand by..."; inside of a function?

#

or is there a scoping issue or something

stark fjord
#

Ye.

molten yacht
#

Okay cool.

#

Later on I'll make a better function that takes the target unit as the speaker but this'll do for now.

#

Hmm. And now I wonder if anyone has a good progress bar script for showing unobtrusively on the HUD

#

as opposed to holdaction or the ace style where the progress bar is front and center

#

Ready I'd just love to combine Endgame's progress bar with my timer

gaunt tendon
#

Anyone know how can I get the logo of the mod to which a weapon belongs?

stark fjord
#

Check how ace arsenal does it

stark fjord
#

Why no?

molten yacht
#
intel_securityDone = {
    jesterDummy sideChat "Uplink Established to Security System.";
    sleep 3;
    jesterDummy sideChat "Security archives downloaded."; }

Gives:

#

it thinks there should be a = instead of sideChat

#

unless I'm just calling it wrong

stark fjord
#

If u are using cfg functions u can drop intel_securityDone = {

#

And that is unconnected to your global variables jester and jesterDone. Unless they are simple objects in editor they are synced to all clients

#

Also issue is in cfgintel.hpp not the sqf script

molten yacht
#

I'm doing something wrong then

#

Lemme define things for you more properly

stark fjord
#

Define away

molten yacht
#

description.ext: sqf class CfgFunctions { class AID { #include "scripts\cfgIntel.hpp" }}

cfgIntel.hpp's content: ```sqf
class JesterIntel {

intel_securityDone = {
jesterDummy sideChat "Uplink Established to Security System.";
sleep 3;
jesterDummy sideChat "Security archives downloaded."; }
intel_cdcServerStart = {
jesterDummy sideChat "Beginning download from research server...";
// Implement countdown / modem script
}
intel_cdcServerDone = {
jesterDummy sideChat "Research archives successfully downloaded.";
sleep 3;
jesterDummy sideChat "Stand by..."; }
}```

#

I'm implementing this hpp wrong

#

probably because I want to treat them like very simple code blocks when they're not

stark fjord
#

Oh... you did what i said please dont do. You are including sqf script into description ext πŸ˜‰

molten yacht
#

Right, I need a degree of seperation here...

stark fjord
#

No, you need a degree of definition πŸ™‚

molten yacht
#

well yeah that's what I meant :P

#

I see what I"m doing wrong I think

#

yeahhh here it is on the wiki

#

ok

#

I didn't want every function to have to be a seperate SQF is my thing

#

but it looks like it has to be?

#

and then I call those files one at a time in cfgFunctions

stark fjord
#

Yes and no.

#

Since im on the phone and cant type it out, well can but wont. Lets say yes.

molten yacht
#

better to just enforce the structure

stark fjord
#

First you wanna define file="path\to\script\folder"; in 2nd line of intel.hpp

molten yacht
#

file = "scripts\intel"; aye?

stark fjord
#

And then place the scripts in that folder, calling them fn_<functionname>.sqf

molten yacht
#

okay can do

stark fjord
#

Then line 3 of intel.hpp etc
You add class <functionname> {};
(Note do not add fn_ at the front or .sqf extension)

#

And inside .sqf file drop the function = {code} just do code

#

You can later execute said function by AID_FNC_<Functionname>

gaunt tendon
drifting sky
#

Question: Is there a way to quickly get the number of rounds remaining in a mag currently loaded in a muzzle?

warm hedge
#

Not a efficient way, but probably getUnitLoadout or similar commands. I think we want that straightforward command, though

digital hollow
#

weaponState is probably best

warm hedge
#

Oh forgot was a thing

drifting sky
#

closest weaponstate seems to have is if the unit happens to be currently reloading

drifting sky
shut carbon
#

weaponState then πŸ˜›

frigid oracle
#

How can I check if saveloudout is on in a mission?

warm hedge
#

What saveloadout? Campaign you mean?

frigid oracle
#

whoops the thing from eden enhanced I think.

#

but in general anything that saves loadout on respawn, is it possible to detect?

warm hedge
#

3den Enhanced? Haven't used much so...

drifting sky
drifting sky
# digital hollow Syntax 3

My bad, I thought we were talking about currentMagazineDetail, and thanks I didn't spot the ammoCount in weaponState's return value.

tough abyss
#

_allExtractionLocations must be an array of strings. Markers are strings, not positions

#

If that really is an array of positions you could do:

{
    private "_marker";
    _marker = createMarkerLocal [format ["my_marker:%1", _forEachIndex], _x];
    _marker setMarkerTypeLocal "mil_Pickup";
} forEach _allExtractionLocations;

Hard to tell with only one line of code.

silver rampart
#

Does anyone know the reason why player keep losing their main weapon but they kept their arsenal loadout after respawn with ACE?

This is what i'm using based on multiple threads on Bohemia and Reddit:
onPlayerKilled.sqf
player setVariable["Saved_Loadout", getUnitLoadout player];

onPlayerRespawn.sqf
removeAllWeapons player; removeGoggles player; removeHeadgear player; removeVest player; removeUniform player; removeAllAssignedItems player; clearAllItemsFromBackpack player; removeBackpack player; player setUnitLoadout(player getVariable["Saved_Loadout",[]]);

how to produce:
Enable the ACE Spectator and Vanilla Spectator will cause the main weapon not spawned with the player after death.

tough abyss
#

Keep in mind that all marker names must be unique since they are always referenced by that name.

stark fjord
silver rampart
stark fjord
#

Hmm, check addon settings. It might be there now

silver rampart
#

still not working, return me back to default loadout instead of custom one.

still forum
jade acorn
#

how can I render the "bounding box"? or however you call the cuboid showing up when you select an entity in Eden. I'm looking for a more convenient way of highlighting stuff pickable by players during scenario

little raptor
#

By drawing the lines using drawLine3D

meager granite
# jade acorn how can I render the "bounding box"? or however you call the cuboid showing up w...

Here is a snippet I use for debug purposes. Probably can be optimized for use during gameplay, for example you can cache results and drop the cache if getPosWorld&vectorDir&vectorUp changed.

#define MTV(XX,YY,ZZ) _veh modelToWorldVisual [XX,YY,ZZ]

private _color = [0,0,1,1];
private _veh = _x;
private _bb = 0 boundingBoxReal _veh;
_bb select 0 params ["_x", "_y", "_z"];
_bb select 1 params ["_xx", "_yy", "_zz"];

drawLine3D [MTV(_x,_y,_z), MTV(_xx,_y,_z), _color];
drawLine3D [MTV(_x,_y,_z), MTV(_x,_yy,_z), _color];
drawLine3D [MTV(_x,_y,_z), MTV(_x,_y,_zz), _color];

drawLine3D [MTV(_xx,_yy,_z), MTV(_x,_yy,_z), _color];
drawLine3D [MTV(_xx,_yy,_z), MTV(_xx,_y,_z), _color];
drawLine3D [MTV(_xx,_yy,_z), MTV(_xx,_yy,_zz), _color];

drawLine3D [MTV(_xx,_y,_zz), MTV(_x,_y,_zz), _color];
drawLine3D [MTV(_xx,_y,_zz), MTV(_xx,_yy,_zz), _color];
drawLine3D [MTV(_xx,_y,_zz), MTV(_xx,_y,_z), _color];

drawLine3D [MTV(_x,_yy,_zz), MTV(_xx,_yy,_zz), _color];
drawLine3D [MTV(_x,_yy,_zz), MTV(_x,_y,_zz), _color];
drawLine3D [MTV(_x,_yy,_zz), MTV(_x,_yy,_z), _color];
jade acorn
#

nice, thanks. I thought there might be a little less complicated function since it's used in editor already

#

I cannot find any info on how to remove them, do they disappear when _veh does not exist anymore? Is there a cap on how many can I have them?

meager granite
#

drawLine3D only draws for a single frame, you have to do it each frame

#

In Draw3D MEH

jade acorn
#

right

warm hedge
#

This kind of things should be a BIS function IMO

meager granite
#

Engine function rather

#

drawBoundingBox [POSITION, BBOX, COLOR]

#

drawBoundingBox [getPos _vehicle, 0 boundingBoxReal _vehicle, [1,0,0,1]]

paper ridge
#

Howdy @digital hollow & @south rivet, apologies for the ping but I've searched and searched and I'm stuck in a rut here and was wondering whether you two could assist based on the conversation here: #arma3_feedback_tracker message

I'm looking to disable the pilotcamera in jets as described previously here: #arma3_scripting message

There's some info about getting into pilotcamera or setting the FOV but nothing I could find about disabling it. Would the functionality spoken about in your linked conversation in a future update be able to do achieve something like this? Or would it already be possible by scripting (ie not having to delve into the config).

pulsar bluff
#

@meager granite i requested a drawboundingbox function not too long ago

#

its so needlessly tricky but so useful and commonly required

meager granite
#

Yep, no reason not to have these functions not exposed to SQF

pulsar bluff
#

drawline3d in SQF probably isnt the right tool for it either

#

inefficient

#

how many lines, 12 or something

jade acorn
grim pasture
#

does a continue inside a while loop skip the check of the while condition?

sullen sigil
#

no it skips the current iteration of the loop

#
while cond do {
  if ((round time)%2 isEqualTo 0) then {systemChat "oops"; sleep (0.5); continue};
  systemChat "hi im a loop";
  sleep(0.5);
};```
#

will skip the current iteration if time is divisible by 2 with no remainder

grim pasture
#
while { ( _cityOwner == ( _city getVariable "owner" ) ) && ( count ( _city getVariable "attackingSides" ) != 0 ) } do {
    private _thisList = list _thisTrigger;
    if ( ( count _thisList == 0 ) || ( ( _camp getVariable "currOwner" ) countSide _thisList > 0 ) ) then { sleep 0.1; continue; };

    private _attackingSides = _city getVariable "attackingSides";
    _attackingSides pushBackUnique _cityOwner;
    {
        if ( _x countSide _thisList > 0 ) then {
            systemChat str _thisList;
            _camp setVariable [ "currOwner", _x ];
            private _campMarker = _camp getVariable "marker";
            if ( !isNil { _campMarker } ) then {
                private _markerType = switch ( _x ) do {
                    case west: { "b_installation" };
                    case east: { "o_installation" };
                    case independent: { "n_installation" };
                    default { "u_installation" };
                };
                _campMarker setMarkerTypeLocal _markerType;
                _campMarker setMarkerColor ( [ _x, true ] call BIS_fnc_sideColor );
            };
        };
    } forEach _attackingSides;
    sleep 0.1;
};```

this loop only terminates when it's not encountering the continue, even if the condition returns false
I know for a fact that the condition is false because I have the same script run at the same time using different variables (the ones in the condition are the same though)
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

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

pls

grim pasture
#

sorry, don't post code very often

#

I just don't see why the loop doesn't terminate either way
the only explanation I could come up with so far is that continues skip condition checks but the wiki doesn't say anything about it and I'd assume that would be something known

sullen sigil
#

put a systemchat before the continue and see if it chats anything

grim pasture
#

seems like it has nothing to do with the continue
I'm probably just unintentionally changing my condition
thanks for now, maybe I'll be back once I know where my actual problem is and still can't fix it

sullen sigil
#

how are you spawning the code and are you passing the correct variables into it

grim pasture
#

I think I found the issue

private _attackingSides = _city getVariable "attackingSides";
_attackingSides pushBackUnique _cityOwner;

this line in the loop was changing my condition so that it would never return false
I passed the correct variables, I just wasn't aware that the pushBackUnique would also change the original variable in _city

#

yup, that was the problem

private _contestingSides = [ _cityOwner ];
_contestingSides append ( _city getVariable "attackingSides" );

changed it to this and now it works
thanks

digital hollow
paper ridge
#

Also, thanks for the reply!

jovial belfry
#

Hi
I'm trying to get the icons to work in my inventory
To explain exactly what I mean, it's the icon you issue in your inventory in I.

little raptor
#

What is the issue?

jovial belfry
little raptor
#

How do you show it?

jovial belfry
distant egret
#

I think he wants to see the code you are using.

jovial belfry
# little raptor How do you show it?
        {
            mass=20;
            uniformmodel="sf\sf1.p3d";
            modelSides[]={3,1};
            armor=75;
            passThrough=0.5;
            ace_hearing_protection=0.75;
            ace_hearing_lowerVolume=0.15000001;
            hiddenSelections[]=
            {
                "camo",
                "camo2",
                "camo3",
                "camo4",
                "camo5"
            };
            hiddenSelectionsTextures[]=
            {
                "sf\tex\SF_Body_Blk.paa",
                "sf\tex\SF_NVG_Base_blk.paa",
                "sf\tex\SF_rail_blk.paa",
                "sf\tex\AMP_P1_blk2.paa",
                "sf\tex\AMP_P2_blk2.paa"
            };
            hiddenSelectionsMaterials[]=
            {
                "sf\data\SF_Body_nohq.paa",
                "sf\data\SF_NVG_Base_nohq.paa"
            };
            picture="sf\tex\logo.paa";
            class HitpointsProtectionInfo
            {
                class Head
                {
                    hitpointName="HitHead";
                    armor=75;
                    passThrough=0.5;
                };
            };
        };```
south swan
sullen sigil
#

already asked about getting that irritating thing changed but was told too much work for too little reward

supple matrix
#

Does anybody have a working example for a DLL extension, which doesn't require Visual Studio?
I found something in Go, but it makes the game crash, because the code is obviously outdated.

stark fjord
#

Ugh i once recompiled exdb3 for 64bit on linux using gcc. But i guess you need it for windows

supple matrix
#

yeah, primarily for Windows, but gcc should be fine, no?

stark fjord
#

It should i guess

pastel pier
#

Anybody know how to script a nuke UXO with gm? Is it possible?

warm hedge
#

Nuke UXO... like, the rocket but that is stuck on the ground?

stark fjord
astral bone
#

"Code on unit created" in civilian presence, if it returns false, does the unit not get created?

gentle fjord
#

to be fair if the bomb/warhead landed in such a way that it damaged the trigger mechanism in such a way that it is sensitive to vibrations - it could be set off by foot steps I imagine

#

not that I have any knowledge of nuclear weapons trigger mechanism

#

rule of cool for sure though

proven charm
astral bone
#

ah yes, it seems triggers and synchronizing might do waht I want xD

proven charm
#

it's called after the civilian is already created

pastel pier
astral bone
#

or not-

south swan
#

tacops notlikemeow

#

allPlayers select {_x distance _pos < 50 || {(_x distance _pos < 150 && {... from relevant function code notlikemeow

#

only uses special unit classes with redefined fsm properties notlikemeow

#

_unit spawn (_module getVariable ["#onCreated",{}]); and only spawn the provided code after the unit has been created

stark fjord
torpid mica
#
PCA_fnc_targetFinding = {
params ["_grp"];
_groupTarget = _grp getVariable ["PCA_groupTarget", ""];
_index = 0;
if (_groupTarget == "") then 
    {
        for "_i" from 0 to count sortedArrayBlu do
            {
                _target = sortedArrayBlu select _i;
                _trigger = _target select 7;
                _connectedGroups = _trigger getVariable ["PCA_connectedGroups", []];
                _noConnectedGroups = count _connectedGroups;
                if (_noConnectedGroups < attacking_squads) then
                    {
                        _connectedGroups pushBack _grp;                         
                        _grp setVariable ["PCA_groupTarget", _target];
                        _target
                        break;
                    };
            }
    };

};

i want to break the for loop (and the whole function) if the condition is met and i also want to return the _traget... what would be the right wa to do this?

sage heath
#

btw update from last night, to simulate time on target tlam attacks, i simply just doubled the script and maybe more so 2 maybe will do 4 vls will fire at the same time, which means no fewer than 2 targets will be hit at the same time

granite sky
#

@torpid mica Well, there is breakWith.

#

Your for loop is overshooting by one element though.

#

Generally you want to use forEach for that.

proven charm
#

@torpid mica ```sqf
scopeName "func"; // first line of the function
_target breakOut "func"; // exit the function

#

just a one way to do it

granite sky
#

In this case there isn't any more function afterwards so you don't really need it here :P

proven charm
#

ya whatever you prefer

#

don't forget to return a default value

torpid mica
#

thank you very much πŸ™‚

torpid mica
#

when i have an endless loop which cycles all elements of an array and i add elements to this array will they also be available in the endless loop?

still forum
#

yes

#

probably.. depends on how you loop, but most likely yes

#

Show code as example if you want a sure answer

torpid mica
still forum
#

if you pushBack into bluGroups, it would loop over the new values too yes
even if you do it inside the forEach loop

little raptor
#

if you do it inside the forEach loop
if it's not controlled you'll have an infinite forEach on your hand... meowsweats

#

in this case since it's a global variable you don't need pushBack

#

(and it could be dangerous if it's not done carefully as I said)

torpid mica
#

it seems like iΒ΄m doing something wrong with pushBack:

if (count _groupTarget == 0) then 
    {
        for "_i" from 0 to count sortedArrayBlu do
            {
                _target = sortedArrayBlu select _i;
                _trigger = _target select 7;
                _connectedGroups = _trigger getVariable ["PCA_connectedGroups", []];
                _noConnectedGroups = count _connectedGroups;
                hint str _connectedGroups;
                if (_noConnectedGroups < attacking_squads) then
                    {
                        _connectedGroups pushBack _grp;                         // for groupDeletion do _connectedGroups = _connectedGroups - [_grp];
                        _grp setVariable ["PCA_groupTarget", _target];
                        breakWith _target;
                    };
            };

    }
    else 
    {
        _groupTarget
    };

};

this code runs several times. on the first run _connectedGroups = [], but on the second iteration it should be _connectedGroups = [_grp].... but it is still empty... why?

still forum
#

If the array was empty at the start, it won't be written into the trigger after you pushBack

#

You need to setVariable it back onto the trigger because getVariable doesn't create the variable if it doesn't exist

#

Technically you only need to set if it didn't exist yet.. but it's easier for you to just always set it

torpid mica
#

is it possible to delete a specific entry from that array with _connectedGroups = _connectedGroups - [_grp]; when _grp is already saved in there?

still forum
#

Yes, but then you HAVE to setVariable definitely

#

Alternative, pushBackUnique? If you want to prevent duplicates

torpid mica
#

ok thank you very much i will try to implement everything into my code...

tough geode
#

Is there a way to refer globally to the squad logo of a unit? I would like to use the logos in setObjectTextureGlobal but as squadParams only return the local path to the file that doesn't help. As the game is able to set the squad logo on every client when someone get's into a vehicle shouldn't there be a way to do the same?

digital hollow
#

hmm. spitballing here, can you getObjectTextures check the selection?

tough geode
#

Haven't tried it yet but i suppose it only would return the local path again but let me try real quick^^

#

Nope getObjectTextures don't return the squad texture

still forum
#

I'd say no

tough geode
#

Mhh not sure if applying it on each client locally would be worth the effort. Thought there may be a mechanism to refer to the squad files without getting the file path on each client :/

turbid crag
#

Is there any way to get what value was set withsetPlayerRespawnTime?
playerRespawnTime returns it, but only if the player is dead. I need a way of getting the current respawn time a living player, because I was to temporarily set the respawn time very high, then revert it back to what it was previously.

I will make a FT if there is no way to currently achieve this.

agile flower
#

hey gang

#

everyContainer

#

Can I use this on players?

#

doesn't appear to work

sharp grotto
#

nvm you can

_ListOfContainersInBackpack = everyContainer (backpackContainer player);
agile flower
#

yeah, player is vehicle right

#

thanks for your help though

sullen sigil
#

backpack or vest container

agile flower
#

Thanks will, however query answered like 2 hours ago. thanks for response though.

drifting sky
#

Question: With preprocessor command #if, what kinds of things can be used as conditions there?

drifting sky
granite sky
#

It's not really working with variables at all.

#

You might do something like this, for example:

#define MYVERSION 3

...

#if MYVERSION >= 2
   //some code here
#endif
#

preprocessor replaces later instances of MYVERSION with 3

#

I assume it only allows simple numerical comparisons.

meager granite
#

Is there much overhead when you assign first variable (setVariable) to an entity? As in does it initialise the variable space somehow or are they already initialised alongside the entity? Talking about shots more specifically, I noticed that you now can do setVariable even on bullets (I think you previously couldn't?), so I'm wondering if I should do setVariable on them or use them as a key in some hashmap instead (str _projectile for a key). Not sure if I can measure it with diag_codePerformance easily, thus my question in case somebody has engine insight.

stable dune
#

Hello,
How do I check is DLC loaded when building mission.
If I have 4 different textures and i have ability to change color of canister if DLC orange is avaible. I can do this in config or in function doesn't matter, what is easiest way, that I would use.

meager granite
#

getAssetDLCInfo ["C_IDAP_UAV_06_F", configFile >> "CfgVehicles"] => [true,true,true,true,"571710","Arma 3 Laws of War"]

#

[isDlc, isOwned, isInstalled, isAvailable, appID, DLCName]

#

So in total:

private _is_orange_installed = getAssetDLCInfo ["C_IDAP_UAV_06_F", configFile >> "CfgVehicles"] select 2;
warm hedge
#

What do you mean by "available"?

meager granite
#

Yeah, isn't this DLC always preloaded even if you don't own it?

stable dune
#

Does it? Haven't test. I have two accounts I have current dlc on both so I cannot test without .
I use settexture object global, there I saw path to other textures is in orange dlc.
If that is preloaded , does that mean I can use textures without owning current dlc?

warm hedge
#

Everyone has every data from First-Party DLCs (besides Contact)

#

Owning a DLC just "unlocks" it

stable dune
#

Aa, awesome. Didn't know this. So I do not need to check is DLC loaded/ owned, right?

warm hedge
#

If the intention is just to access an paa, no

stable dune
#

Yes.

#

Thanks alot guys

warm hedge
#

Ah yes I mean, yes

#

Japanese speaker English sometimes do this, disregard

granite sky
#

Technically users can uninstall DLC by unticking boxes in Steam. It's all installed by default.

warm hedge
#

Can we remove one through that nowadays?

granite sky
#

hmm, maybe it doesn't actually get rid of anything when you do.

#

Ah yeah, it'll even redownload if you untick, delete & verify.

#

So I guess you can assume existence of DLC.

wind hedge
south swan
#

and what was different before?

#

ah, no auto download meowsweats

#

or just no auto-load? πŸ€”

warm hedge
#

Of course not..

drifting sky
#

Question: Is there any way to get the height of the nearest surface under a position? Whether it be a terrain surface, or an structure surface (such as building)

drifting sky
south swan
#

Return Value: Array of intersections in format [[intersectPosASL,... uhm?

thorny osprey
#

What is the easiest way to get a profile of all scripts executing? Looking for a sum of execution times per script, to learn what mods are causing slowdowns.

gaunt tendon
drifting sky
south swan
#

and i still don't really understand the problem blobdoggoshruggoogly

drifting sky
south swan
#

so you can just run lineIntersectSurfaces [[_xpos, _ypos, _zpos], [_xpos, _ypos, 0]]; to raycast straight down and get the first intersection (with maybe selecting non-default LOD or applying some fitting logic to result selection), no?

drifting sky
south swan
#

"height" from what

drifting sky
#

basically i'm trying to figure out what vertical clearance there is between the surface and the position, whatever surface is immediately below a position.

south swan
#

height of the starting position to the intersection - you subtract their Z coordinates πŸ€·β€β™‚οΈ

drifting sky
south swan
#

Return Value: Array of intersections in format [[intersectPosASL,...

drifting sky
#

OOps. I'm used to seeing the return value listed near the top of the article. My bad.

still forum
meager granite
#
_projectile setVariable ["stuff", [1,2,3]];
```vs
```sqf
projectilesHashMap set [str _projectile, [1,2,3]];
```which is one more command
still forum
#

setting the first (and only) variable on projectile will use more memory, but so little that you shouldn't care

meager granite
#

Gonna do that for each and every Fired local projectile in the game 😬

still forum
#

good luck

little raptor
#

btw do projectiles have object IDs?

#

I don't remember

meager granite
#

They do, thus str _projectile being unique, it has ID there

little raptor
#

(as in getObjectID)

meager granite
#

no netid though

little raptor
meager granite
#

Yeah, getObjectID returns just the number, gonna use it instead of str then

south swan
#

no automated cleanup with single global hashmap, though

meager granite
#

diag_codePerformance returns same execution time for both though

meager granite
little raptor
still forum
#

as here you even need to measure single-run performance

#

Oh I mean for projectile setVariable, witht he single run

with str vs objectId its probably also so low difference that the old profiling cannot measure it with its millisecond precision

south swan
#

getObjectId also seems reverse-able with position nearestObject typeOrId notlikemeow

meager granite
#

Did 100 copy pasted str and 100 copy pasted getObjectID in a row (no for), still about the same πŸ€”

still forum
#

[
diag_codePerformance [{str player}, nil, 10000],
diag_codePerformance [{getObjectId player}, nil, 10000]
]

[[0.00091146,10000],[0.00042464,10000]]

meager granite
still forum
#
[
diag_codePerformance [{str player}, nil, 1000],
diag_codePerformance [{getObjectId player}, nil, 1000]
]

Current Arma: [[0.001,1000],[0.001,1000]]
Next profiling/dev: [[0.0008925,1000],[0.0004305,1000]]

meowawww

quiet geyser
#

Running into an issue where ALiVE is virtualizing artillery shell UAV classnames created by ITC. This is an issue as that means the shells never land. The current script we've got (which is meant to exclude this class from virtualization) is running on initServer.sqf. We've got a headless client as well but I don't think that should affect things. Just to sanity check that the script is written correctly, this is how it is currently:

_vehicle setVariable ["ALIVE_profileIgnore", true];
}, nil, nil, true] call CBA_fnc_addClassEventHandler;```
Is this formatted properly?
sullen sigil
#

is itc_land_shell_b the classname of what is actually created when fired

manic sigil
#

Im working on a script that captures a helicopters flight path in a series, then on command places simulation-disabled copies in position along the path. Its intended to help display to new fliers the different methods and approaches available to landing, as a review tool, etc.

My current problem is that, while they are 'Can_Collide'd to each other with no issue, they are still physical objects to the rest of the world, which means that the helicopter creating them needs to leave the area before the spawning code can be run.

Is there a way of making them permeable?

#

I was tinkering with a way of turning any copy that is approached to hidden, but trying to sort out how to un-hide it when free was turning into a giant hassle.

proven charm
#

oh that command doesnt work with PhysX objects, i guess helis are such

meager granite
#

Air conditioners and wind turbines have simulation = "fountain"

#

Had no idea this simulation was even a thing

#

"getText(_x >> 'simulation') == 'fountain'" configClasses (configFile >> "CfgVehicles") apply {configName _x}
=> ["Land_wpp_Turbine_V1_F","Land_wpp_Turbine_V2_F","Land_AirConditioner_01_sound_base_F","Land_AirConditioner_02_F","Land_AirConditioner_03_F","Land_AirConditioner_04_F"]

still forum
#

fountains have a continuously emitted sound

meager granite
#

πŸ€”

#

Assumed it might be something about rotating blades or something, but then again its "fountain", it doesn't have blades

still forum
#

just the humming sound these make (and fountains usually make)

sullen sigil
#

your fountains hum? damn

little raptor
#

They do in Czechia

#

Unless dammaged

stark fjord
#

Then they roar?

daring escarp
#

Hi guys complete noob to scripting honestly haven't a clue how to work it. But I need some help anyone here know of a way I can make it so Medical Vehicles will not be engaged by AI as per Geneve Convention? I basically want to have Blufor players drive a Medical Vehicle, when any Blufor Players get in the Medical Vehicle they get marked as Civillian as the Vehicle would be marked as civillian so AI don't shoot it. When the Players exit the vehicle they would then become Blufor again... Is something like this possible??? Thanks

sullen sigil
#

setcaptive of unit that gets into it

quiet geyser
proven charm
#

anyone knows why this code doesn't fill the b array?```sqf
a = []; a resize 10000; // Updated
b = [];

{ b pushback _x; } foreach a;

#

either im trying to do something weird or could it be bug in the new SC feature?

#

If I change _x to 0 then the b array gets filled

stark fjord
#

Is it possible cause its filled with nil?

proven charm
#

dunno

stark fjord
#

Yes

Posted on November 26, 2014 - 18:25 (UTC)

DreadedEntity
pushBack does not support nil while set and a plus b do

proven charm
#

just tested and yeah you are right, its because a is filled with nils

still forum
#

Every script command is silently ignored if you give it nil as argument

#

_x is nil, so every pushBack is ignored

proven charm
#

makes sense

digital wasp
#

how do i properly end the mission in multiplayer?

brave jewel
#

Hey there,

I'm currently trying to figure how how to disable damage taken from HE explosions.
This is what I have so far. No idea tho how to handle the area effect of explosion damage.

player addEventHandler ["HandleDamage", {

 params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

    if (_source isEqualTo mtt_static) then {
        systemchat "hit"; //debug
        _damage = 0; //new damage
    };
    _damage
}];````
fair drum
brave jewel
#

❀️

fair drum
# brave jewel THIS, Good idea. (Why didn't I think about this)

an example from one of my old (2021) pvp missions for cinematic explosions

player addEventHandler [
    "HandleDamage", {
        params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

        diag_log format ["%1 - source, %2 - projectile, %3 - damage", _source, _projectile, _damage];

        if (_source == _unit || _source == objnull || _projectile == "Bo_GBU12_LGB") then {
            _damage = 0;
        };

        diag_log format ["%1 resulting damage after calculation", _damage];
        _damage;
    }
];
#

i was using the GBU to create my explosions

#

without ACE

#

ace does something different with spalling

brave jewel
#

Oh so my above probably has some issues with this then I guess, because we're using ace

fair drum
#

yeah so you need to find that spall class. so do the logging

brave jewel
#

on it on it

maiden vigil
#

Greetings.

#

Im trying to get IMS (Improved Melee System) from Webknights, to running on my "AltisLife" Australia Life Server.
But i dont know how to fix it.

#

Thats what he sended

#

In Singleplayer, everything works fine.
But when i go on the Server.
There are No Animations, Attacks etc etc.

granite sky
#

Not enough information. You'd need to know what functions to add to cfgRemoteExec.

#

Either that or you just allow everything.

boreal parcel
#

anyone know of an existing script that would allow players to respawn via airdrop? so when a player dies it would spawn an aircraft going a certain direction, put them in the cargo, and then drop them over a certain point?

fair drum
maiden vigil
boreal parcel
fair drum
boreal parcel
maiden vigil
fair drum
brave jewel
fair drum
brave jewel
#

Well, basically I could take loads of hits, but I figured I am dying by ""

#

like literally

#

19:55:06 "mtt_static - source, - projectile, 0.00136427 - damage"

#

no idea how I can handle this

fair drum
#

so you're getting a projectile class now?

#

with the redplasma?

brave jewel
#

Yes I do all the time, but the redplasma doesnt kill me actually

#

Like I take no damage from it

#

or in other words, it gets handled by the EH

#

script is looking like this right now:

_test = player addEventHandler ["HandleDamage", {

 params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
    diag_log format ["%1 - source, %2 - projectile, %3 - damage", _source, _projectile, _damage];

    if (_source isEqualTo mtt_static) then {
        systemchat "hit mtt"; //debug
        _damage = 0; //new damage
    };
    if (_projectile isEqualTo "3AS_MTT_redplasma_HEAT" ) then {
        systemchat "hit heat"; //debug
        _damage = 0; //new damage
    };
    if (_projectile isEqualTo "ammo_Penetrator_AAT" ) then {
        systemchat "hit penetrator"; //debug
        _damage = 0; //new damage
    };
    if (_projectile isEqualTo "") then {
        systemchat "hit empty"; //debug
        _damage = 0; //new damage
    };
    if (_source isEqualTo player) then {
        systemchat "hit player"; //debug
        _damage = 0; //new damage
    };

    _damage
}];
diag_log _test

#

sorry edited

#

I have no idea how I can figure this out

fair drum
#

which things do you want someone to NOT take damage from

brave jewel
#

Well basically I have a course, where a vehicle (mtt_static) is aiming as usual and firing. I want the players to not take damage by the vehicle turrets but still be able to take damage from small arms fire of infantry

#

so you can better imagine what I mean

#

basically like a citadel

fair drum
#

@brave jewel

player addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

    if (
        _source in [player, mtt_static]
        or
        toLowerANSI _projectile in (["3AS_MTT_redplasma_HEAT", "ammo_Penetrator_AAT"] apply { toLowerANSI _x })
    ) exitWith {
        diag_log format ["Source: %1 | Projectile: %2 ---- Setting Damage to 0", _source, _projectile];
        0 // damage of 0
    };

    diag_log format ["Source: %1 | Projectile: %2 ---- Allowing Damage Through: %3", _source, _projectile, _damage];
    _damage;
}]

what does this give you in the log?

brave jewel
fair drum
#

I don't want the damage in the diag_log besides the Allowing Damage Through

brave jewel
#

got it

fair drum
#

delete that wall of text

#

you can post with pastebin instead or something

brave jewel
#

true

fair drum
#

or just put it as the message that discord does and i'll look through it. that one up there correct?

brave jewel
#

btw, there is no entry with allowing damage through in the logs

#

the upper one is correct, yes

fair drum
#

and you're still dying? it should tell us what is killing you

brave jewel
#

still dying yes

fair drum
#

if you are, then its something ace is doing behind the scenes i think

brave jewel
#

I believe it could be ace fragmentation simulation

fair drum
#

let me see if i can find anything relevant in their code.

brave jewel
#

ace_frag_skip got it, trying to put it in the mission now

#

should be ace_frag_skip = 1 I believe

#

should be ok if I put ace_frag_skip = 1; in the debug console right? if yes, doesn't work

fair drum
#

that is for CfgAmmo

#

you can't change that outside of a mod CfgPatches

brave jewel
#

true

fair drum
#

try this @brave jewel

player addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

    if (
        _source in [player, mtt_static]
        or
        toLowerANSI _projectile in (["3AS_MTT_redplasma_HEAT", "ammo_Penetrator_AAT"] apply { toLowerANSI _x })
    ) exitWith {
        diag_log format ["Source: %1 | Projectile: %2 ---- Setting Damage to 0", _source, _projectile];

        [_projectile] call ace_frag_fnc_addBlackList;
        0 // damage of 0
    };

    diag_log format ["Source: %1 | Projectile: %2 ---- Allowing Damage Through"];
    _damage;
}];
#

if not, might have to add to blacklist before the hit handler, so you would add it to the "Fired" event handler on the vehicle shooting

brave jewel
#

Guess I'm gonna try the fired eh then, cause that didn't work out.. man is this is complicated xD

brave jewel
#

should be correct eh?

fair drum
brave jewel
#

well, didn't work xD

fair drum
#

you still need the player handler though

brave jewel
#

yea got it as wlel

fair drum
brave jewel
#

Just to have it set up right: HandleDamage goes into initplayerlocal / fired goes into initServer or init?

fair drum
#

make them both local to the object they are attached to

brave jewel
#

I see alright, thanks

#

Thanks for the help and effort πŸ™‚

spice kayak
#

Sorry about the long delay. Each Extraction Location is named 'Extraction_0' through to 'Extraction_5'

round scroll
#

of which type is Extraction_0 to Extraction_5?

spice kayak
#

I'm sorry, what do you mean?

#

I can explain what I'm doing as a whole, but it's even confusing for me :(

round scroll
#

how do you define _allExtractionLocations? Does it look like _allExtractionsLocations = [ "Extraction_0", "Extraction_1", ... "Extraction_5"]; ? or without the parentheses?

spice kayak
#

Oh, sorry, yes. _allExtractionLocations = ["Extraction_0","Extraction_1","Extraction_2","Extraction_3","Extraction_4","Extraction_5"];

#

Sorry, I just woke up.

round scroll
#

so did you try commy2s advice and created a marker with 'createMarkerLocal' first? Otherwise there is simply no such marker 'Extraction_0' to 'Extraction_5'.

spice kayak
#

Not yet, I'll give it a try in a second!

pastel crater
#

I want people to listen to a short intro music track on mission join.

#

How would I go about this?

#

I was using:

#

description.ext

#

author = "Gazpa Nova";
onLoadName = "Biohazard";
onLoadMission = "Abandonados en el desierto... una sola misiΓ³n.";
loadScreen = "images\denton_Fallujah_01.jpeg";

class Header
{
gameType = Coop; // Game type
minPlayers = 1; // minimum number of players the mission supports
maxPlayers = 25; // maximum number of players the mission supports
};

respawn=3; respawnDelay=2; respawnOnStart=-1;

#include "LARs\override_VA_templates\settings.hpp"

class CfgFunctions
{
#include "LARs\override_VA_templates\functions\functions.hpp"
};

class CfgMusic
{
track[]={};
class gameIntro{
name = "";
sound[] = {"\music\gameIntro.ogg", db+10, 1.0};
};
};

#

init.sqf

#

playMusic "gameIntro";

#

but it's not working

hallow mortar
#

I assume gameIntro.ogg is actually located in a folder called music in your mission folder?

pastel crater
#

it is

hallow mortar
#

You might try adding a sleep 0.1; immediately before your playMusic in init.sqf. Init.sqf runs during the "briefing" phase (when the mission is at the map screen and the game has not actually started), and playMusic might not work during this stage. Adding a sleep would force it to wait until the mission starts.

pastel crater
#

interesting. Will try that right away. Thank you!

hallow mortar
#

Oh, also where you have track[]={}; in description.ext, that should be tracks[]={};

trim tree
#
_tgt = tgt1;
pzf hideObject false;
pzf enableSimulationGlobal true;
_tgt enableSimulationGlobal true;
sleep 2;
pzf reveal _tgt;
pzf dotarget _tgt;
sleep 1;
pzf doFire _tgt;
grp4 setCombatMode "RED";
grp5 setCombatMode "RED";

for some reason the unit pzf isnt shooting anymore. I had it working reliably last time I checked this and I dont remember changing anything.
The AI unit has only the launcher equipped (but doesnt draw it, it just stands still).

ocean folio
#

Hey, do any of you know off the top of your head a good explosion class? I'm trying to do flak guns firing at incoming aircraft, hopefully with some screen shake and whatnot

#

*screen shake for the passengers of the aircraft

fallow vector
#

Hello guys!
I'm trying to make a "Gas attack" Operation.
I would very much like to avoid using a mod, and would much prefer using scripts to achieve this.
In reality, the only thing I need is a visible "Gas". Something colored, whether it's yellow or any other color really.
Any ideas?
Thank you kindly! πŸ’™

winter rose
#

see this tutorial for guidance (and here for help!)

spice kayak
#

Oh wait, I just realized he's creating the markers, as where I'm using existing ones.

true frigate
#

Sorry for the late reply lol

ocean folio
#

lol ye HelicopterExploBig was a neat one but I didnt find it had much shake

#

I ended up using I think an IED explosion

true frigate
#

If I remember correctly, "Bo_GBU12_LGB_MI10" is the largest vanilla explosion there is

#

For screen shake, I usually do that by myself with addCamShake

ocean folio
true frigate
#

I'm just trying to work out how to pass variables through addAction right now. Being a ballache lmao

fallow vector
fallow vector
true frigate
#

Due to the way addAction works with params, if I add it in the params line, it returns the variablename of the unit that used the action. I took a look at the wiki and it seems you pass arguments through after the script.

#

It's a little confusing lol

#

Either that or the lack of examples is really getting to me

spice kayak
#

I'll kinda explain what I'm doing. For a certain character, at the start of a game, 6 extraction locations are shown, but only one is correct. As long as he's in possession of a certain item, over time, markers will be removed one by one until only the correct one remains. I've never really used arrays before, but I have a few now. _allExtractionLocations contains all the names of each marker, _trueExtraction contains the name of the correct one, and _extractionLocations is = _all - _true, and is constantly having one removed each, say, 2 minutes.

fallow vector
spice kayak
#

Hope that makes some sense.

fallow vector
#

Although i'll have to figure out a way to remove the damage!

#

And donezo! You're a god among men, I swear

#

How big of an impact on frames do you think the "Gas" particle is (on a dedi)? I'm planning to encompass an entire city (around 500m or so) with it. That a bad idea?

round scroll
#

when you remove a marker, how do you do that? set the alpha? Or delete it?

robust brook
#

Doing a whole city would most likely tank frames with a lot of particles. Just have to edit the particle params and see what works best for you.

fallow vector
fallow vector
spice kayak
#

change it's type from "mil_pickup" to "none"

#

Oh, and then remove it from the _extractionLocations array

#

But I'm just trying to get it to show all of them first, using arrays and code.

drifting sky
#

Question: Is there any way to force ai to "turn out" when they're sitting at a station which has a gun that can only be fired from the turned out position?

spice kayak
#

Here's a picture of what I have now. A little messy, but I'm new to scripting, so. I've also removed most functionality from the bottom part, as I was just using systemChat to check if things were executing when they were needed http://i.imgur.com/nR5e96y.png

drifting sky
round scroll
#

where do you define the markers for Extraction_0 ...

#

or are they defined in the mission.sqm?

spice kayak
#

Yes, they are created within the editor in advance. I find it easier to place them exactly where needed.

round scroll
#

sorry, out of ideas now

spice kayak
#

It's all good. Thank you for trying though!

#

I think I know what the issue is.

#

Normally when you'd do setMarkerTypeLocal, the marker name is defined as "Marker_Name" in quotes. Maybe I should make a string first, that uses quotes and _x? Issue is, I don't know how to use quotation marks... in quotation marks haha.

indigo snow
#

the code is correct, so the error is somewhere else

spice kayak
#

But wouldn't the array _x output be Extraction_0, where, for setMarkerTypeLocal, it needs to be "Extraction_0" ?

indigo snow
#

no? thats not how strings work

#

_x is the current element forEach is reviewing, which are all strings in your array

nocturne bluff
#

i love how you took a picture of your code xD

spice kayak
#

Yeah, I didn't really want to fill up the chat with it either, and pastebin wasn't l oading for me haha.

coarse needle
#

Definitely the best way :D

spice kayak
#

Sorry :P

nocturne bluff
spice kayak
#

I thought you were being sarcastic with that link haha.

indigo snow
#

Do you get the "Download under 20" systemChat?

spice kayak
#

Yes, actually. I was just about to say that.

indigo snow
#

log _allExtractionLocations as well there

#

see if its gone wierd

spice kayak
#

knowing me, probably 'any'

indigo snow
#

systemChat str count _allExtractionLocations

spice kayak
#

Also, thank you for Hastebin. I like it.

indigo snow
#

what? log is not a command in arma

#

did you mean to put diag_log there?

spice kayak
#

ugh, yeah. Sorry. I'm going to grab some coffee or something before I slam my head into my keyboard any further. I might make sense afterwards.

agile flower
#

QQ

#

Any idea why

_vehicle = createVehicle [ _vehicleType, [0,0,0], [], 0, "NONE" ];

wouldn't work, but

createVehicle [ _vehicleType, getPosATL player, [], 0, "NONE" ];

does?

#

fails silently

hallow mortar
#

The only thing that comes to mind is that the first one is creating at [0,0,0], which may not be where you're looking for the vehicle. It is also [0,0,0] ATL, which may be underwater depending on the map.

#

Alternatively _vehicleType could be wrong because of stuff happening before the posted code

meager granite
#

createVehicle uses AGL coordinates but yeah, first line creates at 0, second near player

#

Land_Camping_Light_F has simulation="shipx";

#

Oh, that's why class Land_Camping_Light_F: FloatingStructure_F so it can float

agile flower
meager granite
#

You're moving it wrong then

spice kayak
#

ah, (count(_allExtractionLocations)) gives me scalar.

indigo wolf
#

I am trying to execute this in runtime as zeus. However, it gives me a black screen instead of the PiP. Its executed as 'Local'.

_bb = "Land_BriefingRoomScreen_01_F" createVehicle [550.533, 4516.7, 0];
_bb setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_bb setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
uav = createVehicle ["B_UAV_01_F", _bb modelToWorld [0,100,100], [], 0, "FLY"]; 
createVehicleCrew uav; 
uav lockCameraTo [_bb, [0]]; 
uav flyInHeight 100; 
_wp = group uav addWaypoint [position _bb, 0]; 
_wp setWaypointType "LOITER"; 
_wp setWaypointLoiterType "CIRCLE_L"; 
_wp setWaypointLoiterRadius 100; 
{
    cam = "camera" camCreate [0,0,0]; 
    cam cameraEffect ["Internal", "Back", "uavrtt"]; 
    cam attachTo [uav, [0,0,0], "PiP0_pos"]; 
    cam camSetFov 0.1; 
} remoteExec ["spawn",-2];
meager granite
#

Are you're server?

indigo wolf
#

Ah i didn't think about that omg. Let me try with remoteExec 0

meager granite
#

Also you need to broadcast your uav to other clients

#

publicVariable "uav";

#

Or sent it as argument in remoteExec

#
[uav, {
    cam = "camera" camCreate [0,0,0]; 
    cam cameraEffect ["Internal", "Back", "uavrtt"]; 
    cam attachTo [_this, [0,0,0], "PiP0_pos"]; 
    cam camSetFov 0.1; 
}] remoteExec ["spawn", 0];
stark fjord
#

Suggest u use [0,-2] # isDedicated instead of -2. So u dont have to worry bout it un future.

indigo wolf
#

Ah ok. Also can I add the addMissionEventHandler inside the remoteExec block?

meager granite
#

You can but it doesn't sound like a good idea

indigo wolf
#
[uav, {
    cam = "camera" camCreate [0,0,0]; 
    cam cameraEffect ["Internal", "Back", "uavrtt"]; 
    cam attachTo [uav, [0,0,0], "PiP0_pos"]; 
    cam camSetFov 0.1; 
    addMissionEventHandler ["Draw3D", { 
        _dir =  
            (uav selectionPosition "PiP0_pos")  
                vectorFromTo  
            (uav selectionPosition "PiP0_dir"); 
        cam setVectorDirAndUp [ 
            _dir,  
            _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0] 
        ]; 
    }];     
}] remoteExec ["spawn", -2];``` It would look something like this.
meager granite
#

Change uav to _this inside spawn code

stark fjord
#

(-2 again)

meager granite
#

Also uav won't be available inside "Draw3D" either

#

So I guess public var'ing it is better here

indigo wolf
#
_bb = "Land_BriefingRoomScreen_01_F" createVehicle [550.533, 4516.7, 0];
_bb setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_bb setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
uav = createVehicle ["B_UAV_01_F", _bb modelToWorld [0,100,100], [], 0, "FLY"]; 
createVehicleCrew uav; 
uav lockCameraTo [_bb, [0]]; 
uav flyInHeight 100; 
_wp = group uav addWaypoint [position _bb, 0]; 
_wp setWaypointType "LOITER"; 
_wp setWaypointLoiterType "CIRCLE_L"; 
_wp setWaypointLoiterRadius 100; 
publicVariable "uav";
{
    cam = "camera" camCreate [0,0,0]; 
    cam cameraEffect ["Internal", "Back", "uavrtt"]; 
    cam attachTo [uav, [0,0,0], "PiP0_pos"]; 
    cam camSetFov 0.1; 
    addMissionEventHandler ["Draw3D", { 
        _dir =  
            (uav selectionPosition "PiP0_pos")  
                vectorFromTo  
            (uav selectionPosition "PiP0_dir"); 
        cam setVectorDirAndUp [ 
            _dir,  
            _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0] 
        ]; 
    }];     
}remoteExec ["spawn", [0, -2]];```
#

Or am I confusing myself with the LE/GE functionality.

#

(and it does not work 😦 )

proven charm
#

change: remoteExec ["spawn", [0, -2]]; to: remoteExec ["spawn", [0, -2] # isdedicated];

spice kayak
#

Just to make sure my array was actually working, I did try this, and it worked {systemChat format ["Extraction: %1",_x];} forEach _allExtractionLocations;

#

It showed all locations. So I've got that going for me, which is nice.

indigo wolf
#

I've set it to 0 for now and its still a black screen hmmm

meager granite
#

Perhaps you're not server and remoteExec is blocked?

indigo wolf
#

So i try this code in a my own local server as zeus and executing this in the Execute Code module and in Local execution.

meager granite
#

Make sure you do this: }remoteExec ["spawn", 0];

indigo wolf
#

yes

#

still a black screen

meager granite
#

Are you even looking at the right screen at all?

indigo wolf
#

Its the only screen in 500m radius πŸ˜„

finite bone
little raptor
#

# doesn't take bool

finite bone
#

Oh yea, the # would require a number not bool

meager granite
indigo wolf
#

Its still black for me idk why (even with remoteExec call and 0)

indigo wolf
meager granite
indigo wolf
#

I have just that

#
_bb = "Land_BriefingRoomScreen_01_F" createVehicle [550.533, 4516.7, 0];
_bb setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_bb setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
uav = createVehicle ["B_UAV_01_F", _bb modelToWorld [0,100,100], [], 0, "FLY"]; 
createVehicleCrew uav; 
uav lockCameraTo [_bb, [0]]; 
uav flyInHeight 100; 
_wp = group uav addWaypoint [position _bb, 0]; 
publicVariable "uav";
_wp setWaypointType "LOITER"; 
_wp setWaypointLoiterType "CIRCLE_L"; 
_wp setWaypointLoiterRadius 100; 
{
    cam = "camera" camCreate [0,0,0]; 
    cam cameraEffect ["Internal", "Back", "uavrtt"]; 
    cam attachTo [uav, [0,0,0], "PiP0_pos"]; 
    cam camSetFov 0.1; 
    addMissionEventHandler ["Draw3D", { 
        _dir =  
            (uav selectionPosition "PiP0_pos")  
                vectorFromTo  
            (uav selectionPosition "PiP0_dir"); 
        cam setVectorDirAndUp [ 
            _dir,  
            _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0] 
        ]; 
    }];     
} remoteExec ["call", 0]; ```
digital hollow
indigo wolf
#

Its on Ultra / Very High

finite bone
meager granite
indigo wolf
#

I have no idea where this is going wrong or what im doing wrong at this point xd

finite bone
meager granite
finite bone
#

Cool thanks!

meager granite
finite bone
#

Thats something new/strange for me

indigo wolf
meager granite
#

Try remote exec'ing something simple

meager granite
#

And check RPT on other clients and server for WORKS!

indigo wolf
#

It does.

#

I can see it in my RPT files - "WORKS!"

#

Forget remote execution, I can't even execute it locally on a SP instance too.

finite bone
meager granite
finite bone
#

Thanks a lot!

indigo snow
#

at the same place in the script? Try (_allExtractionLocations select 0) setMarkerTypeLocal "mil_Pickup"; around the same spot.

indigo wolf
#

So essentially im doomed in figuring out whats the problem behind this xd

spice kayak
#

I'll give that a try. I was just about to say, despite what i said earlier, about the {systemchat} forEach _all working, it doesn't seem to want to work when used in this, even if I remove the setmarkertypelocal line http://hastebin.com/okadahozuq.avrasm

#

Yeah, no visible markers for that either. I'll see what select 0 actually returns as.

quartz blade
#

Can I ask you what do you think about this script? Do you think it will work? I made it with ChatGPT (Ignore the text in Italian)

// Imposta la variabile per indicare se il giocatore sta mirando a un nemico o a un civile
player setVariable ["isAimingAtEnemy", false];

// Aggiungi l'evento per verificare se il giocatore sta mirando a un nemico o a un civile
player addEventHandler ["Fired", {
_unit = cursorTarget;

// Se il giocatore sta mirando a un nemico o a un civile
if (!isNull _unit && (_unit isKindOf "Man" || _unit isKindOf "CAManBase")) then {
    player setVariable ["isAimingAtEnemy", true]; // Imposta la variabile per indicare che il giocatore sta mirando a un nemico o a un civile
    hint "Premi ALT + A per far abbassare l'arma e alzare le mani."; // Mostra un messaggio sullo schermo per indicare all'utente cosa fare
} else {
    player setVariable ["isAimingAtEnemy", false]; // Imposta la variabile per indicare che il giocatore non sta mirando a un nemico o a un civile
};

}];

// Aggiungi l'evento per far abbassare l'arma e alzare le mani
player addEventHandler ["KeyUp", {
_key = _this select 1;

// Se il giocatore sta mirando a un nemico o a un civile e preme ALT + A
if (player getVariable ["isAimingAtEnemy", false] && _key == 18) then {
    _unit = cursorTarget;
    _morale = morale _unit;
meager granite
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
spice kayak
#

'any'

quartz blade
#

Thank you XD

meager granite
#

Oh and ChatGPT sucks, it doesn't know SQF and you can't learn from it. If you understand SQF and Arma you don't need it, if you don't understand SQF it won't help you.

quartz blade
#
        if (!isNull _unit && !isNull (primaryWeapon _unit) && _morale < 0.5) then {
            _unit action ["DropWeapon", _unit, primaryWeapon _unit];
            _unit action ["GestureSurrender", _unit];
        } else {
            // Altrimenti, se il morale Γ¨ alto, il nemico o il civile rispondono o attaccano
            switch (floor(random 3)) do {
                case 0: {_unit say "Non mi arrenderΓ²!";};
                case 1: {_unit say "Non mi farei intimidire!";};
                case 2: {_unit fireAtTarget [player, "FullAuto"];};
            };
        };
        
        // Rimuovi la variabile che indica che il giocatore sta mirando a un nemico o a un civile
        player setVariable ["isAimingAtEnemy", false];
    };
}];```
quartz blade
quartz blade
#

I asked to create a script that when you press ALT + A and the morale of the enemies is low, it makes them surrender

gentle fjord
#

what that code will do, as far as I can tell, is check if a unit exists and has a weapon and if a variable _morale is below 0.5.

#

_unit also isnt defined, I assume that is outside this

#

if those conditions are true then it looks like it makes the unit surrender and drop their weapon. If not then it randomly selects some random shit to say and do

quartz blade
#

I'm going to ask him to define _morale and _unit

meager granite
#

!quote 6

lyric schoonerBOT
quartz blade
#

Lol

spice kayak
#

I don't get why {systemChat format ["Extraction: %1",_x];} forEach _allExtractionLocations; works at the start of the script, but not in the under 20 if statement, despite the 'under 20' systemchat message shows.

humble tundra
#

Greetings folks.
I can't seem to be able to create a specific rugged laptop with a dedicated screen texture.

The laptop is listed as expected but the texture always fails on me. Tried various format without success.
Any clue?

finite bone
humble tundra
# finite bone Do you have the sample code and or the texture?

The same code I was using on regular laptop and it worked with it. Changed texture number to 1 as rugged are using it instead of 0.

class CfgVehicles


{
   class Building;
   class FloatingStructure_F;
   class Thing;
   class ThingX;
   class Wall_F;
   class House;   
   class Land_Billboard_F;
   class Land_Laptop_device_F;
   class STyx2909_Laptop: Land_Laptop_device_F
   {
        scope=2;
        displayName="Laptop CIA Terminal";
        hiddenSelections[] = {"camo"};
        hiddenSelectionsTextures[]=
        {
        "STyx2909_LAPTOPS\Texture\CIA.paa"
        };
        init="This setobjecttexture [0,""STyx2909_LAPTOPS\Texture\CIA.paa""]";
   };```
#

Rugged laptops code:

class Land_Laptop_03_base_F;
    class Land_Laptop_03_black_F;
       class FODDSQUAD_Laptop1: Land_Laptop_03_black_F {
        scope=2;
        displayName="FODDSQUAD Laptop dark";
        hiddenSelections[] = {"camo"};
        hiddenSelectionsTextures[]=
        {
        "foddsquadpatches\Computer\dark.paa"
        };
        init="This setobjecttexture [1,""foddsquadpatches\Computer\dark.paa""]";
      };
south swan
#

how does it "use 1 instead of 0" with only 1 hiddenSelection listed in config, though? tanking

humble tundra
south swan
#

class Land_Laptop_03_black_F: Land_Laptop_03_base_F for inheritance with seemingly no model redefned and hpp class Land_Laptop_03_base_F: Items_base_F { ... hiddenSelections[]= { "Camo_1", "Screen_1" }; ... in the base class πŸ€·β€β™‚οΈ

young current
#

This new laptop does not have second hiddenselection defined though so it does not have screen hiddenselection at all.

#

And the 0 does not work because camo selection is defined but does not exits

#

Since original uses Camo_1

#

All borked config

#

@humble tundra

sage heath
#

ok so, update, just tested on the server, and the cruise missile part works beautifully, however, i ran into some issues with the S-300 section, (for context, this is a sequence where an S-300 bty launches all its missiles towards an invisible target to simulate an intercept), now, in SP and local MP, the S-300 launch their missiles just fine, but in dedicated MP, the missiles completely miss their target, which does make it look a bit silly, i think there's some issue with either do target or...fire at target, idk

indigo snow
#

it's probably a locality issue or a pointer issue. Try passing +_allExtractLocations into your spawn.

sage heath
#

also hey nikko

hallow mortar
#

Using the original script file (without remoteExec):

  • rename it to fn_wr_vic_shoot.sqf
  • put it in the functions folder with the other one
  • add class wr_vic_shoot{}; to description.ext cfgFunctions alongside the other line that looks like that
  • in missileStrike, replace [_x] execVM "WR-VIC-Shoot.sqf"; with [_x] remoteExec ["TNRGN_fnc_wr_vic_shoot",_x];
#

*and save the mission before testing to force a functions refresh

sage heath
#

alright, ill give it a shot

sage heath
#

and how does it affect the sequence?

hallow mortar
#

It turns it into a function, which is more efficient than a raw script file and easier to remoteExec it.
Then it remoteExecs that function so it's running locally on whichever machine the launcher is local to.
It makes no changes to the actual operation of the sequence, but will solve the locality issue that is likely to be the cause of your problems.

sage heath
#

i see

sage heath
#

so this is the problems in video form, if you can see the 3 floating blufor groups, that are the airborne targets the s-300 are supposed to hit, you can see that the missiles are going straight on based on the vics orientation instead which means the vic failed to aim

#

luckily this is one of those problems that could be explained away "we're jamming the fuck out of those S-300s"
and "growlers are working"

indigo wolf
#

@meager granite I figured out the problem - Every time I enter / leave Zeus, it resets the texture to black.

sage heath
spice kayak
#

Yeah, I think you're right. Moving them down inside of [] spawn worked. I wonder why it didn't work otherwise? It's not like they needed to be public arrays, did they?

nocturne bluff
#

Sounds like you need to read about scopes

spice kayak
#

Well, I did say I was new to all this. I guess I'll have to. Thank you :)

#

And all markers show up. That took a lot longer than it rightfully should have.. Thanks again, @indigo snow! I'll look up scopes now.

indigo snow
simple ore
#

Has anyone explored any of these newer, code-focused models for A.I. generated code?

#

We've been working on it and the results I think will be a lot more promising than GPT.

finite bone
#

The only code-focused models for A.I. generated code I prefer is Github Co-Pilot

#

Saves me a lot of time doing repetitive / regular task

simple ore
#

Co-Pilot has a new rival now called StarCoder.

finite bone
#

What databses do they have as training models?

#

Since Github is pretty much used globally, they should have robust database for training their model so they'd be more stable and general correct

simple ore
#

"StarCoder and StarCoderBase are Large Language Models for Code (Code LLMs) trained on permissively licensed data from GitHub, including from 80+ programming languages, Git commits, GitHub issues, and Jupyter notebooks. Similar to LLaMA, we trained a ~15B parameter model for 1 trillion tokens. We fine-tuned StarCoderBase model for 35B Python tokens, resulting in a new model that we call StarCoder."

finite bone
#

but these are more ifs and thoughs so dont take it 100%

simple ore
#

I can't send links but it's slowly making headlines.

#

Was announced yesterday

sage heath
hallow mortar
#

Nope

simple ore
#

I'm so excited for these coding models.

sage heath
#

should we try remoteExec-ting the code?

hallow mortar
#

If you've followed the previous suggestion, it is already being remoteExec'd to the only place it would make a difference. remoteExec'ing it again would be redundant.

sage heath
#

hmmmm....well this sucks

#

is there any alternatives to do target and fire at target?

digital hollow
sage heath
#

alright lets see how it goes

sage heath
digital hollow
#

The missile is accessible in the fired event handler. Or if players aren't going to be close to the launcher, you can just create the Missiles

sage heath
sage heath
#

im gonna see if the basegaem S-400 has the same issue, if not imma use that

tepid vigil
#

Does startLoadingScreen have any effect on dedicated servers, or do they have the 50ms per frame script execution time regardless?

digital hollow
spice kayak
#

will do, thank you.