#arma3_scripting

1 messages ยท Page 629 of 1

winter rose
#

originally, only a function deleting a unit that may or may not be in a vehicle

#

now, it's everything

#

ok, 50 lines only, I counted the description in

cosmic lichen
#

so if a marker is not in a vehicle it gets deleted? ๐Ÿ˜„

winter rose
#

yes! ๐Ÿ˜

#

if you pass a group, it deletes the units then the group, and it works with arrays of elements too

#
[units player] call LM_fnc_delete
```poof, no more sidekicks
#

_myWaypoint call LM_fnc_delete too

#

โ€ฆwhat am I doing with my life

cosmic lichen
#

Quick!

winter rose
#

๐Ÿ˜„

cosmic lichen
#

โ€ฆwhat am I doing with my life
@winter rose Yeah, today I told myself I am just going to fix that one thing, then discovered that I could do something entirely new with addonFiles

#

Now I am sitting here 4 hours later

winter rose
#

masโ€ฆ debugging

cosmic lichen
#

You are saying you wrote an efficient function which can just delete anything? Maybe even my mother in law? Yes it's pertinent

winter rose
#

well it's just a "clean way of doing", so you don't bother finding and checking deleteVehicle/crew/deleteLocation stuff
well, I'll post it and you tell me

delicate lagoon
#

Hello. It's me again! Yet again another issue

#

I'm using the "Create Diary Record"-modules linked to a trigger that activates when we complete an action on an object. The trigger activates since we get the "log downloaded"-message that I put in there. But the diary entry does not show up for any of us. I'm guessing the module doesn't work on dedicated servers? if so, is there any other way that works on dedicated?

winter rose
#

โ€ฆ+ fixes

little raptor
delicate lagoon
#

I'm sure

#

it is supposed to be a briefing

#

with info

little raptor
#

ok

delicate lagoon
#

it's weird tbf

little raptor
#

I recommend that you add the diary by remoteExecing that command in the trigger activation code.
I think the trigger code might execute for all of you, so you should make sure it only runs on one machine (preferably the server)

winter rose
#

module's function is indeed using the command only (local effect)

delicate lagoon
#

so uh

potent depot
#

anyone know if there is a good command for pulling the default inventory of a crate from it's config?
assuming the config has the items in the Transport(Type) defined in the format:

    class #ITEM{
      name = #ITEM; 
      count = COUNT; 
    }

Am trying to convert the full list across all types into one usable 2D array with classname and quantity. Not sure if there is a nice way of doing it.

winter rose
little raptor
#

Is there a way to check if a file exists before using loadFile or preprocessFileXXX?

drifting sky
#

Arma2OA: I cannot find the information I need to successfully add a new fire mode (for use by the ai) to an existing weapon.

exotic flax
drifting sky
#

Can you make a new fire mode inherit from a another fire mode in the same weapon class? Or does it always inherit from the class that the weapon inherits from?

exotic flax
#

afaik are all weapons based on the same core class which have the different modes defined. Or it's even separated completely... no idea, never worked with weapon configs...
PS. this is more a #arma3_config question, since there's nothing you can do with scripts

outer fjord
#

For the Chemical Detector MFD animations

"YourLayerName" cutRsc ["RscWeaponChemicalDetector", "PLAIN", 1, false]; //IGUI display on``` What exactly is  "YourLayerName" for? Like Is that to sort out multiple variants if I was to change different detectors or?
exotic flax
#

