#arma3_scripting

1 messages · Page 110 of 1

tulip ridge
#

For some basic things, you can do randomized unit/object placement within a given radius.
You might also be able to get the garrison points of a building and randomly spawn ai on them (not sure about that, just something I thought of).

You could also do named game logics as unit spawn points at, and then give them orders to do certain tasks

ornate whale
#

Recently I saw the HBQ Spawn System, which is quite interesting in this regard.

meager granite
#

Having a list of all respawn persistent event handlers would've been useful

tidal idol
#

How would I go about replacing an arbitrary vehicle's crew with units of a specific class/side (Very specific classname MyUnit)? Currently, my code is set up to boot out the existing crew and re-make the default vehicle crew using createVehicleCrew, but I'm not sure how I would go about swapping unit class type/side to the new crew.

//Run the abs logic.
if (_isMan) exitWith {};
_cursorTargetCrew = crew (_cursorTarget);

if (_isStaticWeapon) then {
    {unassignVehicle _x; moveOut _x;} forEach _cursorTargetCrew;

    sleep 0.25;

    _NXIntruderAbsGroup = createGroup [opfor, true];
    _NXIntruderAbsGroup createVehicleCrew _NXIntruderAbsGroup;```
#

As another question - if cursorTargetCrew is an empty array, would my little "boot-out" line cause any errors? I want this script to populate empty and full vehicles alike with MyUnit.
As another note - I also want this to work on UAV/UGVs like the Stomper RCWS. It doesn't matter that MyUnit is not a UAV-type unit, I have that taken care of by other means.

warm hedge
#

An empty array with forEach does iterate the code zero times, which means nothing will happen

#

Not even an error

meager granite
#

Add driver, then iterate through every turret and add a unit if turret has hasTurret = 1

tulip ridge
#

How can you get the position of a memory point in model coords?
I remember having some code for it before but I can't find it

little raptor
#

selectionPosition

tulip ridge
#

👍

hardy valve
#

Is there a script i can run locally to blacklist items in a players arsenal?

sharp stag
#

Hi, id like to ask regarding arrays. How to remove a specific player that has been added on the array once they leave the trigger, assuming that they got added on the array upon entering the trigger?

Heres the code im trying to use under "On Deactivaton" but it doesnt remove the player somehow:

PlayerTPArray = PlayerTPArray - [(player) in thislist];

warm hedge
#
PlayerTPArray = PlayerTPArray - [player];```but this is insufficient and not necessary, if I get your idea properly
sharp stag
#

But will this remove all players that is added on the array? Or only the player that triggers it? Sorry im still confused about how local and global aspects of triggers.

warm hedge
#

Everything basically only exists on local computer, except you tell the scripts to share it to everyone

sharp stag
#

Thats the case though, the PlayerTPArray is declared on init.sqf. so that means, if im not mistaken, eveyone shares the array PlayerTPArray. Or i may have misunderstod that

warm hedge
#

Well, that only means “everyone declares the variable and everyone can do anything with it”, but sharing/syncing is one thing you explicitly have to

sharp stag
#

I get it now, my next problem is how to sync one array across all player? Is there a sample I could use as referrence?

#

Like if one player makes a change, it will also change the array for all players

warm hedge
#

To answer that, I would need to get the entire idea and intention around there

sharp stag
#

Im trying to make an psuedo elevator system, but actually utilizing setpos to teleport them somewhere. What I want to happen is every player that is present inside the trigger, once the button is pressed, those players are the only one that will be teleported.

warm hedge
#

That would mean you do not need any array in order to detect all players who is in a trigger

#

What is the script to teleport you have?

sharp stag
#

{
titleText [_this select 3, "BLACK FADED", 1];
sleep 1;
player setPosASL (getposASL (_this select 1));
player setdir (_this select 2);
titleCut ["", "BLACK IN", 1];
} foreach (list (_this select 0));

My script syntax goes as : [[TRIGGER,OBJECTTOTP,ROTATIONNUMBER,"TEXTDISPLAY"],"scripts\Teleporter.sqf"] remoteExec ["execVM", 0];

warm hedge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
warm hedge
#

FYI you can have this kind of highlighting so even in Discord it is better to read

#

So and, that remoteExec, how did you execute it?

sharp stag
#

I use to contain it inside

{ //here
} foreach thislist;

I've already tried a lot (i mean a lot) of ways in tackling the code. Most of the results come by as

  1. All players get teleported regardless if they are inside or not
  2. Only 1 player gets teleported even though they are multiple players inside the trigger
warm hedge
#

I meant what executes it. thislist so I guess you have it in a trigger like 0-0-1?

sharp stag
#

Right now, the way I've set it up is as follows:

  1. player enters the trigger
  2. trigger detects the player, adding it to the array
  3. a button with "Addaction" will activate the trigger
  4. trigger, with the code, will execute the command for all players inside it

Sorry I cant answer your question referring to 0-0-1, im not sure what it is 😦

warm hedge
#

0-0-1 was a way to execute a code from a trigger in a special way, but if you don't, disregard

#

And guess I get the entire idea. Give me a bit to write a bit of code

#
{player setPosATL [0,0,0];} remoteExecCall ["call",thisList];
```Minimum setup to teleport everyone who's in the trigger. If the trigger is defined properly
#

(note: not tested)

sharp stag
#

Will try this one, thank you!

next kraken
#

Is there a working download link for the good poseidon tools ? official website has no download anymore. or an alternative ?

split scarab
#

Any way to randomize weapons/gear in a crate (automatic picking from all accessible weapons from base game+mods) but ensuring that there's also the proper magazines for the randomized weapons?

#

Seen an online example where you write the names of the weapons/magazines/gear manually but I was hoping it could somehow dynamic pick any weapon/gear from the base game or mods

little raptor
# split scarab Seen an online example where you write the names of the weapons/magazines/gear m...

you can search through the cfgWeapons config to find all weapons and select some randomly:

_allWeapons = toString { getNumber (_x >> "scope") == 2 } configClasses (configFile >> "CfgWeapons");
_rifles = _allWeapons select { getNumber (_x >> "type") == 1; } apply { configName _x };
_handguns = _allWeapons select { getNumber (_x >> "type") == 2; } apply { configName _x };
_launchers = _allWeapons select { getNumber (_x >> "type") == 4; } apply { configName _x };
split scarab
little raptor
#

it does

split scarab
#

Wonderful, then I just call compatibleMagazines for each random weapon selected and add them to the crate?

little raptor
#

yep

split scarab
#

Thanks a lot!

vivid bridge
#

I'm getting an error on this line. Where's the error?

({(_x distance b1) < 10} count (units group bob)) > 0

winter rose
#
units bob findIf { _x distance b1 < 10 } > -1
```(this will be faster btw)
vivid bridge
winter rose
#

weird, you may have wrong code before that or an invisible character there perhaps

meager granite
#

But yeah, might be an invalid character

kindred zephyr
#

Does the wiki has any oficial listing on which EH gets to be persistent for objects, specifically units/players and respawning players?

meager granite
#

or just test stuff to find out yourself

kindred zephyr
meager granite
#

It seems that this persistence is different for local\remote units too

#

or is it just for var space vs EHs

kindred zephyr
#

that page on E.H could use some formatting.
Notes are inconsistent accross entries, some of them have "boxes" why others are just bullet points. Could this be suggested on #community_wiki?

meager granite
#

EntityCreated being called before var space is copied on remote respawned entities doesn't help it either

split scarab
little raptor
#

if you want to use other config properties, open an item in config viewer and see what properties they define and what the values are

limber thunder
#

I am trying to check if the players that are in the array are present and if not they should be deleted from the array. If I run the code with all units it works perfectly and I get at the end 8 out given (8 elements in the array) if I now remove a unit, then I get of course an error message that the unit with the variable name was not found and I get as output nevertheless 8 elements.

How do I make it so that I don't get an error message and the unit which is not present is deleted from the array?

Players = [p1, p2, p3, p4, p5, p6, p7, p8];

_num = 0;
{ _select = Players select _num;
    
    if (alive _select) then {
        hint str [_select];
    } else {
         Players deleteAt _num;
    };
    _num = _num + 1;
    sleep 1;
    hint ""; } forEach Players;

    //waitUntil { _num == 8; };
    _check = count Players;
    hint str [_check];
little raptor
#
Players = [p1, p2, p3, p4, p5, p6, p7, p8] select {alive _x};
south swan
#

except if some players aren't present - nothing works at all because variables aren't initialized by default 🍿

little raptor
#

they're not?

#

well then you can add an isNil blobdoggoshruggoogly

#
Players = [p1, p2, p3, p4, p5, p6, p7, p8] select {!isNil "_x" && {alive _x}};
#

maybe:

isNil {Players = [p1, p2, p3, p4, p5, p6, p7, p8] select {!isNil "_x" && {alive _x}};};

instead if that throws error in schd blobdoggoshruggoogly

limber thunder
#

I will try

south swan
#
Players = ["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8"] select {!isNil _x} apply {missionNamespace getVariable _x};``` ![notlikemeow](https://cdn.discordapp.com/emojis/700311897937018890.webp?size=128 "notlikemeow")
limber thunder
#

both work when I run the code but how do I access the new array where only the players that exist are inside?

south swan
#

inb4 allPlayers

limber thunder
#

okay so it is the same array but the elements that are not exsit have been replaced with objNull?

split scarab
# little raptor it searches the config and returns an array of config entries that match the con...

Sorry to annoy you again :)

I've put this in the init field of the crate and based on the hints that appears, it seems to work fine except the items aren't added to the crate inventory?

_allWeapons = toString { getNumber (_x >> "scope") == 2 } configClasses (configFile >> "CfgWeapons");
_rifles = _allWeapons select { getNumber (_x >> "type") == 1; } apply { configName _x };
_handguns = _allWeapons select { getNumber (_x >> "type") == 2; } apply { configName _x };
_launchers = _allWeapons select { getNumber (_x >> "type") == 4; } apply { configName _x };
 
for "_i" from 1 to 5 do {
    _randomWeapon = selectRandom _rifles;
    _compatibleMagazines = [_randomWeapon] call BIS_fnc_compatibleMagazines;

    this addWeapon _randomWeapon;
    hint format ["Random weapon : %1", str _randomWeapon];
    if (count _compatibleMagazines > 0) then {
        {
            this addMagazine _x;
            hint format ["Random magazine : %1", str _x];
            _randomGear pushBack [_randomWeapon, _x];
        } foreach _compatibleMagazines;
    };
};
hint format ["Randomized gear in crate: %1", str _randomGear];
cosmic lichen
#

for boxes or vehicle inventories you need to use the add****Cargo variants

split scarab
#

And addWeaponCargo?

cosmic lichen
#

Instead of the function you should use the command. It's faster (should do the same)

split scarab
#

Oh interesting, I literally googled "arma 3 compatibleMagazines" and that BIS function was the only thing popping up

cosmic lichen
#

The command was added later

split scarab
#

Amazing, that works

#

Any way to turn the crate into an arsenal afterwards? (With access to only the gear that is in the crate)

#

Just to make it more manageable looting with ridiculous amount of magazines

cosmic lichen
#

But I wouldn't add the normal items first just to then turn it into a Virtual Arsenal. Make it an Arsenal right of the start.

limber thunder
#
if (alive teamWest == true) then {        //teamWest is the array with the players from Bluefor
                hint "All alive teamWest!";
                _true = false;
            };

How do I check if all elements of an array are alive? Is there a way to extract all the elements and compare them to something at once?

stable dune
#

On compare to {!alive _x} == -1

Then it checks there are 0 non alive unit
So if findIf doesn't find any dead unit, it returns -1

limber thunder
stable dune
#

You need find from your array.

If (teamWest findIf {!alive _x} == -1) then {
    systemChat "all units in teamWest is alive"
};
#

But if you want them all dead you need change your check.

limber thunder
#

yes I got it. Thanks 🙂

split scarab
#

Struggling to make a timer that counts how long a unit has been alive since !gamestart was written in chat, I have this which works but having trouble implementing the actual timer

_gameStarted = false;
_timer = 0;
publicVariable "_gameStarted";
publicVariable "_timer";

addMissionEventHandler ["HandleChatMessage", {
    params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
    
    hint "reached onChatMessage";
    if (_text == "!gamestart" && !isNull (getAssignedCuratorLogic _person)) then {
        _gameStarted = true;
        hint "reached game start";
    };
}];

I basically want the timer to reset and start when _gameStarted = true

hardy valve
#

Hi - Does anybody know How I can blacklist or filter the arsenal for players on my server. Something local

tulip ridge
# hardy valve Hi - Does anybody know How I can blacklist or filter the arsenal for players on ...

Make an arsenal and then call BIS_fnc_removeVirtualXXCargo (weapon, item, etc.) on it
Can basically use this code here on the forums but swap out the function calls (and classnames) https://forums.bohemia.net/forums/topic/211997-making-a-limited-arsenal/

hardy valve
tulip ridge
#

Well how does Warlords do its arsenal(s)?

hardy valve
#

It uses some filter but i cant find where the items are classified

#
_blacklist = [];

_cfgWpns = configFile >> "CfgWeapons";
_cfgVehs = configFile >> "CfgVehicles";
_cfgGlasses = configFile >> "CfgGlasses";
_cfgMags = configFile >> "CfgMagazines";

{
    _cfg = switch (_x) do {
        case 5: {_cfgVehs};
        case 7: {_cfgGlasses};
        case 22;
        case 23;
        case 26: {_cfgMags};
        case 24: {_cfgMags};
        default {_cfgWpns}
    };
    _arr = +(BIS_fnc_arsenal_data select _x);
    _arr = _arr select {!(toLower getText (_cfg >> _x >> "DLC") in _blacklist)};
    BIS_fnc_arsenal_data set [_x, _arr];
} forEach [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 22, 23, 24, 26];```
#

This is the arsenal script

#
/*
WARLORDS-SPECIFIC FUNCTION

Author: Josef Zemánek

Description: Opens Arsenal interface.
*/

_funds = player getVariable "BIS_WL_funds";

"close" call BIS_fnc_WLPurchaseMenu;

_null = ["Open", TRUE] spawn BIS_fnc_arsenal;

player setVariable ["BIS_WL_funds", (player getVariable "BIS_WL_funds") - BIS_WL_arsenalCost, TRUE];

closeDialog 602;```
tulip ridge
#

Bis_fnc_arsenal is what actually opens the arsenal
True just means to load everything

#

So if you want to a blacklist (i.e. "players can access everything except these items) you could modify:
_arr = _arr select {!(toLower getText (_cfg >> _x >> "DLC") in _blacklist)};
to be
_arr = _arr select {!(_x in _blacklist)};
Which would let you specify a list of class names in _blacklist, and those items would not appear in the arsenal

hardy valve
#

Okay interesting. I'll give that a shot

#

Another thing- do you know where BIS_fnc_arsenal_data is saved?

#
if (BIS_WL_arsenalEnabled == 1) then {
    BIS_fnc_arsenal_data set [3, BIS_WL_factionAppropriateUniforms];
    BIS_fnc_arsenal_data set [5, (BIS_fnc_arsenal_data select 5) - BIS_WL_mortarBackpacks];
    BIS_fnc_arsenal_data set [23, (BIS_fnc_arsenal_data select 23) - ["APERSMineDispenser_Mag"]];
    BIS_WL_arsenalSetupDone = TRUE;
};```
tulip ridge
#

No clue, first time I've seen BIS_fnc_arsenal_data

#

There's not anything on the wiki about it

hardy valve
#

Yeah I've never seen it either I've tried researching some but no luck. My guess is it may be hidden somewhere in the game files

#

But hey - as always, I appreciate your help 🤙

tulip ridge
#

Really weird naming convention
Because at first glance the name makes it seem like it's a function, but the way it's used is either an array or a hashmap

little raptor
hardy valve
granite haven
hardy valve
#

I've tried a couple methods with no luck

granite haven
#

in a tarkov raid rn but i can help you after

hardy valve
granite haven
#

lol died

#

so i can help now

hardy valve
#

💀

#

Lol

granite haven
#

this variable is an array so in the example you showed you set a key in the array and make it an array with each element of that array beeing a uniform or helmet etc

#

3: Uniform
4: Vests:
5: Backpacks
6: Helmets
etc

#

what are you trying to do by the way?

hardy valve
#

Okay - to simply put it I'm trying to remove certain weapons (for now) and eventually want to set specific uniforms to be used since our server uses mods. People go crazy with ridiculous loadouts and i want to put a limit on whats available (RHS backpacks etc)

#

But being that its warlords - am I able to edit these functions?

granite haven
#

yes, ill write a little code and explain the steps

#
private _weaponBlacklist = ["", ""]; //Blacklisted weapons
private _vanillaWeapons = BIS_fnc_arsenal_data select 0; //Vanilla weapons array
private _newList = [];

{
    _newList pushBackUnique _x;
} forEach (_vanillaWeapons select {!(_x in _weaponBlacklist)});

BIS_fnc_arsenal_data set [0, _newList];
#

so here you just get the vanilla weapons and wich ever weapon isnt blacklisted you just dont put i nthe new refreshed arsenal list

#

you run this code on initPlayerLocal.sqf or anywhere before they open the arsenal

#

so in the _weaponBlacklist you add classnames of the guns you dont want in the arsenal. they must be strings

#

ofcourse this is just limitting vanilla weapons, if you are working with mods your ideal option might be to just create one whitelist

hardy valve
#

Wow. So - I just add this to initPlayerlocal, add weapon_of_mass_destruction in ["here", "and_here"]; ?

#

I really can't thank you enough. Wow

granite haven
#

no wait if you want to also add guns you need to make an addition array

#
private _weaponBlacklist = ["", ""]; //Blacklisted weapons
private _vanillaWeapons = BIS_fnc_arsenal_data select 0; //Vanilla weapons array
private _addWeaponsList = ["", ""];
private _newList = [];

{
    _newList pushBackUnique _x;
} forEach (_vanillaWeapons select {!(_x in _weaponBlacklist)});

{
   _newList pushBackUnique _x;
} forEach _addWeaponsList;

BIS_fnc_arsenal_data set [0, _newList];
#

this is written w/o testing so make sure you test

#

the second forEach loop will add you custom mod weapons. the first forEach loop will remove vanilla weapons

hardy valve
#

Yeah I will for sure, It's great to have found someone who knows about warlords. I realllllly appreciate the help mid tarkov raid

split scarab
# little raptor `_gameStart` is a local var and is not visible in the EH

How close am I to success?

_gameStarted = false;
_timer = 0;
publicVariable "_gameStarted";
publicVariable "_timer";

_startGlobalTimer = {
    while { (_gameStarted && alive hunted) } do {
        _timer = _timer + 1;
        hint format [Timer: \n %1, _timer];
        sleep 1;
    };
    hint format ["The Hunted survived for: %1 seconds", _timer];
};

addMissionEventHandler ["HandleChatMessage", {
    params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
    
    if (_text == "!gamestart" && !isNull (getAssignedCuratorLogic _person)) then {
        hint "reached game start";
        _gameStarted = true;
        [] spawn _startGlobalTimer;
    };
}];
granite sky
#

You can't publicVariable a local variable.

granite haven
split scarab
#

Can I do publicVariable "_timer" = X;

granite sky
#

No.

split scarab
#

Wiki showed me this:

GlobalVariable = 33;
publicVariable "GlobalVariable";
granite sky
#

which is fine.

hardy valve
granite sky
#

You have a global variable. You publish it to all machines.

hardy valve
# granite haven yhea

Great job 👏 I will be in touch. Don't mind if I ping you here again in the future?

granite haven
#

i dont mind

#

my dm's are always open aswell

granite sky
#

I don't think you want those vars to be published anyway? You just want them global.

#

In this case the best solution is to pass them into the mission event handler though.

#

See the third parameter of addMissionEventHandler.

split scarab
#

Yeah globally accessible I guess, I need _gameStarted to be global at least so it's accessible in the timer function?

granite sky
#

if you call it gameStarted rather than _gameStarted then it's global, but it can be avoided here.

#

underscore: local variable, no underscore: global variable.

split scarab
#

I see, thought _ was just like in C# variable naming preference, but thankfully this works :)

gameStarted = false; 
timer = 0; 
 
startGlobalTimer = { 
    while { (gameStarted && alive hunted) } do { 
        timer = timer + 1; 
        hint format["Timer:\n%1", timer]; 
        sleep 1; 
    }; 
    hint format["The Hunted survived for:\n%1 seconds", timer]; 
}; 
 
addMissionEventHandler ["HandleChatMessage", { 
    params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"]; 
     
    if (_text == "!gamestart" && !isNull (getAssignedCuratorLogic _person)) then { 
        hint "reached game start"; 
        gameStarted = true; 
        [] spawn startGlobalTimer; 
    }; 
}];
split scarab
#

Can I pass a string/number to what I think is a function somehow? So if I wrote !mark 500 the string/number would be useable in the marker function?

marker = {
    ....
};

if (_text == "!mark" && gameStarted && !isNull (getAssignedCuratorLogic _person)) then {
        [] spawn marker;
};
granite haven
#
_text spawn marker; //[_text] spawn marker; if you plan on using more params

if thats what you mean and in marker.sqf:

params ["_param1"];

//More code
tidal idol
#

How do I run a string as a scripting command? My code locates the statement executed in the SOG:PF eject action for any SOG:PF plane and stores it as a string in a variable. However, how do I make this string run as a line of code in my script?

_ejectionStatement = getText(configFile >> "cfgVehicles" >> typeOf _cursorTarget >> "UserActions" >> "vn_pilot_eject" >> "statement");```

I want to run the string stored in `_ejectionStatement`.
I have also identified a further issue that different planes have different classnames for the ejection action... is there a way to determine the appropriate function to execute regardless of what this ejection UserAction class is called?
My only idea I can come up with right now is to traverse every entry in class UserActions and check which has the shortcut of "Eject", then use that classname instead of `vn_pilot_eject`.  While this makes it work on any aircraft, I still have the issue of executing the string as a command.
sullen sigil
#

call compile _string

tidal idol
#

Why is this returning an empty array? I am attempting to generate an array of all UserActions with the parameter shortcut = "Eject";.

_cursorTargetEjectionClasses = "getText(configFile >> 'cfgVehicles' >> typeOf _cursorTarget >> 'UserActions' >> '_x' >> 'Shortcut') == 'Eject'" configClasses (configFile >> "cfgVehicles" >> typeOf _cursorTarget >> "UserActions");```
_cursorTarget is the vehicle to which I am affecting.  It is guaranteed to contain a `UserAction` class with a `shortcut = "Eject";` parameter.

I ran a test with the condition set to true, and found that it gave me a config path in the format [bin\config.bin/CfgVehicles/.../UserActions/Plane_Fighter_04_Eject]
Somehow, I need to use the condition section to parse just the substring after the final `/` character and enter that into the configFile path where the `'_x'` placeholder currently is.
kindred lichen
#

If you destroy buildings during the init of a server you get the intact and destroyed buildings on top if each other.

dusk gust
split scarab
#

Using the Vehicle Respawn Module, how can I in the expression (Tooltip for expression says "Code executed when the vehicle respawns (passed arguments are [<newVehicle>, <oldVehicle>])") field copy the vehicle customization and vehicle pylons from the <oldVehicle> to <newVehicle?

#

Because right now the vehicles respawn with default weapons instead of the empty pylons I selected for it

tidal idol
dusk gust
# split scarab Using the `Vehicle Respawn Module`, how can I in the `expression` (Tooltip for `...

Never used the vehicle respawn module, however you might be able to take some inspiration from this script from 2017?
https://forums.bohemia.net/forums/topic/205244-ai-vehicle-respawn-script-an-alternative-for-bi-module/
Could also just try something like

    params ["_newVeh","_oldveh];
    _pylons = getAllPylonsInfo _oldVeh;
    {
        _x params ["_lPylonInd", "_lPylon", "_lTurret", "_lMag"];
        _newVeh setPylonLoadout [_lPylonInd, _lMag, true, _lTurret];
    }forEach _pylons;

Specifically for the pylons

shell panther
#

(altislifev5) in the weapons shop config, does anyone know how to make weapons sellable but not purchasable? i tried { "MMG_01_tan_F", "", "" , 16500, "" } & { "MMG_01_tan_F", "", "-1" , 16500, "" }

dusk gust
shell panther
#

thanks for the input, that still works, just makes them free lol

dusk gust
shell panther
#

Yeah sorry that was a misprint. it was without the quotemarks

dusk gust
shell panther
#

ive never done that before, ill do some research and figure it out

tidal idol
#

One final thing:
Does anyone have a method of replacing a substring in a larger string with another string, WITHOUT creating a brand new function? Basically I want to take my string and replace "_this" with "_cursorTarget" within a function/script.
Yes, I have looked at this thread, that's why I want to do this without creating a function. https://forums.bohemia.net/forums/topic/216673-quick-stringreplace/

tidal idol
#

okay, I was just confused when I saw that before since it mentions a haystack which I thought sounded like some weird deep computer science stuff lol
also because the regex stuff sounded confusing lmao

split scarab
dusk gust
tidal idol
split scarab
#

Is there any way to spawn a dog and conceal it as a BLUFOR or OPFOR infantry unit?

I'm wanting to spawn a few dogs and use the ZEN Suicide Bomber Module and attach it to the dog. I've worked out how to spawn the dog but I can't attach the Suicide Bomber Module on the dog cause "Unit must be infantry"

dusk gust
meager granite
#

Not sure why event handlers page mentions persistence in some event handlers but not the others

split scarab
# dusk gust Never worked with AI, but you could try making it join a group? Highly doubtful ...

Hmm doesn't seem to work unfortunately :(

_dogArray = ["Fin_sand_F", "Fin_blackwhite_F", "Fin_ocherwhite_F", "Fin_tricolour_F", "Fin_random_F", "Alsatian_Sand_F", "Alsatian_Black_F", "Alsatian_Sandblack_F", "Alsatian_Random_F"];
_dog = createAgent [selectRandom _dogArray, getPosATL hunted, [], 5, "NONE"]; 
_dog setVariable ["BIS_fnc_animalBehaviour_disable", true];

_target = hunted;

[_dog, _target] spawn { 
    params ["_dog", "_target"]; 
    
    _side = WEST;
    [_dog] joinSilent createGroup _side;
    _dog playMove "Dog_Sprint"; 
    
    while { sleep 3; alive _dog } do 
    { 
        _dog moveTo getPosATL _target; 
    }; 
};
#

Can't remote control it either since it's an "empty unit"

#

Hope you can cheat it somehow cause there'll be room for loads of shenanigans making dogs controllable and able to be suicide bombers

kindred zephyr
meager granite
#

Its about respawn persistence though. Was there a time when only some EHs were persistent on local respawning units? I don't remember anymore

kindred zephyr
#

wouldnt be really able to tell since only recently I have gotten into scripting, but i dont see any mention of recently persistently-converted eh

tidal idol
# dusk gust Seems about right

For whatever reason, it's not working. Error is shown, and the hint shows the current value of _ejectionStatement when executed. Because the hint has [this] instead of [_cursorTarget], I know my string replacement is faulty. Code below. I have also tried not using parentheses around the strings of interest in the regexReplace brackets.

            _ejectionStatement = getText(_cursorTargetEjectionClass01 >> "statement");
            //Adjust string such that this is replaced with _cursorTarget.
            _ejectionStatement regexReplace ["(this)", "(_cursorTarget)"];
            hint _ejectionStatement;
            call compile _ejectionStatement;```

Edit: I'm an idiot, I needed to have `_ejectionStatement = _ejectionStatement regexReplace [...];  Verifying right now.

It works!
meager granite
#

So all in all respawn persistence looks like this:
EHs on local: All persistent
EHs on remote: None persisten
Vars on local: All persistent
Vars on remote: All persistent (but EntityCreated is called to early)

split scarab
#

How can I get the position of the nearest unit (in or out of a vehicle) that is part of Independent?

meager granite
#

Another approach, good if you want to search in small-ish distance.

private _nearest = nearestObjects [player, ["AllVehicles"], 30];
private _index = _nearest findIf {side group _x == independent};
private _nearest_indfor = if(_index < 0) then {objNull} else {_nearest select _index};
#

But it will find vehicles with independent in it

#

But you can turn vehicle into unit inside easily with effectiveCommander

#
private _nearest_indfor = if(_index < 0) then {objNull} else {effectiveCommander(_nearest select _index)};
#

Both snippets search around player, change for whatever position you want

split scarab
#

Spawned in random Independent AI units, but it only goes after the Independetn Player unit?

while { sleep 1; alive _dog } do 
{ 
    _array = units independent apply {[_x distance getPos _dog, _x]};
    _nearest_independent = if(count _array > 0) then {_array select 0 select 1} else {objNull};
    
    if (!alive _nearest_independent) then {
        _dog playMove "Dog_Idle_Stop";
        
        while { !alive _nearest_independent } do {
            _array = units independent apply {[_x distance getPos _dog, _x]};
            _nearest_independent = if(count _array > 0) then {_array select 0 select 1} else {objNull};
            sleep 1;
        };
        _dog playMove "Dog_Sprint";
    };
    
    _dog moveTo getPosATL _nearest_independent;
    
    if (_dog distance _nearest_independent <= 10) exitWith {
        bomb = "R_TBG32V_F" createVehicle (getPos _dog);
        _dog setDamage 1;
    };
}; 
#

I basically want _dog to constantly chase the closest Independent unit at all times

#

Which I thought this would do

meager granite
#

You didn't sort the array

split scarab
#

Aha

meager granite
#

[_x distance getPos _dog, _x] makes [distance, entity] arrays for sort command

#

also you can drop getPos

#

You can do ENTITY distance ENTITY

split scarab
#

So like this?

_array = units independent apply {[_x distance  _dog, _x]};
_array sort true;
_nearest_independent = if(count _array > 0) then {_array select 0 select 1} else {objNull};
meager granite
#

Yes

#

Instead of two whiles inside each other, have your moveTo part inside else of !alive check

#

If its about animations, you can store previous target and check if target changed to do stop and sprint animations

split scarab
#

Sorry I'm a little lost

[_dog] spawn { 
    params ["_dog"]; 
    _target = objNull;
    
    while { sleep 1; alive _dog } do 
    { 
        _array = units independent apply {[_x distance  _dog, _x]};
        _array sort true;
        _target = if(count _array > 0) then {_array select 0 select 1} else {objNull};
        
        if (!alive _target) then {
            _dog playMove "Dog_Idle_Stop";
        } else {
            _dog moveTo getPosATL _target;
        };
        
        if (_dog distance _target <= 10) exitWith {
            bomb = "R_TBG32V_F" createVehicle (getPos _dog);
            _dog setDamage 1;
        };
    }; 
};
#

I need to execute _dog playMove "Dog_Sprint"; only once if the dog has a target

meager granite
#

Try:

_new_target = if(count _array > 0) then {_array select 0 select 1} else {objNull};
if(alive _new_target && _new_target != _target) then {
  _target = _new_target;
  _dog playMove "Dog_Sprint";
};
split scarab
#

Inside the else?

meager granite
#

instead of _target assignment after sort

split scarab
#

It works but it takes the dog a good 15-20 seconds to aquire a new target?

#
[_dog] spawn { 
    params ["_dog"]; 
    _target = objNull;
    
    while { sleep 1; alive _dog } do 
    { 
        _array = units independent apply {[_x distance  _dog, _x]};
        _array sort true;
        _new_target = if(count _array > 0) then {_array select 0 select 1} else {objNull};
        if(alive _new_target && _new_target != _target) then {
            _target = _new_target;
            _dog playMove "Dog_Sprint";
        };
        
        if (!alive _target) then {
            _dog playMove "Dog_Idle_Stop";
        } else {
            _dog moveTo getPosATL _target;
        };
        
        if (_dog distance _target <= 10) exitWith {
            bomb = "R_TBG32V_F" createVehicle (getPos _dog);
            _dog setDamage 1;
        };
    }; 
};
#

Oh maybe because the target I'm testing on respawns every 5 seconds with the same variable hunted on it?

meager granite
#

Variables stay on respawned units, yes

split scarab
#

Actually, even if I spawn in new units while they're waiting they take forever to re-aquire a target

meager granite
#

And see what target they get

split scarab
#

It aquires a target quickly but doesn't move towards it

#

Until after 10-15 sec

#

Maybe the idle animation is really long?

#

Changed _dog playMove "Dog_Sprint"; to _dog playMoveNow "Dog_Sprint";

#

Seems to be much faster

meager granite
#

Yeah, probably unit animations

#

I remember animals being hard to control swiftly

split scarab
#

Yeah.. I really wanted to be able to remote control them as well for some Zeus fuckery but this'll do until I can figure that out

#

Now the only issue is that the explosion is sometimes WAY off if it's triggered on a incline/decline

meager granite
#

Try switchMove on _target assignment, it should skip animation queue completely

#

Not sure how well it will work though

meager granite
#

createVehicle ["R_TBG32V_F", ASLtoAGL getPosWorld _dog, [], 0, "CAN_COLLIDE"]

#

you don't need bomb = assignment either if you're not going to do anything with it

split scarab
#

Shouldn't _new_target become objNull if there's no available target?

meager granite
#

Yes it will be null if there are no alive indep units anywhere in the game

split scarab
#

So shouldn't _new_target != _target technically work and re-target even if the new/old target is the same? So long as they've been dead for more than 1 second

meager granite
#

Old _target might be dead unit, while _new_target will be null

#

So you'll get dead != null => true as if you found a new target, when you didn't

#

Also nulls aren't equal, even if its "same" null

#

private _var = objNull;
_var == _var => false
_var != _var => true

#

I used alive _new_target as a replacement for !isNull there

#

units doesn't return dead units anyway

split scarab
#

What if I default _new_target to the dog itself but then check that _new_target != _dog so it won't begin chasing itself

#

That way _new_target is a new target and once the independent unit respawns it'll get set as _new_target?

#

Or something like that, so _new_target is changed to something else than the old _target

#

Wait no... _target needs to change away from the latest target if there are no other targets available, but if I set the dog as _target then it'll bomb itself

#

A bit silly but made it work

while { sleep 1; alive _dog } do 
{ 
    _array = units independent apply {[_x distance  _dog, _x]};
    _array sort true;
    _new_target = if(count _array > 0) then {_array select 0 select 1} else {objNull};
    
    if (isNull _new_target) then { _target = _dog; };
    hintSilent str _target;
    if(alive _new_target && _new_target != _target) then {
        _target = _new_target;
        _dog playMoveNow "Dog_Sprint";
    };
    
    if (_target == _dog) then { _dog playMove "Dog_Idle_Stop"; };
    
    if (!alive _target) then {
        _dog playMove "Dog_Idle_Stop";
    } else {
        _dog moveTo getPosATL _target;
    };
    
    if (_dog distance _target <= 8 && _target != _dog) exitWith {
        createVehicle ["R_TBG32V_F", ASLtoAGL getPosWorld _dog, [], 0, "CAN_COLLIDE"];
        _dog setDamage 1;
    };
}; 
split scarab
#

Can I not add this event to an agent?

_dog addEventHandler ["Killed", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    
    if (_unit == _dog) then {
        createVehicle ["R_TBG32V_F", ASLtoAGL getPosWorld _dog, [], 0, "CAN_COLLIDE"];
    };
}];
#

Nothing happens when the dog dies

stable dune
#

your if statement is false.

#

params ["_unit", "_killer", "_instigator", "_useEffects"]; _unit -> object the event handler is assigned to
so in eventhandler _unit is your object , _dog . So you can test.

_dog addEventHandler ["Killed", {
    params ["_unit", "_killer", "_instigator", "_useEffects"]; 
    systemChat str _unit;
    createVehicle ["R_TBG32V_F", ASLtoAGL getPosWorld _unit, [], 0, "CAN_COLLIDE"];
}];
split scarab
stable dune
#

sry, edited.

#

changed _dog to _unit,
because _dog is not avaible in evenhandler, so you need use _unit to get your _dog

split scarab
#

Ah I see

meager granite
#

So, since EntityCreated respawned unit doesn't have event handlers or variable on it, is there a way to know it was a respawned unit?

little raptor
#

Check 1 frame later maybe

meager granite
#

Still, having this bug fixed wouldn't solved this headache

dreamy kestrel
#

Q: does anyone have an idea how to patch the ASL_Attach_Ropes function, Advanced Sling Loading mod?
I tried in a self-hosted environment, seems to work, and solve the issue.
however in a dedicated environment, no such luck. I am wondering if it is a security precaution patching functions in this manner, or if there is a better way to do it.

carmine sand
crude egret
#

Ello everybody... I want to make a new kinda big Gamemode. But since my scripting is bad (im new at arma scripting) i could really need some help.
Is there anyone that wants to work with me on a new gamemode or just someone who i can directly ask about solutions if i have problems scripting something? It would help me alot!

PM me if u want to know more about the gamemode 🙂

meager granite
humble bough
#

Is there a way to setVariable on submunition from clustermines fired from MBT's? Like from fired eh? For purpose of logging who the killer was

humble bough
#

thanks

dreamy kestrel
meager granite
#

but after for local

still forum
#

That's not a bug

meager granite
#

Why is it different for local vs remote though?

still forum
#

Because remote units have network sync

#

The event is called EntityCreated
and not EntityCreatedAndFullyInitializedAndNetworkSynchronized

meager granite
split scarab
#

Anyone know how to add and equip a TFAR radio to a Zeus unit?
I've tried this but didn't work:

this addItem "TFAR_anprc152"; 
this assignItem "TFAR_anprc152";
still forum
#

What TFAR version?

split scarab
#

I think Beta

still forum
#

tfar_ is theclassname

#

you can copy it out of arsenal

split scarab
#

I tried using the config viewer to look and I found one called 'tf_anprc152'

meager granite
split scarab
#

Lemme check which version

meager granite
split scarab
still forum
#

the ones you already used

split scarab
#

Didn't work unfortunately

#
this addItem "TFAR_anprc152"; 
this assignItem "TFAR_anprc152";
#

this linkItem "TFAR_anprc152; worked!

kindred zephyr
#

Is there a reason of why cursorObject always return null?
Im trying to detect a renegade unit but cursorTarget returns null too.

This doesnt happend on lan and sp, but only on mp for whatever reason?

Cursortarget will not return enemy units, even very close, if "autoreport" is disabled in game difficulty settings, and if player is alone.

Maybe this ^?

split scarab
#

How can I check if an object is an animal? Hmm

still forum
#

isKindOf probably

dreamy kestrel
#

got a bit of a kerfuffle... using portable drones the AI crew are created local, which to server side dedicated scenarios, the crew is literally []... is there any way around that?

split scarab
#

How can I freeze a player (unit enableSimulation = false;) for 120 seconds if I'm not allowed to suspend in the MissionEventHandler EntityKilled?

#
addMissionEventHandler ["EntityKilled", {
    params ["_killed", "_killer", "_instigator"];
    
    if (!(_killed isKindOf "Animal") && _killer != hunted && side _killed == civilian) exitWith {
        _killer globalChat format ["PENALTY! %1 killed a civilian and have been frozen for 2 minutes.", _killer];
        _killer enableSimulation false;
        sleep 120;
        _killer enableSimulation true;
    };
}];
granite haven
#
addMissionEventHandler ["EntityKilled", {
    params ["_killed", "_killer", "_instigator"];
    
    _killer spawn {
      params ["_killer"];
      if (!(_killed isKindOf "Animal") && _killer != hunted && side _killed == civilian) exitWith {
          _killer globalChat format ["PENALTY! %1 killed a civilian and have been frozen for 2 minutes.", _killer];
          _killer enableSimulation false;
          sleep 120;
          _killer enableSimulation true;
      };
    };
}];

@split scarab

dreamy kestrel
#

how do I transfer owner to server from a vehicle created local? for portable drones in particular, in which this appears to be the case.

wary sandal
#

How do I move an aircraft carrier (Land_Carrier_01_base_F) ? setPosASL seemingly doesn't work, when I try rotating it with setDir it also doesn't work.

#
private _carrierPositioning = selectRandom [
    [[15130.19, 8149.624], 144]
];
private _carrierObject = createVehicle ["Land_Carrier_01_base_F", [0, 0, 0], [], 0];

_carrierObject setPosASL [_carrierPositioning # 0 # 0, _carrierPositioning # 0 # 1, 0];
_carrierObject setDir _carrierPositioning # 1;
stable dune
#

Change dir before setPosATL

wary sandal
dreamy kestrel
sullen sigil
#

i havent looked into how you get references for them however nearestobject stuff should work

stable dune
wary sandal
wary sandal
little raptor
#

no

wary sandal
little raptor
#

allMissionObjects "All"
returns array of objects

wary sandal
#

error message wasn't clear

#

but i still don't get why it works for him (and everyone in the comments) lol

#

what even is "All" without quotes

#

I need some explanations this video confuses me

winter rose
#

all"all"

#

all is not a command; by itself, is an undefined global variable (same as mySuperThing)

pallid cedar
#

hey so im new to scripting in arma 3 i have a server and all up for multiplayer testing but im trying to make a script that will grab the player object and do stuff with it, im using "addMissionEventHandler ["OnUserSelectedPlayer"]" which gives me the player object but when i run it the player object is returned as "any", been googling and it says any is returned because of the runtime? not sure what that means, this code is in the "initServer.sqf" file, was wondering if anyone could help? thank you

split scarab
#

Shouldn't side _killed == civilian only return true if _killed is part of the civillian team?
How come it returns true if I friendlyfire a blufor unit as a blufor unit?

#
[_killer, _killed] spawn {
    params ["_killer", "_killed"];
    if (!(_killed isKindOf "Animal") && _killer != hunted && side _killed == civilian) exitWith {
        _killer globalChat format ["PENALTY! %1 killed a civilian and have been frozen for 2 minutes.", name _killer];
        _killer enableSimulation false;
        sleep 120;
        _killer enableSimulation true;
    };
};
shell panther
#

Is there anyone here that would be willing to troublshoot a mission pbo for me? Causing an immediate crash on startup. I’d pay for your time

hallow mortar
hallow mortar
quartz blade
#

Hey, is it possible to get the AI back to the start position after an animation has been interrupted due to the presence of danger?

split scarab
#

Not entirely sure why I'm getting this error

playerMarkers = [];
while {true} do {
  {
    [_x] spawn {
      params ["_unit"];
      _playerName = name _unit;
      _playerPos = getPos _unit;
      _playerDir = getDir _unit;

      _marker = createMarker ["marker_" + _playerName, _playerPos, 1];
      _marker setMarkerText _playerName;
      _marker setMarkerType "mil_start";
      _marker setMarkerDir _playerDir;
            
      if (side group _unit == blufor) then { _marker setMarkerColor "colorBLUFOR"; };
      if (side group _unit == opfor) then { _marker setMarkerColor "colorOPFOR"; };
      if (side group _unit == independent) then { _marker setMarkerColor "colorIndependent"; };
      if (side group _unit == civilian) then { _marker setMarkerColor "colorCivilian"; };
    
      playerMarkers pushback _marker;
    };
  } foreach playableUnits;
    
  sleep 1;
    
  {
    deleteMarker _x
  } foreach playerMarkers;
  playerMarkers = [];
};
granite sky
#

playerMarkers pushback [_marker]

#

should be playerMarkers pushBack _marker

split scarab
#

Bruh.. ofc

#

Can players with Zeus access see all player markers? If so, how do I restrict it so you only see markers from other sides if you're playing as a Zeus unit?

hallow mortar
#

Run your marker script locally, with local marker commands, so each player has their own local set of markers instead of a globally broadcast set. You can then have checks so that markers are only created for units that match the player's side, or for all units if they're a VirtualCurator_F.

#

Useful filter:

private _friendlyPlayers = (playableUnits + switchableUnits) select {side group _x == side group player};```
split scarab
#

Because I'm dumb/lazy, could I instead use setMarkerAlphaLocal and set it to 0 for all players who shouldn't be able to see the marker?

#

Like this?

if (side group _unit == independent) then {
  [_marker,0] remoteExec ["setMarkerAlphaLocal", units blufor];
};
hallow mortar
#

It would be better to run locally to reduce network traffic

split scarab
#

Not sure I understand how I would do so

hallow mortar
#
// do this somewhere that runs on all clients but not the DS/HC, or use >> if !hasInterface exitWith {}; << at start if it does run on DS/HC
playerMarkers = [];
while {true} do {
  private _friendlyPlayers = (playableUnits + switchableUnits) select {side group _x == side group player};
  if (typeOf player == "VirtualCurator_F" then {
    _friendlyPlayers = (playableUnits + switchableUnits);
  };
  {
      private _playerName = name _x;
      private _playerDir = getDir _x;

      private _marker = createMarkerLocal ["marker_" + _playerName, _x];
      _marker setMarkerTextLocal _playerName;
      _marker setMarkerTypeLocal "mil_start";
      _marker setMarkerDirLocal _playerDir;

      private _sideNumber = (side group _x) call BIS_fnc_sideID;
      _marker setMarkerColorLocal (["colorOPFOR","colorBLUFOR","colorIndependent","colorCivilian"] select _sideNumber);
    
      playerMarkers pushback _marker;
    };
  } foreach _friendlyPlayers;
    
  sleep 1;
    
  {
    deleteMarkerLocal _x
  } foreach playerMarkers;
  playerMarkers = [];
};```
split scarab
#

Uhm, how will I know if something runs on all clients?

#

I've done everything in the editor so far, so on Game Logic objects and individual triggers/units/objects

hallow mortar
#

Editor init fields are run on all machines, including server, either on scenario start or when the client joins the mission

#

Triggers run on any client where the condition is satisfied (unless marked as server only), so that depends on the condition

#

initPlayerLocal.sqf runs on player clients and not DS/HC, when the mission starts or when the client joins. init.sqf runs on all machines, when the mission starts or when the client joins.

split scarab
#

Can I edit the initPlayerLocal.sqf from the editor?

#

If so I can just put it in there right?

#

Think I see it? Edit > General > Init?

hallow mortar
#

You can't edit initPlayerLocal.sqf from the Editor - you have to create it yourself in the mission folder and edit it with a text editor.
You can put this code in initPlayerLocal.sqf.

split scarab
hallow mortar
#

The Init you can edit in the Editor is a global init script equivalent to init.sqf, not initPlayerLocal.sqf

#

It runs on all machines, including the server. You can put this code there, but you need to put a check to exclude DS/HC as well.

split scarab
#

Like if (!isServer) then {...

hallow mortar
#

Like the if !hasInterface exitWith {}; I mentioned before

split scarab
#

Okay just that? Don't need to check both dedicated server or headless client individually?

hallow mortar
#

hasInterface returns true on any machine that has an interface, and false on any machine that doesn't have an interface. Players all have interfaces; DS and HC do not.

tulip ridge
#

Quick question, how do you overwrite CfgFunctions in a script?

#

Just wanting to test some quick changes without having to relaunch arma each time

split scarab
#

nvm, found the missing ), after typeOf player == "VirtualCurator_F"

hallow mortar
tulip ridge
#

(As in just by pointing to a new file)

split scarab
#

No worries mate, however now a different and harder to spot error imo

hallow mortar
# split scarab

It is an accurate error report. The }; above the } forEach ... line shouldn't be there

