#arma3_scripting

1 messages · Page 155 of 1

proven charm
#

can you somehow get the currently seen display? allDisplays doesnt seem to be in correct order

ruby turtle
#

Hey guys, I have the problem, I have a wokring 60 second countdown script, but when i try to using format into mm:ss showing in the hint, I get the error that sleep 1; is not allowed in this context.

My working old script:

// Dauer des Timers in Sekunden
private _duration = 60;

// Schleife, um den Timer herunterzuzählen
for "_i" from _duration to 1 step -1 do {
    // Nachricht an alle Spieler mit der verbleibenden Zeit anzeigen
    {
        hint format ["Zeit bis Detonation: %1 Sekunden", _i];
    } forEach allPlayers;

    // Eine Sekunde warten
    sleep 1;
};

// Nachricht anzeigen, wenn der Timer abgelaufen ist
{
    hint "Detonation!";
} forEach allPlayers;

my try to format the time showing in the hint:

private _duration = 60;

for "_i" from _duration to 1 step -1 do {
    private _minutes = floor (_i / 60);
    private _seconds = _i % 60;

    private _formattedTime = format ["%1:%2", format ["%02d", _minutes], format ["%02d", _seconds]];

    {
        hint format ["Zeit bis Detonation: %1", _formattedTime];
    } forEach allPlayers;

    sleep 1;
};

{
    hint "Detonation!";
} forEach allPlayers;

Why sleep is now not allowed? or I do where im wrong?

south swan
#

are you calling it differently?

#

i.e. spawn-ing the first one and running the second one from debug console

ruby turtle
#

yep exactly that way.

calling it from sqf file working now, but shows me nothing in the hint except: d:d

#

format time i never used before

faint burrow
ruby turtle
#

but where is my logical problem to format the time correct?

faint burrow
stable dune
#

Maybe he trying get
Format Data Result
%02d 1 01
%02d 11 11

faint burrow
#

Yes, but this is not C, this is unsupported in SQF.

stable dune
#

Yeh, its

south swan
#

and yes, it's not blobcloseenjoy

ruby turtle
#

yes i already edited IT 😅

faint burrow
#

Yes.

ruby turtle
#

so i dont need to define much just using a pre existing function ^^

faint burrow
#

Exactly.

ruby turtle
#

i will Test it when Back Home in 1hour and give you a Feedback.

#

%1 will be filled with the following string place, right? in every situation?

faint burrow
#

If you provide a value.

ruby turtle
#

in my case i have pre defined what is _i so this will be the Content of %1 (formatted with the function but in simple words)

#

correct?

faint burrow
#

I believe so.

ruby turtle
#

Im not a scripting expert, so I will understand what I using. So next time its easier maybe without help

faint burrow
#

Of course, if you need help, read BIKI, ask questions...

ruby turtle
#

BI wiki is my first way everytime, but sometimes there are not enough information to be handled by a noob ^^

faint burrow
#

I think it's at first glance. In my opinion, BIKI can almost always answer any question.

charred monolith
#

Hi ! I have question regarding the use of Function-as-files and Inline functions.
Which one should I prioritize ? Is there like a common practice to use ?

proven charm
warm hedge
#

Not sure both Function-as-files and Inline functions mean, but I guess there is no literal difference. They are semantically same terms of how it works, so you better to pick either of them you prefer/easier to maintain

proven charm
#

if you want to put several functions in one file you can do ```
myFunction = {
// Code here
};

sharp grotto
#

You can also be lazy/fast and do that inside initplayerlocal.sqf / init.sqf / initsever.sqf / mod pre-init etc.

// Define functions
{
    missionNamespace setVariable [(_x #0), compileScript [_x #1]];
} forEach
[
    ["XYZ_fnc_ABC","Code\XYZ_fnc_ABC.sqf"],
    ["XYZ_fnc_DEF","Code\XYZ_fnc_DEF.sqf"]
];
south swan
#

you can be even more lazy and define the functions inside init.sqf blobcloseenjoy

late drum
#

Anyone knows where can I edit that text that says SYSTEM? On my server it just says BattleEye

still forum
#

It's defined in game stringtables

#

Part of it

#

These ones most likely in dta/languagecore

sacred turret
#

some vehicles have special roles assigned to it (e.g HEMTT medical, HEMTT refuel, Medical tents, etc.), as it can be seen in CfgVehicles; is this modifiable on runtime? are there any commands that can make, for example, a MH-9 function as a medical, repair and fuel vehicle at the same time?

tulip ridge
sacred turret
#

What about modifying it ""non-runtime""?

tulip ridge
#

Yes, you can do it by modifying the config values of whatever class(es) you want

proven charm
#

so i guess no command exists to get the currently rendered display? maybe i should make a ticket for that?

fair drum
#

You mean top most display?

proven charm
#

yeah

sharp grotto
unreal wharf
#

I'd like to have an object orbit around another object. Is there any function that exists which might fulfill this purpose?

covert oak
#

I'm at work now so I can't poat the script, but it was pretty simple to make the AI use hand signals. I added an event handler CommandChanged for the group, and defined a table (array with key-value pairs) for each possible command and a hand signal animation from SOGPF. The good thing about those animations are they only affect the arm, so they work if the unit is standing, kneeling, or prone.

gritty parrot
unreal wharf
gritty parrot
# unreal wharf A sort of planetarium like display.

The way I would approach this is:

  • add cba_fnc_addperframehandler, within that
  • Get the objects up vector, the one that the other thing should be rotatet around
  • Rotate the vector a tiny bit using the cba function to rotate 3d vectors (forgot name), then attach the object to the other using the rotated vector as offset.

Need links to funcs?

real tartan
#
// initServer.sqf
addMissionEventHandler [ "onUserSelectedPlayer", {
    params [ "_networkId", "_playerObject", "_attempts" ];

    _playerObject spawn 
    {
        params [ "_unit" ];
        waitUntil { sleep 0.5; getPlayerUID _unit isNotEqualTo "" };
        // do stuff
    };
}];

I am getting false positives from getPlayerUID. What condition should I check, to wait server transfer player object to client ?

hollow blade
#

Hello, does anyone here use a linux based system and mod? I want to ask if there will be any differences or anything I'll need to set up via wine.

hallow mortar
devout cobalt
#

How would i change the name of a weapon, not the display name but the other name?

hallow mortar
#

Which other name?
(Chances are very good that this is a #arma3_config problem - most weapon properties are config-controlled only)

devout cobalt
hallow mortar
#

I don't have the game open right now, could you give me an example?

devout cobalt
hallow mortar
#

Right, that's the weapon's classname, the internal name used to refer to it in scripts and config

devout cobalt
hallow mortar
#

In order to actually change it you would need to modify the original mod (can't and don't, even if it's your mod, changing classnames is not backwards compatible). The best you could do is make another mod that makes a new class with the name you want that inherits everything from the original, and then have your mod modify the original class to hide it in the Arsenal. That's an exercise that's technically possible, but pointless.

devout cobalt
#

ah okay, thanks

hallow mortar
#

It's just an internal name to refer to the weapon type. It's only important for use with scripts and mods, and even then it doesn't really matter what it is as long as you know what it is.

devout cobalt
#

Yeah

onyx wasp
#

it happens immediately when someone joinees

#

i will thanks guys

indigo snow
#

Also init.sqf, initPlayers.sqf and any functions in cfgFunctions with either the preInitnor postInit flag set

spring stone
#

immediatley when someone jips...

but that did not happen before...it starts about a week ago (1.54)

indigo snow
#

Yes the update might have broken a script

#

For example the alternative syntax of local got changed

vital tangle
#

Hey guys
Hope you are all going well.
Hoping someone can help me figure out a quick code.
When someone is killed a marker is placed and lasts for 5 minutes.
I'm wanting to timestamp each marker so I know what ones I need to hit first. What's the script for something like that?

tulip ridge
indigo snow
#

Finally if this returns nothing youll have to check your mods by removing and adding them back one by one.

vital tangle
tulip ridge
#

Why check isServer twice?

vital tangle
#

They were done separately and then combined so just missed it haha

tulip ridge
#

Also, you're using apply on an array, but you're never using the result. You can just use {} forEach [...]

#

You also create the marker if it doesn't exist, and then check if it exists just after.

Nevermind, I see what you're doing

raw vapor
#

So I realized today that 'init' fires literally every time a player joins the game. How can I make it only fire once? Or do I have to resort to other means of doing scripts at game start or when a unit gets spawned by Zeus? I don't want the script firing every time a player joins.

#

Or, I may have answered my own question. Is that what if (isServer) then {...}; does?

tulip ridge
#

That just runs code only on the server

covert oak
#

So isServer does what it says on the tin, it means the script will only be executed by the server (host)

tulip ridge
#

Which may or may not be what you want

covert oak
#

That said it will only execute once if it's in the init.sqf file if I'm not mistaken.

#

I don't think I've opened eden without eden enhanced installed since it was released, but is the init box in general from enhanced or vanilla?

lavish dagger
#

this is perfect, cause I do want their to be an explosion

raw vapor
#

My goal is to have a composition of AI who randomly spawn in with different equipment every time one of them gets placed, or at mission start if I place them in 3den.

lavish dagger
#

I'm completely new to arma 3 scripting as whole, can anyone assist with a simple, if you open inventory of this item, it spawns mk82?

vital tangle
#

I'm confused with how to timestamp the kill.

#

Would it be
_marker setdate

#

Or maybe _marker diag_tickTime?

vital tangle
#

So that would be
setMarkerText diag_tickTime
?

warm hedge
#

Read the wiki

vital tangle
#

Thanks mate. I actually had someone write the script for me and have been using it for the last few months and love it when I'm running Antistasi.
Now I'm wanting to tweak it that last little bit and I just can't figure this bit out haha

tulip ridge
#

What exactly are you wanting, like the in-game time when the marker is created or the number that shows how long the client has been running for

vital tangle
#

In game time that is also

tulip ridge
#

Okay, so then use date, it gives an array of the day month year hour min etc.

#

Then you can just use format to format it how you want

#

For example:

private _name = format ["Surrendered Unit - %1:%2", _hours, _minutes];
vital tangle
tulip ridge
#

It doesn't technically matter, as long as you do that before the setMarkerText

vital tangle
#

ahh ok easy.
Ill have a fiddle when I get home and see if I can make it work.
Thanks mate

tulip ridge
#

👍

raw vapor
#

"Error: addVest: Type array, expected Object"
I'm not sure what's going wrong here. I put this in the init field of a unit and this error is the result. _this should definitely not be an array.

{
 _handle = 0 spawn { 
  sleep 10; 
  _this addVest "HITMAN_47_Hidden_Vest"; 
  _this addWeapon "CUP_arifle_AK47_Early"; 
  _this addMagazine "CUP_30Rnd_762x39_AK47_M";
 }; 
};```
#

