#arma3_scripting

1 messages · Page 75 of 1

indigo wolf
#

Anyone has any ideas how to ensure that object texture does not reset upon entering / exiting zeus interface?

meager granite
#

Try to figure out why it gets reset in the first place? Some mods perhaps?

indigo wolf
#

I was thinking of having a continuous loop (onEachFrame) to keep reseting the texture back to the rtt

digital hollow
sage heath
#

yeahhhhhh i have no idea how to implement that, i've got no clue about scripting, sorry

indigo wolf
digital hollow
indigo wolf
#

XD

sage heath
#

i finally have a lead, open question, does cba invisible targets do anything differently in dedicated mp?

stark fjord
#

Uhhh??

sage heath
stark fjord
#

You pinged me

sage heath
#

right so

sage heath
#

i could explain it again if you'd like

stark fjord
#

Maybe attach darter or drone to missile and target that

sage heath
#

and it worked with an invisible target

#

but then it just breaks in mp

#

and idk why

stark fjord
#

Dunno really ive never dealt with aa missiles. If u wanna go full out, you could make a mod that adds plane which is something small like pen model, attach it to missile and any aa would target it.

#

If you can attach anything to missile to begin with

sage heath
#

and im not trying ti shoot those missiles down just fyi

#

im just trying to getthem to fire succesdfully in that direction which they’re even failing to do

stark fjord
#

Dont think missile can be destroyed anyways.
Were you using invisible air target?

sage heath
#

it fucks up in mp doesnt it

stark fjord
#

Did you reveal position to all ai aa units?

sage heath
#

do i have to…?

stark fjord
#

It certanly helps, so they instantly target it

sage heath
#

how do i implement that, sorry?

stark fjord
sage heath
#

so this is the full script

*/

//-------------------------------------------------------------- Params

_vic = _this select 0;

//---------------------------------------------------------------------

while {true} do {
    
    sleep 1;

//---------------------------------------------------------- 1st Target
    
    _vic doTarget t3;

    sleep 2;
    
    _vic fireAtTarget [t3];

//---------------------------------------------------------- 2nd Target
    
    _vic doTarget t3;

    sleep 2;
    
    _vic fireAtTarget [t3];

//---------------------------------------------------------- 2nd Target
    
    _vic doTarget t3;

    sleep 2;
    
    _vic fireAtTarget [t3];
    
//---------------------------------------------------------- 3rd Target
    
    _vic doTarget t3;

    sleep 2;
    
    _vic fireAtTarget [t3];
    
//---------------------------------------------------------- 4th Target
    
    sleep 1;

};

//---------------------------------------------------------- Script end```
so where would i put this?
stark fjord
#

Probs before dotarget

sage heath
#

gotcha so it'd be,

    _vic reveal t3;
    _vic doTarget t3;

    sleep 2;
    
    _vic fireAtTarget [t3];```
like that?
#

forgot semi colon

stark fjord
#

Yeah. Plus ; after it

#

Also why are you always giving target t3? Even tho ur comments say target 1,2,3,4?

sage heath
stark fjord
#

U can reveal target and do target only once, then just fireAtTarget

sage heath
#

oh

sage heath
stark fjord
#

Then it fires without a lock

#

Also what s300 are u using modded or vanila?

sage heath
stark fjord
#

Also how do you exec above script?

sage heath
#

?

#

oh

stark fjord
#

I cant open it. Im on phone

sage heath
#

so nikko's initial troubleshooting solution was move the sqf to a function, so it's remote execed

sage heath
stark fjord
#

Just important part

sage heath
# stark fjord I cant open it. Im on phone
// Trigger your SAM launch
[] spawn {
    {
        sleep (random 5);
        [_x] remoteExec ["TNRGN_fnc_wr_vic_shoot",_x];
    } forEach [s3001,s3002,s3006,s3004,s3005,s3003];
};

sleep 60;

#

whoops sorry

#

yep, thats it

leaden scaffold
#

@sage heath so an aa from opfor fire to blufor, laserTargetE maybe better, what is the line 7 to line 12 inside file fn_missileStrike.sqf purpose for? and t3 variable is confirm that exist and you may also need fetch the radar too

sage heath
stark fjord
#

Where is t3 created?

sage heath
#

in eden

leaden scaffold
#

ima try recreate your scenario

stark fjord
#

Ah. Any special parameters to it?

#

Like disable sim etc?

sage heath
sage heath
stark fjord
#

No hide model/simple object etc?

#

Dynamic sim?

sage heath
# stark fjord No hide model/simple object etc?

well with the F/A 181 target, it turned off sim, hide model, although i could test it again without taht, issue is, other AA pieces fire on it IMMEDIATELY, for the cba invisible target, nothing

stark fjord
#

Hmm

#

Dunno. Id have to test it. But that wont happen for a while

leaden scaffold
#

rpt got error about it?

sage heath
sage heath
stark fjord
#

That wouldnt help in my case.

sage heath
#

rip

spice kayak
#

I think I'm just way over my head for what I wanted to do. I'm having doubts now haha.

leaden scaffold
#

based on what i observed that doTarget kind of useless, you can just do fireAtTarget

sage heath
leaden scaffold
#

maybe was the mod cause it? i have try the arma anti air, works good at mp and dedicate mp

sage heath
#

i gave up and just removed that sequence entirely

#

screw it

small plover
#

How would I go about adding a position to load a static weapon onto a vehicle that does not have one?

indigo wolf
#

How'd I go about using EH to detect whenever any camera view is being switched? (Like entering and closing arsenal, zeus interface, etc). Is there any other method than EH for this?

warm hedge
#

There is no generic way to detect a camera has changed

digital hollow
digital hollow
indigo wolf
warm hedge
#

There is the example?

finite bone
indigo wolf
#

wait nvm i got it confused

indigo wolf
#

i thought the unit was a variable not the type in that example

#

Is that LE / GE?

warm hedge
#

It is impossible to be GE

indigo wolf
#

Ok I've tried the CBA's addPlayerEventHandler and my script entirely breaks (no PiP is generated). Without it - PiP/render works but as soon as I enter/exit Zeus Interface, Arsenal or any other display/overlay the render breaks. Any help in this is appreciated.

_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, -2] select isDedicated]; 
meager granite
#

getObjectTextures your vehicle after you close zeus?

#

See what it returns

#

@still forum HitPart generates a lot of crap for the event handler arguments, I wonder how expensive it is really on the engine side? I'm planning on adding HitPart to all relevant in-game entities (units and vehicles, few hundred in real scenario), gonna try my best to have EH code as fast as possible but I wonder how much strain it is going to put on the engine or can I just ignore it? Not sure if I can measure it myself, thus the question

supple tusk
#

bit of a noob when it comes to scripting but I need some help with this one. i'm currently trying to setup a "Droid Spawner" for a star wars scenario. The mod I'm using has a vehicle that actually produces droids that I'm attempting to use however my problem is I have no idea how to tell it to preform the action on its action bar to spawn droids if BLUFOR enters the radius of a trigger. Ideally if someone would also know what I could add to tell it to stop spawning droids if a certain number of OPFOR is present in the area that would be wonderful but any help is appreciated :)

indigo wolf
boreal parcel
#

is there an event handler that fires when a smoke grenade goes off? or is there a way to get the cords of where the smoke grenade goes off?

meager granite
#

Perhaps you need to do cameraEffect again

meager granite
indigo wolf
#

OMG Yes - A rerun of cameraEffect displays it again (until I open up an arsenal / enter / exit zeus interface at which point I must run it again)

#

but this issue is so mundane

meager granite
#

No idea why it happens, I didn't work with zeus too much

#

There is probably an event handler that fires when you close it

#

Otherwise you can check some other way

boreal parcel
meager granite
#
(_this select 4) isKindOf "SmokeShell"
```Will check if fired projectile inherits from base smoke grenade (your `SmokeShellBlue` does)
finite bone
meager granite
#

He'll need something like:

if(_ammo isKindOf "SmokeShell") then {
    private _goes_off_at = diag_tickTime + getNumber(configOf _projectile >> "explosionTime");
    // New thread that waits until time comes and prints coordinate into chat
    [_projectile, _goes_off_at] spawn {
        params ["_projectile", "_goes_off_at"];
        waitUntil{diag_tickTime >= _goes_off_at};
        systemChat format ["Smoke started at %1", getPosATL _projectile];
    };
};
#

inside Fired EH

finite bone
#

ah

meager granite
#
if(_ammo isKindOf "SmokeShell") then {
    _projectile spawn {
        private _goes_off_at = diag_tickTime + getNumber(configOf _this >> "explosionTime");
        waitUntil{diag_tickTime >= _goes_off_at};
        systemChat format ["Smoke started at %1", getPosATL _this];
    };
};
```Same thing but a bit simplier
finite bone
#

is there a way to have dynamic variable names?

#

kind of like an incrementing variable name?

boreal parcel
finite bone
#

Basically I want to do this but instead of creating a marker, im trying to create a vehicle each time the script is executed.

if (isNil "PEPE_markerIndex") then { PEPE_markerIndex = 0 };
_pepemarkerName = format ["PEPE_%1", PEPE_markerIndex];
PEPE_markerIndex = PEPE_markerIndex + 1;
_pepemarker = createMarker [_pepemarkerName, _logic];```
meager granite
#
private _vehicle = createVehicle ...
PEPE_vehiclesArray pushBack _vehicle;
meager granite
#

Is there a reliable way to turn FireGeometry selection names (from HitPart EH) to HitPoints selection names that HandleDamage EH ends up getting?

#

I would've done similar check to what engine done by checking radius of every HitPoints point (precalculated ofc) but unfortunately selectionPosition doesn't have return mode to return all points, only first, average or bound box, neither of which tell the full picture

#

I guess I'll need to ask for AllPoints return more for selectionPosition?

hallow mortar
#

HandleDamage has a selection return as well as a hitpoint return. Is that not the same as the HitPart selection return?

#

I think you could use the return from getAllHitPointsDamage to convert between them as well

meager granite
#

Example, tank turret hit in HitPart: ["otocvez","hit_main_turret"], HandeDamage reports hit_main_turret_point selection, getAllHitPointsDamage has hit_main_turret_point for HitTurret too

wary needle
#

I'm making a script that changes the faction of the demining drone the players faction when placed. Where do I start?

round scroll
#