it's the name of your layer, which you'll need for other commands later on (like removing the layer, or adding a fadeIn/Out

#

alternatively you can use the layer number (since Arma 3 v1.57)

hollow plaza
#

Does removeAction completely remove an action, or just hide it? I'm currently looking for a way to temporarily disable an action when it is activated, but the game does not like me trying to use addAction to bring back the action which I had added at the start of the sqf file.

robust hollow
#

completely removes it

hollow plaza
#

Currently it would appear that I have to create the same action from scratch within the same loop, which I'd prefer avoiding

robust hollow
#

you can use a variable in the condition field and set it true/false when you want to show/hide the action

hollow plaza
#

I got it to work in a way that it does the script I put into the variable embedded within the action, and it succesfully hides the action after using it, so that is at least working.

#

Oh well, I'm guessing I'll just have to do a new action at the end of the If-statement

#

Alright, it's working now.

#

Also, how do I go about making a hint that is only shown for the person that uses this addAction? Like this way: _thisPlayer hint "You used the action"

#

I know it doesn't work that way, or so I believe, but you get the point.

robust hollow
#

hint "You used the action"

#

hint is unary - only takes a right argument, and it has a local effect, meaning it only shows the hint on the player who executed it.

hollow plaza
#

Oh, alright.

sonic thicket
#

Hey folks, so I am a bit confused due to "onPlayerRespawn.sqf" not firing at mission start while I have respawnOnStart = 0; in the description.ext

#

does this only fire on multiplayer sessions or also on sessions executed from eden?

#

I might be working in another scenario, Im currently loading in so im not sure but it often is something as plain as that when I really cant figure it out

#

hehe yeah it was a different scenario

winter rose
#

@sonic thicket โ†‘

hollow plaza
#

Noticed a small problem in my script, it would appear that everyone has the addAction available and they can activate the script for the ones that have it in their init as long as they're looking at them. I'd assume this is due to the lack of a condition.

What would be the simplest way to set the addAction condition to be just you.

winter rose
#

if (local this) then { /* addaction */ } @hollow plaza ๐Ÿ™‚

hollow plaza
#

I meant as in condition that is within the addAction itself, this is currently my script up to the condition.
_speedBoost_action = _runner addAction["Stim Boost", "boost_activated = true", "", 1.5, true, true, "", "CONDITION"];

winter rose
#

where does the code execute?

#

because if you add the action to everyone but escape it with a condition, that's losing CPU for nothing

hollow plaza
#

It is set within the init of certain units that are allowed to use the boost

winter rose
#

use local around the addaction then, it's better

hollow plaza
#

speedBoost = [this] execVM "speedBoost.sqf"; That is the init thingy

#

Ah alright, so I'll stick the whole script within if (local this)

#

By script I mean the forementioned sqf file

winter rose
#

no, just the execVM thing

#
if (local this) then { [this] execVM "speedBoost.sqf" };```
hollow plaza
#

Oh, right

#

I'll check it real quick

#

Still appears that I'm able to activate the script for others as well

#

The object to whom I give the action is _runner, which is _this select 0

#

Does that have anything to do with this problem?

#

Actually no, it shouldn't, considering that only gives the action to the people it is assigned for within their init.

winter rose
#

in singleplayer, yes

#

you can do if (player == this) then instead

hollow plaza
#

Yeah, it's meant for MP. I'm guessing this is only because I'm doing it with AI on SP, so it should work perfectly fine with players in a way that they cannot activate it for each other?

winter rose
#

Yep
player == would work both sp & mp

hollow plaza
#

I guess I'll go with that, considering I can't test MP scripts by myself

#

Yep, it works now. @winter rose Thanks fella

cedar sundial
#

Hi,
My goal is to end up with an array over the players current mag count:
["magType", amountOfMagazines]

Following:
_magArry = magazinesAmmo player;
_magArry = _magArry call BIS_fnc_consolidateArray;
Will create something like:
[["magType", magsize]amountOfMagazines]

Is there a better way to fetch the data? If not, could someone help me with the statment to transform the data? Iยดm not an expert on nested arrays ๐Ÿ˜ฉ

potent depot
#

what are you having issue with specifically?

#

@cedar sundial

#

also, do you care about ammo amount in each mag or just the overall count of each type?

cedar sundial
#

I'm not able to achieve my goal. I have gotten so far that I have this nested array, but not able to transform it how according to my need. I do not care about size/counting rounds, just the amount of each type.

#

Storing that data in a way so it's easy to compare with an equal set of data, to spot the differences

potent depot
#

then you can count for each type as you go through

cedar sundial
#

Oh, that looks neat indeed. Not sure how I missed that one

potent depot
#

now working with a 2D array. You should be able to you two selects like so: array select 0 select 1 with the first select selecting the pair and the second selecting the value from that pair.

#

and appending you can append the entire pair [classname, count]

#

that said, if you are counting from that array format, you can do 2 parallel arrays for simplicity

sonic thicket
#

Thanks Lou, sorry for the late reaction by the way ๐Ÿ™‚

cedar sundial
#

Oh, thanks! I was trying to find that syntax. Tried array select (select 0 ) without success

sonic thicket
#

Is there any way to prevent damage done by checking if there is damage done?

#

Reason why i am asking is because I am trying to work around a mod

cedar sundial
#

You can prevent damage by event handler
_unit addEventHandler ["HandleDamage", {0}];

#

@sonic thicket what are the requirements for this check? In what cases? What mod?

sonic thicket
#

Ravage zombies hits persons through cars and I want to stop this from happening as I've implemented my own system that first breaks all the windows and then starts hitting the players that are inside

#

Nice, HandleDamage ill look that up ๐Ÿ™‚

austere hawk
#

does setDamage even trigger the Eventhandler?

sonic thicket
#

it should fire for HandleDamage

#

Oh heck well it works off the bat

#

so i guess it doesnt trigger setDamage

#

Thanks Knopen, that worked out perfectly ๐Ÿ™‚

still forum
#

Is there a way to check if a file exists before using loadFile or preprocessFileXXX?
@little raptor in script currently no. But I wanted to make one, I wonder where that went

runic edge
#

hello guys, i was wondering if the napierian log was existing alongside the base 10 one ๐Ÿค”
thanks !

little raptor
#

@runic edge do you mean natural log?

#

If so, ln is what you're looking for.

runic edge
#

thanks

languid oyster
#

Hey folks, is there a reliable method to check, if unit is inside a building?
This is what I currently use, but it does not always work:

NIC_CheckInside = {
    private _unit = _this select 0;
    private _unitPos1 = getPosWorld _unit vectorAdd [0, 0, 1];
    private _unitPos50 = getPosWorld _unit vectorAdd [0, 0, 50];
    private _objectsUP = lineIntersectsObjs [_unitPos1, _unitPos50];
    private _unitPosDown2 = _unitPos1 vectorAdd [0, 0, -2];
    private _objectsDown = lineIntersectsObjs [_unitPos1, _unitPosDown2];
    if (_objectsUP select 0 == _objectsDown select 0) exitWith {true}; 
    false
};```
In certain buildings, e.g. the industry shed ("Land_i_Shed_Ind_F"), the roof windows will not collide with lineIntersect.
So, if a unit is inside that building, but under a roof window, it will return false, though the unit is inside.
A few other buildings have this problem as well. Any ideas?
little raptor
#

@languid oyster The most reliable LineIntersectsXXX command is lineIntersectsSurfaces. Ditch the rest

#

But some buildings do not have proper LODs, so it may not work for some buildings anyway.

#

but under a roof window, it will return falseBecauselineIntersectsObjsuses the "VIEW" lod. You should use the "GEOM" (or "FIRE") and "VIEW" lods inlineIntersectsSurfaces`

languid oyster
#

Aha, many thanks for the answer. Will test, if I get anything more reliable.

finite sail
#

@languid oyster, i have an existing function for checking

#

wait 1

#

while i dig it out

#

ok, so there's 2 ways to do this

#

lineintersects is one way

#

do you know which building you are checking for or is it any building?

little raptor
#

It's better to check if the AGL height of the unit is positive first

#

Can save you some performance

#

Altho not true in some buildings

#

(e.g. sheds)

finite sail
#

how do I post code here?

little raptor
#

Ctrl+C, Ctrl+V ๐Ÿคฃ

winter rose
#

sqfbin if it is big, ```sqf if not

finite sail
#

you want me to copy it straight in?

winter rose
#

(see pinned message)

finite sail
#

k

#

is my rework of a kzk function

#

returns true if the supplied position is in any house (must be ASL)

#

does a reasonably good job of returning false with balconies that have an overhanging roof section too

#

and another function if you know the building you want to check..

#

this originally from pedeathtrian, modified by me

half spear
#

Hey sorry to bother but I'm having some issues with the sleep function. I'm trying to delay ordnance on an objective. It's triggered when opfor appear in a trigger space.

little raptor
#

@half spear I think you're using sleep in unscheduled environment. You should spawn/execVM the code

winter rose
#
if (isNil "_argument") exitWith { false };
if (
    _argument in [objNull, grpNull, controlNull, displayNull, locationNull, scriptNull, taskNull] || {
        private _typeName = typeName _argument;
        [0, {}, configNull, missionNamespace] findIf { typeName _x == _typeName } != -1 ||
        _argument isEqualTo teamMemberNull || // isNull exception
    }
) exitWith { false };
```@little raptor
should do, I guess?
little raptor
#

I think it's worse than the original now!

#
if (isNil "_argument" || 
{
    _argument in [objNull, grpNull, controlNull, displayNull, locationNull, scriptNull, taskNull, teamMemberNull] || 
    {
        typeName _argument in ["SCALAR","CODE","CONFIG","NAMESPACE"] //alternative approach: _argument isEqualTypeAny [0, {}, configNull, missionNamespace]
    }
}) exitWith { false };
#

now it's fast

copper raven
little raptor
#

I didn't know that existed

#

But anyway, my way is a bit faster (unless you prefer a more "readable" approach)

modest vector
#

Hello I have a problem, I will explain to you,
I would like to detect a player when he disconnects and be able to retrieve the player's values with GetVariable "****",
so I proceed the way with the ```sqf
addMissionEventHandler ["HandleDisconnect", function_blabla];

the function works, I manage to execute HandleDisconnect on the server side but when I want to retrieve the player's variables
#
_player = _this select 0;
_variable = _player getVariable "*****";

well the variable does not exist, and I assure you that the name of the variable is correct, so I would like to know how I can do this?

little raptor
#

If the variable was local to that player's machine, I don't think you can retrieve it anymore (because that client is no longer connected to the server)

modest vector
#

How can I do the trick to store a variable in a player and then be able to fetch it?

half spear
#

Not sure what u mean by use spawn/execVM. Iโ€™m pre new to scripting with arma 3 missions

little raptor
#

do you execute that in the trigger activation code?

#

whatever it was you wanted to do with sleep

#

you didn't even mention what you wanted to do, or what your script was

copper raven
little raptor
#

But don't use it if the variable update rate is too fast

#

otherwise you'll ruin the server performance

winter rose
#
if (isNil "_argument" ||
    {
        _argument in [objNull, grpNull, controlNull, displayNull, locationNull, scriptNull, taskNull, teamMemberNull] ||
        { _argument isEqualTypeAny [0, {}, configNull, missionNamespace] }
    }
) exitWith { false };```will do ๐Ÿ˜‹
gilded rover
#

So questions on fsm files right , how (if possible) can one import the variable name of an object synced to say a module?

little raptor
#

what does it have to do with fsm?
List of objects synced to some other object:

synchronizedObjects _object
#

you can use it inside fsms too (if that's what you meant)

gilded rover
#

yeah thanks , and this creates an array of objects or list? (kinda gonna try modify a preexisting module to get rid of hard coded variables)

little raptor
#

an array

#

there's no such variable type as a "list". So if you see the term list, we typically mean arrays

gilded rover
#

fair enough , thanks alot ๐Ÿ™‚

little raptor
#

modify a preexisting module to get rid of hard coded variables
Not quite sure what you want to get rid of, cuz modules need their "variables"

gilded rover
#

BIS_FD_Competitor , i want to change firing drill module to accept any competitor linked to it , not just the one person called BIS_FD_Competitor
firing drills work in MP , but only one player can be running the drill before you need to restart the mission to allow the next

little raptor
#

To do that you have to modify the module function

gilded rover
#

jup , hence why I asked about fsm

cosmic lichen
winter rose
#

diag_activeScripts ?

languid oyster
#

@finite sail Hey, your routine works quite nice. Thank you ๐Ÿ™‚

finite sail
#

you're welcome, which one did you use?

little raptor
#

@winter rose
isn't this even better?!

if (isNil "_argument" ||
    {
        _argument isEqualTypeAny [0, {}, configNull, missionNamespace] || {
         !(_argument isEqualType "") && {isNull _argument}
       }
       
    }
) exitWith { false };
winter rose
#

๐Ÿฎ PERHAPS

little raptor
#

well, unless I'm missing something (e.g invalid isNull), it is

#

can _argument be an array?

winter rose
#

misses the teamMemberNull exception
and yes, _argument can be anything

little raptor
#

totally forgot that one...again! ๐Ÿ˜‚

deft ivy
#

Hi friends. Can I contact anyone here for help? I would like to make an arena style TDM map (think Quake or UT), but I don't have the mental horsepower for it. And looking for solutions on google don't help. Main problems are - 1) giving players default gear when they spawn and 2) dead bodies don't disappear, so their gear can still be taken. Here is a video of what I have done so far. Mainly weapon pickups that respawn, so that's interesting.

little raptor
languid oyster
#
tky_fnc_inHouse = {
    private _unit = _this select 0;
    diag_log formatText ["%1%2%3%4%5", time, "_unit: ", _unit];
    private _unitPos = getPosWorld _unit;
    lineIntersectsSurfaces [_unitPos, _unitPos vectorAdd [0, 0, 50], objNull, objNull, false, 1, "GEOM", "FIRE"] select 0 params ["","","","_house"];
    if (!(isnil "_house") && _house isKindOf "House")  exitWith {true};
    private _wallScore = 0;
    private _directionsToCheck = [[2,0,1],[0,2,1],[-2,0,1],[0,-2,1],[2,2,1],[-2,2,1],[-2,-2,1],[-2,2,1]];
    {
        lineIntersectsSurfaces [_unitPos, _unitPos vectorAdd _x, objNull, objNull, false, 1, "GEOM", "FIRE"] select 0 params ["","","","_house"];
        if (!(isnil "_house") && _house isKindOf "House")  then {
            _wallScore = _wallScore + 1;
        }
    } foreach _directionsToCheck;
    if (_wallScore > 7) exitWith {true}; // found at least 4 walls nearby
    false
};```
finite sail
#

@languid oyster , yeah, killzonekid did most of the heavy lifting on the script, I just fiddled with it a bit

little raptor
#

it was Tankbuster's

finite sail
#

๐Ÿ™‚

wet shadow
#

Anyone know if there is a scripting command that would list all controls of a display/dialog?

winter rose
buoyant patio
#

So, I'm fairly new to scripting, and I've had idea to make a thing when one ai is shot at another comes running to help in another direction. I thought using firedNear could be useful. If anyone could point me in a direction it would be good.

winter rose
#

this way โ†’
joke aside, you could wait until behaviour of unitA is "danger", then tell unitB to move to unitA's position

worn forge
#

I kind of wish there was an eventHandler that related to unit behaviour, would avoid adding a waitUntil as you propose

winter rose
#

there will be an EH for suppression, but as of now we have nothing alike

#

the firedNear is only valid up to ~69m around the unit, and it could be about someone shooting at the clouds

worn forge
#

Specifically Lou: distance: Number - Distance in meters between the unit and firer (max. distance ~69m) so it's not even about how close the projectile is to the unit, but how close the shooter is to the unit

winter rose
#

yep (I somehow meant that, I swear!)

little raptor
#

I can see that the programmer who implemented that command was a ... man of culture ๐Ÿคฃ

still forum
#

its probably max geometry lod size, which maybe was 70m diam?

worn forge
#

I'm trying and failing to think of a practical use case for that EH.

winter rose
#

scaring birds :p

little raptor
#

"hearing" shots?!

worn forge
#

That was my first thought Leopard20, but then, you'd have to be truly deaf not to hear a shot at 70m

#

Birds included ๐Ÿ™‚

little raptor
#

What about the AI?! Like reacting to a situation or something?

worn forge
#

Something like a behaviourChanged event handler would be way more useful as it would already leverage the AI's ability to perceive / react to danger.

#

I could already see how it could be implemented:

    params ["_unit", "_previousBehaviourState", "_currentBehaviourState", "_unitThatCausedChange"];
}];```
... I guess you could kind of get there with an `animChanged` event handler if you knew they would go into the weapons up animation on a behaviour change.
half spear
#

I tried using the spawn script with sleep to create the ai unit group but it ignores the sleep function and immediately spawns them

#

Nvm I found a fix

fair geyser
#

Hi guys. Is anyone super familiar with DAC. its acting funny and cant find a fix

slim oyster
#

something like a behaviourChanged EH would be a nice replacement for the danger fsm hooking

#

of course, you could make your own CBA eventhandler in a custom dangerFSM and handle it that way

cosmic lichen
#

I have missed that EH so often TBH

#

Might be worth a ticket.

keen orchid
#

Howdy lads, could someone help me with this script?
this addAction ["Collect Food", {food = food+1; deleteVehicle _this;}];

#

it's supposed to delete the object it's on when it finishes but i keep getting an error saying "_this is an undefined variable"

robust hollow
#

undefined variable doesnt sound like the right error ๐Ÿค” try deleteVehicle(_this#0)

#
target (_this select 0): Object - the object which the action is assigned to
caller (_this select 1): Object - the unit that activated the action
actionId (_this select 2): Number - activated action's ID (same as addAction's return value)
arguments (_this select 3): Anything - arguments given to the script if you are using the extended syntax

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

keen orchid
#

thank you, that worked

dim terrace
#

as for firedNear - this EH is really handy for grenade detection and I think it was primary use of that EH in past

#

it is used also on Contact alien entity

#

as for dangerFSM - it would be super cool to be able to stack it or have it attached per vehicle, instead per AI. This way you could do special procedures for more sophisticated vehicles (i.e. shtora)

topaz field
#

Hi there I'm trying to use an addAction to change a tasks state. I'm doing this by assigning each addAction a public variable with a number. Then in a trigger im trying to add them together and use an if statement to pass the task.

#

this addAction ["Pick up First Aid Kit", "PublicVariable2 = 1;"] This is what the indivudal addActions look like

#

if (PublicVariable + PublicVariable2 = 2) then [fak setTaskState "Succeeded"];

#

This is what the code looks like in the trigger to try and pass the task

jade abyss
#

var = something <- "var" will be defined
var == something <- "var" will be checked against "something"

#

@topaz field

languid oyster
#

Is there any way to force an AI unit to a certain spot inside a building, which is NOT a predefined building position?

little raptor
#

setPosXXX ๐Ÿคฃ

#

CBA has something called "Building position" or something. I've never used it, but you can take a look at it.
The reason the AI can't move freely inside a building is that the building path LODs is just a bunch of lines, not polygons
So their movement is always fixed along those paths

languid oyster
#

Meh ๐Ÿ™‚ I know, but I like to have a more immersive way ๐Ÿ™‚

#

aha, cool

little raptor
#

CBA's "Building position"
Doesn't give them a path. They still cannot move in the "immersive" way you want

languid oyster
#

Challange for the cracks: Make a mod, where AI naturally runs into building, gets on balcony, then climbs on roof ๐Ÿ˜†

little raptor
#

That's what I'm working on rn

languid oyster
#

๐Ÿ˜ฎ me too

little raptor
#

I mean a full AI replacement mod, with significantly better path finding

languid oyster
#

oh, then not ๐Ÿ™‚ I'm happy if I manage to know, if an AI is inside a building or not ๐Ÿ˜†

#

Trying to do a mod for a medic, who is able to get to incapacitated players on rooftops

little raptor
#

get to incapacitated players on rooftops
using ropes and ladders?!

languid oyster
#

Oh god, no. Wanted to use Enhanced Movement Rework routines for that. No salvation on skyscraper rooftops

#

Somehow, he cheats the AI to move through buildings

young current
#

Ai is tied to the building paths when moving on/inside objects. I highly doubt that it can be changed.

#

Ah his system uses forced animations to move. Which like he says can be unreliable.

little raptor
#

@languid oyster

he cheats the AI to move
so do I. But it requires you to generate paths inside the building. If you want to go down that road, it is definitely possible. But could be difficult if you're not familiar with that stuff

languid oyster
#

@little raptor I AM not familiar with that stuff. As far as I understand, the things he does are scripted. Meaning they work for one building at a certain place. Where as I would like to have things dynamic. Will see, if I can do it or not.

little raptor
#

I'm not talking about what JBOY does. In general, you'd have to generate a navigation mesh for the building and then generate a path using the nav mesh.
That's the "fastest" way you can generate a dynamic path for a building

topaz field
#

is setTaskState Obsolete?

winter rose
#

yes

#

you should be using the task framework functions @topaz field

young current
#

@little raptor so you are building a navmesh and new movement system to work with that?

languid oyster
#

@little raptor Building a nav mesh? Me? Guess I'll dump the idea.

winter rose
#

will be fixed in the next patch, use remoteExec setObjectTexture for now

#

(or hideObjectGlobal)

#

maybe ยฏ_(ใƒ„)_/ยฏ

#

hideObjectGlobal backpackContainer player

winter rose
#

any error?

#

if it doesn't work, use this

[backpackContainer player, [0, ""]] remoteExec ["setObjectTexture", 0, true];
#

oh and indeed, hideObjectGlobal is server-side only.

#
[backpackContainer player, true] remoteExec ["hideObjectGlobal", 2];
``` may be better JIP-wise, but don't forget to unhide it if you apply another texture
#