tulip ridge
split scarab
#

Fuck, suspending not allowed in that context

hallow mortar
hallow mortar
# split scarab Fuck, suspending not allowed in that context

Here we see one of the ways in which the Editor init system is inferior to external init scripts.
I suggest moving to initPlayerLocal.sqf, as you won't have this problem and it's easier to edit. If you really don't want to, add 0 spawn { at the start and }; at the end.

split scarab
#

Absolutely brilliant

#

That's gonna be so damn useful for all of my future missions

#

Huh, shouldn't this delete the object?
if (typeOf _x == "Reflector_Cone_01_narrow_red_F") then { deleteVehicle _x };

hallow mortar
#

Replace deleteVehicle _x with systemChat "Target object type found"

split scarab
#

Didn't appear

hallow mortar
#

Then there is most likely a problem with whatever is generating _x

split scarab
#

I have a cache with a Chemlight and Smoke module + 2 of those cone lights around it which I want to disappear when a unit gets close enough (25 meters) to the trigger around the cache, got it working to delete the smoke effect with this:

{
  deleteVehicle ((_x getVariable "effectEmitter") select 0);  
} forEach thisList; 

And setting the Trigger to anybody - present

#

Not the prettiest I'm aware but it worked :)

hallow mortar
#

In order to appear in thisList, the light object must be within the trigger area. The point where the object's icon appears in the Editor is what counts.
The anybody condition should allow most types of objects to appear in the list.
It's possible the Editor-placeable object is just a proxy for a dynamically created light and is removed when the mission starts, but I don't think that's how the light cone objects work.