Clearly I am not understanding something.

warm hedge
#

Your code in error and your code you've posted are not the same anyways, you're passing 0 or [this] that are definitely not an object

raw vapor
#

I grabbed the wrong screenshot but I suppose the hang-up is I'm not using spawn correctly. I'm trying to delay my code because I can't just type sleep in the init field without putting it in a spawn field and I have no idea how spawn works and reading the wiki didn't clear much up.

warm hedge
#

Still, 0 or [this] is not an object. this is

raw vapor
#

Okay, let me try that. I see the problem now.

#

Okay now I got it. Thank you.

{
 _handle = this spawn { 
  sleep 3; 
  _this addVest "HITMAN_47_Hidden_Vest"; 
  _this addWeapon "CUP_arifle_AK47_Early"; 
  _this addMagazine "CUP_30Rnd_762x39_AK47_M";
 }; 
};```
warm hedge
#

To clarify and future ref: [0] is an array, that has a number in it. You can retrieve 0 out of it using select or some other commands... but [0] is an array still

#

Same with this or [this] etc

raw vapor
#

Yeah I was trying to copy from somewhere else not fully understanding how spawn worked to begin with.

warm hedge
#

It is about _this more TBH

meager granite
#

Is it normal for IncomingMissile event to fire twice? Was it always like this? 🤔

formal grail
formal grail
willow hound
#

I also noticed this back in 2021. My theory was that it fires once for AI firing a guided or unguided projectile at the target and once more for a guided projectile as it starts tracking the target.
Then it also makes sense that players firing at the target only trigger the EH if they fire a guided projectile that has locked onto the target.

cobalt path
#

Question, is it possible to attach multiple objects to different parts of a rope

warm hedge
cobalt path
#

Essentially I want 6 or so objects to be attached to the end, than 3m higher than 3m higher than 3m higher than etc up the rope

#

uhh

#

I see

#

Are the segments always named the same?

warm hedge
#

Name? What it does mean

cobalt path
#

Okay I did some testing and I aint sure anymore
I did

[cl4, [0,0,0], 168075] ropeAttachTo MyRope9;

168075 is 3rd to last rope segment. But object is still attached to last one

warm hedge
#

168075 is just a number, not an object

cobalt path
#

I mean that command above did successfully do the attachment, just to the wrong thing

#

or not the thing I intended atleast

warm hedge
cobalt path
#

Well apparently it does

#

it attached rope end to the object cl4

#

Just executed it after your last comment

warm hedge
#

Then you are not running that code. The code should throw an error straight

cobalt path
#

I dont know what to tell you

#

Anyway, segments. I get a bunch of numbers in return

warm hedge
#

No. They are objects, not numbers

cobalt path
#

rope.p3d

#

all of them

warm hedge
#

They are objects

cobalt path
#

okay, how do I attach to, lets say, second to last one

warm hedge
#

Okay I stand correct. It seriously for unknown reason sqf [objNull, [0,0,0], 0] ropeAttachTo objNull;is not throwing an error. But that is not the code you want anyways. Seems the second argument is not even working correctly?

#

To get the second to last segment, sqf (ropeSegments _yourRope)#-2

cobalt path
#

I use that instead of rope name? at the end of ropeattachto?

warm hedge
#

No?

cobalt path
#

or in the third variable?

warm hedge
#

Once again, rope segments are objects. You can use one of the segment that is returned by ropeSegments to refer one of the segment object

#

Urm okay, I stand corret again. You want to use attachTo instead. Not ropeAttachTo

cobalt path
#

What

#

huh

vital tangle
#

Hey guys
Does this look correct?
More importantly just the timestamp portion half way down.

raw vapor
#

So this is what I was working on and I'm quite proud of it.
Fot context I was wanting to modify the weapons that spawned with CFP civilians. The problem is you can't set loadouts because code attached to CFP civilians automatically randomizes their loadouts. That's great if you don't want your civilians to look samey, but bad if you want those unique looking civilians to carry guns.

Now I could have stopped at making sure they spawn with a gun by using a spawn and sleep to add the weapons I want, but you see, I am an insanely autistic person and so I hyperfixated on this for the past twelve hours pulling every single gun and all of the ammo variants I specifically wanted to use.

The way it works is...

  • First, you define an array of arrays containing a gun and all the ammo types that go with it. [gun,["mag","mag","anotherMag"]] Not literally all ammo types but specifically what you want to use. Sure I probably could have used something sane like pull all available mag types for that gun instead of doing it manually but this method lets me intentionally add duplicates of certain mags to increase their commonality like 20rnd 5.56 on old M16s, or to omit certain mags I don't want like 150 round double-drum mags. These guys I made are supposed to be militants, so they have a wide variety of possible mag spawns.
  • Once I have that array of arrays, I randomly choose one of those arrays. This assigns what gun will spawn.
  • (Optional) Add a vest or backpack that allows the AI to carry more magazines, since civilian outfits tend to have bad inventory space. I used an in-house mod to add a cheaty invisible vest that allows me to do this without adding visible changes to the characters
  • With that gun chosen, I then also check the next item inside that gun's array which is a sub-array containing the mag types I want to go with that particular gun. I randomly select one of those magazines each time we attempt to spawn a magazine. This assigns what magazines can potentially spawn.
  • Repeat previous step about 30 times or whatever. You won't get extra magazines if you're unable to fit any more so may as well do it a whole bunch of times.
  • Just as a fail safe because the AI is a little janky and sometimes still spawns with empty guns, try to reload in 7 seconds if you haven't loaded your gun yet.

Just plop this sucker in the init field and you're golden. Probably. I haven't tested it in multiplayer.

Mods included are CUP, GM, Aegis, and SOG guns, but you can repurpose this to whatever mod set you see fit.

Anyway, the sun is up, time for bed. smilethonk

#

If someone would care to proofread my work (you can skip the giant block of arrays) and let me know if this works fine in multiplayer I'd appreciate it.

#

I cannot test this, and I am not sure if this would work if I spawned the units with say, Zeus. Would the units get all their assigned gear on all players' screens or do I need to use different commands? if (isServer) should prevent the script from firing every time a player joins at least.

ruby turtle
#

Short question because i cant test MP compatibility currently. Will this work well in MP? it works fine on eden testing sp and mp

[] execVM "scripts\ambient\countdown.sqf";
["sgmusic_2"] remoteExec ["playMusic", 0];

hatak hideObjectGlobal false;
shield_1 setdamage 1;
shield_2 setdamage 1;
[4] remoteExec ["BIS_fnc_earthquake", 0];
sleep 20;
[4] remoteExec ["BIS_fnc_earthquake", 0];
sleep 20;
[4] remoteExec ["BIS_fnc_earthquake", 0];
sleep 20;
[4] remoteExec ["BIS_fnc_earthquake", 0];
sleep 20;
[4] remoteExec ["BIS_fnc_earthquake", 0];
sleep 20;
[4] remoteExec ["BIS_fnc_earthquake", 0];
sleep 40;

hatak enableSimulationGlobal true;
sleep 20;
hatak setdamage 1;
hallow mortar
#

It should, as long as it's executed only on the server

#

Your code block didn't format correctly because you used different characters at each end. You must use ` at both ends.

ruby turtle
#

I call it via addaction: 0 = this addAction ["Reaktor überlasten!", "scripts\ambient\zpm.sqf"];

hallow mortar
#

hideObjectGlobal and enableSimulationGlobal require server execution. If this is called from an action, then the script will only be executed on the machine where the action is activated. You would need to either remoteExec those two commands to the server (target 2) or remoteExec the whole script to the server. Personally I'd suggest the latter; handling this on a client means the sequence will be stopped if that client happens to disconnect partway through, whereas the server will never disconnect (without taking the entire mission with it, anyway)

sharp grotto
#

Also don't use execVM, use functions.
execVM should be only used if you run/execute something once.

ruby turtle
#

the whole Script I want to be used only one time. but the effects I want to be global.

#

is that possible?

this addAction ["Reaktor überlasten!", {
    "scripts\ambient\zpm.sqf" remoteExec ["execVM", 2];
}];
meager granite
#

You either need arguments or no array

#

around the file path

ruby turtle
#

which arguments?

#

I edited my old code, you mean like this?

meager granite
#

right

blissful current
#

Is there a way to stop an AI from going prone? I have one in a guard tower and when he sees players he does this making it hard for players to see him.

proven charm
blissful current
blissful current
#

Is there way to use the trigger condition BLUFOR detected by OPFOR have a timer that satisfies the condition?

For example right now I have that condition in a trigger synced to a task that fails if BLUFOR is detected. But I want to give the player a chance to kill the sentries within lets say 10 seconds. If they do that then trigger wont fire and the "alarm" wont be raised.

Basically right now it is too punishing for the player. I hope this is making sense.

fleet sand
#

Quick question does anybody know how can i make it so Zeus cant delete specific object. or Respawn position. Even when he adds it to Zeus interface.

bitter fractal
#

Hi guys question, anyone knows how to make a command to give all units a certain amount of mags or even give them grenades or certain items to start with? i tried to start with this to just add magazines to everyone but i keep getting error i even tried to add a debug but it still doesn't work

{ _primaryWeapon = primaryWeapon _x; systemChat format ["Unit: %1, Primary Weapon: %2", _x, _primaryWeapon]; if (_primaryWeapon != "") then { _magazines = magazines _x; { _x removeMagazine _y } forEach _magazines; // Correct usage: _y is each magazine, _x is the unit _magazineType = getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "magazines") select 0; \ for "_i" from 1 to 5 do { _x addMagazine _magazineType; }; systemChat format ["Added magazines: %1 to %2", _magazineType, _x]; } else { systemChat format ["No primary weapon for unit: %1", _x]; }; } forEach allUnits;

#

i made an action combat scene where everyone should already start with mags on them without the need to refill from a crate or something because it's not part of the scene, i just want everyone to start with mags and grenades

little raptor
#

Your forEach is wrong

#

_y is not "each magazine"

#

It doesn't even exist

#

Is that chat gpt generated?

bitter fractal
# little raptor It doesn't even exist

{ private _primaryWeapon = primaryWeapon _x; systemChat format ["Unit: %1, Primary Weapon: %2", _x, _primaryWeapon]; if (_primaryWeapon != "") then { private _magazines = magazines _x; { _x removeMagazine _x } forEach _magazines; private _magazineType = getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "magazines") select 0; for "_i" from 1 to 5 do { _x addMagazine _magazineType; }; systemChat format ["Added magazines: %1 to %2", _magazineType, _x]; } else { systemChat format ["No primary weapon for unit: %1", _x]; }; } forEach allUnits;

bitter fractal
#

do you know how to do it then?

#

i don't have time to learn arma coding i am already coding in java

little raptor
#

Define the unit outside the scope, using another variable

#

I didn't really bother to read the rest of that code tho

bitter fractal
#

what would you use for sqf then?

faint burrow
bitter fractal
#

i would learn it but i want to invest every single hour i have into java

bitter fractal
#

and everyone scream no ammo no ammo when they start

bitter fractal
#

i don't know why would arma 3 makers make it so hard to just make units start with a certain amount of mags it should be just a basic slider or a value to set in the options

#

why do i have to know coding to give my units mags

#

it should be the most basic option \ slider

#

ill try to dig into the wiki but i hope i won't need to spend hours on hours to learn a new lang and code an entire script just to play a video game i just want to enjoy

#

this worked for me

{ private _unit = _x; private _primaryWeapon = primaryWeapon _unit; systemChat format ["Unit: %1, Primary Weapon: %2", _unit, _primaryWeapon]; if (_primaryWeapon != "") then { private _magazines = magazines _unit; { _unit removeMagazine _x } forEach _magazines; private _magazineType = getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "magazines") select 0; for "_i" from 1 to 5 do { _unit addMagazine _magazineType; }; systemChat format ["Added magazines: %1 to %2", _magazineType, _unit]; } else { systemChat format ["No primary weapon for unit: %1", _unit]; }; } forEach allUnits;