w/p

winter rose
#

then setObjectTexture it is

#

2.02, no ETA

unique fox
#

Is it possible to define custom formations in Arma 3?

I would like a squad to have a unit close to another, while the rest of the squad is more spaced out

#

Or am I limited to only the vanilla formations?

cosmic lichen
#

configFile >> "cfgFormations"

#

Only through a mod though =/

#

And I dunno if custom formations work. I've yet to see a mod which uses custom ones.

unique fox
#

I see, thanks for the help!

little raptor
young current
#

Quite cool. Will it work in MP too?

worn vale
#

Would adding this to the script solve the issue?
disableUserInput !userInputDisabled;

#

Nvm I found out that indeed nope that does not help xD

little raptor
#

@young current
Yeah

worn vale
#

It'd be pretty disappointing if there's no way to allow players to move when the borders appear, but c'est la vie

little raptor
#

I was replying to HorribleGoat! :)
@worn vale If you want to use cinematic borders and have user input, you can use cutRsc

worn vale
#

Can you give me an example of how to use it or a link? ๐Ÿ˜ฎ

little raptor
#

You'll have to define a new Rsc Title in the config first

worn vale
#

Ok. I'm not very experienced with scripting in Arma 3 but I do want to figure this out. I am trying to do this for a multiplayer mission, does that complicate things?

little raptor
#

For what you want, something like this will do:

class RscText
{
  access = 0;
  type = 0;
  idc = -1;
  style = 0;
  w = 0.1; h = 0.05;
  //x and y are not part of a global class since each rsctext will be positioned 'somewhere'
  font = "TahomaB";
  sizeEx = 0.04;
  colorBackground[] = {0,0,0,0};
  colorText[] = {1,1,1,1};
  text = "";
  fixedWidth = 0;
  shadow = 0;
};
class RscTitles
{
    class MY_cinematicBorders
    {
        idd = -1; 
        duration = 1e6; //1e6 seconds
        fadeIn = 1; //1 second to fade in
        fadeOut = 1; //1 second to fade out
        onLoad = "uiNamespace setVariable ['MY_cinematicBorders', _this select 0]"; 
        onUnLoad = ""; 
        class Controls
        {
            class Top: RscText
            {
                idc = 1200; 
                colorText[]={0,0,0,0};
                text="";
                colorBackground[]={0,0,0,1};
                x = safezoneX;
                y = safezoneY;
                w = safezoneW;
                h = 0.15*safezoneH;
            };
            class Bottom: Top
            {
                idc = 1201; 
                y = safezoneY+0.85*safezoneH;
            };
        };
    };
};
#

I am trying to do this for a multiplayer mission, does that complicate things?
You'll have to remoteExec that for every player in MP

worn vale
#

oooo boy ok. And yeah that sounds like it should be no problem then to have it work in MP

little raptor
#

Yeah, it will work fine in MP too

#

If you're planning to make a mission and not a mod, note that RscText (for the part: class RscText;) is not defined. You'll have to define it manually

worn vale
#

I have some more information on what exactly I'm trying to do in #arma3_editor

#

But yes, just a one-off multiplayer mission for me and some friends

little raptor
#

For fade in and fade out time, put them into the above config (in seconds). You can also adjust the duration (again, in seconds)

#

@worn vale updated the above config entry.
You'll have to put it in description.ext

#

To show the border:

"MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN"]
#

It needs to be remoteExeced in multiplayer

#
["MY_cinematicBorders", ["MY_cinematicBorders", "PLAIN", 1]] remoteExec ["cutRsc", 0]

something like that

hollow thistle
#

Depends when he wants that to appear, if it's at mission start he can also use some init scripts.

little raptor
#

Yup, that's even better!

worn vale
#

Ok so, I've got the description.ext file in my mission's root folder with the config you posted above

#

What I'm aiming for is for the borders to appear on one trigger, and then fade out on another... or am I getting too complicated?

little raptor
#

To fade it out, use cutFadeOut

#

e.g.:

"MY_cinematicBorders" cutFadeOut 1;
worn vale
#

So I would place that into my trigger volume?

little raptor
#

volume? You put it in the trigger activation/deactivation statements

worn vale
#

More or less what I meant haha, lol

#

But okay cool. Sorry if I seem like a big confused noob. It's because I am

little raptor
#

It's alright. Anyway, for MP, don't forget you'd need to remoteExec these cutRsc and cutFadeOut commands, because they have local effect

worn vale
#

For sure

#

One sec as I try to put it together..

hollow thistle
#

You need RE only if using server only trigger

#

otherwise you have local triggers on every machine.

little raptor
#

Yeah, if you placed the trigger using Eden editor without checking "Server only", the trigger runs on each machine separately, so no need for remoteExec

worn vale
#

OK so... ultimately if I'm using triggers and I have all that info in the config above in description.ext would it go like

trigger 1, borders fade in
"MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN"]

trigger 2, borders fade out
"MY_cinematicBorders" cutFadeOut 1;

#

am i getting this right or?

little raptor
#

yes. You can also define the fade in time using:

"MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN", 1]
worn vale
#

excellent, I'll give it a test!

buoyant patio
#

Kind of a dumb dumb question, but how would I make an Ai friendly until attacked? Been bashing my head against it.

winter rose
#

use setBehaviour "careless", and add a hit event handler mayhaps

little raptor
#

You mean once attacked, it becomes enemy to you?

buoyant patio
#

Yes

#

Like, its friendly until shot

little raptor
#

if so, just use a handleDamage event handler, once taken fire, create a new group on the enemy side and move the unit to the new group (although everyone will attack the poor AI!)

#

or maybe just use: _unit addRating -1e4

worn vale
#

The borders didn't seem to come in when I tested the triggers

little raptor
#

did you use the updated RscTitles?

#

look at it again, make sure they match

worn vale
#

Ah it seems I didn't have the updated one, sorry

#

Still seems to not be working.

little raptor
#

where did you put the codes? also are you testing in SP or MP?

worn vale
#

Testing on MP

little raptor
#

Are your triggers set to "server only"?

worn vale
#

So I have this in description.ext

{
  access = 0;
  type = 0;
  idc = -1;
  style = 0;
  w = 0.1; h = 0.05;
  //x and y are not part of a global class since each rsctext will be positioned 'somewhere'
  font = "TahomaB";
  sizeEx = 0.04;
  colorBackground[] = {0,0,0,0};
  colorText[] = {1,1,1,1};
  text = "";
  fixedWidth = 0;
  shadow = 0;
};
class RscTitles
{
    class MY_cinematicBorders
    {
        idd = -1; 
        duration = 1e6; //1e6 seconds
        fadeIn = 1; //1 second to fade in
        fadeOut = 1; //1 second to fade out
        onLoad = "uiNamespace setVariable ['MY_cinematicBorders', _this select 0]"; 
        onUnLoad = ""; 
        class Controls
        {
            class Top: RscText
            {
                idc = 1200; 
                colorText[]={0,0,0,0};
                text="";
                colorBackground[]={0,0,0,1};
                x = safezoneW;
                y = safezoneY;
                w = safezoneW;
                h = 0.15*safezoneH;
            };
            class Bottom: Top
            {
                idc = 1201; 
                y = safezoneY+0.85*safezoneH;
            };
        };
    };
};```
This in the fade in trigger
```"MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN", 1];```
And this in the fade out trigger
```"MY_cinematicBorders" cutFadeOut 1;```
#

None of the triggers are set to server only.

little raptor
#

Then try remote execing the command like I mentioned

worn vale
#

OK

#

Like this?
remoteExec "MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN", 1];
remoteExec "MY_cinematicBorders" cutFadeOut 1;

little raptor
#

no

worn vale
#

Ok, apologies. I'm not sure where to put it

little raptor
#

Left hand side are the arguments, right hand side the command and targets

#
["MY_cinematicBorders", 1] remoteExec ["cutFadeOut", 0];
#

The other one

worn vale
#

Okay, thank you so much for your help btw. I don't normally do this kind of scripting stuff but I wanted to try something cool XD But I feel so lost when I try to learn this kind of stuff lmao

little raptor
#

check out the pinned messages. you can find some tutorials and stuff

worn vale
#

Still no dice on that cinematic border ๐Ÿฅบ

little raptor
#

do you get any errors?

#

maybe check out the rpt?

#

also, I recommend that you test the thing in singleplayer before jumping to MP

worn vale
#

No errors

#

I normally make all of my missions in multiplayer since that's the kinds of missions I make

#

But i will try it in SP now

#

Or that's not really possible is it? Hrmm

little raptor
#

you're missing a }

worn vale
#

ope

little raptor
#

in the config

worn vale
#

Dang where?

little raptor
#

last line

worn vale
#

Ah it didnt paste properly when I posted it to discord

#

It's there tho

little raptor
#

ok

#

ill check

#

it was a typo, my bad

worn vale
#

It's ok. what needs to be fixed?

little raptor
#

check out the updated rscTitles.

#

it works for me

#

you probably don't need the remoteExec stuff anymore

worn vale
#

Yep that test mission works like a charm

little raptor
#

ok, so just replace your description.ext with mine

worn vale
#

yooo it's working

little raptor
#

good to know! :)
I think I broke the fade in effect. You can fix that yourself (fadeIn = 1)

worn vale
#

Yep no worries lol I got it

little raptor
#

Is there any way to check if an extension (.dll) exists? (in sqf)

still forum
#

try to call it

winter rose
still forum
#

use the other one with error code

little raptor
#

It returns 0 for error code:

"noExt" callExtension ["fnc1", []];
#

Shouldn't it return some other error code? According to the wiki, 0 means no errors

winter rose
#

Thanks for raising and fixing the issue Ded', much appreciated ๐Ÿ‘

sonic thicket
#

Hello everyone, I have been trying to bind the arma3 default tracks to a radio. However playmusic does not come with a _object parameter and all other methods dont recognize the classes from songs ( Class source: https://community.bistudio.com/wiki/Arma_3_CfgMusic )

#

The only other method I know of is mapping all the music source files and using something like say3d but that'll take longer then i'd hope for

winter rose
#

that's ^ the solution.

sonic thicket
#

Ah bummer, that's gonna take a while. Its weird that these functions do not recognize the default class names though

winter rose
#

a "music" is an in-game music, a sound is a possibly 3D sound

#

historical reasons

sonic thicket
#

Hmm, putting it that way it does actually makes sense. Sometimes i forget arma is old and therefor sometimes can be references to as a house of cards ๐Ÿ˜›

still forum
#

Thanks for raising and fixing the issue Ded', much appreciated ๐Ÿ‘
@winter rose wat

#

Shouldn't it return some other error code? According to the wiki, 0 means no errors
@little raptor I thought there were like 101 102 and such errors

quartz coyote
#

Hello !
I have spinning weapons.
But since I am very very bad in maths I cannot understand how to have the weapon spin in the correct position.
Currently the weapon is spinning layed on it's side. I'd like it to be spinning up-right like when you hold it in your hands.
I understand I might need setVectorDir, setVectorUp or setVectorDirAndUp
But I do not understand the geometry/maths behind the commands so I don't know which one to use and how

while {/*condition*/} do
{
    _X1 = (_X1 + 0.1) % 360;
    if (/*condition*/) then
    {
        w1Launcher setDir _X1;
    };
    sleep 0.01;
};```
little raptor
#