split scarab
#

It's within the trigger for sure

hallow mortar
#

Did you put this line before or after the effectEmitter line, inside the forEach?

split scarab
#

Before

#

inside the foreach

hallow mortar
#

The code is probably silently erroring out for every object in thisList that doesn't have an "effectEmitter" variable, because getVariable vs. undefined variable returns Nothing, and you can't do select on Nothing. However, if you have this line before that getVariable, that's probably not the issue because it will get to this line before it encounters the error.

#

To be safe, use this instead:

_x getVariable ["effectEmitter",[objNull]]```
This will cause the `getVariable` to assume a default value if `_x` doesn't have an `"effectEmitter"` variable. That default value is an array containing `objNull`, which is a valid object reference but can't be deleted, ensuring a safe failure.
split scarab
#

Even if I do this, the cone lights stay

{ 
  deleteVehicle _x;
} forEach thisList; 
hallow mortar
#

Just as a quick check, give one of the light objects a variable name, launch the mission, and do alive light_varname_here in the debug console.

split scarab
#

Returns true

hallow mortar
#

Then it's not a proxy that gets deleted; it's just not a type that gets picked up by the anybody condition. You'll need to find a different method of detecting nearby lights.

#

Instead of thisList, try thisTrigger nearObjects ["Reflector_Cone_01_narrow_red_F",50]

split scarab
#

Forgot the foreach heh

hallow mortar
#

You need () to force the order of operations to resolve the nearObjects stuff first. It's trying to do forEach thisTrigger, which doesn't work because thisTrigger isn't an array.

split scarab
#

That worked!

#

Can I do multiple types of objects in that nearObjects (function?)

hallow mortar
#

No, nearObjects (command) only has one type filter.
It does use isKindOf checking, so if you're looking for objects that all inherit from the same class (different light colours probably do), you can provide that base class and find anything that inherits from it.
Alternatively, you could use nearestObjects, which accepts an array of classes to find. The syntax for that is a little different, look it up.
If you're looking for wildly different objects that you want to do different things to, I'd suggest doing two separate nearObjects / nearestObjects.

split scarab
#

And then append the two arrays to a new array maybe?

#

Or just straight up do two different foreach loops?

hallow mortar
#

Two different forEach would be my recommendation. Otherwise you're running another check on each object to find out which type it is, which is a waste.

split scarab
#

Fairs

#

Let me try it with the chemlight and smoke modules as well then

hallow mortar
#

For the modules, try using nearEntities instead of nearObjects (same syntax). If it detects them - and I think it will since they're logics - it's slightly faster. I mean, the speed's not gonna make any difference for this example, but it's good to discover these things.

split scarab
#

I getcha

#

Well it worked for the chemlights, they disappeared but the smoke still stays after the smoke module is deleted

hallow mortar
#

I don't know enough about how the smoke module works to figure this one out. It will have some invisible object for the particle source, but you might have to find the module function and look at what it does in order to figure out what you can target.

split scarab
#

Got lazy so:

{
  deleteVehicle _x; 
} foreach (thisTrigger nearObjects ["Reflector_Cone_01_narrow_red_F",25]);
{
  deleteVehicle _x; 
} foreach (thisTrigger nearEntities ["ModuleChemlight_F",25]);
{
  deleteVehicle _x; 
} foreach (thisTrigger nearEntities ["ModuleEffectsSmoke_F",25]);
{
  deleteVehicle ((_x getVariable "effectEmitter") select 0);
} foreach thisList;
#

Appreciate the tons of help you've given me today, thank you

hallow mortar
#

Since you're not doing anything different between the module types that would require additional filtering, you can combine them into one nearestEntities that looks for both classes

meager granite
#

Wish there was an easy engine-driven way to execute code after X frames

#

Or at least after one frame

#

Useful considering how often you need hack around arma issues by doing stuff exactly one frame after

#

ANYTHING callNextFrame CODE or something

#

ctrlSetScrollValues needs exactly 2 frames to work after display opening iirc, but perhaps you can just stack two callNextFrame inside each other

warm hedge
#

I would dig the idea. Currently the reliable way is EachFrame with diag_frameNo arg and check the frame has passed

#

Maybe at least a function for that would be nice

manic kettle
#

Hey all,
I know i saw a mod or way to see how much processing time a script is taking up. I want to diagnose how good/bad a particular function/mod is

warm hedge
#

Debug Console's left “meter” button

manic kettle
#

That shows the active scripts?

warm hedge
#

Shows... what?

manic kettle
#

Sorry i should be more clear,
I know the meter can help me run script times but i don't have an idea which script/function in a mod is the most taxing. So part of this is to help me find out.
Script 1... 2ms
script 2... 0.02ms
script 3... 15ms
etc

granite haven
#
_asset = createVehicle [_class, _spawnPos, [], 0, "NONE"];
_grp = createVehicleCrew _asset;
_grp deleteGroupWhenEmpty true;

Has anyone found a more reliable command then createVehicleCrew for creating crews for UAVS such as the sentinel, falcon ...?
For some reason 90% of the time this command only creates 1 AI (The gunner).

#

you can see the second one beeing created but never put in the driver seat*

manic kettle
#

Are you sure its not working? I use createVehicleCrew for a drone spawner and i've never had issues. Just tried it and it works fine. Is it a modded drone?

granite haven
#

Drones like UGV etc work perfectly fine. Sentinel, Falcon, greyhawk (and its opfor variants) dont work 90% of the time

manic kettle
#

I just tried like 10 and theyre all fine

granite haven
#

i'l try this function and see if it operates better

#

placing the uavs with zeus works fine for me to

manic kettle
#
_asset = createVehicle ["B_T_UAV_03_dynamicLoadout_F", player, [], 0, "NONE"]; 
_grp = createVehicleCrew _asset;```
granite haven
#