#

it wasn't that hard after all

faint burrow
still forum
bitter fractal
zenith stump
#

Gonna need some advice here.

Been trying to make two objectives for my mission.

Objective 1 is to locate a specific vehicle, and objective 2, spawned by completion of objective 1 is to secure the area around it.

Objective 2 I can make without issue, but I can't figure out how to make first objective complete when players (multiplayer) find the vehicle.

Been trying to figure out knowsAbout command, since that's what was suggested to me, but I can't figure out how to make it work.

Any help you be appreciated.

faint burrow
#

I would use https://community.bistudio.com/wiki/cursorTarget command.
Create a trigger and sync it with the vehicle. Then set up the trigger:

  • Activation type: none
  • Activation: none
  • Repeatable: unchecked
  • Server only: unchecked
  • Activation condition: cursorTarget in (synchronizedObjects thisTrigger)
  • On activation:
[cursorTarget] remoteExecCall ["createSecureAreaTask", 2];
zenith stump
#

I'm probably doing something wrong since it's not working.

#

Nvm, it just doesn't do it automatically, unless you are really close to it.

#

Thank you, that did what I wanted it to do.

faint burrow
spring stone
#

Mhhh, I have a script that runs when a player joins that uses local. What could I do now? (The script is actually IgiLoad...I know its outdated but it worked fine till now T^T)

vital tangle
glass nest
#

help me figure out my 3-person camera script