is there a way to determine on which object a player/vehicle stands? Can lineIntersectsWith be used for that purpose, just a line vertically down? I want to determine if something/someone is on an elevator on the Nimitz

hidden shoal
#

I'm working on a mission where players can earn tiered upgrades to gear and weapons from a limited ACE arsenal depending on their performance in jobs I give them. Is there some kind of scipt I could use to add things to an ACE Limited arsenal based on selections like Gear; Tier 1-3, Weapons; Tier 1-3, NVGs; Tier 1-3, etc?

#

I know I can get a raw array for ACE arsenal by exporting it in editor.

indigo snow
#

as long as the elevator is a proper object, why not?

meager granite
#

In WeaponAssembled EH

round scroll
#

just wondering if there might be a better way

quiet gazelle
#

how come we don't have a worldWorldToModel command to convert positionASL to positionRelative?

little raptor
#

Forgotten blobdoggoshruggoogly

#

Make a ticket

quiet gazelle
#

will do once i'm home

quiet geyser
#

to clarify on this in case anyone was eyeballing it, issue was fixed by just executing that code in init.sqf rather than initServer.sqf

finite bone
#

Can anyone (tagging: @meager granite since I'm using his code as base) explain how a Nested onEachFrame gives significant performance compared to a single onEachFrame?
For example:

testcenter2 = getPosWorld player;

if (!isNil "testmap2") then { deleteVehicle testmap2 };
testmap2 = createVehicle ["Land_MapBoard_F", player modelToWorld [0.2, 3, 0], [], 0, "CAN_COLLIDE"];
testmap2 setDir (player getDir testmap2);
testmap2 enableSimulation false;

testmaptexture2 = "map" + (diag_frameno toFixed 0);

testmap2 setObjectTexture [0, format["#(rgb,2048,2048,1)ui('RscDisplayEmpty','%1')", testmaptexture2]];

testframe2 = diag_frameno + 5;

onEachFrame {
    private _displays2 = [
            findDisplay testmaptexture2
    ];
    if ( _displays2 findIf { isNull _x } < 0 ) then {
        testdisplays2 = _displays2;
        {
            private _map2 = _x ctrlCreate ["RscMapControl", -1];
            _map2 ctrlMapSetPosition [0.2, 0.2, 0.6, 0.6];
            _map2 ctrlMapAnimAdd [0, 0.03, testcenter2];
            ctrlMapAnimCommit _map2;
            _x setVariable ["map", _map2];

            private _marker_color2 = (["ColorRed", "ColorGreen", "ColorBlue", "ColorYellow"] select (_forEachIndex % 4));

            _map2 setVariable ["color", getArray(configFile >> "CfgMarkerColors" >> _marker_color2 >> "color")];

            displayUpdate _x;
        } forEach testdisplays2;

        onEachFrame {
            {
                private _map2 = _x getVariable "map";
                _map2 ctrlMapAnimAdd [0, 0.03, testcenter2];
                ctrlMapAnimCommit _map2;

                displayUpdate _x;
            } forEach testdisplays2;
        };
    };
};``` This is more stable than

```sqf
testcenter = getPosWorld player;

if (!isNil "testmap") then { deleteVehicle testmap };
testmap = createVehicle ["Land_MapBoard_F", player modelToWorld [0.2, 3, 0], [], 0, "CAN_COLLIDE"];
testmap setDir (player getDir testmap);
testmap enableSimulation false;

testmaptexture = "map" + (diag_frameno toFixed 0);

testmap setObjectTexture [0, format["#(rgb,2048,2048,1)ui('RscDisplayEmpty','%1')", testmaptexture]];

testframe = diag_frameno + 5;

onEachFrame {
    private _displays = [
            findDisplay testmaptexture
    ];
    if ( _displays findIf { isNull _x } < 0 ) then {
        testdisplays = _displays;
        {
            private _map = _x ctrlCreate ["RscMapControl", -1];
            _map ctrlMapSetPosition [0.2, 0.2, 0.6, 0.6];
            _map ctrlMapAnimAdd [0, 0.1, testcenter];
            ctrlMapAnimCommit _map;
            _x setVariable ["map", _map];

            private _marker_color = (["ColorRed", "ColorGreen", "ColorBlue", "ColorYellow"] select (_forEachIndex % 4));

            _map setVariable ["color", getArray(configFile >> "CfgMarkerColors" >> _marker_color >> "color")];

            displayUpdate _x;
        } forEach testdisplays;
    };
};```
sullen sigil
#

How would I loop through an array and use all possible combinations of all its values? e.g

private _arr = [1,2,3,4,5];
{
  systemChat str _x;
} forEachCombination _arr;
//Would output something like [1],[1,2],[1,2,3] through to [5],[5,1],[5,1,3] and so on```
#

completely stumped here

#

use case is to output all possible combinations of hiddenselections + textures into an array to make my life easier

muted fox
#

Hey

meager granite
#

First layer is used to wait until findDisplay testmaptexture2 is not null, then it initialises and replaced OEF with one that does map animation

muted fox
#

So I got 4 sounds for flashbangs Indoor close, Indoor distant, Outdoor close, and Outdoor distant does my fnc_flashbangThrownFuze determine which audio gets played for the distances?

meager granite
#

Unless you use some tiled or flat texture

winter rose
muted fox
#

Yeah standby i’ll send it in a second

winter rose
still forum
muted fox
#
/*
 * Author: commy2
 * Waits for the flashbang grenade fuze to trigger and 'explode'
 *
 * Arguments:
 * 0: projectile - Flashbang Grenade <OBJECT>
 *
 * Return Value:
 * None
 *
 * Example:
 * [theFlashbang] call ace_grenades_fnc_flashbangThrownFuze
 *
 * Public: No
 */

params ["_projectile"];
TRACE_1("params",_projectile);

if (alive _projectile) then {

    playSound3D ["Bang_Sound\Sounds\grenade_flash_start_indoor_close_1.ogg", _projectile, false, getPosASL _projectile, 5, 1.2, 50];
    playSound3D ["Bang_Sound\Sounds\grenade_flash_start_indoor_distant_1.ogg", _projectile, false, getPosASL _projectile, 5, 1.2, 400];
    playSound3D ["Bang_Sound\Sounds\grenade_flash_start_outdoor_close_1.ogg", _projectile, false, getPosASL _projectile, 5, 1.2, 50];
    playSound3D ["Bang_Sound\Sounds\grenade_flash_start_outdoor_distant_1.ogg", _projectile, false, getPosASL _projectile, 5, 1.2, 400];

    ["ace_flashbangExploded", [getPosASL _projectile]] call CBA_fnc_globalEvent;
};```
#

Here's what it says

stark fjord
#

This (maybe) plays 4 sounds, which are audiable at distance < 50m and only _distant is heard out to 400m. Both indoor and outdoor are played.

muted fox
#

Yeah thing is how do I get it to know which sound to play outdoor and indoor yk

#

Nvm

#

It's soundshaders

sullen sigil
muted fox
#
{
    class Toka_soundtweak_Flash_closeExp_SoundShader
    {
        range = 15;
        rangeCurve[] = {{0,1},{5,0.75},{15,0}};
        samples[] = {{"",1}};
        volume = 1;
    };
    class Toka_soundtweak_Flash_midExp_SoundShader
    {
        range = 2200;
        rangeCurve[] = {{0,1},{100,1},{500,0},{2200,0}};
        samples[] = {{"",1}};
        volume = 1;
    };
    class Toka_soundtweak_Flash_distExp_SoundShader
    {
        range = 2200;
        rangeCurve[] = {{0,0},{100,0},{250,1},{2200,1}};
        samples[] = {{"",1}};
        volume = 1;
    };
};```
#

What do I put in here to have indoor and outdoor

hallow mortar
tribal sinew
#

I'm using CBA_fnc_parseJSON to parse a JSON (duh) and getVariable to retrieve certain fields. It seems that if the field doesn't exist then getVariable does nothing. Is there a way to check whether the field doesn't exist? isNil and isNull didn't work.

#

Here's the function if needed:

finite bone
#

Here's a sample script that uses intersect and selects the door aimed by the player inside a building.```sqf
// Allow players to breach a 'locked' door in a building with a shotgun

player addEventHandler ["Fired", {
private ["_shooter", "_magazine"];
_shooter = _this select 0;
_magazine = _this select 5;
_houses = nearestObjects [_shooter, ["house"], 10];
if (count _houses > 0) then {
_house = _houses select 0;
// _shooter sideChat format ["Nearest House: %1", _houses];
private _intersects = [];
{
_intersects = ([cursorObject, _x] intersect [ASLToATL eyepos _shooter, (screentoworld [0.5,0.5])]);
if (count (_intersects select 0) > 0) exitwith {
_intersects
}
} forEach ["FIRE","GEOM","VIEW"];
// _shooter sideChat "Found Intersect";
if (count _intersects > 0) then {
_intersect = _intersects select 0 select 0;
_dist = _intersects select 0 select 1;
// _shooter sideChat "Checking _is_door";
_is_door = [false,true] select (["door",_intersect] call BIS_fnc_inString);
// _shooter sideChat "Checking _magazine";
if (_is_door && _dist < 3 && _magazine == "rhsusf_5Rnd_Slug") then {
// _shooter sideChat format ["Breaching Door: %1", _intersect];
_select_door = format ["%1_rot", _intersect];
// _shooter sideChat "Animating";
_house animate [_select_door, 1,false];
};
};
};
}];```

quiet gazelle
digital hollow
meager granite
#
    class HitEngine2: HitEngine1
    {
        name = "engine_2_hit";
        convexComponent = "engine_2_hit";
    };
#

Not sure if this convexComponent is even from FG

digital hollow
#

Yes exactly, or should anyway

meager granite
#

After studying how it all works, I come to conclusion that there should be something like HandleDamage but from shooter side

#

The goal I'm trying to achieve is to connect projectile hits to corresponding HandleDamage, mainly to get full info about the shooter, secondly to build detailed damage report.

#

So far from all my tests I was unable to reliably tell which FG component in HitPart does damage to which HP, there are tons of FG components and the only way to tell which HP vertices they contain would be to return these vertices

#

selectionPosition can only return first, average or bounding box of these HP vertices

#

Did some tests trying to come up with approximate FG->HP conversion but couldn't make it reliable

#

If I could iterate through each vertex in each HP selection and see what FG they're inside, then I can tell which FG belongs to which HP

#

Hardcoding the conversion is not an option of course

meager granite
#

Though modelToWorldWorld should've been called modelToWorldASL

#

Speaking of getPos* commands, had a need for getPosAGL to skip one command when doing ASLtoATL getPosASL because muh microseconds

boreal parcel
#

why would this be undefined in initPlayerLocal.sqf ?

#

trying to do this addEventHandler

boreal parcel
#

oh gotcha, that makes some sense. I assumed this would be the current client. Thank you

little raptor
sharp grotto
#

Are there ways to check if a object is either dynamically or globally simulated ?

hallow mortar
#

https://community.bistudio.com/wiki/dynamicSimulationEnabled
You can check an object's current simulation state with simulationEnabled, but only its simulation state on the local machine. You can't tell if it's currently sim disabled on a different machine, unless of course you know its state has been globally set.

sharp grotto
#

Thanks, didn't see that one on the wiki meowsweats

manic flame
#

How do I generate a diaryRecord for all players using remoteExec?

I tried this but it doesnt seem to work:

{
     ["notes", "Notes"] remoteExec ['createDiarySubject', _x];
     ["notes", ["Factory Note 1", "Note text here "], taskNull, "", false]; remoteExec ['createDiaryRecord', _x] 
} forEach units player;

I used this code in a "hold action" section of an object.

#

would it work if instead of looping through the player list I just ran the remoteExec with player as one of the arguments?

grizzled cliff
#

i like how the description of this chat is literally impossible to execute in sqf

proven charm
grizzled cliff
#

even if chat here was a valid command :P

proven charm
#

also you have extra ; there

manic flame
#

yeah i noticed

manic flame
#

*looping through all players with remoteExec

proven charm
#

i would just run the whole thing on each client (without remexec) but IDK what you are trying to achieve?

manic flame
#

I want one of many players to find a note, but the note contents are shared across all clients

proven charm
manic flame
#

Then its fine I guess

proven charm
#

yeah

#

you can also give list of players straight to remoteExec (as targets) but IDK if that matters a lot (and not loop)

manic flame
#

oh yeah targets works

#

Would I be able to;

[player, "notes", "Notes"] remoteExec ['createDiarySubject', BIS_fnc_listPlayers];
proven charm
#

or give the players side as target (west or east or resistance)

#

you need call for BIS_fnc_listPlayers

#

and player doesnt exist in dedi server

manic flame
#

ah, not even in the remoteExec context?

proven charm
#

nope

#
     ["notes", "Notes"] remoteExec ['createDiarySubject', west];
     ["notes", ["Factory Note 1", "Note text here "], taskNull, "", false] remoteExec ['createDiaryRecord', west] 
manic flame
#

createDiaryRecord does need an object parameter though,

unit createDiaryRecord [params]

proven charm
#

something like that , not sure though about the order in which those commands are executed though, could be an problem

sharp grotto
#
"message" remoteExec ["hint", 0];        // sends a hint message to everyone, identical to "message" remoteExec ["hint"]
"message" remoteExec ["hint", -2];        // sends a hint message to everybody but the server
"message" remoteExec ["hint", myCar];        // sends a hint message where myCar is local
"message" remoteExec ["hint", -clientOwner];    // sends a hint message to everybody but the current machine
proven charm
manic flame
#

that's why I was looping through the playerlist at the beginning

proven charm
#

right

manic flame
#

yknow im gonna stick to the player list thing

#
private _playerList = call BIS_fnc_listPlayers;
{
 [_x, "notes", "Notes"] remoteExec ['createDiarySubject'];
} forEach _playerList;
proven charm
#
private _playerList = call BIS_fnc_listPlayers;
{
 [_x, ["notes", "Notes"]] remoteExec ['createDiarySubject', _x];
} forEach _playerList;
manic flame
#

target is a must?

proven charm
#

i think its like that, this remexec stuff is bit complicated

#

default target is 0 which means it sends to all

manic flame
#
"message" remoteExec ["hint", 0];                // sends a hint message to everyone, identical to "message" remoteExec ["hint"]
#

its essentially the same anyways

proven charm
#

still worrying about the order of the commands

#

I would personally just create a function that adds the diaries and remoteExec that

stable dune
# manic flame ```sqf "message" remoteExec ["hint", 0]; // sends a hint message ...

Yes. But if you do that in forEach, every one remoteexec for everyone same code again and again.
So you need add target where current code will be executed.
You can also call your code.
Like example

[player, [primaryWeapon player, 1]] remoteExec ["setAmmo", MyGroup]; // WRONG: the local player object is used here!
{ player setAmmo [primaryWeapon player, 1]; } remoteExec ["call", MyGroup]; // CORRECT: the remote player object is used here

Or above (if you scroll up) was couple version how remoteexec call works

manic flame
#

Wasnt player ignored in the dedicated server context?

#

And the call way is simply awesome, just what I needed as a workaround

stable dune
#

And best way is do function of it and call function.

manic flame
#

yep

#

thanks!!

manic flame
hallow mortar
#

player can be used in a mission that's hosted on a dedicated server.
It cannot be used in code that's executed on the DS machine itself, because there is no player on a DS.
In the second example, the code containing player is not being executed on the DS. It's being prepared as a Code data type, and sent, unprocessed, to the client which will execute it.

supple tusk
#

Any suggestions on how I can make an object that is a modded object preform an action that's unique to it in its action menu?

manic flame
#

oh, good to know.

#

@stable dune thanks for the tip! works flawlessly!

finite bone
#

Wait actually I can by adding it to the displays - need to figure out how to add them in the array and finddisplay in runtime

little raptor
hallow mortar
#

OneEachFrame, you might say

tribal sinew
little raptor
#

isNull wouldn't work anyway

tribal sinew
#

yeaaaah

#

figured it out 😛

#

though that getVariable would return something when the variable is not defined

#

guess not (by default)

little raptor
astral bone
#

what's the UserActions condition? Is it standard addAction condition params or?

thick venture
#

Please ping me, I have a large area that I like to clear the grass, is there a script that I can set onto a trigger or a marker. Drop the link if there's a YouTube video or Reddit post thank you

tough abyss
#

@grizzled cliff It should be
if (script) then { systemChat "here"; };

grizzled cliff
#

relevant username

tough abyss
#

indeed

grizzled cliff
#

lack of boolean comparisons is annoying in the rare chance you need them

stark fjord
#

Is there a way to make ai not automatically decide where to move like with disableAI "PATH", yet still move when doMove is issued?

granite sky
#

There are several different types of automatic movement. Was there anything specific that you wanted to block?

stark fjord
#

In fsm i use doMove on unit, since it needs to get within ~3m to attack. However natural response of ai is to run away (ai is unarmed) when enemy is detected. So it feels like im constantly fighting it.

#

It works if i set ai to careless but that brings other problems

granite sky
#

disableAI "FSM" might do that one.

#

Assuming that you didn't already replace that :P

hallow mortar
#

Disabling FSM while you're using FSM seems like a bad idea

stark fjord
#

^

#

But i can try

granite sky
#

If it's a scripted FSM then it's still going to run.

stark fjord
#

It is a custom fsm so i guess ill give it a shot. But what exactly does disableAi "FSM" cover?
Just responses or also seeking etc?

I still want it to respond to given waypoints

granite sky
#

Not sure, I've never read (or found) the native FSMs.

stark fjord
#

From what i understand they arent publicly avalible.

granite sky
#

I did a test once where I had to make an AI run towards an enemy without stopping to shoot. I don't think I wrote down the method though.

#

Might have used careless + set movement speed.

#

but even careless will shoot sometimes.

#

autotarget as well maybe.

stark fjord
#

Yup, it works that way. But its target seeking ability seems to be quite inhibited.
Also it tends to stop midway, if distance is long enough to "think". (Thats the annoying part)

native hemlock
#

I was going to say you should specify that publicvariableclient can only be run from the server, but killzone kid said starting 1.43 it works client to client if you know the owner id of the target

tranquil nymph
#

^ and thank god for that

native hemlock
#

could probably still specify that owner has to be run from the server

nocturne bluff
#

if only we could get ids from clients

#

;C

tranquil nymph
#

lol, I was thinking the same thing, but I can live with it

native hemlock
#

could have the server set a variable on them when they connect of their clientID, but then you run into whether it's worth it to getVariable the clientID and then send them the publicvariableclient versus having a function you call on them to set your chosen variable

meager granite
#

Fire particle damage is so stupid, staying 5 meters away from camp fire keeps damaging you (and firing tons of HandleDamage) and does 0 or almost 0 damage (5.62454e-010 and such)

#

I wonder how much processing goes into vehicle wreck fire trying to damage everything around them, would FPS improve if this damage check was removed

#

I also remember back in the day damage used to be local->global as in damage was X number of clients in the game, but I think that was fixed

candid bough
#

Wondering if anyone can offer some help, currently using this CUP to Livonia building replacement in my custom Overthrow scenario, the problem being is that it does not account for houses that are already spawned and saved in by the scenario, so I'm getting multiple copies of houses spawned in on top of each other and it's causing conflicts. I've tried many different solutions to check whether there is already a house object spawned in within 5 meters and if so to not place a new one however any changes seem to break the script, not really experienced in scripting so any help would be appreciated.
https://github.com/lelop15/CUP-To-Contact

GitHub

A simple mission script that replaces old A2-era buildings from CUP with ones that have interiors from Contact. It accounts for the offset between models as to prevent horrendous clipping and misp...

meager granite
candid bough
#

Just tested and still seems the problem is persisting, building replace script is creating a house object and overthrow is also loading in it's own object for player owned houses, not sure if it could be something to do with the load order of the scripts as well, cant really touch the OT spawned house as a lot of game elements are tied to the house object

meager granite
#

I have no idea what is "Overthrow" or how it works, but yeah, forcing order of scripts could be the solution

#

Change

        class postInit{postInit=1;};
```to
    class postInit{};
#
call ctc_fnc_postInit;
```after your other stuff, whatever you run
candid bough
#

Thanks will give it a go, yeah it's my own custom fork of the Overthrow scenario, I might have to check with their discord in case it could be something with the custom save/load system causing issues

fair lava
#

so im tryna make something that sets a players setUnitFreefallHeight . My code is in an init event handler, which works but when the player respawns it resets, how do i fix that?

#

is there a better event to hook onto, or should i hook onto both init and respawn, im also not sure about locality and if i need to run this for everyone or just where the player is local

tough abyss
#

what is the easiest way to remove a specific object from an array that is having units added and removed from it at the same time?

#

i've got an array that detects players in a distance but once they leave that distance from a object i can not remove them from the script i want to apply as they are in a variable

proven charm
meager granite
manic kettle
#

Alternatively just set the variable inside onPlayerRespawn.sqf event script for a mission side solution

modern meteor
#

Is is possible to execute Hold Fire (same command like in the vanilla command menu) via script? If I use any of the setCombatMode then the units either go back into formation or engage. But I only want to put them on hold fire.

manic sigil
modern meteor
#

The problem with SetCombatMode is that it also triggers to go into formation or engage. But I only want the units to hold fire.

manic sigil
#

Sorry, its 'Autocombat', disable that AI feature.

modern meteor
winter rose
#

it simply prevents the current script from being saved in a savegame

#

if you only do no-save/MP, you're good

modern helm
#

Trying to delete a vehicle if it exists on a helipad. Here's the method:

padObject = missionNamespace getVariable "pad_alpha";
_veh = (nearestObjects [padObject, ["AllVehicles"], 10]) select 0;
if (alive _veh) then {
  deleteVehicle _veh;
  sleep 0.3;
};

It works perfectly when there is something on the pad, but throws an undefined variable error when there isn't as the if statement doesn't catch this. I've tried alive, !isNull, and !isNil and none of them have caught it. Can anyone lend a hand?

meager granite
#

If there are no vehicles, nearestObjects will return empty array.
[] select 0 => nil, so when i'll try to feed nil into some command (alive) it will throw the error.

#

Why delete only the first vehicle btw?

#

You need a count check to see if array is empty before getting its first vehicle.

private _vehs = nearestObjects [padObject, ["AllVehicles"], 10];
if(count _vehs > 0) then {
  private _veh = _vehs select 0;
  if (alive _veh) then {
    deleteVehicle _veh;
    sleep 0.3;
  };
};
#

Also looks like you used !isNil wrong, proper check would've been:

if (!isNil "_veh" && {alive _veh}) then {
```but doing count check is more valid approach here than to select from an empty array.
modern helm
#

ahh gotcha, thanks

modern helm
#

while you're here, could you help with calling a function... if I add this through zeus it works but not through eden editor:

padObject = missionNamespace getVariable "pad_alpha";
pad = getPosATL padObject;
dir = getDir padObject;

removeVehicle = {
  _vehs = nearestObjects [padObject, ["AllVehicles"], 10];
  if (count _vehs > 0) then {
    private _veh = _vehs select 0;
    if (alive _veh) then {
      deleteVehicle _veh;
      sleep 0.3;
    };
  };
};

this addAction 
[ 
    "Spawn MH-6M", 
    { 
        call removeVehicle;
        // code continues
meager granite
#

padObject is not defined in that function

#

Otherwise this looks like it could work in Init field

modern helm
#

padObject = missionNamespace getVariable "pad_alpha"; is a line before the function declaration

#

will edit for clarity

meager granite
#

Where do you add this anyway? In Init fields?

modern helm
#

yes

meager granite
#

Your assignments will execute once on Init and that's it. If your "pad_alpha" was undefined, your padObject will remain nil forever

#

Even if you define "pad_alpha" later, assignment was done during initialisation

modern helm
#

that hasn't caused any problems yet

#

the pad exists from the start of the mission

meager granite
#

Well your code not working is a problem

#

Variable doesn't

modern helm
#

it only doesn't work when moved into a separate function

#

ah i think i'm understanding

meager granite
#

Btw, unless you're swapping namespaces, you can just use pad_alpha instead of missionNamespace getVariable "pad_alpha"

#

_vehs = nearestObjects [pad_alpha, ["AllVehicles"], 10];

modern helm
#

this script goes on several objects with different pad names, wanted an easy way to only have to change the name in one place

meager granite
#

If you use same script on different objects, your global padObject variable will be overwritten with different pad_* variables

modern helm
#

if I prefixed the variable with an underscore, it wasn't accessible from the action methods

#

what is correct?

meager granite
#

Yeah because underscored names are local variables

modern helm
#

Coming from other languages, the scoping on this is really bizarre

meager granite
#

Overall, you're structuring it wrong and need to rethink how you define stuff

meager granite
#

Define one function somewhere (Like init.sqf):

removeVehicle = {
  _padObject = missionNamespace getVariable _this;
  _vehs = nearestObjects [_padObject , ["AllVehicles"], 10];
  if (count _vehs > 0) then {
    private _veh = _vehs select 0;
    if (alive _veh) then {
      deleteVehicle _veh;
      sleep 0.3;
    };
  };
};

then add actions where you need them:

this addAction 
[ 
    "Spawn MH-6M", 
    { 
        "pad_alpha" call removeVehicle;
        ...
#

Could also use some better function naming because removeVehicle looks very close to a scripting command deleteVehicle, you can't redefine those

#

Beware though, vehicle Init fields are done before init.sqf so if you define some function in init.sqf and try to call it from Init field, it won't work.

modern helm
#

All I need to do to make this functional is make these variables local while still being able to reference them within action methods:

padObject = missionNamespace getVariable "pad_alpha";
pad = getPosATL padObject;
dir = getDir padObject;

I don't mind having code that isn't terribly clean. Is it possible to do this?

wary sandal
#

Hello! I'm entirely new to ArmA mod making so keep that in mind. Is it possible to interact with any kind of filesystem library to write files? I'd like to record some actions my player does and outputs them to a cache or whatever file so that i can use it elsewhere.

meager granite
modern helm
#

I understand that

meager granite
#

Do you only have single padObject? I guess its "Vehicle name" is pad_alpha?

modern helm
#

There are multiple with ascending names in the phonetic alphabet

meager granite
#

You can address this object with pad_alpha

wary sandal
#

to achieve what i want

winter rose
#

Yup

wary sandal
#

time to learn cpp aviator

#

||worst mistake of my life||

winter rose
#

some exist already, but yeah the base game doesn't allow you that

winter rose
wary sandal
#

but wouldn't that cause security problems?

#

like

modern helm
wary sandal
#

would that even be allowed on the workshop

meager granite
#

Init field:

_some_local_var = 123;
this addAction ["action", {
    //this is a completely new scope, _some_local_var is not available here
}];
#

There are arguments to addAction though, but they're static, you can't change them after you added addAction

modern helm
#

I understand this which is why I made the variables global without realising other scripts could access and overwrite it. Is there no middleground between these two types?

meager granite
#
_some_local_var = 123;
this addAction ["action", {
    diag_log (_this select 3); // 123
}, _some_local_var];
meager granite
modern helm
#

I am not

#

I'd like to be able to copy the code in the editor and paste it into different areas only having the change one string at the start to reference a pad name

wary sandal
meager granite
#

But here is how you could have it done your way:

_padObject = missionNamespace getVariable "pad_alpha";
_removeVehicleFunction = {
  _vehs = nearestObjects [_this, ["AllVehicles"], 10];
  if (count _vehs > 0) then {
    private _veh = _vehs select 0;
    if (alive _veh) then {
      deleteVehicle _veh;
      sleep 0.3;
    };
  };
};

this addAction 
[ 
    "Spawn MH-6M", 
    {
        (_this select 3 select 0) call (_this select 3 select 1);
    },
    [_padObject, _removeVehicleFunction],
    ...
#

You have your function and pad object as local variables at top of the Init field, then add action and have your local variables stored as arguments for action function

#

You can customize your function in each Init field as well as what pad object is

#

But this is a really clunky way of doing it all

modern helm
#

Trying with just on provided variable...

this addAction 
[ 
    "Spawn MH-6M", 
    { 
        _pad = getPosATL _this select 3;
        // continues
    },_padObject, 1.5, true, false, "", "true", 5 
];

Should the line be _pad = getPosATL _this select 3 select 0; even when one variable is given?

meager granite
#

(_this select 3 select 0) turns into _this inside (_this select 3 select 1) function

meager granite
meager granite
#

unary commands (getPosATL ENTITY) are always called before binary commands (ARRAY select INDEX)

#

So game was trying to do getPosATL _this and _this is array of addAction crap

sullen sigil
#

github or other methods

meager granite
modern helm
#

Got it working, thanks a bunch

modern helm
meager granite
wary sandal
#

most of my work is open sourced

wary sandal
#

why do i keep getting this error everywhere?

#

"this declaration has no storage class or type specifier"

warm hedge
#

What do you mean? The red line?

wary sandal
#

i could remove the error squiggles but i'd still like to keep intellisense on

wary sandal
#

on every red line

warm hedge
#

Unrelated “error”. No need to think

wary sandal
#

how can I silence it?

#

it's pretty annoying

warm hedge
#

Probably just remove the highlighter or something. I'm not very familiar with VSCode (I assume)

wary sandal
#

ig it was my intellisense complaining because this file wasn't compilable

#

hmm

#

do I need to create a meta.cpp file or is it created automatically?

stark fjord
#

On topic of FSMs
4 - DCExplosion, // explosion detected
is never a cause. no matter how close explosions are to ai

indigo wolf
#

Are Public Variables JIP enabled?

meager granite
indigo wolf
#

Great thanks

warm vapor
#

Is there a way, by way of script, to set the name of a target as it would appear on a radar when marked?

manic sigil
#

I believe it references the target's type, so outside of making a whole modded vehicle with that name... :/

warm vapor
#

Shoot; Fair enough. My hope was that I could easily script something in to create a target

manic sigil
#

What effect are you trying to create?

warm vapor
#

There's been a few times I've wanted to rename assets. One scenario for example, if I wanted to have an 'prototype' vehicle, to be able to rebrand it as such

#

But I don't necessarily want to create a whole vehicle in an addon to do it for one mission

modern meteor
#

Hi, having a syntax problem and cant solve it. How can I use a variable for the text below?

private _MeterLoop = player distance  (units group player select 1);
["<t color='#db1a1a' size='.4'>["%1", _MeterLoop]</t>",-1.17,1.05,4,0,0,789] spawn BIS_fnc_dynamicText;
manic sigil
#

Ah, yeah. Only thing I could think to work around with that is a 'on locking this object, player comments 'wow my radar reports X but it doesn't look like an X!'. Just gotta work with the systems you're given.

warm vapor
#

Fair enough. I didn't consider an event handler

manic sigil
#

I mean, it's still not quite the impact you want, but it's the best you can do 😛

#

Bluh, sorry, the text clipped half off the screen and on second review, it didn't work as expected.

manic sigil
modern meteor
#

Brilliant, thanks a lot for your help!

crisp sleet
#

Hello, I've seen a script on a server that allows the player to edit the inventory of all vehicles, that are in a certain area... So far, I haven't found that script... do you know where I can find that? Cheers

modern meteor
#

Is there a way to show multiple texts on screen? It seems that ```sqf
BIS_fnc_dynamicText

always overwrites the existing text, even if it is in a different corner of the screen.
granite sky
#

You need to use a different resource layer.

modern meteor
#

how can I do that please?

granite sky
modern meteor
#

I am using the following code but it gives me syntax errors:

if (combatMode player == "BLUE") then  {["<t color='#1a81db' size='.4'>Blue Mode</t>",-1.33,1.05,4,0,0,789] [1] spawn BIS_fnc_dynamicText;};
if (combatMode player == "GREEN") then  {["<t color='#16c728' size='.4'>Green Mode</t>",-1.33,1.05,4,0,0,789] [2] spawn BIS_fnc_dynamicText;};
if (combatMode player == "YELLOW") then  {["<t color='#dde33d' size='.4'>Yellow Mode</t>",-1.33,1.05,4,0,0,789] [3] spawn BIS_fnc_dynamicText;};
if (combatMode player == "RED") then  {["<t color='#db1a1a' size='.4'>Red Mode</t>",-1.33,1.05,4,0,0,789] [4] spawn BIS_fnc_dynamicText;};
if (combatMode player == "WHITE") then  {["<t color='#f5f7f6' size='.4'>White Mode</t>",-1.33,1.05,4,0,0,789] [5] spawn BIS_fnc_dynamicText;};
#

Where shall i put the layer?

granite sky
#

blinks

#

["<t color='#1a81db' size='.4'>Blue Mode</t>",-1.33,1.05,4,0,0,789] <- The "789" here.

#

The extra [n] you put in is nonsense syntax.

modern meteor
#

yea, but how do i use different layers?

#

i don't know how to do it

granite sky
modern meteor
#

So 789 is the layer number?

granite sky
#

Yes.

modern meteor
#

Got it, thank you!

wary sandal
#

what would be the easiest way of adding a button to the menu when you press escape?

#

the only resource I found on this is a library from 2013 and it's outdated, everything else is about creating actual UIs and not "appending" buttons

little raptor
opal zephyr
#

I think rhs does it for their stuff, could check that out for reference

stark fjord
#

Is there a way to check if AI can reach certain position or not calculatePath returns positions array even tho AI could never reach that spot.

Example AI is on the ground and position it wants to reach is on the rooftop (no ladder/ramp avalible)

finite bone
#

So what type of execution / locality does diag_frameNo use?

stark fjord
hallow mortar
#

It returns the number of the current frame (as in rendered frame) since the game was opened. It has no arguments, and only returns one number.
So...it can only return the value for the local machine.

wary sandal
#

my goal here is to insert a button within these ones

little raptor
#

CBA does it. check their stuff

#

in any case it's not simple as you wanted

wary sandal
little raptor
finite bone
#

So in ctrlSetPosition what do the x,y,w,h mean? Since its a 2D display box, you'd only require 2 coordinates right? Like aren't the width and height of the control already specified by x and y?

south swan
#

No, they aren't

finite bone
#

More so in the wiki description:
For 3D control, param is relative [x, y, z]. where as in Syntax 3: controlName ctrlSetPosition [x, z, y]

wary sandal
#

i can't find the function where those are created tho

little raptor
wary sandal
#

i thought of adding that button at the top-middle of my screen but i'm not too sure how to make it appear only when the escape menu is opened

#

do i have to use findDisplay to check whether the escape menu is opened?

little raptor
#

gamePaused or something event handler

#

or was it called interrupted?

little raptor
wary sandal
#

or...

#

wait

little raptor
#

it's a display

wary sandal
#

what about if the menu is closed?

#

is it this event?

little raptor
wary sandal
little raptor
#

what menu?

little raptor
#

when you unpause the game the display gets destroyed

#

and everything in it goes with it

wary sandal
#

or do we have to explicitly tell Arma that an UI is apart the pause menu

#

i have very little experience with UIs in general so excuse me for my pretty narrow knowledge

#

||and i also can't type today||

little raptor
#

when you unpause the game the display is destroyed

#

so obviously everything in the layer is gone

wary sandal
#

so i have to call ctrlCreate on the display

#

to create the button

#

thx for the help

modern helm
#

Could anyone give me a hand on how to add an ace interaction? I've been reading the docs and this is as close as I have gotten but it's not appearing.

_action = ["SpawnVehicle","Spawn Vehicle","",{hint "Spawning vehicle...";},{true}] call ace_interact_menu_fnc_createAction;
[this, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
modern helm
#

trying to add it to an object from the props tab

little raptor
#

props tab?

#

are you putting the code in the object init?

modern helm
#

yes

little raptor
#

did you try from debug console in the mission?

modern helm
#

I've also tried adding it from zeus if that's similar to what you mean

finite bone
little raptor
#

dunno never used that

modern helm
finite bone
#

Works fine for me

little raptor
#

maybe you're too far from the center?

modern helm
#

that might be it

finite bone
#

Ah you are using the Aircraft Factory - Its a big object

modern helm
#

there's a parameter for distance but there are some other parameters I have not defined in between, how do I ignore those and only set the distance?

little raptor
#

give them the default value all the way up to the distance one

modern helm
#

the default values are not specified

finite bone
#

or set them null maybe

modern helm
#

tried setting to null and distance of 30, still can't find it

little raptor
modern helm
#
_action = ["SpawnVehicle","Spawn Vehicle","",{hint "Spawning vehicle...";},{true},{},nil,[0,0,0],20] call ace_interact_menu_fnc_createAction;
[_this, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
#

still unable to find it

#

even tried distance of 50

little raptor
#

why not try on another object to make sure everything works before moving onto this one?

#

it maybe not be due to dist anyway

finite bone
#

It works for other objects - The specific object hes trying to add it to is too big (like a building)

modern helm
#

oh well

finite bone
#

Recommend having an invisible object and then adding this function while within the Aircraft Factory building.

modern helm
#

i have an easier problem, i hope: i'm using a trigger and this code to repair and refuel a vehicle

thislist spawn {  
    {_x Setdamage 0} Foreach _this; 
    {_x Setfuel 1} Foreach _this; 
    {_x setVehicleAmmo 1} Foreach _this; 
};

I would also like to message the crew in the vehicle while this is happening, this is what I tried:

thislist spawn {  
    {
        hint "Your message here" to _x;
    } forEach crew _this;
};

But I am getting an error

modern helm
winter rose
modern helm
#

_this is an array, i need to iterate through it then get the crew?

#

dr house

winter rose
#
["Your message here"] remoteExec ["hint", thislist select { isPlayer _x }];
```I guess
finite bone
#

Alternatively you could use vehicleChat

modern helm
#

could you explain how it works if you have the time?

finite bone
modern helm
#

ah got it, thanks

molten yacht
#

my brain is deep fried. will this properly set a public variable named "endCDC" to the boolean true?

missionNamespace setVariable ["endCDC", true, true];
#

And enforce that True upon JIP

silent salmon
#

so a question regarding CBA scripting: Im trying to use the waitAndExecute fnc to fire off a flashbang effect 5 secs after a submunition is deployed. Now when I use the following:

[{ systemChat str _this}, [_this], 5] call CBA_fnc_waitAndExecute;

works just fine and reads back the submunition correctly
however if I use:

[{ _this call ace_grenades_fnc_flashbangthrownfuze}, [_this], 5] call CBA_fnc_waitAndExecute;

nothing happens, has anyone tried anything like this? or have an idea where the error could be?
currently the SQF is tied too cfgFunctions which in turn is in a class EventHandlers init in the submunition ammo code

molten yacht
#

rest of my stuff isn't tho :(

#

I have a holdaction that when it completes should do remoteExec ["AID_fnc_intel_securityDone", -2]

#

and that function shows up just fine in the functions viewer, so my cfgFunctions is working

#

but it's not actually doing it

#

even though the function is laughably simple

#

literally just 2 sideChats and that previous "set this variable to true, globally"

#

I don't get it

#

Maybe I need to call the function some different way?

#

.....wait

#

maybe it's because of the environment, brb.

#

Okay that was totally it

#

note for other morons testing shit on their own machine

#

if you set the remoteExec param to -2 to avoid it executing on the server when it's on dedi, it won't execute on your machine when you're testing it locally in "test multiplayer"

winter rose
#

ta-daaa, don't code "for dedi only"

molten yacht
#

yep yep

#

shoulda thought of that

winter rose
#
[0, -2] select isDedicated
molten yacht
#

pleased as punch with my growth as a scripter to look again at the wiki page and understand what I was doing wrong without someone telling me, tho!

#

wait, what would that look like with the whole context

winter rose
#

just replace -2 with that extract

molten yacht
#

so ["AID_fnc_intel_securityDone", [0, -2] select isDedicated]?

winter rose
#

if the function is extremely simple, go for 0

winter rose
#

(if done on server ofc)

molten yacht
#

hmm it's a holdaction so I'm gonna write that method down for later but use 0 here

#

thanks, you're a saint

winter rose
#

Speak freely, @stark fjord

stark fjord
#

Im having a weird issue with Init event handler and createSound
So this is how event handler is defined inside CfgVehicles

class EventHandlers
{
  init = "[_this select 0] call MST_FNC_monster_init;";
  deleted = "[_this select 0] call MST_FNC_monster_delete;";
  killed = "[_this select 0] call MST_FNC_monster_delete;";
};```

MST_FNC_monster_init
```sqf
params["_monster"];
if (isServer) then
{
  private _sound = createSoundSource ["SFX_monster_loop", position _monster, [], 0];
  _sound attachTo [_monster, [0, 0, 0], "Head"];
  _monster setVariable ["MST_Sound", _sound];
};```

MST_FNC_monster_delete
```sqf
params["_monster"];
if (isServer) then
{
  private _sound = _monster getVariable ["MST_Sound", objNull];
  if (!isNull _sound) then
  {
    deleteVehicle _sound;
  };
};

Event handler fire OK, sound gets created and deleted ok.
So the funny thing and it only shows on dedicated server:
When i create monster for the first time, 1 sound is created and 1 sound is deleted when i kill/delete monster.
When i create monster 2nd time 2 sounds are created?!? but 1 sound is deleted,
Third time 3 sounds are created but 1 sound is deleted, and so on you get the idea.
More funny things, when i create same monster as diffrent side, lets say OPFOR after that,
again 1 sound is created and 1 sound is deleted...

#

Any thoughts and prayers on that?

stark fjord
#

how does it even know how many times it was created ....
Also monster_init also create some clientside effects with if (hasInterface) then { check, and that does not create multiples of...

winter rose
#

do you miss some params to define _monster perhaps?

stark fjord
#

nono its there, sound does get created and plays just fine...
It just with if i spawn N monsters, it creates N*N sounds 😐

stark fjord
#

touche

#

but edited to avoid confusion

winter rose
#

(thonks)
both the code and config seem ok
and it seems to work properly on hosted, so idk 😐

stark fjord
#

it only shows on dedicated which is wierd... i guess i can just

{
  deleteVehicle _x;
} forEach allMissionObjects "#dynamicsound";``` as a workaround... but sound does get earrapingly loud at about 6th one spawned (and rest are dead/Deleted)
molten yacht
#

Does anyone know the best way to remoteExec bis_fnc_dynamictext? Should I just shove it into a custom function like I have all my other shit, and execute it?

stark fjord
#

yes

stark fjord
# stark fjord Im having a weird issue with Init event handler and createSound So this is how e...

Okay to follow up on this, it only happens when unit is deleted, either via deleteVehicle or Zeus delete.

First time its deleted it works fine.
Then when i spawn it again Init and Delete event handlers fire twice on server, but only once on client as expected.

Third time its deleted both event handlers fire 3x and so on. always only on server.

It is also side related as if i spawn same unit but different side then it works normally again until i delete that unit.

#

Also if i use 1st syntax of createUnit on server, dynamic sound gets created on server, and is at valid position and attached, but it doesnt play a sound.
If its created on client it works fine.

alt syntax works fine in every case.

frozen knoll
#

did you check if _sound returns null after deleting the first time?

#

im guessing each time you create a monster it has a unique id?

winter panther
#

Do anyone knows a good script for periodically spawning groups of infantry and vehicles and make them move towards a point? (either preconfigured units or editor placed). I tried a couple scripts: DAC and JEBUS, but neither allows me to spawn units on demand, they only respawn units when they die. There's also DMP, which is great but it doesn't have anything to order units to move.

stark fjord
frozen knoll
#

like lou said the code you posted looks fine it comes down to how you call it and create the unit which we cant see

stark fjord
#

With createUnit. And code is called from cfgvehicle event handlers

#

As ive said, issue is init and delete evt handlers fire multiple times after unit is deleted, only on server.

sage heath
#

@hallow mortar after copius amounts of...testing i finally figure out what's causing the issue with the S-300 if you remember

it's cba, i don't know why it's cba, i basically stripped down the mission and script to just the S-300 part, and launched the game with just pook sam pack, and cba_a3, and this issue occurs, and doesnt occur when CBA_a3 is not loaded!

so yeah

#

what now?

hallow mortar
#

I have absolutely no idea

sage heath
#

crap

sage heath
frozen knoll
#

@stark fjord strange that, out of curiosity have you run a debug like the below to make sure that _monster is unique and doesn't have a sound variable already? first time would return NONE i am curious about second time

params["_monster"];
if (isServer) then
{
  private _sound = createSoundSource ["SFX_monster_loop", position _monster, [], 0];
  _sound attachTo [_monster, [0, 0, 0], "Head"];
  diag_log format["MST Sound Var | %1",_monster getVariable ["MST_Sound","NONE"]];
  _monster setVariable ["MST_Sound", _sound];
};
opal zephyr
#

Anyone ever see the "giar pre stack size violation" error before?

#

cant find anything about it on google

#

Fixed, was missing a semicolon

granite sky
#

Yeah those are basically undetected script errors that break the interpreter.

manic kettle
#

Hmm that discussion gave me an idea,
If I wanted to use a killed event handler on all npc/vehicles with a timer to delete their bodies after say...30m
Would all those EH be somehow taxing to the server?
As opposed to the traditional garbage collection

granite sky
#

The EH isn't very expensive.

#

Having 30 threads hanging around is a bit more interesting.

hallow mortar
#

If you want to do something like that, I'd suggest an EntityKilled mission EH that tags bodies with time of death, paired with a single loop that checks that at a medium interval and acts if necessary

#

Engine garbage collection isn't that bad though, I wouldn't bother unless you really have specific logic in mind that it's important to make it use

manic kettle
#

Yeah that's a good idea.
Well it has a use case on our big operations in big towns where there are a lot of bodies and it won't clean it fast enough. But I could maybe just do a better job at setting it up so eh

stark fjord
#

Here is example of how my test init looks ```sqf
params ["_m"];
if (local _m) then
{
[str player + " Setting local stuff"] remoteExec ["systemChat", -2];
};

if (isServer) then
{
["SERVER Setting server stuff"] remoteExec ["systemChat", -2];
};

if (hasInterface) then
{
[str player + " Setting client stuff"] remoteExec ["systemChat", -2];
};```
Output i see after first entity spawn/delete when createUnit is ran as client>

<player object> Setting local stuff
<player object> Setting client stuff
SERVER Setting server stuff```
Looking good, now second spawn/delete >

<player object> Setting local stuff
<player object> Setting client stuff
SERVER Setting server stuff
SERVER Setting server stuff```

#

If i run createUnit as a server, output looks like this, first spawn/delete >

<player object> Setting client stuff
<null object> Setting local stuff
SERVER Setting server stuff```
Second spawn/delete>```
<player object> Setting client stuff
<null object> Setting local stuff
SERVER Setting server stuff
<null object> Setting local stuff
SERVER Setting server stuff```
#

Same on deleted eh.

#

My current workaround as ive mentioned is sqf if (isServer && isNull(_monster getVariable ["MST_Sound", objNull])) then { //do server stuff & create _sound _monster setVariable ["MST_Sound", _sound]; };
This works okay enough, still fires multiple times but at least it aint spammin sounds...

stark fjord
#

Also for reference this is how i create unit

private _grp = createGroup WEST;
M_TEST = _grp createUnit ["MST_B_Monster", [<position>], [], 0, "FORM"];
// If above is ran on server, #dynamicsound is created and attached but no sound plays, if ran on client it works fine
// OR
private _grp = createGroup WEST;
"MST_B_Monster" createUnit [[<position>], _grp];
// Above can be ran on server or client and #dynamicsound works fine

//Init and Delete EHs still fire multiple times after unit is created deleted on same side multiple times
still forum
# silent salmon so a question regarding CBA scripting: Im trying to use the waitAndExecute fnc t...

https://github.com/acemod/ACE3/blob/master/addons/grenades/functions/fnc_flashbangThrownFuze.sqf#L21
it does a alive check, what happens when you do the alive check and log it.
Also "works just fine and reads back the submunition correctly" are you sure its correct, or do you think its correct?
You thinking it looks correct-ish doesn't mean its right. for example maybe array nested to deep, or the projectle is already dead at that point

wary sandal
#

how do I run a script from an addon when the client starts playing on a mission?

#

I've seen people creating custom start event handlers calling scripts starting with "XEH" but i'm pretty sure it only works with ace/cba

stark fjord
#

PostInit in cfgFunctions would do you. Or preInit if you dont care if objects are created yet.

wary sandal
#

i'm not sure how you call a script this way

stark fjord
#

Not quite.
class myFunction {postInit = 1;};
Instead of postInit = 1;

wary sandal
#

also, how do I tell arma what sqf script to run?

stark fjord
#

Yeah read that a bit. Its explained nicely in there

wary sandal
#

would that work?

class CfgFunctions
{
    class WTK
    {
        tag = "WTK";
        class AnyCategory
        {
            class post_init
            {
                file = "fnc_init.sqf";
                postInit = 1;
            };

            class pre_init
            {
                file = "fnc_preinit.sqf";
                preInit = 1;
            };
        };
    };
};

#

here's my current setup: (cropped out fnc_preinit.sqf)

slow brook
#

Zeus Curator question

hallow mortar
#

You don't need tag = "WTK" if you're already defining the tag class as WTK

stark fjord
#

Also, just below classs WTK. Put file="\addon_prefix\path\function\folder";

#

Then prefix all function files with fn_ and they will be auto included

wary sandal
stark fjord
#

You can use both. But its redundant

hallow mortar
#

You must have the tag class layer, it's part of the config structure. The specific tag attribute is only if you want the tag in the final function name to be different from the tag the game would use to autogenerate a file path; there's almost no reason to do this, definitely not in your case.

wary sandal
#
class CfgFunctions
{
    class WTK {
        file = "\main\functions"
        class AnyCategory
        {
            class post_init
            {
                postInit = 1;
            };
            class pre_init
            {
                preInit = 1;
            };
        };
    };
};
#

would this setup work?

#

i fixed the mistakes i've made

stark fjord
#

Eggzample

class CfgFunctions
{
    class WTK
    {
        class MuhFineScriptz
        {
            file="<addon_prefix>\fn";
            class init {postInit = 1;};
            class preInit {preInit = 1;};
        };
    };
};

Files would be
config.cpp
fn\fn_init.sqf
fn\fn_preInit.sqf

wary sandal
#

file = "Arma3ModTest\addons\main\functions"

#

would it be valid?

stark fjord
#

Also edited you dont need leading \

stark fjord
wary sandal
#

that's my addon prefix

stark fjord
#

Folders INSIDE your mod

wary sandal
#

inside the main (addon) folder?

stark fjord
#

Arma3ModTest\addons\ is your prefix??

wary sandal
#

i don't get it, the path is relative to the path of the main addon (where config.cpp is located) or relative to the path of the mod itself (where mod.cpp and stuff are located)?

stark fjord
#

Config.cpp

wary sandal
#

ok so it should just be file = "functions"

#

where does the prefix come from, it shouldn't matter here?

stark fjord
#

Eggzample

class CfgFunctions
{
    class WTK
    {
        class MuhFineScriptz
        {
            class init {postInit = 1;};
            class preInit {preInit = 1;};
        };
    };
};

Files would be
config.cpp
MuhFineScriptz\fn_init.sqf
MuhFineScriptz\fn_preInit.sqf

wary sandal
#

Arma3ModTest\addons\main

#

this is a correct pboprefix afaik

#

wait actually no

#

it's in any addon

wary sandal
hallow mortar
# stark fjord Config.cpp

The path is not relative to config.cpp. When in mod config, the path is relative to the game root. The addon prefix must be specified.

stark fjord
#

Cause category represents folder name. Look below in under "files would be"

wary sandal
#

ah, i see

#

i guess it's easier if i just remove the file property and rename the category to functions

#
class CfgFunctions
{
    class WTK {
        class functions
        {
            class init { postInit = 1; };
            class pre_init { preInit = 1; };
        };
    };
};
#

correct?

stark fjord
#

Ye. Try this. Also cfgfunctions is included in config.cpp?

wary sandal
#

this is how my config.cpp is structured

hallow mortar
stark fjord
wary sandal
#

just wanna make sure

stark fjord
#

Should.

#

You can add sleep to maybe delay it a bit, so it doesnt hint you somewhere where hint cant be displayed

wary sandal
#

one moment

#

in main menu

stark fjord
#

I guess file is needed then

wary sandal
#

i don't get it

stark fjord
#

You have to replace it.

#

With pbo prefix.

hallow mortar
#

That is a description of how the game detects file paths when no specific path is defined

stark fjord
#

Also just a theory. If my pboprefix contains only test_addon

Then use file="\test_addon\functions"; that would work right?

wary sandal
#

i think it's better to keep it consistent with the pboprefix

hallow mortar
#

When you specify a path, it is treated as <root>\whatever\path\fn_functionName.sqf

#

What <root> is is determined by the game. As described, when in mod config, <root> is the main game root, and if you want to reference an add-on you have to specify it

#

When loaded, addons are essentially folders inside the main game root

wary sandal
#

@hallow mortar according to what you've quoted, <root> is where mod.cpp and meta.cpp are located so I have to explicity tell the game the directory, this way:

class CfgFunctions
{
    class WTK {
        class InitScripts
        {
            file = "Arma3ModTest\addons\main\functions";

            class init { postInit = 1; };
            class pre_init { preInit = 1; };
        };
    };
};
#

correct me if i'm wrong, the name of the category doesn't matter if a file path is provided

hallow mortar
#

That is correct

wary sandal
#

really appreciate the help guys

stark fjord
#

Cause if we take example from
CfgWeapons, picture="\my_addon\myPicture.paa"
I might be bamboozled here but in cfgFunctions
file="\my_addon\functions" would work all the same. Without the need to prefix
"MyAddonFolder\addons\my_addon\functions"

hallow mortar
# wary sandal

Well, this is what their prefix actually is. If this is the file structure then this is where they need to tell the game to look.

The file path begins at the game root.

#

You can in theory direct the file path to a different addon, if you're some kind of maniac.

stark fjord
#

Ill check once im home... but i think that would work. If pboprefix was my_addon

slow brook
#

Getting this error below. can anyone tell why it's throwing back the missing ()?

15:08:14 Error in expression < serverTime;

private _objects = (call 3P_fnc_getEditableObjects);

{
[_x, _obje>
15:08:14   Error position: <P_fnc_getEditableObjects);

{
[_x, _obje>
15:08:14   Error Missing )

Code:

    private _objects = (call 3P_fnc_getEditableObjects);

    {
        [_x, _objects] call 3P_fnc_updateEditableObjects;
    } forEach allCurators;

Geteditbale returns an array

still forum
#

look at the syntax highlighting and you'll see it

#

look at the colors

slow brook
#

yeah im colour blind

#

what am i missing

stark fjord
#

Prolly cause ur function starts with number

slow brook
#

Is that not allowed then

warm hedge
#

IIRC no, it is not allowed

silent salmon
still forum
# slow brook Is that not allowed then

What you wrote is like if you wrote
(call 3 P_fnc_getEditableObjects)
because variable names cannot start with numbers, it thinks its a number, followed by a variable (or command) name without a space between.

wary sandal
#

how can I give custom properties to my button class?
here's what I have in my description.ext :

import RscButton;

class MyCustomButton: RscButton {
    
}
#

when I create the control with ctrlCreate it creates nothing

#

however, when i put the rscbutton class directly it works

still forum
#

show the ctrlCreate script line

wary sandal
#

i've also tried to put the CT_BUTTON custom class from the wiki but it won't work

import RscButton;

class MyCustomButton: RscButton {
    SizeEx = GUI_TEXT_SIZE_SMALL;
    colorBackground[] = {1,1,1,0};
    colorBackgroundActive[] = {1,1,1,0};
    colorBackgroundDisabled[] = {1,1,1,0};
    colorFocused[] = {1,1,1,0};
    colorShadow[] = {1,1,1,0};
    borderSize = 0;
}
still forum
#

if its empty it probably cannot find it

wary sandal
#

works with the base RscButton class

still forum
#

how about
private _buttonControl = _display ctrlCreate [missionConfigFile >> "MyCustomButton", -1];

And if you run missionConfigFile >> "MyCustomButton" in debug console does it find it

wary sandal
#

so i assume it does?

#

error type config entry, string expected

still forum
#

that looks good

#

"error type config entry, string expected"
wuht, the wiki page says config works

#

since 2.14.. oh.. welp

#

Well atleast we know the button is definitely in description.ext and found

tough abyss
#

question what map do you guys debug in? do you go to altis and see the mediterranian explore europe with livonia or go plain and use vr

wary sandal
#

quicker to load than altis

tough abyss
#

fair fair

wary sandal
still forum
#

did you check the RPT log yet?

wary sandal
#

the : extends the class right

#

it takes all the properties from it

still forum
#

yes the config looks correct to me

wary sandal
#

it doesn't throw any error

still forum
#

To.. check if it throws any error

wary sandal
#

there's a black box everytime there's an error so

still forum
#

no

#

That's only for script errors

bold thistle
#

hello, what is the door object of these houses? I want it to open at the door of the house with the animation, but I could not do it. Can anyone help?

wary sandal
#
17:05:05 Starting mission:
17:05:05  Mission file: moddingtest
17:05:05  Mission world: Stratis
17:05:05  Mission directory: Z:\Documents\Arma 3 - Other Profiles\Wojtek\missions\moddingtest.Stratis\
#

it's clean, no errors

little raptor
#

Then run animationNames cursorObject while looking at the object

#

It will give you all animations you can use with the animate command

little raptor
#

Well you don't need to actually think_turtle

little raptor
wary sandal
#

now i'm into scripting

little raptor
wary sandal
#

those datatypes can be stringified?

#

type control, string expected

little raptor
stark fjord
#

Just a quick question what _display are you using?

wary sandal
#

when you press escape

wary sandal
#

thus it exists

#

the issue is about the UI itself i think

stark fjord
#

Yeah im thinking it does, its just somewhere you cant see it

wary sandal
#

here's my description.ext again

import RscButton;

class MyCustomButton: RscButton {
    SizeEx = GUI_TEXT_SIZE_SMALL;
    colorBackground[] = {1,1,1,0};
    colorBackgroundActive[] = {1,1,1,0};
    colorBackgroundDisabled[] = {1,1,1,0};
    colorFocused[] = {1,1,1,0};
    colorShadow[] = {1,1,1,0};
    borderSize = 0;
    text = "this is some text";
}
little raptor
#

The issue is you're not giving it a pos/w/h

#

It could all be 0

proven charm
little raptor
#

Check in config viewer

wary sandal
#

that's code i ripped from the wiki

stark fjord
#

Thats the example of text only youve ripped. Try setting all 0s to 1s

wary sandal
#

we all love being meowsweats 'd

stark fjord
#

And maybe set sizeEx to GUI_TEXT_SIZE_MEDIUM for easier findability

little raptor
faint oasis
stark fjord
#

Thats respawn tickets no?

faint oasis
#

ok nvm i found it the command is called " scoreSide"

modern meteor
#

Hi, I am using Leopard20's Advanced Developer Tools in game to check scripts for syntax errors. The tools are awesome but is there also another way to check sqf scripts when the game is not running for syntax errors?

wary sandal
#

i don't find mycustombutton

#

but here

stark fjord
#

It will be in mission config

little raptor
#

And its background is invisible so effectively it's completely invisible

wary sandal
stark fjord
#

"this is some text";

little raptor
#

Oh meowsweats

wary sandal
#

and text is a valid property of RscButton so

stark fjord
#

config screenshot is for RscButton

#

not his custom button

wary sandal
#

it's in splendid config viewer or somewhere else?

stark fjord
#

on top select mission config

#

you will find it in there

#

yes in config viewer

wary sandal
#

i don't find it as i said

stark fjord
#

gib moment, ill start the game

wary sandal
#

k, thanks for the efforts

stark fjord
#

here, close configfile by double clicking

wary sandal
#

the text still doesn't show up

stark fjord
#

hmm try setting x=0.5; y = 0.5;

proven charm
#

i think sizeEx is the problem

stark fjord
#

yeah its in quotes

#

why?

proven charm
#

failed preprocess i guess

wary sandal
#

it's not being preprocessed

#

yeah

proven charm
#

try sizeEx = 0.05;

wary sandal
stark fjord
#

ah you didnt put in the macro into description ext

proven charm
wary sandal
stark fjord
#

wait did you set sizeEx in description or not?

wary sandal
#

yes

#

how do i import the macro?

stark fjord
#

remove the whole line

#

it will be medium by default

wary sandal
#

or do i have to make a hpp file to deifne the macro

stark fjord
#

you can define macro in description

wary sandal
#

how?

#

indeed, it was because of that

stark fjord
#
#define GUI_TEXT_SIZE_SMALL     (GUI_GRID_H * 0.8)
#define GUI_TEXT_SIZE_MEDIUM        (GUI_GRID_H * 1)
#define GUI_TEXT_SIZE_LARGE     (GUI_GRID_H * 1.2)```
wary sandal
#

the text now shows up

wary sandal
#

nice

stark fjord
#

.ext is basically cpp file

wary sandal
#

copying the config file also works

#

ah for the macros, yeah

stark fjord
#

thats prolly why your CT_Button example didnt work

warped hornet
#

Does anyone happen to know if its possible in CfgUserActions to have the onActivate return something to be used in onDeactivate

grizzled lagoon
#

Hello, what is the command for change the direction of object in eden editor ?

warped hornet
warped hornet
warped hornet
warped hornet
little raptor
warped hornet
#

Alright, thank you for the help

grizzled lagoon
warped hornet
#

Im not entirely sure what that means sorry

#

Do you mean the center of rotation is wrong or?

#

If so maybe try setDir then SetPos?

grizzled lagoon
#

the object is placed with the right direction but when I look at the coordinates of the object it is wrong

grizzled lagoon
warped hornet
#

Im not sure then, someone else may have better input than I

stark fjord
#

what exactly are you trying to do?

grizzled lagoon
#

i try to generate object in eden éditor, with the position and direction.

i use that for spawn object ```sqf
{
private _t = _x select 1;
private _pos = [(_t select 0), (_t select 1), 0];
private _obj = create3DENEntity ["Object", (_x select 0), _pos];

_obj setpos _pos;
_obj setdir (_x select 2);

} forEach (...);```

stark fjord
#

can you give example of one entry in forEach array?

bold thistle
grizzled lagoon
# stark fjord can you give example of one entry in forEach array?

yes : ```sqf
{
private _t = _x select 1;
private _pos = [(_t select 0), (_t select 1), 0];
private _obj = create3DENEntity ["Object", (_x select 0), _pos];

_obj setpos _pos;
_obj setdir (_x select 2);

} forEach ([["Land_pavement_narrow_f",[3729.06,3048.7,1.90735e-006],114.91]]);```

stark fjord
#

And issue is, that it does set the direction, but its not set in objects attributes?

grizzled lagoon
#

yes

little raptor
#

and you're not using the code I said to use

stark fjord
# grizzled lagoon yes
{ 
    private _t = _x select 1; 
    private _pos = [(_t select 0), (_t select 1), 0]; 
    private _obj = create3DENEntity ["Object", (_x select 0), _pos];
    _obj set3DENAttribute ["rotation", [0, 0, _x select 2]];
     
} forEach ([["Land_pavement_narrow_f",[1796.36,1766.35,0],114.91]]);```
bold thistle
scenic shard
#

I want to add a "Killed" EH to a vehicle, if i understood correctly all players+server needs this EH in case they drive the vehicle, as it only fires where the object is local?

this also needs to work with JIP so i add it inside a remoteExec.

assuming i am correct with the above, how can I remove it from the JIP queue in case the vehicle is destroyed? or will it clean up automatically?

granite sky
#

You might want to consider the mission event handler EntityKilled instead. It's less of a pain.

#

With JIP remoteExec you can set the JIP ID parameter to the object, and then it's automatically cleaned up when the object is deleted. However, you can only have one remoteExec with the same JIP ID.

#

Alternatively you can remove it from the JIP queue manually with remoteExec ["", _jipID]. Works from anywhere.

#

Another option is to use the Dammaged EH, which is for some reason global-argument unlike Killed.

scenic shard
#

do you know if a vehicle counts as "deleted" when it is destroyed? or is the wreck still the same object?

granite sky
#

Nope, same object.

scenic shard
#

ok, might be easier with addMissionEventHandler then, do i only add that one server side and it will always trigger there? regardless of where the vehicle is local?

granite sky
#

Yep.

scenic shard
#

does the EntityKilled trigger when everything is killed, or can I still attach it it a specific unit?

hallow mortar
#

It's a mission event handler, so it detects events in the entire mission and is not object-specific. It will fire when any entity is killed. You can use additional filtering in its code to decide whether to proceed further - for example, using a typeOf or isKindOf check and exitWith.

limber panther
#

Hello!
The following script is a section of exported file from arma 3 arsenal: ```sqf
comment "Remove existing items";
removeAllWeapons _voj;
removeAllItems _voj;
removeAllAssignedItems _voj;
removeUniform _voj;
removeVest _voj;
removeBackpack _voj;
removeHeadgear _voj;
removeGoggles _voj;

scenic shard
#

should work for me, i have a variable set on the vehicle anyways. Im guessing there is no real overhead performance wise to this vs adding it to the specific unit and making sure the JIP queue is updated?

granite sky
#

@scenic shard Things don't die that often so I think it's fine. Ideally have an early-out for objects that don't have classnames, because you can get a bit of spam when bombs drop on towns.

#

Variable set on vehicle is fine too.

limber panther
# little raptor you can add it back

that's exactly what i need to avoid, let me explain, among other mods, we use on our server well known TFAR mod. Each player has to tune his radio to a given frequency in order to be able to talk to the rest of the team. At some locations on the map we have rearm points. Those are basically objects with an addAction on them and after triggering it a script loads a new full gear, just like they would load it from arsenal, but in this situation the radio gets deleted from the inventory and the same one immediately readded, in theory it's ok, but this process resets the radio frequency and they have to set it again after loading the gear.... and that's what most players usually forget to do, we can't hear the player in the radio, we're sending units to his rescue while he's allright and mad why we're not responding, i've been trying to teach those players that they have to set the frequency again but they just still keep forgetting it

scenic shard
#

you can save and restore the freqs used with TFAR's eventhandler "radiosReceived" or similar

little raptor
#
{
  _unit unlinkItem _x;
} forEach (assignedItems _unit - [getUnitLoadout _unit param [9, []] param [2, ""]])
granite sky
#

In the next version we get getSlotItemName :P

limber panther
little raptor
#

yeah

sullen sigil
#

is this using some arma 2 stuff? didnt even know comment was still a command meowsweats

little raptor
#

you can just put a raw string there...why did they even make a command for it?! blobdoggoshruggoogly

sullen sigil
#

yeah i checked the wiki and it felt like either you or lou wrote it after looking at a performance test for it

#

both a warning and an information card on the same wiki page

limber panther
little raptor
wary sandal
#

what's the property that changes the CT_EDIT textbox border (that grey one)?

little raptor
wary sandal
#

like this?

#

i think this is the flag you are talking about

#
#define ST_NO_RECT        0x200
little raptor
#

it's a style meowsweats

wary sandal
#

but you said

#

to its type

#

wait

#

i'm confused

little raptor
#

style = ST_LEFT + ST_NO_RECT

little raptor
olive forge
#

Hey

#

ive been stuck on this all day and there are no guides to tell me how

#

im trying to make a very simple mod that justs prints "entity spawned" whenever an entity is spanwed

#

but just cant figure it out

#

i cant find any good tutorials

#

can anyone link me a good tutorial?

wary sandal
#

i'm a perfectionist when it comes to this kind of stuff

olive forge
#

Through initServer.sqf

#

Mission event handlers

stark fjord
#

just a thought, why dont you just print your message when you spawn it in there?

tough abyss
#

i like how the description of the chat is literally impossible to execute in sqf
It triggers me.
Error generic error in expression

olive forge
#

I’m just using the scenario as a way to learn how to do it

#

I plan on doing a lot more

#

But gotta learn how to turn it into an addon first

#

@stark fjord

#

Can anyone link a tutorial?

willow hound
olive forge
stark fjord
#

No event scripts are used in addon. If you wanna put scenario into addon, then it will be still used in scenario folder.

tough abyss
#

best error message ever

thorny osprey
#

Is there a script function to change a value in an existing (in config) muzzle class?

tough abyss
#

finding the error is like shooting an elephant with a .22 blindfolded xD

sullen sigil
#

you cannot edit config properties with sqf

thorny osprey
#

What I want is to script a hotkey to throw a grenade at half power. By changing as little as possible.

#

I see, thanks.

#

Change would not have to persist btw. It would be temporary to fire the muzzle, then revert.

#

But if it can’t be done like that I’m dropping the idea. Not going to create new muzzles and all the hassle.

stark fjord
hallow mortar
#

Fired event handler will detect grenades, you can then immediately change the grenade's velocity

thick arrow
#

Anyone got a solid script to set player respawn with additional player spawns set to certian roles say d_flag_hangers was set to pilot role and d_flag_garage was set to crewman?

tough abyss
#

Anyone knows which config entry is correct?
soundIncommingMissiles
or
soundIncommingMissile
or
soundIncomingMissile

#

I see both

#

pls don't harm inncoent elephants

wind sapphire
#

Just wondered if anyone has seen an error like the one below and if so what it means ...

#

x (268435456) out of range <0, 1024)

#

I assume it refers to a value such as unit number etc.

stark fjord
#

Maybe some more context?

tough abyss
#

Edited the question. This get's more confusing the longer I look at it.

stark fjord
#

When object is created in editor Init event handler fires, but deleted doesnt,
Is there any such event handler that would?

#

so i can delete particles if unit is deleted

shut lily
#

hey guys, is it possible to make a tank full of players drive without input? want to make a cutscene similar to the Thunder Run mission from bf3. Playing on dedicated so Unitcapture won't work..any ideas?

broken stirrup
wind sapphire
#

I think the error is generated when trying to reference a unit - I'll get more information for you if I can.

queen cargo
#

was first who blamed the description
even provided better example which would compile (still ... t would have given an error msg due to the fact that it called a function which was never defined)

hallow mortar
rose aurora
#

looking for a zombies script to run in official pub zeus. seen someone use one sucessfully a month or so ago

tough abyss
#

this worked for me ```sqf
_unitCaptureData1 = //your unit data here;
[Heli_1, _unitCaptureData1] spawn BIS_fnc_unitPlay

cyan dust
cyan dust
#

Another question: Why helicopter pilots may sometimes completely ignore given waypoints? They just hover in the air doing nothing. Just for fun I killed one of them and second pilot immediately took control and proceeded to the wp.
How to overcome this?

still forum
#

Many people tried to implement solutions navigating around SQF's deficits. This is the solution to get rid of the deficits

cyan dust
#

Could you give an example?

stark fjord
#

It looks something like Lua module

still forum
#

instead of

thingy call Ded_fnc_thingy_DoThing
and
thingy call Ded_fnc_thingy_DoOtherThing

you can write
thingy call ["DoThing"];
thingy call ["DoOtherThing"];

and instead of

if (thingy#0 == "TypeA")
thingy call Ded_fnc_thingy_A_DoThing;
else if (thingy#0 == "TypeB")
thingy call Ded_fnc_thingy_B_DoThing;

you can write
thingy call ["DoThing"];

Plus the ability to implement RAII type constructs with a destructor, makes lots of things simpler