i have the createVehicleCrew in a diff scope, maybe thats the issue but thad would be very interesting

#

deff not the cause

warm hedge
#

Just in case vanilla or modded?

granite haven
#

everything vanilla

warm hedge
#

The entire environment I mean

granite haven
#

I figured it out yesterday evening, or so far its been fixed atleast. after creating the uav and filling the crew there is a script beeing run:

_assetGrp = group effectiveCommander _asset;
_asset setOwner (owner _sender);
_assetGrp setGroupOwner (owner _sender);

Removing this code fixed it

ashen ridge
#

Can i check if an AI unit (not in a vehicle) can go from point A to point B?

#

When a player fights a group of AI, i want to detach one AI from the group and move hin to the player position.
But if the player is unreachable, like in a island or in a place AI can't reach, this is not supposed to happens.

meager granite
#

Sometimes it is 1 frame, sometimes 2 frames, maybe even more, probably network-related

#

Tested locally though with near-zero latency

ashen ridge
meager granite
#

scheduled is not an option, init must be done as soon as possible

#

Just gotta come up with another hack if simply waiting 1 frame doesn't work

#

Guess just gonna do init twice, in created and then in respawned

granite sky
#

Also detailed pathing is done in chunks, IIRC, so an AI will initially move towards an unreachable location if it's far enough away.