player addEventHandler ["GetOutMan", {
        params ["_unit", "_role", "_vehicle", "_turret", "_isEject"];
        if (cameraView isNotEqualTo "INTERNAL" && {(getPos _unit) distance (markerpos 'base0') > 500}) then {
            _unit switchCamera "INTERNAL";
            };
    }];
     addUserActionEventHandler ["personView", "Activate", {    
          disableSerialization;  
          if ((getPos player) distance (markerpos 'base0') > 500 && {((isNull objectParent player) || (["car","Motorcycle","truck","truck_F","plane"] findif {(objectParent player) iskindof _x} != -1 && ["Wheeled_APC","Wheeled_APC_F"] findif {(objectParent player) iskindof _x} == -1))}) then {
            player switchCamera "EXTERNAL";
        };
     }];
      findDisplay 46 displayAddEventHandler ["KeyDown", {
      private _handle = FALSE;
      if (((_this #1) in actionKeys "personView" || (_this #1) in actionKeys "curatorPersonView") && {(getPos player) distance (markerpos 'base0') > 500} && {((isNull objectParent player) || (["car","Motorcycle","truck","truck_F","plane"] findif {(objectParent player) iskindof _x} != -1 && ["Wheeled_APC","Wheeled_APC_F"] findif {(objectParent player) iskindof _x} == -1))}) then {
        player switchCamera "INTERNAL";
        _handle = true
      };
      _handle
    }];
    findDisplay 46 displayAddEventHandler ["KeyDown", {
      private _handle = FALSE;
      if ((_this #1) in (actionKeys "tacticalView")) then {_handle = true};
      _handle
    }];
#
findDisplay 46 displayAddEventHandler ["KeyDown", {
      private _handle = FALSE;
      if ((_this #1) in (actionKeys "networkStats") && {(getPos player) distance (markerpos 'base0') > 500}) then {_handle = true};
      _handle
    }];
addUserActionEventHandler ["MoveForward", "Deactivate", { 
      disableSerialization;  
         if (((isNull objectParent player) || (["car","Motorcycle","truck","truck_F","plane"] findif {(objectParent player) iskindof _x} != -1 && ["Wheeled_APC","Wheeled_APC_F"] findif {(objectParent player) iskindof _x} == -1))  && {(getPos player) distance (markerpos 'base0') > 500 && {cameraView isEqualTo "EXTERNAL"}}) then {
            player switchCamera "INTERNAL";
        } 
     }]; 
#

periodically, the player's camera flies off - that is, the camera freezes in place, and the helicopter flies away
Why is that?
The problem is only in MP

#
player remoteControl objNull;
switchCamera player;
```this kind of solves the problem and returns the camera to the player, but at the same time it is clear that the transition is taking place - sound settings and range visibility fly off
which is very annoying
#

the feeling is that the problem is with locality and its transition, because if you distribute different skins at the local level, then when the camera returns, the skin of the helicopter will change

#

That's why I asked why it doesn't work

 player switchCamera "EXTERNAL"
```when setting thirdPersonView 0 or 2
[#dev_rc_branch message](/guild/105462288051380224/channel/105466812870713344/)
it's much easier to turn on the camera when I need to (on respawn) than to constantly monitor and disable it
ruby turtle
proven charm
ruby turtle
#

this in the unit init

proven charm
#

ok

ruby turtle
#

but its working, until the First AI combat modi

proven charm
#

yeah AI mod could effect the behaviour

proven charm
#

kinda funny inArea works with negative values. (getpos player) inArea [(getpos player), -5, -5, 0, true] returns true. but i guess there is some logic behind that?

digital radish
#

I've done extensive single player missions and do quite a lot of scripting for them (I'm a Software Engineer in real life).
But I want to make a multiplayer mission, which I've only done super simple stuff for.
What's the usual dev cycle/testing for a multiplayer mission? What's a fast way to test things are working fine on a multiplayer scale?

proven charm
#

create a .bat file that starts dedicated server on your PC then connect to that from the client. that's the fastest way I know. I sometimes run and automatically connect the client via .bat file as well

#

you can also use programs such as FASTER or TADS etc to setup the server

digital radish
#

Can I run a multiplayer mission straight from the editor and have my friends connect to it too or no?

proven charm
#

i think so, never tried that my self

digital radish
#

Yeah, I'm just low key dreading having to rewrite a bunch of code to make it run correctly on multiplayer and testing it.
I use a lot of setVelocityTransformation for example for stuff like dynamic CAS and helicopter/osprey landings. And I'm not entirely sure how I'd have to rewrite that as server only on run on all clients.

proven charm
#

the wiki shows how each command must be used in multiplayer. the icons show if argument to the command is local/global and how the execution is like local/global

digital radish
#

Oh I've read that before, I'm pretty familiar with game networking and stuff (I've made a couple web browser games with socks and all that + unity games)
But the dev cycle itself to do it fast and in a not annoying way cuz I'm assuming I'll have to rewrite a bunch of stuff

tepid vigil
digital radish
#

I'm trying to avoid tedious 😂 , I have thousands of lines of code.
I kinda recreated Dynamic Recon Ops but a bit different and map agnostic, and it's fun but I wanna play with my friend who is a retired Marine.

tepid vigil
digital radish
blissful current
proven charm
#

you still have to make sure the server is working properly

terse tinsel
#

hello, I have a question: how to change the spawning position of gbu ASL to be the position of an object, for example plane1? in this script [[4706.77,10185.1,500], "Bo_GBU12_LGB", tank, 100, false, [0,0,0.25]] spawn BIS_fnc_exp_camp_guidedProjectile; [5324.93,12317.9,0] are these first digits

faint burrow
#
[getPosASL plane1, "Bo_GBU12_LGB", tank, 100, false, [0,0,0.25]] spawn BIS_fnc_exp_camp_guidedProjectile;
grim cliff
#

i have decided that i want to make a mod for use on my server, but i want to know if i can make it a servermod instead of a mod that all my players have to download. this mod may be subject to refinement for a while, and i dont want players to have to deal with it getting updated all the time.

i want to know if its possible to be a servermod, and not a client mod, becasuse im not adding any 3d assets, i want to use whats already available in the base game.

what i dont know will be fully possible is if i wanted to use the command menu in this mod, if it will be available on the clients side.

according to the documentation i have read, i havent seen anything stating that it must be a client addon,
but also i dont know if the defined class CfgCommunicationMenu will be properly defined on the client side.

for the actual menu, as required i would be adding the command menu options to the clients via remote execution and BIS_fnc_addCommMenuItem.

as far as the documentation for addCommMenuItem, i know the command expects the CfgCommunicationMenu class but i dont know how classes are applied, and i dont want to cause client crashes

hallow mortar
#

In a server-only mod, you can do anything that can be done through pure scripting, because you can use remoteExec/publicVariable to send stuff, including functions, to clients for them to use.
You can't do anything that requires custom config on the client. You can use config stuff that already exists in the base game/mods the client has loaded, but any config in a server-only mod will only exist on the server.

grim cliff
# hallow mortar In a server-only mod, you can do anything that can be done through pure scriptin...

one of the existing submenus available is "#USER:HC_Custom_0";

it doesnt appear to be populated at all and if i set a global array like so:

HC_Custom_0 = 
[
["MenuName", false],
 ["Teleport", [2], "", -5, [["expression", "player setPos _pos;"]], "1", "1", "\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"], 
 ["Kill Target", [3], "", -5, [["expression", "_target setDamage 1;"]], "1", "1", "\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"], 
 ["Disabled", [4], "", -5, [["expression", ""]], "1", "0"]
];

and then i use showCommandingMenu "#USER:HC_Custom_0";

the commands assigned in the array appear to work.

would this technically be considerable to use the servermod to define the contents, make the command menu array variable public from the servermod, and then i should be able to use the commands on the client side without needing to have a client side mod?

hallow mortar
#

Looks that way

#

It also looks like the #USER: prefix is what's important here and you can use any name that matches a global variable containing a correct array

grim cliff
#

i guess now my question is:
is there a way that i can add opening the HC_custom_0 menu to the supports menu

hallow mortar
#

🤷
Solid maybe. I don't use the radio menu system very often.

halcyon cobalt
#

how would i create a fire particle via script?

#

i currently have
"test_EmptyObjectForFireBig" createVehicle position firePos;

but it doesnt look vry good and doesnt have sounds

sharp grotto
fair drum
#

can I destroy a hashmapObject from within itself?

naive wigeon
#

is there any way to get the distance of the UAV turret laser mark controlled by a player?

hallow mortar
meager granite
#

@still forum Can I ask for engine insight? How does UAV Terminal draws Follow waypoint lines? What position does it take as line destination?

still forum
still forum
#

Ah just waypoints probably

#

if the waypoint is on a "target", it uses last known AI position.
Otherwise just.. position.
And then it draws arrow from previous to next

meager granite
#

Ooh, this answers why terminal draws the line to seemingly random spot

#

Btw there is zero info about follow waypoint on wiki thonk

#

Why I needed this, I'm drawing thicker lines over engine-drawn lines so they're move visible, maybe its a good idea to make the engine draw thicker lines in a first place

still forum
#

The arrow should draw to the waypointPosition 🤔

#

it should draw arrow from current position, to waypointPosition (I would expect waypointPosition command to do the same thing of using last ai known?)

#

are there actually multiple arrows? maybe I was looking at the wrong thing?

meager granite
#

I haven't tried drawing scripted arrow to targetKnowledge yet

meager granite
#

Since you only do it once for the client themselves performance impact each frame should be miniscule

glass nest
meager granite
glass nest
#

it seems to me that this is some kind of bug of the game

gloomy egret
#

how do i attach a powerful flashlight to my gun

#

?

#

like

#

qq flashlight attaches a light cone to flashlight

opal zephyr
#

CreateVehicle can create a light source which can be modified to mimic a flashlight and then attached to the user

gloomy egret
#

ok

#

so i just spawn in a katiba in singleplaur

#

and then give it createvehicle code

#

and then some woodo black magic code i have a flashlight which lights up the entire map

opal zephyr
gloomy egret
#

Ok

thin fox
#

Hello. Does anyone knows if "ArtilleryShellFired" MEH actually works? I'm getting this error if I add this EH on my mission: Error Foreign error: Unknown enum value: "ArtilleryShellFired"
(Is this only available in dev branch?)

gloomy egret
#

Ill try to understand this code

#

Thanks

thin fox
#

Damn

#

current public version is 2.16 right?

little raptor
#

Yeah

#

You can try it out in dev branch

thin fox
#

sure, but not ideal, I'm trying to add some "counter-artillery" stuff in my liberation

#

this EH is just perfect for that

gloomy egret
#

ok

#

i am actually code illiterate

#

whatever

#

i can deal with this

charred monolith
#

Hi ! I have a question, can you interact with this marker via a script ? Like get it's position or set it ? The marker can be create with shift + left click

hallow mortar
#

There's customWaypointPosition to get its position, and that's it. We don't have a setter for it.

charred monolith
#

Well it's enough, i don't really nead to move it often. Thank you for your help !

cobalt path
#

I am a bit confused how remoteexec works.
I am trying to make that a player takes place of another AI unit. Like Playable AI works where you just become them.

Is it smth like?

[selectPlayer AI_Variable;] remoteExec ["call",Player_variable];

viral yew
#

Try [[], {selectPlayer AI_Variable;}] remoteExecCall ["call", Player_variable];

meager granite
#
AI_Variable remoteExec ["selectPlayer", Player_variable];
cobalt path
#

So problem solved

meager granite
granite sky
#

They have call in CfgRemoteExecCommands? :P

meager granite
#

yep

#

Hmm, maybe not? 🤔

#

Hardcoded maybe?

granite sky
#

Wouldn't that make the whole thing pointless?

meager granite
#
While Arma 3's main config may still have traces of it, CfgRemoteExecCommands is now obsolete. Originally used with BIS_fnc_MP, which is now also obsolete as well and is left for backward compatibility.
granite sky
#

oh, I mixed up with CfgRemoteExec

rough summit
#

Anybody knows how i can remove these text?

rough summit
#

@verbal groveIt is already

terse tinsel
#

why doesn't execVM want to run in my trigger? . The old version of exec works but execVm does not

tulip ridge
terse tinsel
#

and when I enter it in the units ini, it works

winter rose
tulip ridge
#

Look at examples on the wiki, the right argument is the path to a script

terse tinsel
terse tinsel
#

mission folder

#

ok, I did it by simply entering [player] execVM "ammo.sqf" in the trigger; topic closed 🙂

little raptor
winter rose
#

question @still forum , what's the difference between unitBackpack and backpackContainer?

granite sky
#

unitBackpack's older, right

#

I'm gonna guess that backpackContainer was added along with vestContainer and uniformContainer for consistency.

faint burrow
#

backpackContainer returns a container, "attached" to a backpack. unitBackpack returns the backpack itself.

tulip ridge
#

A backpack and its container are the same object.

(unitBackpack player) isEqualTo (backpackContainer player); // true
#

Backpacks are objects, they do not need a separate container like uniforms and vests do.

faint burrow
#

Do they have the same class name?

tulip ridge
#

They return the exact same object, they're the same class

#

A single object cannot be two different classes

faint burrow
#

Then it seems I got it wrong with uniforms and vests, they and their containers have different class names.

tulip ridge
#

Yes, because uniforms and vests are weapons, and use separate container objects to actually store things.

typeOf uniformContainer player; // "Supply30" (for U_C_CBRN_Suit_01_Blue_F)
faint burrow
#

Then backpackContainer is a modern alias for unitBackpack.

granite sky
#

backpack gives you the classname.

meager granite
harsh bloom
#

A common problem i see is people grabbing gear they arent supposed to on operations.
Has anyone come up with a script to lock an NPC's inventory on death?
Could just despawn them instantly but thats cringe

fair drum
fair drum
#

EDIT: Disregard - I forgot to define DEBUG_MODE_FULL

so some macros don't work in hashmapObject methods it seems:

Hemtt throws no flags. States everything processed correctly

    ["#create", {
        params ["_checkpointManager", "_group", "_radius", "_maxDistance"];

        _self set ["m_checkpointManager", _checkpointManager];
        _self set ["m_assignedGroup", _group];
        _self set ["m_radius", _radius];
        _self set ["m_maxDistance", _maxDistance];

        _self set ["m_activationRadius", _radius / 2];

        LOG_1("%1:: New Object Created",str _self);
    }],

after preprocessing:

    ["#create", {
        params ["_checkpointManager", "_group", "_radius", "_maxDistance"];

        _self set ["m_checkpointManager", _checkpointManager];
        _self set ["m_assignedGroup", _group];
        _self set ["m_radius", _radius];
        _self set ["m_maxDistance", _maxDistance];

        _self set ["m_activationRadius", _radius / 2];

        ;
    }],
granite sky
#

sqfc or not?

fair drum
#

not sure, but would assume when hemtt packs, its converted to sqfc. the second is what is returned when when you reference the object array from ADT debug. when creating the object from the array, I get no messages in the log file either. Tested with some system chats after, which go through successfully.

#

looks like it does it futher down too: (raw copy from ADT debug)

granite sky
#

Not sure if that's representative of what's running.

#

I would guess that with sqfc, it stores a link to the original code and that's what's displayed there.

#

It's not translating the bytecode back again.

fair drum
#

it appears that QGVAR(Checkpoint) is doing it correctly, if you look at the #str portion near the beginning showing landnav_common_Checkpoint

granite sky
#

Although I guess it runs the preprocessor first, stores the result and then converts it to bytecode...

#

If it's sqfc then it's a different preprocessor than what Arma is using anyway, so it matters.

acoustic abyss
#

What is a convenient/high performance way to detect if any AI group detects the player (group)?

fair drum
#

GVAR series looks like it works fine, LOG is the one that is failing. Using dev and build so its not sqfc atm. Just building sqf files.

acoustic abyss
#

So I would use findIf to search through an array of all AI groups, to see if they are in combat with the player?

fair drum
#

sure. and the search stops the moment its true. so if group 3 of 10000 meets it, it stops there and doesn't search through the other 9997

acoustic abyss
#

I suppose if I pack this into a trigger (loop every 5 seconds) this should be minimal impact on the server. Thank you.

acoustic abyss
#

This script works great:

#
groups blufor findIf { combatBehaviour _x == "COMBAT" } != -1 ;    

Once. Even if the trigger is set to "repeatable". What am I missing of the FindIf behavior?

indigo snow
#

Only the alternative syntax was changed, not the normal one

#

local _a = 1; is now private _a = 1

acoustic abyss
#

In testing it seems, once TRUE, always true. Even if the groups are set to "delete when empty". Any way around this?

fair drum
#

with some more findIfs!

#

instead of using the full group set, use select and filter out the groups that have no alive units (using findIf as well)

#

then do your final findIf based on that set

#

untested example theory:

private _groupsWithAliveUnits = groups blufor select {
    private _group = _x;
    units _group findIf {alive _x} != -1
};

_groupsWithAliveUnits findIf { combatBehaviour _x == "COMBAT" } != -1;
acoustic abyss
#

Arigato!

harsh bloom
#

isnt it supposed to be "west" not "blufor"?

winter rose
harsh bloom
#

I tried blufor in the past and it never worked

winter rose
#

very weird.

harsh bloom
#

i was messing with adding tickets

#

and west only worked

faint burrow
#

blufor has always worked for me.

winter rose
#

west/blufor, east/opfor, resistance/independent
all since Arma 3, never failed since

#

(perhaps you were writing bluefor? IDK)

harsh bloom
#

Dont think so.
i got no idea why it didnt work. Could be the context i was coding it in.

#
[west, -1] call BIS_fnc_respawnTickets;
still forum
winter rose
still forum
#

Would take too much time to analyze the code to find that out. Certainly seems to be the case

winter rose
#

thanks, that lifts a heavy weight from the doubt I had 😄

little raptor
#

Ok no it doesn't.

winter rose
#

backpackContainer works on vehicles
vehicles can have backpacks? 🤨

#

wear* backpacks?

little raptor
#

No I mean the code did something like primaryGunner stuff

#

So I figured it fetches the gunner and returns his backpack

tight cloak
#

got a real weird error here. cant see what im doing wrong

_controlTurret addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    {
        _x fireAtTarget [objNull, currentWeapon _x];
    } forEach (_thisArgs select 0);
},_turretArray];
#

error, 3 elements provided. 2 expected

#

values based on diag_log -
_controlTurret = port_3
_turretArray = [port_1,port_2,port_4];

little raptor
#

addEventHandler doesn't support arguments

tight cloak
#

ah bugger

#

i guess i just tag the "control turret" with the array and retrieve it on the EH?

#

as unit can be accessed

little raptor
#

tag it? You mean setVariable?

tight cloak
#

ye

little raptor
#

Yes

tight cloak
#

alrighty, cheers

#

works now

late drum
#

is there any way to add a progress bar in a hint?

winter rose
#

through hintSilent and formatted text yes

late drum
#

I have it, but I can only get it to work with #, is there any way to get a character like this to appear: █? Because it comes out as spaces

proven charm
#

I created weapon using model as simple object but it has muzzle flash, how do I get rid of that?

opal zephyr
proven charm
#

no hide selection thing possible?

winter rose
#

try "zasleh" perhaps

proven charm
#

have to ask is this really the current only way to get weapon current magazine ammo count ? ```sqf
_cmd = currentMagazineDetail player;
_ammoInfo = _cmd splitString "([ ]/:)";

playerAmmoCount = parseNumber (_ammoInfo # 5);

opal zephyr
#

sorry gencoder, I made an assumption you were creating a supersimple object, thats my bad

proven charm
opal zephyr
#

wait.. you said "model".. are you using the p3d path for the simple object or the classname?

proven charm
#

this: createSimpleObject [_model,[0,0,0]];

opal zephyr
proven charm
cobalt path
little raptor
#

Did you try attachTo as polpox said?

#

And also what else did you try?

proven charm
little raptor
#

It's kinda naive tho. But still let's see if that works at all

cobalt path
cobalt path
#

I might do a work around and use multiple ropes, maybe

#

But for some reason objects seem to get unattached from the rope at speed. I wonder if its possible to change that

little raptor
#

You'll have to move the object every frame

digital osprey
#

has anybody tried to subscribe to BIS_fnc_kbTellLocal_played by BIS_fnc_addScriptedEventHandler? is kbTell in general called when radio commands are issued?

fair drum
tawdry knot
#


_npcPos = getPos transportNPC;

_offset = [10, 0 , 0];

_vehicleLocation = _npcPos vectorAdd _offset;

_truckType = "B_Truck_01_f";

_truck = createVehicle [_truckType, _vehicleLocation, [], 0, "NONE"];
#

I tried to create this vehicle on trigger of a addaction, the hint properly displays however the vehicle does not.

#

Used vector addition to offset spawn location so that isn't the issue.

#

Anyone have any idea?

granite sky
#

Have you checked that transportNPC is a valid object in context and that B_Truck_01_f is a valid vehicle classname?

grim cliff
#

hey if i wanted to do a whole bunch of "fired" event handlers, would it be better to do
A: a single event handler with conditional statements (IF)
B: a single event handler with switch statements to handle the different categories for the code of each event i want to control
C: seperate switch statments for each possibility

i have a lot that i want to do that is unfortunatly only picked up on by the fired event handler such as grenade throwing, specialized secondary weapon handling, or even mine placements, so i want to find a suitable means of having a way to handle all that jazz.

grim cliff
cobalt path
fair drum
tawdry knot
formal grail
# grim cliff hey if i wanted to do a whole bunch of "fired" event handlers, would it be bette...

The only way to know for sure is to profile/benchmark it, especially when you're optimizing at this level.
But... here's my general rules of thumb:

  1. If it's only a couple if/else/ifs, just keep the if else ifs, and order the execution from fastest to slowest with short circuiting.
  2. If it's more than that, consider how you can use a hashmap's O(1) get for faster operation.

A switch is simply an if/else/if put in a pretty way that can be understood easily, and my understanding is arma doesn't actually do a lot of heavy optimization other languages (like how Java/C++ use jump tables, but I might be wrong here). If your case is at the bottom, it's going to run all the conditions from the top of the switch statement til your actual case, so it's got the same considerations as if/else/if. In actual use, it might be slower than if.

tldr: profile, profile, profile.

meager granite
#

But in general I'd recommend prioritizing code maintainability and coherency rather than saving on peanuts of performance

#

Though depends on what you'll have in the event code too, of course

meager granite
#

There used to be some quirk with mission event handlers compiling each time but I think this was fixed ages ago

formal grail
# grim cliff hashmaps?

Here is an example of how a hashmap helps. Imagine you're checking Fired event for mines. If the player places down a type of mine, I want to kill them instantly. And imagine we have 10 or so types of mine. Here's the most obvious way you do it with if/else/if.

if (_ammo == "MineClass1") then {
    player setDamage 1;
} else {
    if (_ammo == "MineClass2") then {
        player setDamage 1;
    } else {
        //...
    };
};

You can improve that readability with:

if (_ammo == "MineClass1") exitWith { player setDamage 1; };
if (_ammo == "MineClass2") exitWith { player setDamage 1; };
//...
if (_ammo == "MineClass10") exitWith { player setDamage 1; };

But those two are functionally the same. You can write it in a switch similarly, and it'll perform roughly the same. For something that's not a mine, you need to go through every check. That's unavoidable with that approach.
With hashmaps, you can optimize it to a single check.

// (consider putting this in a global var, not construct it every fired event)
private _myMineClasses = createHashMapFromArray [
    ["MineClass1", true],
    ["MineClass2", true],
    //...
    ["MineClass10", true]
]; 

// on fired
if (_ammo in _myMineClasses) then {
    player setDamage 1;
};

As hashmap operations are O(1), this kind of check is likely much faster than using your if else statements or checking against arrays. And obviously, the more checks you need to do, the more this second approach will pay off. The fewer checks, the less likely it is to significantly outperform (or at all) the first.

#

As an example, I use this for an APS type script, and when I have like 30+ different kinds of projectiles to check against, it is much, much faster with this approach.

#

But also, as @meager granite said, prioritize code readability. The efficiency of your script literally does not matter until you hit some barrier (I think it's almost a millisecond?).

grim cliff
formal grail
#

Hm...
If you only have 2 or 3 muzzles, I wouldn't do it like that, I would do it with an if/else for simple readability. You're not saving much performance (if at all) with a hashmap there.
But say you have more muzzles (way more), that may be one way to do it. Putting Code types in a hashmap data structure like that awakens something ugly in me but I don't see why that wouldn't work?

south swan
#

I mean, missionNamespace can effectively be considered a hashmap as well. And if code can be stored in missionNamespace - what's wrong with storing it elsewhere? 😛

grim cliff
formal grail
#

As I will keep repeating, you can't optimize code at this level without profiling and benchmarking. First make things work, find out how long that takes in a loop, then make things work with an "optimized version", measure how long that takes.

grim cliff
#

well im currently looking at a special handler for all the mines and remote explosives, 76 rifles, 4 launchers, 6 handgun weapons, and 1 grenade. i gotta go to bed but i will follow up tomorrow on how to run diagnostics

meager granite
#
call (myhashmap getOrDefaultCall [hashValue [...properties...], {
    switch(true) do {
        case complex_condition1: {{...code1...}};
        case complex_condition2: {{...code2...}};
        default {nil};
    };
}, true]);
#

properties should be values that you're checking inside complex conditions

#

but this is really useful if you have vastly different code for vastly different conditions

#

For readability sake it might be better to do class check in a runtime instead, the performance impact will be a drop in an ocean for your case

south swan
#

Or checking for if single string is present in big array/set of strings

#

What counts as "big" needs further testing

#

Better wording: i don't know what counts as big in this context without further testing

meager granite
meager granite
digital osprey
tough abyss
#

Anyone good with AI scripts? I could use some help

edgy dune
#

I think I know the answer to this ,but will attachto work on cfgAmmo entries? from my tests it doesnt just wanted to confirm

tough abyss
#

As in spawning etc.

indigo snow
#

What are you getting stuck on?

stable dune
tough abyss
#

Well... What do you reckon an ai script would NEED ?

#

Also

#

I don't know if this is correctly made

#

Gimme a sec, i'll put it on github

indigo snow
#

Depends what you mean with "AI script"

#

Its a very broad, vague term

tough abyss
#

spawn ai, give them waypoints, cache them, delete dead bodies

little raptor
#

Yeah even when I test in game it works

#

You can't attach an ammo to something tho if that's what you mean

indigo snow
#

Seems like you figured out what you need

#

What are you getting stuck on?

candid scroll
#

Is "KnowsAboutChanged" used to show units that have been spotted on the players map that fade over time?

tough abyss
#

Well

#

I used the PFH

#

Is this good?

open hollow
#

hi guys, its posible to change the displayed name of a player ?

indigo snow
#

It's not objectively good or bad

#

What did you use it for?

digital osprey
tough abyss
#

I made a loop with the PFH

#

That basically runs the whole system

candid scroll
#

I see! That is odd, I'll have to do some testing. Thanks for confirming!

#

Do you know if the "Fired" event is supposed to work with AI?

#

Doesn't seem to be triggering for some reason

#

But it does for my player

tough abyss
#

And every 3 seconds it runs the loop, which calls functions for all the groups

#

I just realised that it might be bad

still forum
digital osprey
tough abyss
#

I tried with ~ 100 groups

#

And had pretty low fps

little raptor
#

But you probably want FiredMan if the AI is in a vehicle

little raptor
open hollow
tough abyss
#

Is this the wrong way of going about this? I feel like I fucked it up

open hollow
#

Sometimes ppl uses other profile, and I’ll like to change the name to an already defined one

thin fox
#

Hello. Does anyone knows if there is a particular config path do get HE or Smoke shell from a magazines array?

open hollow
thin fox
#

I wonder thats why the antistasi scripts had to grab every possible magazine class for every possible artillery into a script

open hollow
#

maybe class parent?

thin fox
#

some of them got the same class parent

#

like LG and Flare

hallow mortar
#

Check its simulation type or the simulation type of its submunition. Flares and smokes have their own types because of how they work.

thin fox
#

Ok, the LG shell has a specific type of submunitionAmmo.
If modded, the smoke shell has differents types of submunition, but the simulation of them is the same "shotSmoke"

#

I think I can work on that, thank you

indigo snow
#

You could not call for every group every 3 seconds

#

But only a subset

#

So 1-6 once, then 7-12, like that

lone glade
#

holy shit my eyes

indigo snow
#

100 groups is quite a lot though

lone glade
#

you spawn a PFH and try to halt it..........

tough abyss
#

How do I halt it?

lone glade
#

oh wait that's before the PFH

indigo snow
#

Lol alganthe

#

In the end 100 groups is quite a lot

#

Its why system like ALiVE offload to .dll

lone glade
#

it's half the limit not that much

#

actually is it 200 or 150 ? can't remember

indigo snow
#

It means calling at least 100 functions in a single frame

tough abyss
#

144 seemed to be the group limit for a side

indigo snow
#

It is, but not always the practical limit

tough abyss
#

Btw, does PFH just run as in a call loop?

cobalt path
#

Does anyone know is there a way to prevent rope from breaking? I though maybe there are different rope types. (Because rope type can be defined in createrope script), but apparently there is only one

lone glade
#

it's an onEachFrame

#

stacked event

indigo snow
#

Its unscheduled

lone glade
#

thus it's unscheduled and can't be halted even if you spawn the code.

indigo snow
#

I count ~6 functions in the EH

lone glade
#

(not inside it ofc)

indigo snow
#

So with 100 groups thats 600fncs in a single frame

#

You need to delimit that to gain fps

lone glade
#

no biggie.

tough abyss
#

unscheduled should be faster, correct?

indigo snow
#

Not nevessarily

lone glade
#

unscheduled doesn't have the 3ms runtime limit

#

so in this case yes.

tough abyss
#

How do you delimit?

indigo snow
#

Running this kind of code unscheduled would be unwise

#

Itd end up not executing after a while

tough abyss
#

oh.....

digital osprey
tough abyss
#

I see

lone glade
#

eeerm, no it'll keep executing

indigo snow
#

I suggest selecting only a few groups to run functions on

tough abyss
#

Unscheudled will clogg up the engine, as in scheduled only gets 3ms, keeping the engine running?

lone glade
#

scheduled runs for 3ms for each script and then goes on the next

#

and in this case it's not possible to run scheduled unless you spawn / execVM inside the PFH, which wouldn't be advised

cobalt path
meager granite
#

They do, they die from explosions for example

cobalt path
#

Huh, okay I will try. Didnt know they get destroyed by explosions either

lone glade
#

if your script doesn't eval fast enough the condition / variables can change before it start to run again

tough abyss
#

I can switch the PFH to a while loop, I guess...

lone glade
#

god no

#

It'll fucking destroy your framerate

tough abyss
#

Also I have the heavier functions running only on active groups, and only running cache script for the cached groups

lone glade
#

you could keep that but increase the time between the PFH ticks

tough abyss
#

I used to have it on 1 second

lone glade
#

RIP frames

indigo snow
#

It executes it all in a single frame still with a PFEH?

#

Doesnt matter what frame you pick

lone glade
#

doesn't matter if you're still processing the previous tick

indigo snow
#

Better only evaluate a subset of groups every time

lone glade
#

10s or 30s might be better.

indigo snow
#

Handle it in batches of 10

lone glade
#

or yeah.

tough abyss
#

Is there a way to check how long this script takes to run?

#

ohh nvm... I can diag_log the tick

lone glade
#

perf check in debug

tough abyss
#

How that?

lone glade
#

wel, run the performance check in the debug console ?

tough abyss
#

Stupid question, I just pasta all the code in there?

lone glade
#

use the button on debug or call this

edgy dune
edgy dune
little raptor
tough abyss
#

Man, I never learned to debug...

#

I had the empty debug console

#

and clicked the debug button

tulip ridge
#

They do, I attach them to vehicles when doing sound effects since otherwise they would only be heard for a moment if moving quickly (i.e. planes and helis)

lone glade
#

😄

#

that + watch fields and diag_log = never miss an error

#

also note that PFHs don't return errors, if you have an error in it the PFH won't run but won't error out

#

very important to know when working with them.

tough abyss
#

What?

#

I literally spent hours trying to figure out the PFH, because it wouldn't work....

lone glade
#

😄

#

that's why you should diag_log them if they don't work

#

it's easier to spot the errors that way, checking if your args are passed properly / incorrect expression

tough abyss
#

Well.. thanks a lot for that tip 😄

cobalt path
meager granite
#

Try on all segments?

tough abyss
#

scalar NaN ms

cobalt path
#

Hmm no I didnt, just on entire rope

cobalt path
#

"Rope Type
A rope stretches and breaks following the formula:"

if (currentLength > maxRopeStretchLength) { /* breaks */ };
lone glade
#

also PFHs should be self terminating, unless it's a very specific case.

tough abyss
#

So, using PFH for this loop is wrong. Which loop should be used instead?

lone glade
#

no it's fine in this case

tough abyss
#

Ahh, I guess it's not as bad as I thought at first

edgy dune
tulip ridge
#
[QGVAR(say3d), {
    params ["_object", "_sound", ["_distance", -1], ["_type", 0]];
    if (_sound == "" or {player distance _object > _distance}) exitWith {};

    private _source = _object say3D [_sound, _distance, 1, _type];
    // if object not a unit, attach sound to object itself
    // Primarily meant for vehicles in motion
    if !(_object isKindOf "CAManBase") then {
        _source attachTo [_object];
    };
}] call CBA_fnc_addEventHandler;
indigo snow
#

PFEH is in a way like while {true} do { uiSleep 3; call my_fnc}; and alganthe is going to hate me for saying it this way.

little raptor
#

I think both of them can get attached. But the sound from createSoundSource doesn't update with its position

#

@edgy dune try moving it manually using setPosWorld too

little raptor
tulip ridge
#

I vaguely remember doing it with createSoundSource too

lone glade
#

It's not that, at all

#

it's not even close

#

and while {true} do loops are bad, just plain bad

tough abyss
#

why are those bad?

lone glade
#

unending loops

tough abyss
#

while {variable} do {} ?

lone glade
#

better.

digital radish
#

So, I have a recon mission I'm building that includes using binoculars to see if there are units in a town. Now this is easy if there's actually units in the town, detecting them alone does the trick.
However, how would one go about looking at an area and checking detect that there are no enemy units there? 🤔

keen drum
#

idk turn model off and maybe make them careless

last cave
#

Finally! Now it will be possible to throw bodies a dozen meters away from the explosion\other Hits and not return them to a living state!

2.18 will be one of the best updates with a lot of features. Especially the presence of a number of command improvements for throwing grenades and some eventhandlers.

#

There are no more cans that are created locally in the game that beat the player at high speed so that he himself would fall.

candid scroll
#

@little raptor @digital osprey Yeah, I was definitely not getting any fired events for AI during a firefight, although my player was triggering the event. I will explore what you've shared there @digital osprey thank you. @little raptor , do you have insight into why that could be?

#

Is it because the actual player isn't nearby so it's not firing the event?

candid scroll
candid scroll
tired spear
#

I cannot for the life of me find a good example or tutorial on how to limit what object classes can be placed in zues ie: zues can only place B_Story_SF_Captain_F (Miller)

little raptor
tired spear
#

ah thanks!

little raptor
tired spear
#

i took a look but I couldn't figure it out lol

digital radish
tulip ridge
#

How are you checking for units currently?

tulip ridge
digital radish
#

I just check that player reveals units, so if there are enemy units in said area, and the user reveals any of them, then the area has been recon'd.
But I also want to make sure that the player can check if the area is empty, but how can you tell if an area is empty by looking at it?

What I had thought about was something like, when user pulls out the binoculars and look at a point of interest, automatically check that the map coordinates at crosshairs are within the area for x amount of time. Which is very doable and probably the best alternative, but wondering if you guys have better ideas.

#

I'm not asking for a solution, more like, do you guys have any recommendations or better ideas to do this?

tired spear
granite sky
#

The only machine where Fired events trigger everywhere is the server.

granite sky
#

I'm not sure if it's a hard rule that curator objects only function when server-local, but that's usually where they end up anyway.

tired spear
#

Huh, can I get an example using a random class? Might me a language lesson

granite sky
#

I dunno, CuratorObjectRegistered seems to be sub-minimally documented.

#

Apparently it just dumps every CfgVehicles class (surely scope-limited?) into the input array.

#

so that's gonna be a very slow EH.

candid scroll
granite sky
#

gonna sanity check that.

candid scroll
#

I have this on mission init

if (isServer && missionName != "introExp") then {
  diag_log text "attach fired event";
      // Adding a "Fired" event handler
      _unit addEventHandler ["FiredMan", {
          params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
          _unitID = str _unit; // Unique ID of the unit
          _message = format ["eventFired %1", _unitID];
          "a3wc" callExtension _message; // Send to C# extension
      }];
  };
};
#

this is a merged snippet, but there is a function:

private _attachEventHandlers = {
    params ["_unit"];

diag_log text "attach fired event";
    // Adding a "Fired" event handler
    _unit addEventHandler ["FiredMan", {
        params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
        _unitID = str _unit; // Unique ID of the unit
        _message = format ["eventFired %1", _unitID];
        "a3wc" callExtension _message; // Send to C# extension
    }];
};
#

and then in that "isServer" block I have

addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    

    if (isNull _entity || !(_entity isKindOf "Man")) exitWith {};

    [_entity] call _attachEventHandlers;
}];
#

Fires for my player entity but not any AI that have moved off screen

granite sky
#

Fired EH works fine at 6km with localhost here, both SP and MP.

candid scroll
#

I am very confused then

granite sky
#

I'll check FiredMan

#

works too.

candid scroll
#

Right

#

Welp

granite sky
#

oh, you have a scope issue there.

#

_attachEventHandlers doesn't exist within the EH scope.

#

you'd need to declare it as a global or pass it into the addMissionEventHandler args.

candid scroll
#

🤦‍♂️

granite sky
#

It doesn't throw any error because unscheduled :/

#

(dedmen plz throw undefined var errors in -debug)

candid scroll
#

Thank you for catching John, I will amend and do some testing after work

#

That would explain a lot

#

And I do have an initial allUnits loop which would be assigning it to the player that already exists in the server context which has access to the function

#

which explains why player and not AI

last cave
#

execute by holder box

{    
    _box disableCollisionWith _x;
    [_box,_x] remoteExeccall ["disableCollisionWith",_x];
} forEach allPlayers;

It is interesting that someday developers will finish synchronization on the network for all users to disable collisions. Otherwise, it turns out that I will have to send each client something that each client does not have a collision.

#

What see other me 2 and other me 3

#

by disabling the collision, I want to remove the moment when a player at speed crashes an attached box into another player and he falls off his feet. (often dies from it)

granite sky
#

The standard approach to this is to reduce the mass of the box to a tiny amount.

#

However, setMass has slow propagation so you need to remoteExec it, even though it's a local-argument command.

last cave
#

Hmm. Maybe this is the way out of the situation.

last cave
#

Now it happened that the weight of the box remained 0.01 and there are no ways to find out what the weight was originally. Other than waiting for 2.18
blobdoggoshruggoogly
For some reason, the 'remoteexeccall' call does not work in mode 0 for clients.
But it only works when the server executes code to all clients in mode 0...

For client ->
But if you make a call from the console, then setmass is immediately applied. But it is not executed from the function code which is in addaction.

granite sky
#

For some reason, the 'remoteexeccall' call does not work in mode 0 for clients.
Probably a CfgRemoteExec file.

last cave
granite sky
#

remoteExec 0 is normally valid from clients.

#

If you need to reset the mass at the end then just store it on the object with a setVariable.

last cave
#

saving in a variable does not cancel the fact that the mass was not applied. And because it was not applied, it cannot even return back. I already simulated that the mass was applied when I took the box. And when I let go, the mass did not return to 500. (For example, for a large box. Or 200 for a small one)

granite sky
#

shrugs

#

I'm not browsing through a dozen pngs to find out which one has anything relevant in it.

#

Check out the ACE carrying code. It works and it's relatively readable for ACE.

last cave
#

Yes. I agree. It's a very difficult topic when something that should work... DOESN'T WORK. (((

By the way, this is the second time I've encountered the fact that remoteexeccall does not execute command in mode 0. But I can't remember with which command.

tulip ridge
tulip ridge
granite sky
#

sighs

granite sky
#

It's the same shit.

tulip ridge
#

To test if it's a remote exec exclusive issue

granite sky
#

We do the same thing with remoteExecCall. It works.

tulip ridge
#

Okay cool, but they're having an issue. So test something else to see if it's some issue with remoteExecCall or something else.

last cave
#

game with no mods blobcloseenjoy

granite sky
#

If remoteExec doesn't work then you have bigger problems anyway.

#

more likely the code isn't getting that far because there was a silent error earlier.

last cave
#

I tested the code and remoteeexec is executed only sometimes. I even repeat the code call 3 times and it is not always executed (but sometimes it is executed with a delay when it should have returned the mass back. That is, instead of inserting 20 it inserts 0.01 which should have been issued a long time ago). There is clearly a problem with owner.

granite sky
#

but sometimes it is executed with a delay when it should have returned the mass back

#

uh, it's always executed with a delay. It doesn't return anything useful.

last cave
#

no executed ...

_mass = getMass _box;
[_box,0.01] remoteExec ["setMass",0];
[_box,0.01] remoteExec ["setMass",0];
[_box,0.01] remoteExec ["setMass",0];
#

server pickup box
All work...

granite sky
#

Why are you changing the locality of the box?

last cave
#

Ok but i simulate setmass by console. work..

last cave
granite sky
#

Paste the simplest, complete and most plausibly correct version of your code that doesn't work.

#

Because all I'm seeing is partials and random garbage tacked on.

last cave
#

client drop box and mass not return in 20.

#

All my code is scattered across different files to create functions, so I can't combine everything into one.

#

My game crashed when I entered the editor.... Excellent, I spent 23 hours in arma without closing it.

tired spear
#

Still cannot phigure out how to limit zues dang poop

digital osprey
still forum
still forum
#

only a few more weeks

candid scroll
#

For 2.18 publish?

last cave
#

And when you hide the bushes, is it possible to somehow remove the sound of rustling leaves besides killing the bush itself?

I think many who make their bases on an open field would really like a separate command that completely disables the existence of map objects, especially sounds (rain on roofs, rustling bushes). The game engine in dynamic terraforming can now work, but can't it handle this?

tribal crane
#

Why are you using the PFH for that at all?

polar belfry
#

hello I would like some help with a script I'm making. it's to teleport vehicles in a mission. I want them to teleport on an oil stain named "p1". I want vehicles of the the ypes Car, Tank, WheeledAPC, TrackedAPC to use the teleporter only.

digital osprey
polar belfry
#

an area trigger

#

so they drive near the point (which will be marked with a cone or helipad)

#
            private _veh = vehicle (_this select 1);
            private _teleportPoint = p1;
            _veh setPos getPos _teleportPoint;
        }];   ```
#

here's my code so far

digital osprey
#

OnActivation?

polar belfry
#

yes

#

I just need the check system

#

for the kind of vehicle (APC, Tank, TrackedAPC, WheeledAPC,Car)

digital osprey
#

driver vehicle player addAction [<t color='#FF0000'>"Teleport Vehicle</t>", {
private _veh = vehicle (_this select 1);
if ((typeOf _veh) in ["APC", "Tank", "TrackedAPC", "WheeledAPC","Car"]) then {
private _teleportPoint = p1;
_veh setPos getPos _teleportPoint;
};
}];

#

something like this?

polar belfry
#

yea

digital osprey
#

1 sec

polar belfry
#

let me try but I'll put it so the check happens before the whole thing

digital osprey
#

I had a mistake there

digital osprey
#

also now thinking of it - IF should be outside of addAction call, because now you would always have the option but it would work only if vehicle is of the right type

polar belfry
#

it doesn't teleport

#

maybe there's an issue with the check

#

could try a long iskindof

lone glade
#

because with other solutions he would have single digit framerate or frames per second

polar belfry
#

is this correct
condition

 private_veh = vehicle player;
this && (_veh isKindOf "APC" || _veh isKindOf "Tank" || _veh isKindOf "TrackedAPC" || _veh isKindOf "WheeledAPC" || _veh isKindOf "Car")

On activation

private _veh = vehicle (_this select 1);
 driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", {
            private _teleportPoint = p1;
            _veh setPos getPos _teleportPoint;
        }];   
#

this is present, anyplayer on condition

digital osprey
#

the problem with TypeOf was that it returned the actual class

#

and those are base classes

polar belfry
#

oh

digital osprey
#

And after testing there also should be a deactivation code for removing the action.

#

I assume you make some sort of "Get into the garage" action

polar belfry
#

yes

indigo snow
#

Keep in mind this is the CBA PFEH, where you can set it to sleep between intervals. So it's not running every frame.

polar belfry
#

how to make a trigger to have a cooldown

#

is it timeout or countdown

faint burrow
#

Yes, scroll down trigger settings.

polar belfry
#

which one of the two? countdown or timeout

faint burrow
#

Depends on your needs. Read tooltips.

digital osprey
#

guess and check😆 (sry)

polar belfry
#

I want it so if someone gets through the teleported the other person cannot instantly run the command too and arma the other one

#

I'll do some testing

digital osprey
#

I think those trigger timeouts won't help you because you should try to put a some sort of coordinated cooldown on the action itself

#

I have a tricky idea but not shure it's a clean one

polar belfry
#

I found settrigerinterval

#

condition
his && (vehicle player isKindOf "APC" || vehicle player isKindOf "Tank" || vehicle player isKindOf "TrackedAPC" || vehicle player isKindOf "WheeledAPC" || vehicle player isKindOf "Car")
On Activation

thisTrigger setTriggerInterval 10;
        driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", {
            private _veh = vehicle (_this select 1);
            private _teleportPoint = p1;
            _veh setPos getPos _teleportPoint;
        }];   

On Deactivation

driver vehicle player removeAction 0;```
digital osprey
#

again, this is not a trigger problem

#

what if 2 players are already in the zone and all trigger cooldowns applied

#

to both of them

#

both of them get their actions and can perform them at once

faint burrow
#

Also the ID of added action can be greater than 0.

digital osprey
#

that can be solved with get/setVariable

#

there might be a case that 2 vehicles shouldn't be allowed to teleport into the same spot at all

polar belfry
#

so my deactivation code doesn't work

#

I found out it becomes whatever the player has +1

#

so I wrote this

driver vehicle player removeAction _actions+1;```
but it doesn't work still
faint burrow
#

Save action ID in the trigger.

digital osprey
#

Activation:
uiNamespace setVariable["actionIdIndex", driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", {
params ["_target", "_caller", "_actionId", "_arguments"];
_veh = vehicle _caller;
_teleportPoint = p2;
_veh setPos getPos _teleportPoint;

}]];