@quartz coyote How can it be on its side?

#

When I spawn a weapon it's upright

quartz coyote
#

Because the weapon "object" was probably designed on it's flank

#

If you place a weapon object in the editor it's always lighing on it's side

little raptor
#

Because it gets placed inside a weaponHolderSimulated

quartz coyote
#

If you say so ๐Ÿ™‚ that doesn't help me with my issue ๐Ÿ˜„

little raptor
#

Well, it kind of depends how the weapon looks when it's on its side.
First, you'll have to make it upright
Then rotate it
All you have to do is just rotate the [0,1,0] vector (which points towards the front of the model)

_vec = [sin 10,cos 10,0];//rotate 10 degrees
_object setVectorDirAndUp [_object vectorModelToWorld _vec, _object vectorModelToWorld [0,0,1]]
#

e.g. spinning an object:

obj = createSimpleObject [getText(configFile >> "cfgWeapons" >> primaryWeapon player >> "model"), eyepos player];
obj setVectorUp [0,0,1];
onEachFrame {
obj setVectorDirAndUp [obj vectorModelToWorld [sin 1,cos 1,0], obj vectorModelToWorld [0,0,1]]
}
#

if you posted a screenshot of how your object looks, I could help better

quartz coyote
#

Oohhhh that helps a lot ! Thanks !

dark ocean
#

hey, I need to remove the brackets that appear in each string that is created

my result >
2020/11/11, 2:44:11 "Time to complete: 0 (in seconds)"
2020/11/11, 2:44:11 "Result: [[""truckDel5_1""],[""truckDel1_1""],[""truckDel2_2""]]"

need
2020/11/11, 2:44:11 "Time to complete: 0 (in seconds)"
2020/11/11, 2:44:11 "Result: [""truckDel5_1"",""truckDel1_1"",""truckDel2_2""]"

little raptor
#

Join the arrays together before making the string

dark ocean
#

but how do I do that, I get the data from here

_query = "SELECT name FROM business WHERE owned='1' AND needitems='1'";
_queryResult = [_query, 2, true] call DB_fnc_asyncCall;

robust hollow
#