#

And if ordered to the upper floors of a building, calculatePath will initially give a valid path but will often recalculate and break later.

ashen ridge
#

I can do a check to see if there is water (surfaceIsWater) beteween AI and player, and if the is water, i do nothing.

sullen sigil
#

check position asl of both and if either height are < 0 do nothing

ashen ridge
#

And i believe it's ok to make AI move near the player, even if he can't reach the exact position. If AI goes near, it's what i want.

sullen sigil
#

though note that will likely cause standing in shallow water to do it -- if you dont want that, check if either height is like < -1 or something

granite sky
#

well, you'd want to check a bunch of points in between too.

sullen sigil
#

why

#

water is at asl 0 in a3

#

youre either < 0 asl or above it

granite sky
#

Because the start and end position might be above water but there's an ocean in the middle?

sullen sigil
#

you cant have that in rv4

#

water is always at asl 0

#

pond decals are a different matter

granite sky
#

blinks

sullen sigil
#

is this news

granite sky
#

This is clearly a misunderstanding but I can't think of another way to explain it :P

glossy pine
#

its possible to close a display with idd -1 ?

sullen sigil
#

this cant happen in rv4

#

both bob and phil would be underwater

#

so simply check if either is underneath asl 0

granite sky
#

yes

#

But what if bob and phil are standing on land that's well above sea level but there's an ocean in between

sullen sigil
#

oh thats what you mean

#

i dont think greger meant that i think they meant lineintersect between them

granite sky
#

like in a island or in a place AI can't reach

sullen sigil
#

oh i missed that bit lmao

#

i didnt see any messages before the one i replied to

granite sky
#

k

meager granite
glossy pine
drowsy sparrow
#

question for the "activatedAddons", It is not finding an expected addon "MA_HUD". Assuming the "addon" name will be what is in the configs cfgpatches is there a reason for that? Is the array just too long for arma to parse properly?

sullen sigil
#

what

#

you need requiredAddons not activatedAddons

drowsy sparrow
#

I am not using it in a config

#

I am using it in a script to check if they have the addon for the HUD

#

so I can set my HUD colors appropriately or use my own if they don't

sullen sigil
#

activatedAddons only lists addons activated with activateAddons
use isClass (configFile >> "CfgPatches" >> _patchesClassname);

drowsy sparrow
#

thank you, I am basing off an existing script as some of my knowledge is very basic I will look into this solution

tulip ridge
#

Is there a way to check if a vehicle's landing gear is active or not?

marsh lark
#

how am i able to give a uav infinite ammo mid game?

tulip ridge
hallow mortar
still forum
sullen sigil
#

they only dont really matter if you dont care about all the other scheduled scripts' execution time 🙃

brazen lagoon
#

any ideas on how to figure out if a unit would currently be able to revive? i.e. how to figure out if they're not currently engaging

sullen sigil
#

monitor group combat state or firedNear EH

brazen lagoon
#

@sullen sigil maybe im misunderstanding but i thought combat modes were supposed to inform how the AI reacted to enemy, not something that changes when entering combat

sullen sigil
#

group on aware/safe swap to combat when in combat

brazen lagoon
sullen sigil
#

yes

brazen lagoon
#

ok so look for units with combat behavior in "CARELESS" "SAFE" "AWARE"

#

cool thx

little raptor
#

cooldown for going back to those from COMBAT is too long iirc

#

5 min?

sullen sigil
#

something like that

#

hence mentioning using firednear eh monitoring

little raptor
#

firedNear range is too short

sullen sigil
#

its what theyre using in ace after next update meowsweats

vocal mantle
#

is the handleDamage EH broken or am I just dumb? It makes my unit invincible no matter what, even without a return value

meager granite
#

Post script

vocal mantle
#

ok. How do you do code format in discord?

vocal mantle
#

...\spawnUnits.sqf

man = "B_Soldier_F" createVehicle position player;


man addEventHandler ["handleDamage",{_this execVM "script\handleDamage.sqf"}];

...\sound\handleDamage.sqf

params ["_unit","_selectionName","_damage","_source","_projectile","_hitPartIndex"];

if (_hitPartIndex == 0) then {
	playSound "hitMarkerlong";
};
#

I was just messing around with COD style hitmarkers

#

replace playsound with whatever or comment it out

brazen lagoon
vocal mantle
#

and when put damage man in the debug watch field it returns 1, meaning he should be dead but is standing...

meager granite
#

you return script handle as result of handle damage

sullen sigil
#

could possibly check with targets command

meager granite
#

I guess it uses it as 0 damage making unit invincible

#

And if you want to have hit marker sound use HitPart instead, it executes on client who does the shooting while HandleDamage executes on client that owns the unit

brazen lagoon
#

that sounds slow but might be fast enough

ornate whale
brazen lagoon
#

yup

vocal mantle
#

lol i replaced execVM with exec. fixed the issue. It was just me lol. Thanks for the tip on hitPart. I am only testing in SP right now, but I will move it to MP soon.

ornate whale
# brazen lagoon yup

First, you than need to define what you consider a combat or a bussy state, just with your words. 🙂 What doees it exactly mean. Not knowing about any enemies? Or not firing a bullet in the last 10 secs. Or not seeing an enemy in the last 15 secs. Or distance between unit and its enemy > 100 meters.

brazen lagoon
#

look with all due respect I know how to script I was just asking if there was a helper function or something in CBA or some such

#

I appreciate the help just, thats not what I need

ornate whale
#

OK then in vanilla Arma there is probably nothing that will make it as you want out of the box.

brazen lagoon
#

if it doesn't already exist that's fine, I just wanted to know if anyone had done something similar

#

yeah that makes sense

#

since vanilla revive doesn't do AI reviving

ornate whale
#

But there are some things you can do if you provide more on how you imagine your AI to work.

brazen lagoon
#

ye I'll play around and see what I run into

vocal mantle
#

Yeah, I forgot that execVM only returns script handle and not a value

ornate whale
# brazen lagoon ye I'll play around and see what I run into

These might help:

  • fired event handler - which would tell you if the AI fired at something lately. If he fires, it means he reacts to a threat.
  • targetKnowledge/targets -> target age - you need to look through the list of known targets and check when was the last time it saw/heard the target.
  • checkVisibility - will tell you if the AI can see the threat now.
  • https://community.bistudio.com/wiki/BIS_fnc_threat - this function will tell you the threat of an enemy unit, I have not tested this, but you could give it a try, if the values is high, you assume he is bussy fighting, if low, you can revive other ppl.

These might or might not help:

  • COMBAT mode won't tell you much, it is just a state.
  • assignedTarget - it only tells you that the AI has been ordered to engage a specific target, nothing else.
  • getAttackTarget - should tell you the last target the AI fired at, so that won't help much either, since the threat might not be relevant anymore.
  • nearTargets -> subjective cost - it could tell you how dangerous the threat is.
  • firedNear event handler - it will tell you when any unit around your unit fired, friendlies or foes. But it works only to distance like 100 meters max.
  • https://community.bistudio.com/wiki/BIS_fnc_enemyDetected - this tells you only if your AI unit detected any hostile unit (1 or more), but it does not mean the enemy is a direct threat.
  • distance - simply checking how far the enemy unit is, if far, the AI unit is not bussy, if close, you assume it is bussy.
brazen lagoon
#

ok this is very helpful actually thanks so much

split scarab
#

Anyone know why the vehicle marker is transparent compared to the on foot player markers? I'm using the exact same marker commands for both except changing the icon

fair drum
#

Should throw them all in global

split scarab
#

Should all be same channel I believe

if (_isOnFoot) then {
    _marker = createMarkerLocal ["marker_" + _playerName, _x];
    _marker setMarkerTextLocal _playerName;
    _marker setMarkerTypeLocal "mil_triangle";
    _marker setMarkerSizeLocal [1, 1.5];
    _marker setMarkerDirLocal _playerDir;
};

if (!_isOnFoot) then {
    _vehicleName = getText (configFile >> "CfgVehicles" >> (typeOf vehicle _x) >> "displayName");
    _vehicleDir = getDir vehicle _x;
    _playersInVech = "";
    
    {
        if (_playersInVech == "") then {
            _playersInVech = name _x;
        } else {
            _playersInVech = _playersInVech + "/" + name _x;
        };
        
    } foreach crew vehicle _x;
    
    if (!isNil ("marker_vech_" + _playersInVech)) exitWith {};
    _marker = createMarkerLocal ["marker_vech_" + _playersInVech, _x];
    _marker setMarkerTextLocal _playersInVech + format [" (%1)", _vehicleName];
    _marker setMarkerSizeLocal [1, 1];
    _marker setMarkerDirLocal _vehicleDir;
    
    if (vehicle _x isKindOf "Car" || vehicle _x isKindOf "Tank") then { _marker setMarkerTypeLocal "loc_car"; _marker setMarkerDirLocal _vehicleDir; };
    if (vehicle _x isKindOf "Helicopter") then { _marker setMarkerTypeLocal "loc_heli"; };
    if (vehicle _x isKindOf "Jet") then { _marker setMarkerTypeLocal "loc_plane"; };
};

_marker setMarkerColorLocal (["colorOPFOR","colorBLUFOR","colorIndependent","colorCivilian"] select _sideNumber);
hallow mortar
#

That does look a lot like the effect of a marker being in a different channel to the one currently selected. However, in the code given, you're not specifying a channel, so all the markers are being created channel-free (like Editor-placed markers) and shouldn't be affected by channel selection.
I tested a quick sample:

marker = createMarkerLocal ["testMarker", player];
marker setMarkerTextLocal "aaaa";
marker setMarkerSizeLocal [1, 1];
marker setMarkerDirLocal getDir player;
marker setMarkerColorLocal "ColorBLUFOR";
marker setMarkerType "loc_car";```
and there is no such effect for me, it just looks normal.
split scarab
#

Apparently it becomes transparent as soon as I'm in it along with someone else?

#

And stays transparent until the vehicle is emptied

hallow mortar
#
if (!isNil ("marker_vech_" + _playersInVech)) exitWith {};

this won't work as intended. isNil tests whether a variable with this name exists. Marker names are not variable names and you can't use isNil to check whether they exist.

granite sky
#

I bet having / in a marker name does something weird.

twin oar
#

Hey! Having issues with whitelisted vehicle slots

addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "RHS_AH1Z_wd") then {
        _entity addEventHandler ["GetIn", {
            params ["_vehicle", "_role", "_unit", "_turret"];
            private _uid = getPlayerUID _unit;
             if!(_uid in whitelistedUIDs && _role == "driver" || _role == "gunner" || _role == "commander") then {
          hintSilent "You must be in ZR to use this vehicle";
          _unit moveout _vehicle;
            };
        }];
    };
}];

So the issue is the whitelisted players can enter the Pilot\driver and gunner\copilot seats zero isse. Nobody can enter the commander seat. Non whitlisted players can enter the copilot seat and unlock the controls and just fly away, any remedy?

hallow mortar
#

That as well

hallow mortar
split scarab
#

I'll try \

#

Yeah that's it

gleaming forge
#

Heya, does anyone know a simple way to make a fixed turret (such as the CIWS) fire sporadically at an invulnerable ground target? I would like to make an OPTRE UNSC ship have it's cannons firing down over a mountain ridge my players will be operating along, in order to introduce some more ambience

#

^ as in, could someone please write me a simple script i can just plug in to a turret that allows me to get it to sporadically fire a couple rounds at x object or coordinate?

fallen locust
#

man addEventHandler ["handleDamage",{_this execVM "script\handleDamage.sqf"}];
_this execVM? no

but why it dosent do aything is becouse "HandleDamage" handles dagame so if you dont return any damage... well it will do nothing

digital hollow
#

If you want it to be simple you can use the tracers module in ZEN. you can choose the type, frequency, duration, spread, etc

gleaming forge
#

I don't mind the tracers module but it needs to come from the air down onto the ground, not the other way aroound

tulip ridge
#

How can you vertically align a player's head / camera?
Want to do some ballistics testing but relying on trying to align it as best as I can manually isn't all that accurate

#

Basically just set the player's head to be level to the ground

warm hedge
#

Arma's bullets shot from the weapon's barrel (more like predefined pos per the weapon model) but you want to align the head?

tulip ridge
#

Not entirely sure why I said the head, re-reading my message now it doesn't make much sense.
But yeah, making the weapon level to the ground

warm hedge
#

One way I did (in a stupid way) is have a dummy object (like sphere) just above the ground and place your unit align with it (have the weapon aligned with the sphere like have rifle inside the sphere), and dosqf player attachTo [sphere]

tulip ridge
#

Something like this?

warm hedge
#

Yeah

#

And you also can level it to ground

tulip ridge
#

Seems to be working, appreciate it

digital hollow
gleaming forge
#

Oh but if I have to do it manually in Zeus it also wont work lol. It's being integrated into a Lib campaign that'll be running 23/7

digital hollow
#

Ah. Then it won't be easy. You can reference the ZEN code for a starting point

hallow mortar
#

Can't really write a full script right now but in theory:

  • pop down some target placeholders (e.g. invis helipads)
  • while {true} do { ...
  • _turret lockCameraTo (selectRandom _targets);
  • gunner _turret fire ["muzzle","burst"];
  • sleep (random [10, 20, 30]);
    Note some syntaxes not correct/complete, not full code just some places to conceptually start
#

The theory is that a loop runs, and at a semi-random interval the turret picks a random one of the targets, is forced to look at it, and fires.
You would probably also need to refresh the turret's ammo as part of the cycle to ensure it doesn't run out.

south swan
#

sounds like half of BI tracers module 🙃

meager granite
#

Interesting, remoteExec with lots of data arrives later than REs with small data, if sent on exact same frame

#

5 frames later in my test but it seems to vary, more or less sometimes

south swan
#

networking blobdoggoshruggoogly

#

probably gets split into multiple guaranteed packages, sent in parts and reassembled at target

meager granite
#

Yep, seems so

gleaming forge
ashen ridge
#

This may seens crazy, but in my mission it has a purpose.
Can i attach some object to a Land Vehicle so AA Launcher lock on it?

#

It will be like a fake way to make AA missiles lock on a Land Vehicle.

vocal mantle
#

already fixed. I'm just using call instead of execVM

calm charm
#

How to disable dust created by vehicles on roads?

vocal mantle
#

man addEventHandler ["handleDamage",{_this execVM "script\handleDamage.sqf";_this select 2}]; probably works too

#

it also says if you return nothing, regular damage is applied. The issue was that it was returning something, a script handle, not a number like its supposed to.

winter rose
#

no can do, AFAIK
why?

still forum
#

CfgDustEffects I think. Its a global config.
Via scripting, can't

split scarab
#

If I have a set of markers all with a variable name like hunted_spawn_1, hunted_spawn_2, etc. How would I put the names of all markers starting with hunted_spawn_ in an array?

fallen locust
#

Keep in mind HD fires once per hitpoint

#

player has 11

meager granite
#
allMapMarkers select {toLower _x find "hunted_spawn_" == 0}
stable dune
#

Like sa Matra said.🙂

vocal mantle
#

and that is why I used if (_hitPartIndex == 0) then { playSound "hitMarkerlong"; };

#

read my post

fallen locust
#

Yea but you are effectivly doing 11 execVMs per frame...

split scarab
#

I've made 5 invisible helipads with the name hunted_spawn_x, this should work no? But I don't think it's finding the objects
_markers = allObjects select {toLower _x find "hunted_spawn_" == 0};

meager granite
#

If you mean name in the editor, then you need toLower vehicleVarName _x

vocal mantle
#

I'm not using execVM anymore, i'm using call.

#

I already stated that

split scarab
#

Hmm still nothing

#
0 spawn {
    if !hasInterface exitWith {};
    
    _markers = allObjects select {toLower vehicleVarName _x find "hunted_spawn_" == 0};
    if (side group player == independent || typeOf player == "VirtualCurator_F") then {    
        {
            _marker = createMarkerLocal ["marker_" + _x];
            _marker setMarkerTextLocal "Spawn #" + str (_x select [count _x - 1, 1]);
            _marker setMarkerTypeLocal "mil_end_noShadow";
            _marker setMarkerColorLocal "colorIndependent";
        } foreach _markers;
    };
};
#

Not even this returns anything

_markers = allObjects;
systemChat str (count _markers);
meager granite
#

allObjects requires operands, you can't use it as nular. Looks like you have errors disabled or you would've seen it.

stable dune
#

if you are using only empty helipads, you could do

private _markers = "Land_HelipadEmpty_F" allObjects 0 select  {toLower vehicleVarName _x find "hunted_spawn_" == 0};
    if (side group player == independent || typeOf player == "VirtualCurator_F") then {    
        {
            private _heliPad = _x;
            private _position = getPosATL _heliPad;
            private _name = format ["marker_%1", _forEachIndex];
            _marker = createMarkerLocal [_name ,_position];
            _marker setMarkerTextLocal format ["Spawn #%1",_forEachIndex];
            _marker setMarkerTypeLocal "mil_end_noShadow";
            _marker setMarkerColorLocal "colorIndependent";
        } foreach _markers;
    };
fallen locust
#

and then pasted a code with execVM

#

but whatever

split scarab
#

That kinda works lol

#

But it only marked 3 out of 5

stable dune
#

check what this return

private _markers = "Land_HelipadEmpty_F" allObjects 0 select  {toLower vehicleVarName _x find "hunted_spawn_" == 0};

is there 3 and 5 or not, and check names in editor.

split scarab
#

It counts 5 yeah

#

5 elements in _markers

vocal mantle
#

I said it might work too. Never said it was a better solution or the one I went with.

split scarab
#
private _markers = "Land_HelipadEmpty_F" allObjects 0 select  {toLower vehicleVarName _x find "hunted_spawn_" == 0};
count _markers;

Returns 5;

stable dune
#

works for me

#
private _markers = "Land_HelipadEmpty_F" allObjects 0 select  {toLower vehicleVarName _x find "hunted_spawn_" == 0};

    if (side group player == independent || typeOf player == "VirtualCurator_F") then {    
        {
            private _heliPad = _x;
            private _position = getPosATL _heliPad;
            private _number = _forEachIndex+1;
            private _name = format ["marker_%1", _number];
            private _marker = createMarkerLocal [_name ,_position];
            _marker setMarkerTextLocal format ["Spawn #%1",_number];
            _marker setMarkerTypeLocal "mil_end_noShadow";
            _marker setMarkerColorLocal "colorIndependent";
        } foreach _markers;
    };

If you want from 1-5

split scarab
#

Nope, what the fuck

#

I even remade all the helipads and double checked that they were 1-5

#

What in the world, I'm at a total loss

0 spawn {
    if !hasInterface exitWith {};
    
    private _markers = "Land_HelipadEmpty_F" allObjects 0 select  {toLower vehicleVarName _x find "hunted_spawn_" == 0};
    systemChat str count _markers;
    
    if (side group player == independent || typeOf player == "VirtualCurator_F") then {    
        {
            private _heliPad = _x;
            private _position = getPosATL _heliPad;
            private _number = _forEachIndex+1;
            private _name = format ["marker_%1", _number];
            _marker = createMarkerLocal [_name ,_position];
            _marker setMarkerTextLocal format ["Spawn #%1",_number];
            _marker setMarkerTypeLocal "mil_end_noShadow";
            _marker setMarkerColorLocal "colorIndependent";
            
            systemChat format ["Created %1", ("Spawn #" + str _number)];
        } foreach _markers;
    };
};
vocal mantle
#

Ultimately I am going to use HitPart as Sa-Matra suggested. It's more MP friendly and it seems to only fire once per hit, not once per hit per hit selection

stable dune
#

hmm

#

Test what _position return

#

that is weird.

split scarab
#

Found the issue, marker_3 and marker_5 already exists

#

changed the _name prefix to marker_spawn_

#

And it worked

vocal mantle
#

this was just a proof of concept

graceful kelp
# twin oar Hey! Having issues with whitelisted vehicle slots ```sqf addMissionEventHandler...
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "RHS_AH1Z_wd") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit", "_turret"];
                private _uid = getPlayerUID _unit;
                if (!(_uid in whitelistedUIDs) && (_role == "driver" || _role == "gunner" || _role == "commander")) then {
                    hintSilent "You must be in ZR to use this vehicle";
                    _unit moveout _vehicle;
                };
            }
        ];
    };
}];
twin oar
#

This is also in each vehicles init

#
this addEventHandler ["GetIn", {  
      params ["_vehicle", "_role", "_unit", "_turret"];  
      private _uid = getPlayerUID _unit;  
      if!(_uid in whitelistedUIDs && _role == "driver" || _role == "gunner") then {  
          hintSilent "You must be in ZR to use this vehicle";  
          _unit moveout _vehicle;  
      };  
  }];
graceful kelp
#

and that works?

#

so its just the ah1z that isint working

twin oar
#

yes except the commander seat and the gunner/copilot seats

#

I can send the whole list if you'd prefer that\

south swan
#

and people getting into cargo and then swapping places 🙃

graceful kelp
#

the gunner shouldnt be a commander so that shouldnt be needed

twin oar
#

Well nobody can get into the commander seat at all

#

but players who aren't whitelisted can get into the copilot seat and take over the controls

little raptor
twin oar
twin oar
little raptor
#

no

#

there's no "copilot"
copilot seat is a "turret" seat. in its config it has some special property that I don't remember. maybe "iscopilot"?

graceful kelp
#

if this is a unique one for the ah1z
this should work

addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "RHS_AH1Z_wd") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs) exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
#

there are not seats other than gunner/pilot so theres no need to disern

twin oar
#

but what about the tanks I've got

#

where there is a commander seat/slot

little raptor
#

tanks do have commander

#

copilot != commander

twin oar
#
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "I_APC_Wheeled_03_cannon_F") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit", "_turret"];
                private _uid = getPlayerUID _unit;
                if (!(_uid in whitelistedUIDs) && _role == "driver" || _role == "gunner" || _role == "commander") then {
                    hintSilent "You must be in ZR to use this vehicle";
                    _unit moveout _vehicle;
                };
            }
        ];
    };
}];
south swan
#

role: String - can be either "driver", "gunner" or "cargo"
tanking

twin oar
#

hm okay

little raptor
#

afaik it can be "turret" too?

#

or maybe it shows "_turret" as an array?

south swan
#

copilots are turrets as well

#

FFV are turrets as well

graceful kelp
#
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "I_APC_Wheeled_03_cannon_F") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs && (_role == "driver" || _role == "gunner" || _role == "commander")) exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
south swan
#

everybody is a turret 🙃

little raptor
#

I know. like I said they have special values defined in the config that tells you what they actually are

#

e.g. gunner -> isPrimaryGunner

#

commander -> isPrimaryObserver
copilot dunno maybe isCopilot

south swan
#

just create an EH that dumps its arguments, get into the position in question and see what it returns blobdoggoshruggoogly

graceful kelp
#

could also try

addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "I_APC_Wheeled_03_cannon_F") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs && (_role == "driver" || _role == "gunner" || _vehicle commander == _unit)) exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
south swan
#

also, wouldn't _uid in whitelistedUIDs && _role == "driver" || _role == "gunner" be parsed as (_uid in whitelistedUIDs && _role == "driver") || _role == "gunner" due to and having higher precedence? notlikemeow

graceful kelp
#

possibly

twin oar
#

trying it now

graceful kelp
#

that look to be after the script

#

can you paste the initserver?

twin oar
#

it was one sec

#
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "RHS_Ka52_vvsc") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs) exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "C_Offroad_01_comms_F") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs && _role == "driver" || _role == "gunner" || _role == "commander") exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "rhs_t15_tv") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs && _role == "driver" || _role == "gunner" || _role == "commander") exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "rhs_uh1h_hidf_gunship") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs) exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "I_APC_Wheeled_03_cannon_F") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs && _role == "driver" || _role == "gunner" || _role == "commander") exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "rhsgref_ins_BM21") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit"];
                private _uid = getPlayerUID _unit;
                if (_uid in whitelistedUIDs && _role == "driver" || _role == "gunner" || _role == "commander") exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