Deactiovation:
driver vehicle player removeAction (uiNamespace getVariable "actionIdIndex")

faint burrow
#
thisTrigger setVariable ["actionIdIndex", _actionId];
digital osprey
#

I think it's something that should be relative to a player or even player's UI

#

becasue otherwise it might bug out in MP

#

trigger on deactivation might clean up other's player action

faint burrow
#

If you do everything right, everything will work.

digital osprey
#

ok from what I read triggers are local so it should work as well

polar belfry
digital osprey
polar belfry
#

driver vehicle player removeAction (thisTrigger getVariable ["actionIdIndex"])?

digital osprey
#

Looks right

polar belfry
#

the command is still there

digital osprey
#

On my side it worked

#

What are the checkboxes in your trigger

polar belfry
digital osprey
#

And new activation code?

polar belfry
#
thisTrigger setTriggerInterval 10;
        driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", {
            private _veh = vehicle (_this select 1);
            private _teleportPoint = p1;
            _veh setPos getPos _teleportPoint;
        }];   ```
digital osprey
#

No

#

_actionId should be the output of addAction command

polar belfry
#
        driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", {
            params ["_target", "_caller", "_actionId", "_arguments"];
            private _veh = vehicle _caller;
            private _teleportPoint = p1;
            _veh setPos getPos _teleportPoint;
        }];```