assuming queryResult is the array, _queryResult = _queryResult apply {_x#0}

potent depot
#

Anyone know if there is a good way to get the default inventory of a crate from the class name or is it easier to spawn the crate in some dummy location and get the inventory via the normal commands?

warm hedge
#

I'd say it's easy to do that via create a dummy one, but it always possible to fetch from config

potent depot
#

Yeah the problem is the format

#

Debug corner coords are 0,0,0 I think right? Never really needed to use debug corner before tbh

warm hedge
#

Debug corner? That doesn't exist... 0,0,0 is just the bottom left corner

#

Well, let me try to fetch from the config

#
_class = "B_SupplyCrate_F" ;
_class = configFile >> "CfgVehicles" >> _class ;
_return = [] ;
{
    _x params ["_transportClass","_name"] ;
    _returnTemp = [] ;
    ("true" configClasses (_class >> _transportClass)) apply {
        for "_i" from 1 to getNumber (_x >> "count") do {
            _returnTemp pushBack getText (_x >> _name) ;
        } ;
    } ;
    _return pushBack _returnTemp ;
} forEach [
    ["TransportMagazines","magazine"],
    ["TransportWeapons","weapon"],
    ["TransportItems","name"],
    ["TransportBackpacks","backpack"]
] ;
copyToClipboard str _return ;```Quick mockup
#
    ["30Rnd_65x39_caseless_mag",(...),"30Rnd_65x39_caseless_mag","30Rnd_65x39_caseless_mag","30Rnd_65x39_caseless_mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","3Rnd_HE_Grenade_shell","1Rnd_Smoke_Grenade_shell","1Rnd_Smoke_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","chemlight_green","chemlight_green","chemlight_green","chemlight_green","chemlight_green","chemlight_green","NLAW_F","NLAW_F","NLAW_F","Laserbatteries","Laserbatteries","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade","MiniGrenade","MiniGrenade","MiniGrenade","MiniGrenade","MiniGrenade","MiniGrenade","SmokeShell","SmokeShell","SmokeShellGreen","SmokeShellGreen","UGL_FlareWhite_F","UGL_FlareWhite_F","UGL_FlareGreen_F","UGL_FlareGreen_F"],
    ["launch_NLAW_F","arifle_MX_F","arifle_MX_F","arifle_MX_SW_F"],
    ["FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","Laserdesignator","acc_flashlight","acc_flashlight","bipod_01_F_blk"],
    ["B_Kitbag_mcamo","B_Kitbag_mcamo"]
]```Returns this
potent depot
#

Ok, interesting. Iโ€™ll see if I can adapt that to the ACE crates and such as the transport classes arenโ€™t written as string arrays for them.

bronze jetty
#

Hello, is there any command to select a grenade in the inventory?
Suppose I want to use a script to change the current grenade (as when pressing CTRL + G).

willow hound
languid oyster
#

Is there a way to change the projectile despawning distance of 7000m?

winter rose
#

maybe setFeatureType, can't guarantee it

young current
#

what kind of a projectile?

#

like a shot from a weapon?

winter rose
#

when does it occur?

exotic flax
#

sounds like a timing issue; trying to get the player object before it exists

winter rose
#

a JIP thingy yup

winter rose
#

waitUntil not isNull player, it should do

#

player isEqualTo player โ€ฆ wat

#

(also, your code brackets {} are incorrectly placed)

little raptor
#

It can be placed like that. But it's not efficient

winter rose
#

and it's not doing what he wants

little raptor
#

The { } are redundant (except for the first one)

waitUntil {!isNull player && {!isNull (findDisplay 46) && time > 0}};
winter rose
#

nope, the code is "valid" and won't throw an error.
do you have -showScriptErrors enabled?

willow hound
#

Got different code in mind that could error? You mentioned teleporting and accessing the name.

#

Where?

winter rose
#

when executed in the same frame the unit was created

little raptor
#

the problem is isPlayer returns false.
We could work around that using "player in allPlayers" but.. Im not sure about the performance of that.

winter rose
#

but yeah, looks like an Arma bug

#

replace isPlayer by unit in allPlayers and it should be fine

willow hound
#

For teleportation?

winter rose
#

no, for setPos* it should work whatever the isPlayer status

wispy cave
#

What's the best way to get all players in a given radius assuming that most of the time there will be no players but there will be plenty of AI? But when players are near it's safe to assume that >75% of the players on server will be near

little raptor
#
allPlayers select {_x distance _pos < _radius}
wispy cave
#

a trigger isn't better?

little raptor
#

hardly is

wispy cave
#

i'll be doing it every 5 seconds though

little raptor
#

altho it depends on what you want.
5 seconds is like infinity in programming. plus it's scheduled so...

wispy cave
#

CBRN mission, if they don't have certain facewear and certain backpacks they'll get damaged

winter rose
#

if i teleport him its his bot that come not the actual player.
it doesn't make any senseโ€ฆ? the player's camera remains on spot? what is the issue

willow hound
little raptor
#

distance is faster than area

willow hound
#

On all machines?

little raptor
#

in other words add more conditions to the waitUntil

#

It most likely is a network issue, yes.
maybe adding one more condition can fix it?

waitUntil {!isNull player && {!isNull (findDisplay 46) && time > 0 && !isNull group player && isPlayer player}};

or some delay?

willow hound
#

Bugs hide everywhere.
Are you using AI stand-ins until a player takes the slot?

proper sail
#

some epic jip code like

  if (player != player) then
  {          
      waitUntil {!(player != player)};
  };```
winter rose
#

heard of isNull? ^^"

willow hound
#

The condition can never be met.

little raptor
#

it can, but it's rediculous

winter rose
#

!(player != player) โ†’ == too ๐Ÿ˜…

proper sail
#

probably changed in a3 then the code i posted is default a2 jip framework

#

this problem just reminded me of that

willow hound
#

As far as I understand it the issue is Arma 3 MP being A3 MP: Sometimes things break.

#

Player slots filled with AI until a player takes the slot and joins.

little raptor
#

I don't know, maybe?!

willow hound
hollow thistle
#

distance is faster than area
inAreaArray

little raptor
#

that's not scheduled. Could end up being worse (depends on the number of players)

hollow thistle
#

It will be always faster, it can be more noticeable on frames tho.

little raptor
#

Yeah. That's what I meant by worse

still forum
#

where what comes from

little raptor
#

what causes the issue

still forum
#

some error in code caused the issue

#

it checked one of two things, and errored if first failed. Even though you can still get name even if first fails

worn forge
#

Dedmen I don't know if you have any pull with the powers that be but it would sure be nice to have some control over what gets spat out into the .rpt file...

astral dawn
#

-nologs gives you some control I think?

#

or -nolog, I forgot

worn forge
#

The great majority of things in the .rpt file are potentially significant to Bohemia but have no relevance to the average scripter

oblique arrow
#

its with the s iirc @astral dawn

astral dawn
#

you can install some extension for writing data into log files and make your own log files with blackjack and ...

#

I can recommend a few

worn forge
#

All I'm asking for is a toggle that lets me log script errors but suppress system notes. For example I'll get thousands of lines related to server: object not found which is of no use to me, and probably no use to Bohemia, either

still forum
#

@worn forge I'm already doing that?

#

the new -debug parameter

astral dawn
#

oh that's cool

still forum
#

"object not found" you can disable these in server config

astral dawn
#

and probably no use to Bohemia, either
well it outlines some desynchronization error generally

worn forge
#

Fantastic!

#

Wait are you saying I can already disable these in server config, or that this will be the impending change?

still forum
worn forge
#

So I'm not sure if you're asking me to scroll back through that entire channel, but can I surmise that you're talking about a change that's current in dev branch that will eventually come to the regular branch?

still forum
#

all changelogs are in pinned messages

#

yeah

worn forge
#

That's awesome. Thanks for reading my mind in terms of what I was wishing for!

still forum
#

it will be long road of moving some logs to debug mode, adding more log info and stuff

worn forge
#

No doubt but I truly appreciate the intention

quartz coyote
#

@little raptor
For my spinning weapons, the solution to have it up-right correctly was this (based on what you provided).
But now that I've changed the vector, the sin 1, cos 1 is rotating the object by 90ยฐ instead of 1ยฐ...

w1Launcher setVectorUp [0,1,0];
onEachFrame {
w1Launcher setVectorDirAndUp [w1Launcher vectorModelToWorld [sin 1,cos 1,0], w1Launcher vectorModelToWorld [0,1,0]];
};```
little raptor
#

It's because now the vectors have changed.

#

You have to adapt the code

quartz coyote
#

do you mean change sin 1,cos 1 for it to affect another vector (the one I changed it to) ?

little raptor
#
w1Launcher setVectorUp [0,1,0];
onEachFrame {
_dir = [vectorDirVisual w1Launcher, 1] call BIS_fnc_rotateVector2D;
w1Launcher setVectorDirAndUp [_dir, [0,1,0]];
};
#

maybe try this?

#

like I said it depends on the orientation of the object. your object is not "standard"

#

It may not work correctly if your object is being influenced by the game (e.g. gravity)

quartz coyote
#

it's not, I disabled simulation

little raptor
#

if so, you can make that even simpler:

w1Launcher setVectorUp [0,1,0];
onEachFrame {
_dir = [vectorDirVisual w1Launcher, 1] call BIS_fnc_rotateVector2D;
w1Launcher setVectorDir _dir;
};
quartz coyote
#

Neither are making the weapon move

#

sending you picture through DM

little raptor
#

lol yeah I just realized that the dir is now [0,0,1]! ๐Ÿ˜…

#

so you cant rotate it with the bis fnc

timid niche
#

Is it possible to change the vehicle class/vehicle without creating a new vehicle.
So basically replace it.

finite sail
#

no

timid niche
#

didnt think so

finite sail
#

you can customise the existing vehicle

#

add / remove RPG cages on vec that have them

little raptor
#

@quartz coyote
since we now know that your up vec should be [0,1,0], this should be safe to use:

onEachFrame {
w1Launcher setVectorDirAndUp [w1Launcher vectorModelToWorld [sin 1,0,cos 1], w1Launcher vectorModelToWorld [0,1,0]];
};

(not tested)

finite sail
#

but underneath, it's still the same vehicle

quartz coyote
#

@little raptor figured it would be something like that so I already tried it but it ends up glitching like hell. So that doesn't work

#

Also tried [sin 1,0,tan 1] in my great ignorence ๐Ÿ˜„

little raptor
#

why?????

quartz coyote
#

Why what ?

little raptor
#

the tan

quartz coyote
#

told you, in great ignorance lol

#

I don't understand the maths so I'm just "testing & breaking"

outer fjord
#

Anybody have a good example of a 'world generator' script that basically sets the settings but then saves those for persistence?

#

I have all my markers set up, but would like them to only randomly move once then just stay that way, even after restart.

worn forge
#

you need to leverage profileNameSpace

#

ie create a variable, then you can do:

saveProfileNamespace;```
#

Then later on mission restart you can do:
missionNamespace setVariable ["myVariable", profileNamespace getVariable "myVariable"];

shadow sapphire
#

Is there such a thing as PlayerConnected.sqf or similar in the mission folder?

I THINK I remember having an onPlayerConnected.sqf file in a previous mission, but I'm not seeing that online at the moment.

My initPlayerLocal isn't working for join in progress.

Should I just respawn on mission start and fire my script onPlayerRespawn?

worn forge
#

I think you need to examine more about why your initPlayerLocal isn't working for join in progress, because there's no reason it shouldn't.

exotic flax
tough abyss
#

Heya everyone.

I have a static, empty, object. A pile of dirt (Dirthump_3_F).

For my mission I am pretending it's a pile of explosives that needs to be set off with a bullet.
My ideas was to use the "Hit" EventHandler to trigger an explosive script.

However, I find that the target needs to take damage for EH to fire. So I'm considering covering the dirt pile with some kind of invisible object. Does anyone have any ideas?

Or should I be scripting this another way? I mean, is there a bullet object detection of any kind?

finite sail
#

, you need another object to sense the bullet hit, with a handledamage EH @tough abyss

#

i usually use traffic cone, which you can hideobject

#

so that it's not seen

#

alternatve

#

is nearestObject [(position of dirtpile), "#crateronvehicle"];

#

but you'll need to run that in a loop

#

another alternaive I've just thought of.. might not work as its untested

#

create a satchcharge at the position of the dirpile and hideobjectglobal it

#

not sure if it will exploded if shot, i suspect it will, but have never done it

#

wait 1 while i test <<< cant make that work

candid cape
#

Hello, what is the code for the left mouse click???.

The one with the mouse I know is this (MouseButtonDown), but that one takes all the mouse buttons. Please do not send me the typical KeyCodes link

shadow sapphire
#

@worn forge, interesting. Yeah, it works in singleplayer just fine. No idea why it's not working for multiplayer.

worn forge
#

@shadow sapphire post your code or pastebin it, sounds like there's a locality issue but it's impossible to know without seeing it.

dark ocean
#

how to disable engine auto start i added this evh and it doesn't work

#
private ["_veh"];
_veh = _this;
_veh addEventHandler ["Engine", {
    private ["_var"];
    _var = (_this select 0) getVariable "engineState";
    if ((isNil "_var") && (local(_this select 0))) then {
        (vehicle player) engineOn false;
    };
}];
sacred slate
#

hello. i once had this working: execVM "C:\Program Files (x86)\Steam\SteamApps\common\Arma 3_folder\file.sqf";
but it was execVM _folder\file.sqf; after 2.0 patch it's not working anymore

dark ocean
#
_veh call slrpg_fnc_initVehiclesEVH;
#

on spawnvehicle

sacred slate
#

i also tried it with leading backslash

little raptor
#

but it was execVM _folder\file.sqf
what?
after 2.0 patch it's not working anymore
did you try filepatching and running arma as admin?
I wouldn't be surprised if it didn't work. It poses security issues and it's actually a good thing that it doesn't work anymore (if that's really the case here)

#

@dark ocean Does your event handler work at all? Did you try putting a hint or systemchat in it to see if it works?

#

@finite sail Hidden objects wont take damge

candid cape
#

Hello, what is the code for the left mouse click???.

The one with the mouse I know is this (MouseButtonDown), but that one takes all the mouse buttons. Please do not send me the typical KeyCodes link

little raptor
#

takes all the mouse buttons
what? the second argument is always the mouse button keycode

#

And it's 0

#

_button == 0 is left click

idle jungle
#

FAO RHS...
because _value is a number
and you can't compare a number to a string

                           expression="if(_value != 'NoChange')then{ _this setVariable ['rhs_decalNumber_type2', _value];[_this,[['Number', cBTR2NumberPlaces, _value]]] call rhs_fnc_decalsInit}";
                           class Value
                           {
                               class data
                               {
                                   class type
                                   {
                                       type[]=
                                       {
                                           "STRING"
                                       };
                                   };
                                   value="NoChange";
                               };
                           };
                       };```
exotic flax
#

what?

idle jungle
#

it throws an error when trying to spawn in compositions from a script. because the vehicles have rhs specific attributes in the editor

#

but tries to compare a value to a string of text

#

So if (0 != 'NoChange' could be changed to like if ('PoopyPants ' != 'NoChange' then it works lol

exotic flax
#

well, you'll have a bigger chance if you report this in the RHS feedback tracker, because this is for scripting help, not bug reports for random mods ๐Ÿคทโ€โ™‚๏ธ

#

although looking at that config, the value should be a string, with the default of NoChange, so technically still correct.

idle jungle
#

oh crap wrong place im so sorry! wrong channellll

sly glacier
#

howdy fellas I need some help with the "UnitCapture/Play" command
I was testing on UnitCapture/Play commands in the editor today, I followed the instructions exactly as this video said for a helicopter (https://youtu.be/bjNuMUHdZL8) and when I activated the Radio Bravo trigger to playback my flight path the aircraft does nothing! No error messages, nothing at all. I tried looking up possible reasons but they all lead to stuff I think don't pertain to my predicament. I'm simply just testing out the the feature (I literally found out about this yesterday, had no idea it was in Arma 2 either.)

exotic flax
#

did you follow the YT steps exactly the same?
because I tried it and worked as in the video

sly glacier
#

Lemme try it one more time, I tried it in Arma 2 and it worked perfectly :/

#

one thing I wanna know is how can I capture input for interacting with a vehicle as well, for example, I wanna capture a cargo helicopter opening its doors so I can load a vehicle into it

#

Ok I think I named the pilot "heli1" not the air craft itself, maybe that has something to do with it?

sly glacier
#

yep that did it lol I just named the wrong thing the variable name

past tiger
#

With allowDamage set to false the HandleDamage EH don't trigger?

torn juniper
#

Does anyone know a way to refresh the inventory? When using setUnitLoadout and the inventory is open your vest and bag vanish and reappear when the inventory is modified (add/remove item or close/open inventory again) - does anyone know of a way to do this via script? player action ["Gear",""]; does not seem to work

#

right now I add and remove a dummy item which does the trick.. but wondering if anyone else knew offhand a better method

compact maple
#

I think you can just close the dialog and reopen it immediatly ?

winter rose
#

@past tiger correct

finite sail
#

@finite sail Hidden objects wont take damge
@little raptor I just damaged a hidden traffic cone with an explosive charge

cosmic lichen
#

You can damage hidden objects. If you destory them they even get replaced by their ruin model if they have one.

#
default
{
    {_x hideObjectGlobal true;_x allowDamage false;};

That's why the edit terrain module also disables dmg for example.

finite sail
#

oo, didnt know that, @cosmic lichen . I have a big hideobjectglobal of the trees in the middle of Feres AB (who has air airbase with a forest in the middle of it?). I will allowdamage false those tree objects too to stop them doing their fallover animation

#

I use this a lot for sensing explosions on objects that don't take damage

#

It's true to say that hiddenobjects don't take bullet hit damage, though

little raptor
#

Hmm interesting, I never damaged them with explosives!

finite sail
#

explosive or missile fire can damage them to be more accurate

little raptor
#

They're both explosives! ๐Ÿคท

#

in other words, any ammo with an "indirectHit" larger than 0

finite sail
#

yes that ^^^

#

here a roadbridge is destroyed because hidden object roadcones take damage from the titan round

little raptor
#

Ooh that was sexy! ๐Ÿ˜‹
I would play that mission! ๐Ÿ™‚

finite sail
#

its a secondary mission, part of

#

i always meant to add objects falling into the water as the bridge section is hidden , a sort of falling rubble visual

#

but it never got done ๐Ÿ™‚

winter rose
finite sail
#

oh wow

little raptor
#

Is it compatible with AI? I wanted to play alone!

finite sail
#

its a coop mission really, best experienced on a dedi server,but its possible to play alone. this mission scales itself back a little for solo players

#

ill be playing it on friday evening with my mate if you want to tag along

#

bring beer

#

friday evening UK time, btw,

#

@winter rose thank you! I didnt know about that

#

will have a look

winter rose
#

can't wait to see the result!

tough abyss
#

@finite sail Thank you for these ideas! Yes, a traffic cone would be a good hidden object. But the dirtpile is really very large (I am making a target that players can easily shoot from 2 km away).. What's the biggest (flattest?) object that detects hits?

finite sail
#

Oh...damn you shadowplay and nvidia
When you go back into the game and press a few heys and shadowplay says "Video has been saved" and you check the shadowplay dir... there's a 4GB file there.. dont remember starting the recording

tough abyss
#

Whoops I'm interrupting another conversation ๐Ÿ˜… . I'll wait

finite sail
#

no its fine mate

#

just me waffling on

#

ok, so the sensor object idea won't work

#

using hiddenobjects in that way only works for explosions, not for bullet hits

tough abyss
#
default
{
    {_x hideObjectGlobal true;_x allowDamage false;};

That's why the edit terrain module also disables dmg for example.
^I just read this above... but it doesn't apply to bullet hits?

finite sail
#

thats correct

#

only works with explosions

#

look at example 5 and use "#crateronvehicle"

#

you might be able to get the bullet hit that way

little raptor
#

@tough abyss If you're familiar with object builder, it's very easy to create an invisible block that can be damaged

finite sail
#

will require an addon though

little raptor
#

true

#

or maybe it doesn't

#

because you can create a simple object

#

Not sure if they can take damage

warm hedge
#

Simple Objects are simple enough not to take any damages

tough abyss
#

Am trying the crater idea. Brb.

little raptor
#

Do all bullet impacts use the "#crater" type?

tough abyss
#

So I just tested nearestObject [player, "#crater"]; in the debug console with a few weapons. Only got it to work with craters created by launchers, not bullets. The nearestObjects command doesn't seem to work with #crater in the search array.

#

Does the engine really have no handle or ID for bullets? I mean, I could just define a trigger area to cover my object, no problem.

#

Note: shooting at the dirt pile seems to create a dirt particle effect: can that be detected? (When the player is 2 km away ๐Ÿ˜ฌ )

little raptor
#

I don't think so

finite sail
#

were you running the nearestobject in a loop?

tough abyss
#

No, I just ran it once after firing each shot.

finite sail
#

you might have missed it

#

need to run that in a loop

tough abyss
#

I don't follow. Just to be clear; after every shot, I clicked back to the debug console, then ran the code again. Effectively I ran the check every 3 seconds. What condition would I loop it on, that would catch it better?

still forum
#

Does the engine really have no handle or ID for bullets? I mean, I could just define a trigger area to cover my object, no problem.
@tough abyss bullets are objects

finite sail
#

the nearestobject command only runs once when you ran it each time

tough abyss
#

@finite sail that makes sense. And it reliably detected the crater decal my RPG launcher made when it ran. Just not bullets. Unfortunately :(

@still forum I couldn't find the classname or object name that easily in the BIKI. Could you tell me where such a list is?

still forum
#

classname is the CfgAmmo classname

little raptor
#

@tough abyss
Let's do it in a different way:

bullets = [];
player addEventHandler ["FiredMan", {
  _bullet = _this select 6;
  _dir = vectorDir _bullet;
  _pos = getPosWorld _bullet;
  if (_dir vectorCos (_pos vectorFromTo getPosWorld DirtPile) > 0) then {
    bullets pushBack [_bullet, _pos];
    onEachFrame {
      {
        _x params ["_bullet", "_pos"];
        if !(alive _bullet) then {
            bullets set [_forEachIndex, -1];
            if (_pos inArea DirtPileArea) then {
                //explode
            };
        } else {
            _x set [1, getPosWorld _bullet];
        };
      } forEach bullets;
      bullets = bullets - [-1];
    }
  }
}]
tough abyss
#

Oh, also the physical object when it is fired? Pardon, I am new to this aspect of missionmaking. Thank you.

still forum
#

I would say, add Deleted Eventhandler on the bullet, and check where it was when it was deleted/hit an object

#

onEachFrame is a bad idea, you break other onEachFrame or they break you

little raptor
#

Does the deleted eh work?

still forum
#

it should

little raptor
#

I know that killed EH doesnt work on them

finite sail
#

@finite sail that makes sense. And it reliably detected the crater decal my RPG launcher made when it ran. Just not bullets. Unfortunately :(

@tough abyss Oh ok, it reliably found explosion decal but not bullet ones.. gotcha

little raptor
#

Not sure about deleted

#

onEachFrame is a bad idea, you break other onEachFrame or they break you
For testing it is fine

still forum
#

well bullets don't get killed, they do kill

little raptor
#

killed == destroyed

still forum
#

no

#

killed == killed

#

:U

finite sail
#

the target object doesnt take damage

#

the one he is using, that is

still forum
#

ok so that means Hit event probably doesn't work on the target object

finite sail
#

exactly

#

handledamage doesnt work there either

still forum
#

but I didn't see anyone talking about that anyway

little raptor
#

we wouldnt be doing this crazy stuff otherwise! ๐Ÿ™‚

still forum
#

there is a hit EH on the ammo itself

#

but only config

tough abyss
#

Yes; my idea was to make a very large target that regular players could shoot at from more than a kilometer away. Justification being that it's a pile of explosive material.

there is a hit EH on the ammo itself but only config
@still forum Could you elaborate?

still forum
#

Also Leopard your code, can probably use inAreaArray.
Also your _pos looks wrong, you never update it

finite sail
#

really, the lnly way to make that work is if the target is a man

still forum
#

"Could you elaborate?"
There is are per bullet eventhandlers, but you can't access them via scripting so they are no option for you

little raptor
#

good point, fixed.
not sure about inAreaArray...

finite sail
#

or, have them shoot explosives (rocket/missle) at the target

#

and use the craterdecal

#

or a hidden sensor object like the traffic cone that can take the damage instead

little raptor
#

@tough abyss Did you try my method?

tough abyss
#

Yeah, it would be sensible to make the player use a launcher, or scale down the distances and target size. The kick in this mission was making players assassinate some target at over 1 km with a very big rifle.

I'm going to play a little with Leopard20 's script. Just a question: how heavy would this be?

little raptor
#

Depends on how many bullets you intend to fire!

#

Not much

#

You can remove the event handler when the pile is dead

still forum
#

maybe you should filter bullets that go in the direction of the pile

#

otherwise you capture all bullets that go anywhere else even if you don't care

little raptor
#

Already did

#

Not sure how big the pile is
I'm just going with angle < 90

still forum
#

AHA! Me can't read

tough abyss
#

Well; it's a 4 player coop mission running on dedicated. I could assign 1 person is assigned as the main sniper (with the .408 sniper; forget the name), for instance.

#

OK OK I'm going to play with this a little. Thanks gents.

little raptor
#

remember to define the pile area in ASL format

#

And the area must have a height

tough abyss
#

@little raptor Yes; it works! You had added an unnecessary curly brace at the end that created errors, and I had to figure out cfgAmmo, but it absolutely works.

FYI the dirtpile object is 12x7x6 meters in size. So I can probably make the "filter" angle quite small, even if players decide to get closer to it.

little raptor
#

The thing is, you can also shoot things "indirectly" at the object and it may still hit

#

For example, a grenade launcher

#

or just grenade

#

So I think 90 degrees is safer

#

You had added an unnecessary curly brace at the end that created errors
typing in discord will only get you so far!

tough abyss
#

That is true. But to give usage context: I am making players standing on the cliffs in Malden shoot at an object on the coast (wanted them to shoot the target character directly, but no rifle reticle will go that far with the ACE ballistics mod loaded). The players have a 20 minute window, and depending on how far they choose to walk, range will be 2.4 km - 800 meters.

I point out the curly brace thing to give myself a tiny bit of troubleshooting credit, not to look a gift horse in the mouth! Impressive you just coded it without testing.

little raptor
#

Also, remember to use a stackable event handler instead of onEachFrame. That was for testing.
Also, if you make sure that the event handler is added locally, you can run that code per client, saving the server performance.

tough abyss
#

Could you clarify (or send BIKI link) on what you mean with "stackable"?

little raptor
#

If you intend to use the mission EH (which is recommended), make sure you don't add duplicate ones.
You can use a condition, e.g:

if (missionNamespace getVariable ["BulletEHAdded", false]) exitWith {};
BulletEHAdded = true;
addMissionEventHandler ["EachFrame", ...
winter rose
#

addMissionEventHandler* is better, stacked is scripted & slower

little raptor
#

what did I say?!

winter rose
#

(mb for tagging you, gimme the time to read your message ๐Ÿ˜‹)

tough abyss
#

@little raptor thanks for changing that =true . Was confusing me!
I apologise for ignorance, am not a programmer by training. How is stacking important here? Is this related to memory stacking?

little raptor
#

No. if you used onEachFrame, and another mod did the same, it would override yours

#

It's about "coexisting"

tough abyss
#

Clear enough. And I am pretty sure the CBA and ACE mods make use of it. So this will be important.

little raptor
#

I don't think they do! They're smart enough not to use that. But other less skilled programmers might

tough abyss
#

Oh. Well, there are no other mods in the mission. But I will apply your fix, regardless. This is getting quite educational.

little raptor
#

@tough abyss One thing I forgot to say: make sure you remove both the "FiredMan" EH and the "EachFrame" EH once this pile is destroyed. You can save the event handler IDs in a variable (either in missionNamespace or object variable space)

#

In fact, if the mission spans across a large AO, you can add the "FiredMan" EH when your units are close enough to the dirtpile (using a trigger or something)

tough abyss
#

Good point in removing the EH. The AO is bloody huge, on purpose, so perhaps I should activate the EH when the previous task completes.

little raptor
#

Yeah.
On second thought, there's no need to save the "EachFrame" ID, because you can simply use:

if (_pos inArea DirtPileArea) then {
    removeMissionEventHandler ["EachFrame", _thisEventHandler];
    //explode
 };
#

The variable _thisEventHandler is defined by the engine for each event handler

tough abyss
#

Didn't know you could delete the whole EH from an inner scope.

#

Thanks for all the help and tips. Will write back if I have further questions.

little raptor
#

no problem!

little raptor
#

By the way, Dedmen, the "deleted" EH doesn't work on bullets. I just tested.

#

I couldn't find any EH that works on them ๐Ÿคท

#

Can we ask for an EH that triggers before the bullet is destroyed?

still forum
#

oof

#

Deleted should probably work there

shadow sapphire
winter rose
#
waitUntil { not isNull player };```would be nice to have at the top @shadow sapphire
shadow sapphire
#

I'll try that immediately!

#

My results are the same, but I'll keep the line, thanks @winter rose!

#

I'm thinking of just moving this script to onplayerrespawn.

shadow sapphire
#

This shit makes me SICK. I know it's something simple or stupid that I'm missing, but for every single little tweak you make, you have to shut down the server, open the editor, load the mission, export the mission, exit the editor, launch the server, rejoin, fail, repeat mission endlessly. Absolutely nauseating.

finite sail
#

you can run with a local server

shadow sapphire
#

It seems to let things slip, it seems to allow things through that won't work on the dedicated sometimes.

Most recently, it seems to be treating the player and server as the same entity when I run the local server.

finite sail
#

yes sort of, the player and server are sort of the same thing on a local server

#

but it does almost all the locality stuff correctly

warm hedge
#

You can launch your local multiplayer game just from Eden Editor

shadow sapphire
#

... That's what we are talking about.

finite sail
#

yes

warm hedge
#

Directly, I mean. You don't need to export or something

finite sail
#

my mission is designed to run on dedi boxes, but I rarely have to actually put the mission on the dedi for testing, 99% of testing is done with local server

warm hedge
#

Ah okay

#

ignore me

shadow sapphire
#

Not a problem for me! Thanks for trying to be helpful, @warm hedge!

warm hedge
#

Not a great time to try to help someone, 2 AM ๐Ÿ˜„

shadow sapphire
#

@finite sail, I'll try to see if I can get it to do the same thing.

finite sail
#

@shadow sapphire do you want me to run through how i do it here? im sure they same process will apply to you

shadow sapphire
#

Sure! If you have the time.

finite sail
#

ive got about 30 mins, MS teams chat with my sons teacher

#

modern wold ๐Ÿ™‚

#

world

shadow sapphire
#

Take your time!

finite sail
#

ok, so game main meni, editor, double click vr world

#

then load the mission into the editor

#

for me, its ion the mpmission folder

#

then I'll tab out into my code editor. 99.9999% mission dev is done in visual code, not in Eden

#

make changes etc

#

find that missing semicolon ๐Ÿ™‚ save the file in visual studio, tab back to the game

shadow sapphire
#

Well, my issue is that the initplayerlocal.sqf is not firing at all anymore, for reason I can find. It fires just fine in singleplayer, doesn't fire on the dedicated.

finite sail
#

initplayerlocal shouldnt fire on the dedi... i assume you mean it doesnt fire on the player when you use a dedi

shadow sapphire
#

Yes.

winter rose
#

oooh, would that be the issue from the beginning
yeah it only fires where there is a player behind the screen

finite sail
#

you do need to bear in mind, the init scripts do fire in a slightly different order when on dedi / local server, but it shouldnt make any real difference

#

do you do stuff in preinit?

#

because I dont

winter rose
#

if you want code to run whatever the server, use initServer.sqf

finite sail
#

I have this at the top of my initplayerlocal, to keep the init order fairly safe

#

waitUntil {getClientState isEqualTo "BRIEFING READ"};

shadow sapphire
#

The things I need to fire need to be fired on the players when they join, at least the beginning part, the other bits might need to be shuffled around, but I know for a fact that the beginning stuff isn't firing.

finite sail
#

ok, just a shot in the dark... playerrespawn.sqf doesnt fire on player join... that caught me out a few times

shadow sapphire
#

First thing that should fire is a gear script, Call ASG_FNC_SOFGear;

#

If the other things didn't fire, I'd think they need to be shuffled to the server, but that one I know should be firing.

finite sail
#

its a function? are you sure the function is compiled by the time initplayerlocal runs?

#

i bet it isnt

shadow sapphire
#

The function is compiled on server initialization.

#

Or so I thought.

finite sail
#

ok, you might find initplayerlocal is running too early

#

the waituntili posted earlier will mitigate that problem

#

in my experience, when it doesnt work in MP SQF without syntax errors... if it aint locality that broked it, it almost always is timing

#

a script running before its time, in other words

winter rose
#

The function is compiled on server initialization.
wait, how?

shadow sapphire
#

I mispoke. IDK what I was trying to say.

finite sail
#

the function needs to compile on the client

#

do you mean that it's compiled everywhere when the server initialises?

#

because it might be that that isnt happening

shadow sapphire
#

No. Ignore what I said, I meant it was defined in the description, thought that was in the serverinit, it's not.

finite sail
#

ok, so its compiled in cfgfunctions?

#

ok gotta brb

shadow sapphire
#

Yes. I think. That's where it's defined, and it works as called in singleplayer, does not work in multiplayer.

I tried your waituntil, and I've tried putting it behind increasingly larger sleep thresholds, neither appears to work in multiplayer.

#

Anyway, I've got to go as well.

worn forge
#
waitUntil { not isNull player };```would be nice to have at the top @shadow sapphire

@winter rose tbh I've never seen that as an actual issue. I know why it's there. It's never made a difference in anything I've seen. But I'm guessing you swear by it?

winter rose
#

well, there are checks with the player value in there, and apparently in some cases (which ones?) a JIP player can be not fully initialised at this stage.

astral dawn
#

Opinion:

== operator should compare bools too

I know the "you should use if (_var) then {} instead" point, but it really just adds to the annoyance and confusion when == works in such non-uniform way: it work with strings and numbers, but not with bools. In the end it just leaves bugs somewhere in the control logic of the code for no good reason at all. If SQF checked this at compile time then it would be more manageable.

winter rose
#

@astral dawn that's already the case

astral dawn
#

huh?

worn forge
#

How about

waitUntil { !(isNil "ASG_FNC_SOFGear") };
Call ASG_FNC_SOFGear;
...

and I have no idea what the practical value of having all those Sleep statements is

winter rose
astral dawn
#

wait, what ๐Ÿ˜ฎ

#

i just got an rpt from guy who had my code crash for him

#

ok let me check his version

#

yes that's right, 1.98

#

my bad, sorry for the rant

still forum
#

Nooo lou don't tell people about the heresy

winter rose
#

hue hue hue, take that, ebol coder

still forum
#

I will get rid of bool == true probably... maybe?
I guess replacing _var == true by _var everywhere universally should be fine huh?

#

probably isn't.. meh

#

I want to tho

astral dawn
#

it's cool, ded. If SQF raised the error at compile time then it would be ok

still forum
#

compile time warnings, can do

astral dawn
#

but since it's dynamic... meh

still forum
#

or rather optimizer time warning

shadow sapphire
#

@worn forge, thanks! Will try that waituntil.

The sleeps are because the subordinate elements being assigned donโ€™t exist yet, and then when they exist, the remaining sleep ensures the subordinate are assigned in a specific order.

Iโ€™m positive there is a more elegant solution, but Iโ€™m not a coder. At all.

rough dagger
#

Hi folks, I am trying to create sentries for wall block and towers, but they are not registering when testing with 'nearestBuilding'. Is it possible to spawn them into wall defences and in hesco towers? Example classname: "Land_HBarrierWall_corner_F". Cheers

#

sandbag bunkers work fine... is there a trick to walls?

past tiger
#

@winter rose i believe after 2.0 it started to trigger, but with a damage value of 0. This is good for me.

winter rose
#

correct, tested just now

worn forge
#

@rough dagger I believe nearestBuilding looks for structures that have building positions, and if that command isn't picking up what you want, that's probably why. You'll need to use nearestObjects or similar.

rough dagger
#

Iโ€™ll play around with that ... thanks Ryko...

#

Do you know if walls have positions you can send units to?

#

I mean they look like legit options for unit placement but I get the feeling they are for human players only lol

worn forge
#

That's what buildingPositions are, and if they don't show up in nearestBuilding, they're not buildings, thus your answer is no ๐Ÿ™‚

past tiger
#

Thanks Lou. I was not believing, this will helpme a lot.

rough dagger
#

Thanks man .. I even tried spawning them above the wall but machine said no ๐Ÿ˜…

worn forge
#

The problem with putting AI there is that unless you give them forceSpeed 0 or otherwise disable their ability to move, they'll walk off the wall anyway.

winter rose
#

@sudden yacht ```sqf plz

#

(and secondaryWeapon)

little raptor
#

Are you adding a second InventoryClosed EH inside the first?!!

#

Im looking to change "If (PrimartWeapon Player == "")

#

secondaryWeapon player == ""

#

Also, your code is not written properly. You should revise the whole thing

worn forge
#

That hurts to look at

winter rose
#

gone

little raptor
#

Not sure if there's a direct way to disable it, but you can fetch the user keybind for pinging zeus and then use the "KeyDown" EH to override it

#

@tough abyss something like:

findDisplay 46 displayAddEventHandler ["KeyDown", {
  inputAction "curatorInterface" > 0
}]

(not sure if it works with inputAction, you'd have to use actionKeys otherwise)

fair drum
#

how do i go about doing a mod check?

#

like, say... see if ACE is loaded?

#

so I can make a single mission but make it compatible if ACE was loaded (medical items etc)

robust hollow
#

could check if the related addon patch exists

#

checking for the workshop id with getLoadedModsInfo is also an option, but that wouldnt work for non-workshop versions

exotic flax
#
if (isClass(configFile >> "CfgPatches" >> "ace_hearing")) then {
   // do something when ACE Hearing exists
};

Although you also might be able to use activatedAddons (never used/tested it)

languid oyster
#

I am doing some little rearm script. Made an observation. The Sholef for example. Right at start, it has 20 155mm HE rounds. But in the config, the magazine reads "32Rnd_155mm_Mo_shells", and it can, of course, be filled up to 32 rounds. Is there any reason for the unit to start with only 20 rounds? Same goes for the "6Rnd_155mm_Mo_mine" magazine. From the start, there are only 4 rounds available, though up to 6 could be fitted.

fair drum
#

post the paste bin

#

also, make sure the units ammo slider didn't accidentally get moved when you were in the editor

languid oyster
#

@fair drum
"also, make sure the units ammo slider didn't accidentally get moved when you were in the editor"
please shoot me

winter rose
#

gladly ๐Ÿคฃ ah well, happens! ๐Ÿ˜

languid oyster
#

Ok, here comes the next dumb question
Currently, I have this in my config:

class Extended_Fired_Eventhandlers {
    class B_SAM_System_03_F {                                                                        // MIM-145 Defender SAM rocket launcher
        fired = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
    };
    class B_MBT_01_mlrs_F {                                                                            // Seara multiple rocket launcher
        fired = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
    };
    class B_MBT_01_arty_F {                                                                            // Sholef artillery
        fired = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
    };
};
class Extended_Reloaded_Eventhandlers {
    class B_SAM_System_03_F {                                                                        // MIM-145 Defender SAM rocket launcher
        Reloaded = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
    };
    class B_MBT_01_mlrs_F {                                                                            // Seara multiple rocket launcher
        Reloaded = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
    };
    class B_MBT_01_arty_F {                                                                            // Sholef artillery
        Reloaded = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
    };
};

I am sure this can be optimized to a more elegant solution. How?

dusk gust
#

Could use them as a child classes if you really wanted to trim it a bit. sqf class Extended_Reloaded_Eventhandlers { class B_SAM_System_03_F { // MIM-145 Defender SAM rocket launcher Reloaded = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';"; }; class B_MBT_01_mlrs_F : B_SAM_System_03_F {}; class B_MBT_01_arty_F : B_SAM_System_03_F {}; };

#

@languid oyster

winter rose
#

also, make a function instead of execVM'ing

languid oyster
#

@dusk gust thanks for optimisation
@winter rose function sounds good. Would be easier for adding or removing units too. Could you give or point me to a little example on how to define or call from config?

exotic flax
#

there are more methods available, although I don't think you want to go into that rabbit hole yet

winter rose
#

What he said!

languid oyster
#

Ok guys, thanks for the help. Will look into that functions thing.

#

In case of units spawned later, the function would have to have a loop to check for those new spawned units to add event handlers, right?

idle jungle
#

Hello all wondering if anyone can assist.

How do I write the !alive name expression outside of a trigger?

Long story short I've got ai to spawn in on a script but one with a variable name i want to check that if he's dead or not to pop up a hint

#

And I'm assuming I will need to use a sleep command to slow down the check prior to the ai spawning in

exotic flax
#

well, it's good practice to check if the unit exists before trying to access it.

// create new unit
waitUntil {!isNil unitVar};
// rest of code
idle jungle
#

// create new unit
waitUntil {!isNil pilot};
Hint "bla";

Like that?

exotic flax
#

for example

#

although if you have everything in one script than it shouldn't be needed, since it the variable exists when you use createVehicle/createUnit, so you can access it directly

idle jungle
#

Thanks mate

winter rose
#

isNil takes a string (or code)
isNull takes an object

exotic flax
#

only in Arma...

#

although nil is also used to check if a variable exists (independent of string/code/object)

little raptor
#

?

isNil {_variable}

_variable can be anything

#

I've got ai to spawn in on a script but one with a variable name i want to check that if he's dead or not to pop up a hint
And I'm assuming I will need to use a sleep command to slow down the check prior to the ai spawning in
why use "variable name"? Just store the unit in a variable (unit = _group createUnit ....), then:

waitUntil {!isNil "unit" && {alive unit}}
#

waitUntil {!isNil pilot};
doesn't mean he's "alive"

#

@idle jungle ๐Ÿ‘† that's what you want

idle jungle
#

Ohh thank you!

signal kite
#

Hi! My script results in a "2 elements provided, 3 expected" error - the group spawn, but the task to Defend is not issued. Any clues?

 AZ = [21100, 7400]; 
  private _side = West; 
  private _grouptype = configFile >> "CfgGroups" >> "West" >> "rhs_faction_usarmy_wd" >> "rhs_group_nato_usarmy_wd_M113" >> "rhs_group_nato_usarmy_wd_M113_squad_mg_sniper"; 
   
  private _vfgrm = [AZ, 0, 100] call BIS_fnc_findSafePos; 
  gruppe = [_vfgrm, _side, _grouptype] call BIS_fnc_spawnGroup; 
  gruppe deleteGroupWhenEmpty true; 
  systemChat format ["%1 spawned at %2.", gruppe, _vfgrm]; 
  [gruppe, AZ, 100] call CBA_fnc_taskDefend; 
finite sail
#

probably the findsafepos failing

#

diag_log all of the variables bfore you send them to the findsafepos

little raptor
#

@signal kite Probably because AZ must have 3 elements

#

Also, post the full error

finite sail
#

findsafepos will accept a 2d, according to biki

#

though ive never done it

little raptor
#

Maybe for that, but what about the CBA function?

signal kite
#

@signal kite Probably because AZ must have 3 elements
@little raptor this! - thank you

little raptor
#

probably the findsafepos failing
wouldn't it return [] tho? (aka 0 elements provided error)

finite sail
#

iirc, it returns worldcentre if it fails to find

little raptor
#

I've never tried the function variant, so I don't know!

finite sail
#

theres another varient?

little raptor
#

command

finite sail
#

not quite

#

ive never found findemptyposition to be reliable

little raptor
finite sail
#

findsafepos uses isflatempty

#

internally

#

findemptyposition doesnt look at terrainslope, it doesn't have a blacklist function and doesnt have a shoreline finder

little raptor
#

yeah I didn't really read the biki page for : BIS_fnc_findSafePos
I just assumed based on provided params

#

[AZ, 0, 100] call BIS_fnc_findSafePos;

#

there's only 3

finite sail
#

finsemptyposition is ok for placing small vecs, markers or manbase, for big vecs or on huilly terrain, findsafepos is best

#

also, ive cooked my own findsafepos, based on Joris' original, that incorporates a lineintersects function

worn forge
#

Any way to just disable zeus pinging?
@tough abyss
You've got two options:

  1. add a keybind to the curatorInterface actionKey, but I have a feeling this isn't foolproof:
(findDisplay 46) displayAddEventHandler ["KeyDown", {
  params ["_display", "_key", "_shift", "_ctrl", "_alt"];
  if ( _key in (actionKeys "curatorInterface") ) exitWith {true};
}];```
2) use the `CuratorPinged` eventHandler on the zeus module itself (I'm assuming an Eden-placed module, putting this code in the init field):
```sqf
this addEventHandler ["CuratorPinged", {
  params ["_curator", "_unit"];
  if ( count allCurators == 0 ) exitWith { "No zeus to ping. Don't ping!" remoteExecCall ["hint", _unit]; };
  _allCuratorUnits = [];
  {  _allCuratorUnits pushBack (getAssignedCuratorUnit _x); } forEach allCurators;
  if ( count _allCuratorUnits > 0 && {!(_unit in _allCuratorUnits)} ) then {
    "Zeus alerted, stop your pingin!" remoteExecCall ["hint", _unit];
    format ['%1 wants attention', name _unit] remoteExecCall ["systemChat", _allCuratorUnits];
  };
  true
}];```
Untested, but it's a variant of what my community is using currently.
little raptor
#

Doesn't it just warn the user not to ping Zeus?

#

if ( _key in (actionKeys "curatorInterface") ) exitWith {true};

first of all:

 _key in (actionKeys "curatorInterface")

is enough

#

Second of all, what about key combos with shift,alt,ctrl?

worn forge
#

you use inputAction, I used actionKeys

#

My preference is not to override user keybinds, which is why I added the second method.

little raptor
#

I use inputAction to also detect ctrl,shift and alt

worn forge
#

Fair, I may adapt to use that

little raptor
#

the second method is just a warning tho

#

he said disable it

worn forge
#

nope, ends with true

little raptor
#

Really? It can also return something?!

#

I didn't see this info on the wiki

worn forge
#

If you push true at the end it aborts, that's why I've got the exitWith {true} in my first example

#

push false and it continues with regular operation

little raptor
#

hmm I gotta ask Lou or someone else to add this to the wiki

winter rose
#

no

little raptor
#

why not?

winter rose
#

j/k ๐Ÿ˜‹

torpid niche
#

IDK where to ask this question but im trying to make an ambient EOD type of mission.
I have it setup with me and 3 other AI. 2 AI are just standing there with ambient standing animations while the other AI is clearing out mines.
What i want is for the EOD AI to clear out 15 mines and then go for the 16th mine and just....D I E

#

and then have a mission thing pop up saying "Go pick up EOD and finish the mission". What also would be nice is to have the "standing" ai go into an animation of crouching behind cover and looking, there is actually an animation for that.
How would i get this all to work??

little raptor
#

for the first case, you can use a loop that does this for each mine:

  1. Tells the Ai to move to where the mine is
  2. When the AI is close, it should go prone.
  3. When it's close enough, play the "Pickup" animation and just delete the mine (or disarm it)
#

When it reaches the last mine, just use:
mine setDamage 1; AI setDamage 1

torpid niche
#

There is actually a demining waypoint in the dev version. So what i could do is have the ai do that, then place a "Move" waypoint on a mine. Would this be easier?

#

but the thing is the demining waypoint has the AI demine ALL mines

little raptor
#

in the dev version
If it's in the dev version, you gotta do with what you have now (especially if you intend to later publish your mission).
There's no way to tell when the next stable will come out

torpid niche
#

Yeee i guess ill do what i can. The animation scripting idk how to do tho. Cuz of course i want the animations to happen after the EOD AI dies

little raptor
#

You can do all of this in one script

worn forge
#

is this just a mission you want to play in single player, or something you want to do in multiplayer?

torpid niche
#

Both???

#

Ill focus on single first

worn forge
#

If you're going to go multiplayer with it I suggest you code with that in mind

torpid niche
#

code? oof. Ye ill focus on singleplayer first XD

little raptor
#

step1: name all your mines: mine_x (or whatever you prefer, just make sure you change that in the script too)
step2: sample of the script you should use

//_cntMines: number of mines to defuse
for "_i" from 1 to _cntMines do {
  _AI setUnitPos "UP";
  _mine = call compile format ["mine_%1", _i];
  _AI doMove ASLtoAGL getPosASL _mine;
  waitUntil {_AI distance _mine < 12};
  _AI setUnitPos "DOWN";
  waitUntil {_AI distance _mine < 5};
  deleteVehicle _mine;
  _AI playMoveNow _pickupAnim; //find this in animation viewer;
};
  // now go for last mine and die
  _AI setUnitPos "UP";
  _mine = LAST_MINE;
  _AI doMove ASLtoAGL getPosASL _mine;
  waitUntil {_AI distance _mine < 12};
  _AI setUnitPos "DOWN";
  waitUntil {_AI distance _mine < 5};
 _mine setDamage 1; //mine explodes
  _AI setDamage 1;// AI dies
  
  _AI2 setUnitPos "MIDDLE"; //second AI crouches
torpid niche
#

wow

worn forge
#

methinks maybe you want to start with a simpler mission idea

torpid niche
#

Ok maybe i wanna start smaller XD. Question. How do i have an AI go into a permanent animation, unless told otherwise, on a waypoint?

torpid niche
#

Is it possible for a trigger to have an explosion but only affect the one inside the trigger?

little raptor
#

go for explosion effect

torpid niche
#

I want the EOD to go into the trigger, get blown up by a "mine" but all the other mines must stay.

worn forge
#

I'm pretty sure mines are susceptible to explosion damage, so I would fake it - create an explosion "effect" and then delete the mine

torpid niche
#

How does one create an explosion effect?

little raptor
#

I would help you but something tells me you know nothing about sqf, so it's gonna be a waste of time
How about you come back after learning some sqf?

worn forge
#

I wonder if you could allowDamage false the other mines

proper sail
#

Does someone have an extension thats whitelisted by BE in a3?

torpid niche
#

yeee idk what sqf is XD

#

Ive never really made big missions with scripts

worn forge
#

Leopard's right Ryan, if you don't know how this stuff hangs together, you're spinning your wheels

torpid niche
#

its all been triggers

worn forge
#

Check the pinned messages in this channel to get started

exotic flax
#

@proper sail TFAR, ACRE, ACE.. just to name a few

proper sail
#

alright cool

still forum
#

why u ask

little raptor
torpid niche
#

Thanks ๐Ÿ™‚

winter rose
#
!(_guy inArea markerOrTrigger)```@cunning oriole
tropic willow
#

how do you find item ID's to add to an array?

winter rose
#

which "id" ?

tropic willow
#

things like..... "G_AirPurifyingRespirator_02_olive_F" for instance

#

im trying to add modded assets into a CBRN script array to be allowed as a gas mask

winter rose
#

typeOf is to get the object's classname

little raptor
#

allowed as a gas mask
masks are not "vehicles" Lou

winter rose
#

indeed

little raptor
#

So typeOf doesn't work on them

winter rose
#

indeed

tropic willow
#

im used to id's in other games, sorry for the confusion. gas masks are in a facewear slot. i just looked in equipment, and i noticed that uniforms are marked with a U at the start, vests with a V, and helmets with an H. but i see no section for Facewear ( glasses, etc). im.. trying to explain my thought process.

im still brand new to scripts for arma, sorry for the confusion. im trying to find the name of a modded gas mask on the coding side so i could add it to an array. i just... dont know how to do that.

winter rose
#

@tropic willow you could wear it in the editor, then use in the debug console

goggles player
```https://community.bistudio.com/wiki/goggles
tropic willow
#

thanks for the information Lou

sonic thicket
#

Hmm, i learned mainly from looking into altis script's how things function, that might be a nice way to get things rolling after getting the basics of scripting down

young current
#

altis scripts?

sonic thicket
#

err Alias*

young current
#

ah

sonic thicket
#

that was a weird mistake ๐Ÿค”

#

made a horde module script, would it be all right to post a video on it's execution here? It still got some issues which I am fixing currently but I am planning on sharing the script

little raptor
#

afaik you can't post videos here not even if you wanted to

frank ruin
#

Mmm

#
            hint parseText format["<t size='1.6' color='#0067c7'>Loadout</t><br/>The loadout could not be saved because the following items are not allowed:<br/><br/><t color='#ff0000'>%1</t>",_names];
        ```
How would I get _names which is an array of various items to be pushed as a new line on the hint? So it lists the item on a different line?
#

So I get like:
Weapon 1
Weapon 2
Weapon 3
...

#

Instead of Weapon 1, Weapon 2, Weapon 3

little raptor
#

@frank ruin
convert it:

_names joinString "<br/>"

Assuming names is an array of strings

#

what are you trying to do again? Explain in more details

#

yes

#

when they leave the area.
who's they?

#

Why not use triggers?

#

If it's a mission

#

Is this a multiplayer scenario?

#

maybe if you created local triggers for each client it would be better

#

But if you want to do it using scripts, it is still fine

#

What is the problem right now?

#

You said you're stuck?

#

@cunning oriole

#

one thing I'm not sure of is whether local triggers consider only local players or all players

#

Yeah maybe

#

with an empty trigger of course

sonic thicket
#

I'm breaking my head over this next issue where everything seems to work and all the checks seem to indicate it should work but it still doesnt work and throws an error.
So, lets break it down to something simple as the script itself isnt since it has 3 kind of paths different exexVM's can take by using [] parameters as ID's.

The part of the script that does not work involves setVariable and getVariable.
When one trigger is activated it uses the varnamespace of the trigger to set a variable:

_trigger_horde setVariable ["zombie", _zombie, true];

So in the above trigger the entity ( _zombie) is saved under the _trigger_horde which is the trigger varnamespace.
When another trigger is activated it tries to get this variable using:

_allhordezombies = (_hordetype getVariable "zombie");

_hordetype and _trigger_horde both reference to the exact same trigger varnamespace, I double checked this.

However when the string _allhordezombies = (_hordetype getVariable "zombie"); is run it throws the following error:

Error Getvariable type string expected namespace object group display... etc
So what am i doing wrong here?

[Context]: Trigger spawns in horde, anoter trigger stops and purges the horde by using a foreach on the output of "_allhordezombies = (_hordetype getVariable "zombie");"