graceful kelp
#

i wouldnt paste the uids here

twin oar
#

there

hallow mortar
#

The code that caused the error doesn't seem to be in here

graceful kelp
#

im assuming the one for stuff without the role checks work?

twin oar
graceful kelp
#

the issuie is the commander

#

removing that will make it all work

twin oar
#

I'll remove my UID from the list to double check

graceful kelp
#

but abviosuly not check the commander

#

the get in dosent seem to provide commander as a role output

twin oar
#

I can now access the commander slot

graceful kelp
#

oh so all is working

twin oar
#

before it just kept kicking me out

graceful kelp
#

just in a debug execute

whitelistedUIDs = [];
#

then try again

twin oar
#

yes I'm removing my UID now to test

#

No can still access the copilot slots

#

and now on the T15 I can access the gunner slot

#

without being whitelisted

#

but on the gorgon it seems to work just fine, except the gunner slot can be used

graceful kelp
#

might need to do a turret check

#

-1 is driver
0 is gunner/coop
1 probably commander

twin oar
#

right

#

could this have to do anything with each vehicles init?

twin oar
graceful kelp
#

you might need to use

vehicle player turretLocal [?];
#

in the seats of what you want block, once you know what you want to block you do it on all vehicles

twin oar
#

I’m gonna be real

#

This is confusing lmao

graceful kelp
#

so

vehicle player turretLocal [-1];
vehicle player turretLocal [0];
vehicle player turretLocal [1];
vehicle player turretLocal [2];

find out which one returns true in the seat you want to block
then add it to the iff statement

addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if(_entity isKindOf "I_APC_Wheeled_03_cannon_F") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit", "_turret"];
                private _uid = getPlayerUID _unit;
                private _crew = fullCrew;
                if (_uid in whitelistedUIDs && _role == "driver" || _role == "gunner" || _turret == [0]) exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
#

well actulay you dont want anyone in any turrets

still forum
#