#

I may need help changing params

digital osprey
#

You just need to put _actionId = driver vehicle player addAction...

#

And then setVariable

#

The rest of the code worked fine on my test

polar belfry
#

?

digital osprey
#

dude no

#

you firstly assign and then use the var

#

thisTrigger setTriggerInterval 10;
_actionId = driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", {
params ["_target", "_caller", "_actionId", "_arguments"];
private _veh = vehicle _caller;
private _teleportPoint = p1;
_veh setPos getPos _teleportPoint;
}];
thisTrigger setVariable ["actionIdIndex", _actionId];

polar belfry
#

I see

#

now I get it

#

found something that made it work

#
       _actionId = driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", { 
            params ["_target", "_caller", "_actionId", "_arguments"]; 
            private _veh = vehicle _caller; 
            private _teleportPoint = p1; 
            _veh setPos getPos _teleportPoint;
            driver vehicle player removeAction _actionID        
        }];```
#

it removes the action

little raptor
#

Use setPosWorld/getPosWorld

polar belfry
#

that's so it can also take height in account

#

?

#

will this work lets say with the vanilla carrier

#

if I want to bring apcs up?

little raptor
polar belfry
#

is there a way to make it work with vehicles that are cargo of othervehicles

#

eg an apc in a bigger boat or zubr

#

eg this

#

cause with the current one they stay in

#

just as a thought experiment

#

normal teleport works

thin fox
polar belfry
#

it does

thin fox
#

I used this script in a operation to let players load vehicles into a LCU

#

don't forget to change the class of the cargo vehicle, I was using a LCU from CUP

polar belfry
#

I want to unload them

#

just need to find how to tell the vehicle to unload on the oil stain (reference point)

thin fox
polar belfry
#

thanks

thin fox
polar belfry
#

trg1 is the point they will go?

thin fox
#

also, there is a EH that detects if the cargo was unloaded using action (ViV)

thin fox
#

it's the same point that you can load stuff

#

actually, this IS an EH, so put this code on the cargo vehicle

#

when you unload using the action, the cargo children will be teleported to the a safe area in the trg1

polar belfry
#

ok

#
    _cargo = _this select 1;   
    private _teleportPoint = p1;   
    _cargo setPos (getPos _teleportPoint);
   ];```
I used the event handler
now the question is how do I add it to the trigger so it happens only in the area of the script (teleportation to p1 not just unloading)
stable dune
polar belfry
#

_x addEventHandler['CargoUnloaded',{if (_this#0 inArea T1) then {_cargo = _this select 1; private _teleportPoint = p1; _cargo setPos (getPos _teleportPoint);}}]

#

T1 is the trigger

stable dune
#
this addEventHandler ["CargoUnloaded", {
    params ["_parentVehicle", "_cargoVehicle"];
    if (_parentVehicle inArea T1) then {
        _cargoVehicle setPosATL getPosATL p1;
    };
}];
frigid mountain
#

any way to make sideRadio messages louder

#

theyre too quiet no matter what db i set them to

thin fox
# polar belfry ```this addEventHandler ["CargoUnloaded", { _cargo = _this select 1; ...

lol it's in my code already, under comments

this addEventHandler ["CargoUnloaded", {
_lcu = _this select 1;
if (!(_lcu inArea trg2)) exitWith {hint "You must be in the right area to unload"};

// Check for vehicles on the unload target area
_veh = (vehicles select { 
 _x inArea trg1 
});

if ({ 
 _x isKindOf "landVehicle" 
} count _veh > 0) exitWith { 
 hint "There is a vehicle in the area" 
};

_cargo = _this select 1;
_pos = [trg1, 0, 10, 1] call BIS_fnc_findSafePos;
_cargo setPos _pos;
}];```
polar belfry
#
thisTrigger setTriggerInterval 5; 
_actionId = driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", { 
params ["_target", "_caller", "_actionId", "_arguments"]; 
private _veh = vehicle _caller;
private _loadingcheck = isVehicleCargo _veh;
private _teleportPoint = p1; 
if ( _veh isKindOf "Landvehicle" && isnull _loadingcheck) then{
    private _dist =(_teleportPoint select 2) + 5;
    _teleportPoint = getPos this vectorAdd [0,0,-_dist];
        _veh setPosATL getPosATL _teleportPoint;}
else{
        this addEventHandler ["CargoUnloaded", {
        params ["_parentVehicle", "_cargoVehicle"];
        if (_parentVehicle inArea T1) then {
    _cargoVehicle setPosATL getPosATL p1;
      };
      }];
};
      driver vehicle player removeAction _actionID        
        }];```
I'm trying to put it in a trigger and when I tried it the apcs disappeared
#

I tried yours and they weren't near the ship

#

probably on the shore

polar belfry
#

where?

#

loadingcheck?

#

hold on

thin fox
#

if the lcu supports ViV you should use setVehicleCargo instead of those setPos thing

polar belfry
#

would set vehicle cargo work if the vehicle calling the command was the apc in the lcu through the add action

thin fox
thin fox
polar belfry
#

yes

#

I have done it

thin fox
#

at least, my script gets any vehicles inside the trg1 and put in the LCU that must be in the trg2

polar belfry
#

I see

thin fox
polar belfry
#

oh for my the addaction is given to the apc/ vehicle driver

thin fox
#

I see, what happens when you try?

#

you said that the apc just dissappers, but, it "loads" in the lcu?

polar belfry
#

I tried only the unloading part with the safe unload

#

also found out I had a different variable name for my trigger so probably they got thrown to 0 0 0

thin fox
#

check those variables

#

it should work normally as you intend

edgy salmon
#

What's wrong with these triggers? 5 pieces of arty label arty1 - arty5 refuse to fire on their respective markers even though all the conditions are met

polar belfry
#

are they in range

edgy salmon
#

yeah, that was my first thaught. They are smack dab in the middle of the medium range distance bracket

hallow mortar
#

Well, one thing is that trigger activation code is an Unscheduled context, so you can't use sleep like that. You'd need to use spawn to create a Scheduled thread where suspension is allowed.

stable dune
#

And does
getMarkerPos"marker_1" work?
Without space 🚀

edgy salmon
#

I do get this error though

polar belfry
granite sky
#

Well, there's a waypoint for that IIRC, although I doubt it ever got much testing.

polar belfry
#

oh which one and how may I utilize it

#

the thing it's so players in viv can get their vehicle out without the viv driver pressing unload all vehicles

granite sky
#

I don't know. It's undocumented.

polar belfry
#

oh ok

polar belfry
#
thisTrigger setTriggerInterval 5;  
_actionId = driver vehicle player addAction ["<t color='#FF0000'>Teleport Vehicle</t>", {  
params ["_target", "_caller", "_actionId", "_arguments"];  
private _veh = vehicle _caller; 
private _loadingcheck = isVehicleCargo _veh; 
private _teleportPoint = getposasl p1;  
if ( _veh isKindOf "Landvehicle" && isnull _loadingcheck) then{ 
    private _dist =(_teleportPoint select 2) + 0.5; 
    _teleportPoint = _teleportPoint vectorAdd [0,0,_dist]; 
        _veh setPosasl _teleportPoint;};
        if ( _veh isKindOf "Landvehicle" && !isnull _loadingcheck) then{
        private _dist =(_teleportPoint select 2) + 0.5; 
    _teleportPoint = _teleportPoint vectorAdd [0,0,_dist];
        private _success = objNull setVehicleCargo _veh;
        _veh setPosasl _teleportPoint;
        };
 
      driver vehicle player removeAction _actionID         
        }];

excuse the placement of lines
I tried this script and it works on smaller vehicles but on tanks it teleports the thing to p1 (oil stain on deck) but then sends it back in the lcu

#

it is meant to teleport vehicles that are in a loading bay in the back of an lhd on the lhd specifically on a reference point named p1

pallid palm
#

nice stuff (Lou) in the pinned Messages i like it thxs you

lone glade
#

it's even better than a sleep actually

little raptor
#

Use NPP or ADT to detect and remove those

#

And as NikkoJT said you also need spawn in the other code

hallow hound
#

Hey there, I've been doing mission-making and zeusing for a while now, but I've never really learned to script. Does anyone have a recommendation on where I can learn

little raptor
#

There's a link to introduction to scripting page in the pins

thin fox
#

Hello. Is there a way to virtually laser an object?

#

for target purpose

little raptor
#

Create a laser target object on it

#

"LaserTargetW" for west and "LaserTargetE" for east

thin fox
indigo snow
#

As long as you need the sleep duration to be reliably exact.

rose vector
#

is there a way to set an Obj position in reference to its current position

#

for example set an Obj 2 meters higher then it was before?

faint burrow
#
_position = getPosASL obj;

_position set [2, (_position select 2) + 2];

obj setPosASL _position;
rose vector
#

ahh i see

#

thank you

bold comet
#

@lone glade "and while {true} do loops are bad, just plain bad"

#

what if you just need something to run permanently

#

how would you write that

#

(i have while true sleep everywhere in my code, performance is good)

lone glade
#

PFH, or just design something that doesn't need to be ran permanently

blissful current
#

Is there an event handler for AI awareness level? (Combat, safe, etc). I'm trying to start a counter and execute code base on if an AI squad has detected the player.

I can't use the in editor trigger for blurfor detected because I can't find a way to have a condition timer (e.g. AI squad alive && it's been 10 seconds)

bold comet
#

what if you don't need it to be every frame

#

like "every 5 seconds do"

lone glade
#

.... PFHs aren't "every frame"

#

it's based on seconds, it's every frame if set to 0

bold comet
#

it exists without CBA ? all i find is links to the CBA doc

lone glade
#

It's easily exported outside CBA

#

it's not based on configs.

bold comet
#

mokay

#

guess i'm not convinced

#

"it's bad" doesn't do much if you don't tell me why it's bad

lone glade
#

Because it's an unending loop that hogs performance.

bold comet
#

so if i have good performance do i need to care ?

lone glade
#

well, yeah avoid getting bad habits

indigo snow
#

You could just have a stacked frame EH, and check the time delta with diag_time

#

Thats basically the CBA EH

bold comet
#

so you're going to check the time every frame

#

is it better than sleep performance wise ?

#

i mean isn't it exactly what sleep already does ?

indigo snow
#

Sleep in scheduled environment becomes unreliable after a while

#

For most things it would not really matter

bold comet
#

you mean it becomes much longer when lots of scripts are running in parallel right ?

indigo snow
#

It might not get executed at all

#

Younger scripts get preference in the scheduler

lone glade
#

Variables of your function / script can change between executions

tired spear
#
d addEventHandler [
"CuratorObjectRegistered",
{
    _classes = _this select 1;
    _costs = [];
    {
        _cost = if (_x isKindOf "WBK_Combine_CP_SB") then 
        {
            [true,0.5];
        }; 
        _costs = _costs + [_cost];
    } forEach _classes; // Go through all classes and assign cost for each of them
    _costs
}
]; ``` 
I have the gamemaster module set to none default addons and want to add one thing  for the zues to spawn but it seems I cannot figure out how to get it to work
indigo snow
#

You basically lose control over what code gets executed when, yes

tired spear
#

yes I've been looking at this

faint burrow
#

It has an example.

tired spear
#

I know, it's what I used but it doesn't seem to work, I tried putting the code above in a trigger, initServer.sqf, initPlayerLocal.sqf, but the man does not appear in the spawnable list

bold comet
#

never had a case where that becomes an issue

#

and yeah variables changing is the definition of what a variable is

faint burrow
#
  • What is d?
  • The if in the example also has else block. Where is it in your code?
tired spear
#

d is the modual, I also tried myCurator

indigo snow
#

Imagine a script that tracks a unit

hallow mortar
#

You mentioned you'd turned off all addons in the Zeus' settings. That'll be the problem. This EH is meant to go through all the available assets and hide them if they're not your chosen class. However, if your chosen class belongs to an addon that's turned off for this Zeus, then it won't be available to begin with and this EH can't unhide it.
You should turn on addons, and then use this EH to hide the things you don't need (this is what the missing else part from the example does)

tired spear
#

OH okay

indigo snow
#

While alive unit etc etc

#

Now in scheduled, the code might halt at any point

#

If the unit dies after the alive check but in the middle of the following code

#

You might run into issues

#

Again, most scripts wouldnt run into issues with this but it is something to keep in mind for longer running scripts

bold comet
#

so the handler guarantees it will never stop in the middle of an execution right ?

#

but if the execution takes several seconds won't it freeze the game or something ?

lone glade
#

PFHs doesn't run into those issues

#

it doesn't have limited runtime