EntityCreated gets called alot and can cause performance issues.
Using it for this purpose is meh..
Instead just add GetInMan eventhandler to all player units
Both better for performance, and easier on game memory (because you'll have less players than vehicles, usually)

twin oar
still forum
#

Okey so?
That doesn't change what i said

#

Just use a GetInMan eventhandler on player units, problem solved. Vehicle respawning, doesn't matter

twin oar
#

okay

#
addMissionEventHandler ["GetInMan", {
    params ["_entity"];
    if(_entity isKindOf "I_APC_Wheeled_03_cannon_F") then {
        _entity addEventHandler ["GetIn", 
            {
                params ["_vehicle", "_role", "_unit", "_turret"];
                private _uid = getPlayerUID _unit;
                private _crew = fullCrew;
                if (_uid in whitelistedUIDs && _role == "driver" || _role == "gunner" || _turret == [0]) exitwith {};
                hintSilent "You must be in ZR to use this vehicle";
                _unit moveout _vehicle;
            }
        ];
    };
}];
graceful kelp
#

in init server

IWantToBlockTheseVehicles = [
    "rhs_uh1h_hidf_gunship",
    "C_Offroad_01_comms_F",
];

in the init of all the players

this addEventHandler ["GetInMan", 
    {
        params ["_vehicle", "_role", "_unit", "_turret"];
        private _uid = getPlayerUID _unit;
        private _turretArray = [-1,0,1,2,3,4];
        if (_uid in whitelistedUIDs && _vehicle in IWantToBlockTheseVehicles && (_role == "driver" || _role == "gunner" || _role == "commander" || _turret in _turretArray)) exitwith {};
        hintSilent "You must be in ZR to use this vehicle";
        _unit moveout _vehicle;
    }
];
twin oar
graceful kelp
#

yh

twin oar
#

then in all the players inits

graceful kelp
#

so its not doing it to every car and shit

#

just what you want

#

yh

twin oar
#

okay then clear the vec inits that where there

graceful kelp
#

i would assume the vehicle init reinitialised on respawn no?

twin oar
#

yes

graceful kelp
#

just give that premise a try

#

might need some tweaking

#

im of to make dinner

#

GL

twin oar
#

thanks will let you know

twin oar
still forum
#

Add diag_log's to see whats going on

twin oar
#

and the hint is populating for every vehicle

still forum
#

So the hintSilent is working.
So you know that your handler runs correctly.
But the moveOut does nothing

#

Maybe when the event fires the player isn't in the vehicle yet, and you need to wait like half a second

#

Also why do you specify the vehicle with moveOut? It the unit should only be able to be in one vehicle. So you can just use the main syntax and move them out no matter what vehicle

twin oar
still forum
#

_vehicle in IWantToBlockTheseVehicles
So that's not working. What is in there

twin oar
#
IWantToBlockTheseVehicles = [
    "RHS_Ka52_vvsc",
    "rhsgref_ins_BM21",
    "I_APC_Wheeled_03_cannon_F",
    "rhs_uh1h_hidf_gunship",
    "rhs_t15_tv",
    "C_Offroad_01_comms_F"
];
still forum
still forum
#

isKindOf + findIf
Find if any element in array the isKindOf check is true

twin oar
#

Honestly at this point I'm beyond confused

#

this is like beyond my knowledge at this point

granite sky
#

You can get the classname of a vehicle, which you can compare again that array, with typeof _vehicle

#

isKindOf works with either objects or classnames so that's different.

twin oar
#

I'm lost

#

It's fine

#

I have reserved slots, is there anyway that I could base these off of the slots instead?

tulip ridge
#

Instead of doing _vehicle in IWantToBlockTheseVehicles, do typeOf _vehicle in IWantToBlockTheseVehicles

#

If you just want a simple way that doesn't check if it inherits from it

#

Unrelated, but I wish there was an alternate syntax for the getX commands to allow a default value, looks a lot nicer than using BIS_fnc_returnConfigEntry or something similar

_ammoCount = getNumber [configFile >> "CfgMagazines" >> _magazine >> "count", 30];
// versus
_ammoCount =
[
    configFile >> "CfgMagazines" >> _magazine,
    "count",
    30
] call BIS_fnc_returnConfigEntry;

Just looks a lot nicer, especially since BIS_fnc_returnConfigEntry calls tend to get lengthy, so you "have" to split them up to multiple lines

south swan
#

*getNumber [_cfg, 30];

twin oar
#

so

#
typeOf _vehilce in IWantToBlockTheseVehicles = [
    "RHS_Ka52_vvsc",
    "rhsgref_ins_BM21",
    "I_APC_Wheeled_03_cannon_F",
    "rhs_uh1h_hidf_gunship",
    "rhs_t15_tv",
    "C_Offroad_01_comms_F"
];
#

?

tulip ridge
#

That would give an error, just add typeOf before _vehicle in your condition

// Current
if (_uid in whitelistedUIDs && _vehicle in IWantToBlockTheseVehicles && (_role == "driver" || _role == "gunner" || _role == "commander" || _turret in _turretArray)) exitwith {};

// Changed                     VVVVVV
if (_uid in whitelistedUIDs && typeOf _vehicle in IWantToBlockTheseVehicles && (_role == "driver" || _role == "gunner" || _role == "commander" || _turret in _turretArray)) exitwith {};
twin oar
#
this addEventHandler ["GetInMan",  
    { 
        params ["_vehicle", "_role", "_unit", "_turret"]; 
        private _uid = getPlayerUID _unit; 
        private _turretArray = [-1,0,1,2,3,4]; 
        if (_uid in whitelistedUIDs && typeOf _vehicle in IWantToBlockTheseVehicles && (_role == "driver" || _role == "gunner" || _role == "commander" || _turret in _turretArray)) exitwith {}; 
        hintSilent "You must be in ZR to use this vehicle"; 
        _unit moveout _vehicle; 
    } 
];
tulip ridge
#

Yep, there ya go 👍

twin oar
#

okay will try

south swan
#

except cringe

tulip ridge
#

You could also simplify _role == "driver" || _role == "gunner" || _role == "commander" to just _role in ["driver", "gunner", "commander"]

south swan
#
this addEventHandler ["GetInMan", {
  params ["_unit", "_role", "_vehicle", "_turret"];
  if (
    getPlayerUID _unit in whitelistedUIDs ||
    !(typeOf _vehicle in IWantToBlockTheseVehicles) ||
    (_role == "cargo")
  ) exitWith {};
  hintSilent "You must be in ZR to use this vehicle"; 
  _unit moveout _vehicle; 
}];``` ![blobdoggoshruggoogly](https://cdn.discordapp.com/emojis/748124048025714758.webp?size=128 "blobdoggoshruggoogly")
#

possible !(_turret in (_vehicle call BIS_fnc_vehicleCrewTurrets)) for FFV cargo positions

#

although they seemingly report "cargo" role with a turret path

smoky verge
#

insane question but is there some console script I could use to find all objects with a certain attribute value?
to be specific I'm trying to find all objects that have a certain scale set in Eden Enhanced
I know I could use get3DENAttribute "ENH_objectScaling"; to somehow find them but I wouldn't know how to create a command that auto selects them all

twin oar
#

only issue with RHS T-15

cosmic lichen
smoky verge
cosmic lichen
#

Sure

smoky verge
#

neat
thank you

south swan
twin oar
#

Well gorgon and t-15

#

lets you enter cargo slots and switch seat

south swan
twin oar
#

lol

south swan
#

except with the trivial code for that passenger would be able to move the driver/gunner out of their place even when being kicked out notlikemeow

twin oar
#

except the ones in the list

twin oar
#

It worked in the editor but now on dedicated I can't

restive hinge
#

Is there a way to loop through all zeus's?

["ModuleCurator_F", "init", {
    _zeus = (_this select 0);
    [_zeus] execVM "scripts\fn_curatorObjectPlaced.sqf";
    }
] call CBA_fnc_addClassEventHandler;
#

I can't get this running.
What I'm trying to achieve is to add event handlers to each unit spawned by Zeus defined in scripts\fn_curatorObjectPlaced.sqf, and I don't want to place the execVM in each init field of a zeus object

vocal mantle
restive hinge
#

There's defintely a better way to do this

hallow mortar
gleaming forge
restive sphinx
#

yooo does anyone have any idea on how to edit the intensity of lights that vehicles produce?

hallow mortar
#

You can't through scripting. That's part of the vehicle model/config.

candid sun
#

looking good

hallow mortar
meager granite
#

Is it me or onUnload event handler doesn't trigger when you close display created through cutRsc? Doesn't trigger through cutFadeOut or manually closing the display with closeDisplay commands.

#

Actually closeDisplay doesn't close it at all, cutFadeOut does but still doesn't trigger the event handler

#

onLoad works fine though

#

Adding event handler with displayAddEventHandler works but again it doesn't trigger on display termination

versed belfry
#

Hello :D

Question, in a script like the following, is there any way to check whether the item of an array is a string/other data type without executing it? Because whenever I try to access an array item it is executed of course.

_test = ["test1", "test2", player allowDamage true, "test4"];

typeName (_test select 2);

If you care what's this for:

  1. I plan on receiving an array like the attached file from a player through a pop-up menu.
  2. I plan to take that array and start reading the data in it to create the markers at their exact position.

This is to allow the transfer of OP plans from https://maps.plan-ops.fr to in-game quickly without mission maker interference.

I assume it's pretty risk maybe even outright crazy to take data from players as it could be exploited easily, hence why I was hopping for a way to safely check if each item of the array is a string before executing it. or maybe I should just throw the idea in the bin 🤷‍♂️

simple trout
#

that will return code type without an execution

versed belfry
ornate whale
ornate whale
# versed belfry I believe so.

I don´t even know if this all is possible to do in SQF, I mean to catch some txt file from a player, parse it, load into an array and validate data types. But if you are getting a string from a player, then if you split it into multiple substrings, then it is still all just strings not a code.

versed belfry
#

Yea, safest solution might just be to not do it.

meager granite
#

Hashmap iterators should've had _x as value and _y as key so you can use same code for iterating both arrays and hashmaps when you don't care about the key.

sage marsh
#

Hey there i'm a rookie in scripting and i have a question regarding initintro.sqf.

It says in the wiki it'll execute immedietely when "intro", "Outro-win" and "Outro-lose" scenario phase started.

I understand how to use the initintro for making intro but how do i use it to make the "outro-win"? Wouldn't that overlap with the intro?

dusk gust
cosmic lichen
gleaming forge
#

Just in the initServer.sqf underneath the first section?

#

Oh I see, it goes in the fn_constantBombardment.sqf

gleaming forge
#

Ah so I just tried it in VR and no luck :(

sage marsh
queen cargo
hallow mortar
still forum
stray flame
#

Correct me if this is the wrong place to ask

#

But after going around trying to get help with this mod's sqf

#

I seem to have no luck

#

Basically this should work as reliably as onplayerkilled.sqf n stuff

    
    
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    player setVariable ["HAMSCH_Saved_Loadout",getUnitLoadout player];
}];


HAMSCH_EH_onPlayerRespawn = player addEventHandler ["Respawn", {
   
    private _loadout = player getVariable ["HAMSCH_Saved_Loadout",[]];
    player setUnitLoadout _loadout;    
    
    params ["_newObject", "_oldObject"];
    deleteVehicle _oldObject;
    player switchMove "UnconsciousFaceDown";
    player playMove "UnconsciousOutProne";

    private _radio = (_loadout select 9) select 2;
    if (_radio isEqualTo "") then 
    {
        hint "Radio not found";
    };
}];


#

It works sometimes, and others it does not. But when it works it works from the start. When it does not, it just doesnt work to begin with

#

Here is how it goes when it does not work

#

I have checked and it is running. It told it to post a chat message when it tried to save my loadout as well as tries to restore that loadout. Which it did

warm hedge
#

How about initPlayerLocal.sqf?

stray flame
#

Hm?

#

My understanding is that things like onplayerkilled.sqf and initplayerlocal.sqf does not work within a mod like it does in mission files

warm hedge
#

Oh I think I see what you mean by

this mod's sqf

stray flame
#

Yes

#

I mention its an sqf as the reason I think its relevant here

warm hedge
#

What exactly calls this script?

stray flame
#

In this channel

#

Uhh

#
class CfgFunctions
{
    class HAMS_Spawn    // tag, will be added to function name
    {
        class myfunctions  // name here doesn't matter
        {
            class SaveLoadout 
            {
                file = "HAMS_Loadout_Saver\functions\fnc_saveLoadout.sqf";
                postInit = 1;
            };
        };
    };
};


#

Im guessing you mean postinit?

warm hedge
#

Indeed

stray flame
#

I think the unreliability is something related to when it tries to do it's thing

#

Like saving loadout without a target or something

warm hedge
#

Indeed. What you said told us the EHs are not available/initialized sometimes

stray flame
#

Seems like it

#

But it looks like there is a concrete reason

warm hedge
#

SP/MP Server/MP Client?

stray flame
#

Because I have never had ut just work sometimes

#

Like if it works, it works the whole session. Start to finish

#

If not, well no

#

Its tested and mainly hosted on player hosted servers

#

So UPnP hosting stuffs

warm hedge
#

Well UPnP or whatever is not related in this situation

#

One thing you want to do is, make sure player is not null when it is happening

#

Use diag_log or something to check if it is or nah

stray flame
#

Sure I am not able to give a proper check right at this moment

#

As I have some errands to run

#

But when I can sure thing

hallow mortar
# gleaming forge Ah so I just tried it in VR and no luck :(

Okay, issues identified.

  1. the turret's weapon does not have any muzzles or firemodes with the name you specified.
    Its only available muzzle is configured as this, which means you just use the weapon's own classname - "OPTRE_M9109_Turret".
    It doesn't have a "Single" firemode, so you need to pick one it does have. I went with "Medium".
  2. the object it's attached to has a very low simulation rate.
    The turret inherits the simulation rate of the object it's attached to; for large static objects like buildings...and frigates...this is not very fast, only updating 1 or 2 times per second. The turret's AI doesn't like this and it freaks out.
    You need to find a different object to attach it to, one with a faster sim rate. Objects that have physics, like vehicles, work well for this. Note that the object it's attached to does not have to be anywhere near it. Putting an invisible, invincible something on top of the frigate should work fine.
ornate whale
#

Is it possible to create an addon for mission makers that would not create any dependencies for players? In other words, in which cases dependencies are not created? Thank you

brazen cobalt
#

Hi guys, I don't know anything about script so any help would be appreciated.

I'm in an Antistasi game rn, using Ace Medical.

Is there is a script I can implement using the server console which:

  1. Ensure anybody who goes unconscious for any reason, will remain unconscious regardless of bloodloss or cardiac arrest, for at least ten minutes
  2. After ten minutes if they are not revived, they die

Is someone able to write a script for the server console to implement the above?
Or perhaps show me how I can write said script?

opal zephyr
restive hinge
#

There's no need in using scripts in this case

brazen cobalt
twin oar
restive hinge
#

Basically make a folder userconfig in root dir of your arma installation dir, place an empty file cba_settings.sqf there
Then open ACE Arsenal from main menu, press settings, then addon options, filter for ACE Medical, change values (make sure to tick overwrite client to the right), then press export and paste the contents of exported config to the file above

#

Then just restart the server

#

In case you did everything right, you should see a line in logs of your arma server something like userconfig applied after mods inititalisation

brazen cobalt
#

This works for dedicated servers too right?

restive hinge
#

This is for dedicated server

#

Make sure to enable filePatching

brazen cobalt
#

I'm guessing I can use Zeus to access ace arsenal right?

brazen cobalt
brazen cobalt
# restive hinge Basically make a folder `userconfig` in root dir of your arma installation dir, ...

ok so here is the problem with this

In Ace medical, there is no way to have settings where if someone goes unconscious, they stay unconscious for ten minutes before they die.

The closest is turning off bleeding coefficient and turning on cardiac arrest death - then you have to give someone CPR once every ten minutes to make sure they don't die.

What I want is to have to settings where you have to revive someone within ten minutes, or else they die, no matter how many times you gives them CPR.

fair drum
sullen sigil
#

fairly easy to do:
hook into cba event for player going unconscious
write a timestamp to a variable for when the player goes unconscious, call it last unconscious time
start a cba waitandexecute for 10 minutes, passing last unconscious time and unit as a parameter
get last unconscious time from unit, compare to last unconscious time passed into waitandexecute
if equal, kill. if not, exit as player has gone unconscious again and all this is happening again

#

links you need

granite sky
#

Do you want to kill players even if they have stable vitals?

south swan
brazen cobalt
sullen sigil
#
//in postinit
[
  "ace_medical_setunconscious",
  {
    params ["_unit"];
    private _theTime = time;
    _unit setVariable ["Stolt_LastUnconsciousTime", _theTime];
    [
      {
        params ["_unit", "_theTime"];
        private _lastUncon = _unit getVariable ["Stolt_LastUnconsciousTime", time];
        if (_lastUncon != _theTime || lifeState _unit == "incapacitated") exitWith {}; // Exit if unit has gone uncon again.
        if (!(_unit call ace_medical_status_hasStableVitals)) exitWith {}; // Exit if unit has stable vitals.
        // Feel free to throw more exit conditions in here.
        _unit setDamage 1; // Will outright kill unit after 10 minutes if still unconscious from the unconsciousness that put them under 10 minutes ago.
      },
      [
        _unit, _theTime
      ],
      600
    ] call CBA_fnc_waitAndExecute;
  }
] call CBA_fnc_addEventHandler;```
#

im in a lecture so john can do stable vitals stuff for me 🙈

brazen cobalt
#

Thanks a lot for your help!

granite sky
#

Fairly sure that's going to kill you 10min after something

sullen sigil
sullen sigil
#

oh wait i forgot to add check for currently unconscious

granite sky
#

yes :P

twin oar
sullen sigil
#

fixed

granite sky
#

Also not sure if the ace setUnconscious triggers on wakeup.

twin oar
#

As I’ve got everything defined, it works perfectly in the editor

sullen sigil
granite sky
#

yeah, doesn't matter with the check.

twin oar
#

Just once on dedicated it kicks me out of every vehicle regardless of the whitelisting

sullen sigil
brazen cobalt
#

Thanks guys!

#

so now I have to find a file called postinit in my dedicated server and copy paste your script anywhere into it right?

sullen sigil
#

er no

#

initServerLocal.sqf i think

#

let me check

#

no just initserver

south swan
sullen sigil
#

if you want it to be for everything, create an addon with it as a function

#

postInit = 1; in the function class to run as postinit

twin oar
#

With the class names of the vehicles I want restricted

brazen cobalt
# sullen sigil no just initserver

Where would I find this file? My dedicated server is with GTX, I've searched for it in the server/arma directory as well as the configuration files but there is no initserver.sqf there

sullen sigil
#

you create it in mission directory

brazen cobalt
#

that would be mpmissions right

sullen sigil
#

no

#

in the dir of the mission file itself

brazen cobalt
#

okay so I made a notepad file, copy pasted your code into it, and then changed the name of the file to initserver.sqf and then uploaded it to the mpmissions folder on my dedicated server

#

oh

#

rip

#

let me see where I can find that

#

wait

#

antistasi is a mod not a mission so does that matter at all?

sullen sigil
#

yes you will need to make it an addon for that

brazen cobalt
#

ok so let me double check I understood this correctly

If I want to use your code for my antistasi mission, I just have to copy paste it into initserver.sqf and then copy paste initserver.sqf into the mission directory (I will find this out on the antistasi server)

Whereas if I want to use your code for any other mission I do then I basically have to turn it into a mod (addon?) and activate that mod each time right?

sullen sigil
#

no

#

you cant do it on antistasi without editing the mission files directly

#

its a pain in the ass to do so

#

so just turn it into an addon with cfgfunctions and run that on postinit

#

however you also want if (!isServer) exitWith {}; on line one in that function to stop players running it

wary sandal
#

how do i check if a plane is on the ground (when the gears touch the ground)?

sullen sigil
#

uh
isTouchingGround?

granite sky
#

There's also an EH, LandedTouchDown, but I don't know how well that works.

brazen cobalt
# sullen sigil so just turn it into an addon with cfgfunctions and run that on postinit

okay idk how to turn it into an addon or what cfgfunctions are or how to run it on postinit since I've never done scripting or coding before, but I did some googling and it sounds like I have to do this:

  1. Create config.cpp
  2. Copy paste ONLY the code under "Functions" from here: https://community.bistudio.com/wiki/Arma_3:_Functions_Library

And then I am a bit confused about what to do next:

Would I just have initserver.sqf and config.cpp in the same folder and then upload that folder to steam workshop and download and install it into my server?

sullen sigil
#

no

#

function points to a .sqf file

#

theres probably a wiki tutorial for it but i cannot search through it rn im in a lecture still

brazen cobalt
#

hey no problem thanks a lot for your help!

#

I will try to continue googling and figuring it out!

sullen sigil
#

refer to scripts

#

For example, scripts that are to be executed at mission init can be added to the CfgFunctions class with an init flag, such as preInit = 1.

#

you want to create an addon that just adds that one function with postInit = 1; in the function class

brazen cobalt
# sullen sigil you want to create an addon that just adds that one function with `postInit = 1;...

okay so I created a folder called MedScript, within it I created config.cpp which I then opened with Notepad++

Based on what you said, it sounds like I just need to copy paste this code into Config.cpp right?

class CfgFunctions
{
class TAG
{
class Category1
{
class myFunction {};
};

    class Category2
    {
        file = "Path\To\Category";
        class myFunction
        {
            file = "My\Function\Filepath.sqf"; // file path will be <ROOT>\My\Function\Filepath.sqf", ignoring "Path\To\Category"
        };

        class myFSMFunction
        {
            preInit        = 1;
            postInit    = 1;
            ext            = ".fsm";
            preStart    = 1;
            recompile    = 1;
        };
    };
};

};

sullen sigil
#

you need cfgpatches too

brazen cobalt
#

okay so like

winter rose
#

…please use pastebin?

brazen cobalt
restive hinge
#

I have this function to run in initServer.sqf for each curator . It works in Editor LAN session, but when ran on dedicated server it wouldn't initialise. I guess it has something to do with a processing latency or locality of script?

// initServer.sqf
{
  [_x] execVM "function.sqf";
} forEach entities "ModuleCurator_F"
// function.sqf
_zeus = (_this select 0);
_zeus addEventHandler ['CuratorObjectPlaced',
    {
        _unit = (_this select 1);
        // waitUntil { _unit != null; };
        if (_unit isKindOf "Man" && side _unit == WEST) exitWith {};
        {
            // Даём рандомные деньги ИИ
            if (side _x == CIVILIAN) exitWith {};
            [_x, [0, 100] call BIS_fnc_randomInt, false] call grad_moneymenu_fnc_addFunds;
            // Удаляем оружие у ИИ
            _x addEventHandler ["Killed",
                {
                    _killed = (_this select 0);
                    removeAllWeapons _killed;
                }
            ]
        } forEach crew _unit
    }
];
#

I guess I have to make a check whether a placed unit is present?

digital hollow
#

Arma 3: Curator Event Handlers are also added with the addEventHandler command. They are executed only where the curator is local - on the machine that is in control of it.
so you need to add them not on the server, but on all clients

vapid scarab
#

So Im making a 3den module. It adds an interaction to an object. For some reason, its not calling on clients.

class BAX_Module_AddIntelAction: Module_F {
        scope = 2;
        displayName = "Add Intel Action";
        category = "Intel";
        
        functionPriority = 1;
        isGlobal = 2;
};

isGlobal = 1 should make this execute on every client + server, right?

stable dune
vapid scarab
#

I read that... But 1 doesnt call the code on every client. so im trying to figure out what "global" means, as opposed to "persistant global"

#

or rather, the difference between 0 (server only) versus 1 (global).

hallow mortar
#

Global would be calling it for everyone currently present, persistent global would be running on JIP clients as well

vapid scarab
#

setting it as 2, fixes it. And I just realized I need to set it to 2 anyways.

gleaming forge
versed belfry
still forum
#

Can't use thingies. Its being abused by scammers so its blocked

twin oar
#

Is there any way to lock vehicle for certain players?

hallow mortar
#

Outright locking is fully global. However, you can use getIn / getInMan event handlers to immediately boot unauthorised units when they get in.

twin oar
#

Could I maybe modify a “AllowGetIn false;”

#

To specific players

#

I’ve tried that and have had several issues

#

With zero resolve

twin oar
hallow mortar
#

allowGetIn appears to be for AI, not players

twin oar
#

hmm

#

what do you suggest

sullen sigil
#

tbh would be nice if GetIn EH was able to be overridden with return value 🙃

twin oar
#

I've done what Artemoz sent me but with no avail it doesn't work even with a PublicVar

#

I used GetInMan