#arma3_scripting

1 messages ยท Page 644 of 1

ebon citrus
#

and swap between them

#

you can literally just MOVE the gate down

oblique arrow
ebon citrus
#

setPos

loud birch
#

that sounds like alot more work compared to hiding and showing two objects

ebon citrus
#

setPos is for setting object position in the worldspace

#

trust me, it's not a lot mroe work

#

it's a lot LESS work

#

as well as a lot less headache

loud birch
#

I mean in my case I can have both my objects placed how I want in the editor and just hide one when the game starts and then show it again when the hold action is complete

robust hollow
#
[obj1,true] remoteExec ["hideObjectGlobal",2];
[obj2,false] remoteExec ["hideObjectGlobal",2];```
in your action
loud birch
#

looks solid to me

#

unless the documentation for hideobjectglobal is literally incorrect this should work perfectly

robust hollow
#

the wiki is correct. that snippet will send the hideobjectglobal command to the server for execution.

loud birch
#

cool

ebon citrus
#

you will have to make your own logic to flip it, though

#

if you want to "close" the gate

#

i would still advice just moving the object

robust hollow
#

own logic ๐Ÿคท

[obj1,!isObjectHidden obj1] remoteExec ["hideObjectGlobal",2];
[obj2,!isObjectHidden obj2] remoteExec ["hideObjectGlobal",2];
#

not sure it really matters much either way

ebon citrus
#

well, youre working with 2 objects isntead of one

#

youre also remote-execing

#

working with 2 objects instead of one will always be a lot more work for the user and the engine

#

imagine if you had to pay 100% extra for a carton of milk

#

what i would do is either just move or if i want to feel extra fancy, lerp the gate-object between the 2 positions

#

to be noted, lerp will always come with some performance overhead, but you wont ever even have this option if you work with just toggling 2 objects

robust hollow
#

as far as big deals go, this isnt one. "a lot more work" is relative to what the person already knows. in this case theyre more comfortable using 2 objects because thats what they know and understand. im not saying your method is wrong or worse or anything, just the end result isnt worth the effort for one small thing imo.

warm hedge
#

Is there any documentation or something I can read as a reference to predict/calculate an unguided bomb path/impact point?

little raptor
#

I'm not sure how accurate it'll be

warm hedge
#

Mmm thanks. I hope I can understand it

split coral
#

IIRC there was a discussion about exactly this on the forums a few years ago. I think someone was trying to create a ccip system. Don't remember how it worked out though.

warm hedge
#
ebon citrus
#

so far as i've come to understand, the best way to make sure a bomb guides in to a target is to guide the bomb in yourself... or rely on arma to do it. These systems are not interchangeable

slim verge
#

from a handledamage EH i am getting some returned values for damage done to a particulare part of for example 9.93263e-006. Can someopne explain this value to me and how can i manipulate the value to return a true value that i can read, eg 0.0000456 for example

little raptor
slim verge
#

i wantr to be able to read the value in a more easily understood format, i know where it comes from i created the line to output it

little raptor
#

ok,
you can try the toFixed command

slim verge
#

/ah ok thx

little raptor
#

9.93263e-006 means : 9.93263 * 10^-6 btw

#

np

fair drum
#

@ebon citrus whats your steam workshop link? I want to see some of the stuff you do. Got any finished stuff on it?

slim verge
#

ah gotcha even better with that command as can return it to a defined number of decimal points thx a lot

slate cypress
#

Is there elseif in sqf? or would I do else if?

#

I don't see elseif on the wiki so I'd assume else if but it doesn't seem to work

still forum
#

not in basegame no

slate cypress
#

what is an alternative?

still forum
#

"so I'd assume else if"
assumed wrong

#

well you can nest your if

#

else {
if ()
}

slate cypress
#

ok thanks

winter rose
#

or (DON'T HURT ME PLEASE) use a switch

little raptor
#

I guess you mean this switch:

#define switch(x) private __switch__ = x; call
#define case(x) if (x == __switch__) exitWith
switch(_something) {
  case(_case) {

  };
};

๐Ÿ™ƒ

still forum
#

no worky, call called on nil no?

#

or call never executing

#

that call on swithc not

#

ah

#

see see

#

it call code, all good all good walk past

winter rose
little raptor
#

I mean I could rewrite it like #define switch(x,y) private __switch__ = x; y = call but that's weird!

still forum
#

you can do a do, while loop (do we evne have that? a bottom control while loop) and use breakWith?

little raptor
#

we do?

still forum
#

I dunno, do we?

little raptor
#

I think you're confusing that with sqc! ๐Ÿ˜„

#

@queen cargo will be so happy to see this! ๐Ÿ˜‚

winter rose
#

we have a while do, not a do while iirc

#

(you could still add that)

little raptor
#
SQC:

do {
    diag_log(position(player));
} while (BOOL);


do diag_log(position(player)); while (BOOL);
little raptor
still forum
#

no need for endswitch if you have no startswitch

little raptor
#

๐Ÿ˜…

queen cargo
still forum
little raptor
#

I don't think it is possible

#

sqf works using operators

#

it doesn't have "operator lookahead"

#

do _code while _code

still forum
#

I don't see why thats a problem :U

little raptor
#

not possible

still forum
#

huh

#

why not

queen cargo
#

cuz syntax

little raptor
#

never seen that anywhere before

still forum
#

if then is also possible

queen cargo
#

tho
do unary + while binary

little raptor
#

if then -> if

queen cargo
#

= do while possible

still forum
#

if creates a temporary, then executes

#

do, while
do creates a temporary, while executes

little raptor
still forum
#

ye

#

so

do code - DoType
DoType while

little raptor
#

oh so you want to add the doType

#

now I get it! ๐Ÿ˜„

still forum
#

I didn't say that I want to do anything :U

gray hull
#

howdy doody lads, quick question regarding the string that parses the given text for BIS_fnc_establishingShot

How exactly, would one introduce a line break in it?

Previous ways of doing so don't work anymore, specifically for this one function, sinc 24/03/2014 when an update changed how establishingShot worked in order to make it more consistent to campaign formatting. But the issue with this is, it's seemingly broke the way one could introduce a linebreak. No more fancy <br/> or |. endl, linebreak, or any other manner of text/string ways of breaking text seperately from this string seem to work. ( defining the string earlier via _string = etc etc etc. Also tried forcing results from composeText into a string via str (compose text ["line 1" + lineBreak + "line2"]) ).

Most of the ways I've tried result in bad returns or just no line break and I'm nearin my wits end on this one. Would appreciate a bit of help with this.

winter rose
#

try maybe \n

gray hull
#

No can do

#

didnt work

#

lemme double check just to make sure, tested this about an hour ago then went out to grab some groceries

little raptor
#

because you're doing it wrong

gray hull
#

Lemme try that real quick

#

Still a no on that one chief.

#

Thanks for correcting me on that though, had a feeling I messed somethin up for the composeText bit somewhere

little raptor
#

it should've worked,
you're doing something else wrong then

#

show me what line1 and line 2 are

#

I mean show me the whole script

gray hull
#

_string = str (composeText [text "Operation: Consequences of Power", lineBreak, text "By: SkytechCEO"]);

[[21808.4,6142.45,0], _string, 300, 300, 45, 1, [], 0, true , 10] spawn BIS_fnc_establishingShot;```

Here ya go
#

This should ROUGHLY be accurate and how you do it Unless I'm being an idiot

little raptor
#

@gray hull why do you str it?

#

remove the str

#

and it'll work

gray hull
#

if I don't string it

#

its text

little raptor
#

no need for the texts either

gray hull
#

and

#

where I have _string in the spawning of establishingShot

#

IT ONLY accepts a string

little raptor
#
_string = composeText ["Operation: Consequences of Power", lineBreak, "By: SkytechCEO"]);

[[21808.4,6142.45,0], _string, 300, 300, 45, 1, [], 0, true , 10] spawn BIS_fnc_establishingShot;
gray hull
#

no text at all

little raptor
#

there fixed

#

when you use str it removes the lineBreak

#

hold on I figured out what you're doing wrong

gray hull
#

yea I was about to say,

little raptor
#
format ["Operation: Consequences of Power%1By: SkytechCEO", toString [10]]
#

this will work for you

#

or you could write it like:

_string = ["Operation: Consequences of Power", "By: SkytechCEO"] joinString toString [10]
gray hull
#

Here's the issue.

#

still no work

#

I wish I thought about format before though facepalm I'm kinda surprised I didn't.

little raptor
#

right

#

apparently vanilla texts can't show them anymore

#

you're kinda right

gray hull
#

was really hoping I was gonna be able to find a work around without facing that fact full on

little raptor
#

@still forum was this intentional?

#

I can't even show hints with line breaks

gray hull
#

^

#

well

little raptor
#
hint format ["Operation: Consequences of Power%1By: SkytechCEO", toString [10]]
gray hull
#

There's a work around for hints

little raptor
#

yes I know

#

but what you want doesn't support structured text

gray hull
#

Yeah :/

#

I know it USED to support some structured text commands

#

At least before that update to it

little raptor
#

@gray hull this works

format ["Operation: Consequences of Power\nBy: SkytechCEO"]
still forum
little raptor
#

according to @gray hull it did

#

but I don't know

gray hull
#

I can guarantee it doesn't work 2.00 since that's what I'm doing now.

I've also tested it ages back and it seemed to work, but uh. Since I don't exactly have a 2013 build of Arma lying around, can't exactly test it right now.

little raptor
#

ok, but what I told you should work (at least in the hint)

#

but if it doesn't I have no other clues

gray hull
#

Yeah, that's my plan.

The issue is, this seems to be different from hint

#

still no work at all

opal sand
#

belated response, but good idea @ripe sapphire thankyou

velvet umbra
#

Hey quick question, if i run continuous conditions and corresponding tasks, is it better to use a loop e.g. while {true} or an fsm?

little raptor
#

doesn't make much difference, but while (or waitUntil) is better

velvet umbra
#

thanks ๐Ÿ™‚ wasnt sure for years and always wanted to know ^^

little raptor
#

because they're fully scheduled and you can have custom delays

#

np

velvet umbra
#

kk i guess the most impact is the frequency of checking the condition so it makes sense ๐Ÿ™‚

little raptor
#

but if you want different delays for each it won't work like that

velvet umbra
#

okay thank you :))

cerulean cloak
#
        [
            UAV,
            "Hack UAV",
            "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
            "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
            "(_this distance _target < 10) && ([_this, 'B_UavTerminal'] call BIS_fnc_hasItem) && (rank _this != "PRIVATE")",
            "(_caller distance _target < 10) && ([_caller, 'B_UavTerminal'] call BIS_fnc_hasItem) && (rank _caller != "PRIVATE")",
            {},
            {},
            {
                UAV engineOn true;
                rec = [] spawn MypathA;
            },
            {},
            [],
            15,
            0,
            true,
            false
        ] call BIS_fnc_holdActionAdd;

I've got that as a hold action on a unit but when the mission starts in mentions an error about a missing closing square bracket in the line

            "(_this distance _target < 10) && ([_this, 'B_UavTerminal'] call BIS_fnc_hasItem) && (rank _this != "PRIVATE")",
robust hollow
#

syntax highlighting shows a quote issue ^

winter rose
#

yes, the code highlight already tells you

"this string is "broken"."
#

also, you can use Code instead of String @cerulean cloak

cerulean cloak
#

I don't see it. Where is it?

winter rose
#

" inside a "-defined string

robust hollow
#
(rank _this != "PRIVATE")",
winter rose
#

use single quotes like others

cerulean cloak
#

Ah...

robust hollow
#

"PRIVATE" -> 'PRIVATE'

cerulean cloak
#

Thanks

robust hollow
cerulean cloak
#

Picard facepalm seems appropriate

winter rose
queen cargo
hollow lantern
#

the trigger object thisTrigger has no function to return thisList from it correct? I'm currently writing a script where it would be good to have both items available, the triggerObj and the thisList array. I could add the array as another requirement in params but I was hoping I could avoid that and access it via the triggerObj but I guess that's not possible?

#

or in other terms, not sure if there is a way to access thisList from outside the trigger to make use of it. In C# one would say a getter of the triggerObj to get that array

little raptor
hollow lantern
#

so list _trigger will give me the same list as thisList ? Then that's all I was looking for.

#

Thanks

little raptor
little raptor
#

doesn't accept code

#

also:

count str - 2
๐Ÿ˜„

#

always gives you 2! (str -2 == "-2")

robust hollow
#

we know what he was going for ๐Ÿ˜›

little raptor
#

yeah, I'm just messing around! ๐Ÿ˜…

ripe sapphire
#

hi guys, how do i make screen flash for a second for the player?

#

do i use ppeffectcreate? or is there another way

ebon citrus
#

In what way flash?

ripe sapphire
#

context is player is taking a picture so screen flashes for a second

opal sand
#

@ripe sapphire You should maybe careful there, as it may trigger someone vulnerable to epilleptic seizures, if you do include, would ensure to have warning text at the start of the media

#

personally dont think a flash is worth it tbh, just a snap sound would be enough

ripe sapphire
#

Dude its literally just one single flash not something crazy like 12 flashes in a row lol

#

Its not that easy to trigger photosensitive epilepsy anyways

gray hull
#

@little raptor late response but I figured out a well, rather dirty and quick workaround for my issue earlier

#

I hard coded my lines into the function itself

ebon citrus
#

@ripe sapphire create a dialog with a fade-parameter

#

that's the size of the entire screen

#

also, use fade to have a "flash". Dont use fade to "flicker"

#

even if your fade is quarter of a second, it still makes a big difference

plain creek
#

Is there a way to exec a command on all units in a faction? I want to make a trigger which if triggered executes enableAI "PATH" on all Opfor units.

oblique arrow
#

some combination of forEach and side?

plain creek
#

If i sync every unit to the trigger does forEach syncedObjects this; work?

oblique arrow
#

that might work, but sounds like a lot of work

still forum
#

btw there is a new script command that turns code to string, without the outer {}

#

I don't know what its name was

still forum
#

dunno

#

I know KK was working on that, no idea where it is ๐Ÿ˜„

hollow ibex
#

Hello so i have this script for deleting entity's when players are 1km away however it does not appear to be working. I am very new to all this so learning still thru trial and error and help is appreciated ๐Ÿ™‚

[{
    params [
        ["_entities", [], [[]]],
        ["_playableUnits", playableUnits, [[]]]
    ];

    private _entity = _entities deleteAt 0;
    private _entity_obj = if (_entity isEqualType grpNull) then {
        leader _entity
    } else {
        _entity
    };

    if (_playableUnits inAreaArray [getPosWorld _entity_obj, 1000, 1000] isEqualTo []) then {
        _entity call CBA_fnc_deleteEntity;
    } else {
        _entities pushBack _entity;
    };

    if !(_entities isEqualTo []) exitWith {
        _this call btc_fnc_deleteEntities;
    };
}, _this, 1] call CBA_fnc_waitAndExecute;
copper raven
#

what is btc_fnc_deleteEntities?

winter rose
#

(it deletes bitcoins)

copper raven
#

i mean if it's a recursive call back to this then it's your initial input, code looks ok to me(except it could be done better)

still forum
#

recursion like that in unscheduled can lead to game crash

#

so better not do that

copper raven
#

๐Ÿค”

unkempt zenith
#

Hi all im trying to add the drag body ability to my mp mission. Ive found the code online but ive no idea where to put it?

The codes:
null = allUnits execVM "H8_dragBody.sqf";
[uNIT1,UNIT2,UNIT3] spawn H8_addDrag;

willow hound
#

Is that all the code you have or did you find some more? Because this is not going to work without the H8_dragBody.sqf and fn_addDrag.sqf files.

unkempt zenith
#

thats all i found atm

willow hound
#

So you have no files named H8_dragBody.sqf and fn_addDrag.sqf?

unkempt zenith
winter rose
#

maybe there is a readme with it?

willow hound
#

Alright.
Step 1: Click Reveal hidden contents and copy the code it reveals.
Step 2: Create a file called H8_dragBody.sqf in your mission root folder.
Step 3: Paste the code from Step 1 into that file.
Step 4: According to the post, all you need to do to set it up is paste null = allUnits execVM "H8_dragBody.sqf; into a file called init.sqf (create it if you don't have it already).
[Unit1, Unit2, ...] spawn H8_addDrag; is, according to the post, used to add units that were spawned mid-mission to the system.

#

The post was last updated in 2014, so no guarantees.

unkempt zenith
#

ty ill give it a try

slim verge
winter rose
#

I believe it's array of [string, string]

slim verge
#

well yeah but cannot return any value from a default vanilla unit and no examples of addresources either

oblique arrow
#

["Legs"]; is a resource

winter rose
#

["potatoes"] might be too

oblique arrow
#

according to

teamMember _agent deleteResources ["Legs"];

slim verge
#

tried returning value got nothing

#

so were all farmers and surgeons now are we ๐Ÿ™‚

oblique arrow
#

although saying "I'm going to remove my teammates potatoes" sounds a bit wrong

slim verge
#

so we could remove thge arms legs and hands and rename the unit bob, put him in the middle of the sea and have some fun, is this where arma milsim has gotten these days ๐Ÿ™‚

little raptor
winter rose
#

and deleteTeam takes a teamMemberโ€ฆ
I believe it was planned to be much more, but got abandoned in the middle

exotic flax
#

why is SQF such a pain...
Error parsenumber: Type Number, expected Bool,String
I might have a number which needs to be a number... breaks when it's a number...

copper raven
#

i don't see anything wrong with it? ๐Ÿ˜„ it wouldn't make sense to make an overload for parseNumber which takes a number and returns the same number

unkempt zenith
#

How do i make a text appear on screen? caused by a trigger?

finite sail
#

see the additional information paragraph to see other option

unkempt zenith
#

ty

mental wren
#

is there a way to build variable names with arguments?
Like

prefix = "test";
hint damage (prefix + "_01");
robust hollow
#

so prefix_01 would be a variable of an object?

mental wren
#

getVariable seems to be it yeah

#

and if the variable is an object in the mission file I'd use missionNamespace getVariable (prefix + suffix) for example?

#

had an aneurysm writing that lol

#

ye my god, the example is literally what I need

#
for "_i" from 0 to 5 do {
    _car = missionNamespace getVariable ("car" + str _i);
    _car setDamage 0;
};
#

thanks a bunch

still forum
hollow plaza
#

Previous method did not appear to be waterproof after all, now I have [this] execVM "speedBoost.sqf"; in the init field of 2 units. This will give them a new action in the sqf file:
_speedBoost_action = _runner addAction["Stim Boost", "boost_activated = true", "", 1.5, false, true, "", ""]; where "_runner" is _this select 0
Now once again my problem is the fact that anyone with the execVM in their init is able to activate this action upon each other. What I want is that all those with the execVM can only use the addAction that has been placed on themselves.

robust hollow
#

put the execvm in initPlayerLocal.sqf instead

#

editor init fields execute for everyone, so everyone would see everyone else's action

hollow plaza
#

Wouldn't it be heavier this way though, as the action is meant to only work for certain units

robust hollow
#

no, just add variable names to those certain units and a condition in the script to only execute if you are one of those units

hollow plaza
#

If the execVM was in initPlayerLocal.sqf, I'd guess that there would need to be a parameter/condition within the addAction itself

robust hollow
#

no? something like this

params ["_player"];
if (str _player in ["u1","u2"]) then {[_player] execVM "speedBoost.sqf"};
#

action would only add to those two units, and you only need to edit one file if you want to change it, rather than on multiple units

hollow plaza
#

I'll try that next, still pretty much an amateur in Arma scripting

winter rose
#

Public Service Announcement:
The wiki is handling big changes about commands and functions categories - the changes are mostly about standardisation (e.g Scripting Commands Arma 3 โ†’ Arma 3: Scripting Commands)

During this time, categories may (will) be incomplete (see for example:
https://community.bistudio.com/wiki?title=Category:Scripting_Commands_Arma_3&redirect=no
vs
https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands)

Don't worry, nothing is lost, the search bar still exists. If you end up on an almost empty category, click "what links here" (bottom left of the screen) and there will be a link to the "old" category.

If you find any other discrepancies, please let us know in #community_wiki. Thank you!

tough abyss
#

Hello everyone im a inexperienced mission maker for Arma 3. Looking to get some help. Currently making a SP mission in Eden, want a video I made to be played from the player immediatly after the mission starts. If possible the briefing would be even better to have the video. Any help would be wonderful. Thank you all.

tough abyss
#

Hello all,

I currently run a small but solid milsim unit and was in process of overhauling my training base again.
I want to have it so the basic's uniform and field kit is on a scroll wheel instead of having to go into the arsenal.
Any help would be much appreciated

Regards
Braid ๐Ÿค™

oblique arrow
tough abyss
#

, {hint "RED"}];
Just out of interest what am I looking at here?
player addAction ["<t color='#FF0000'>Phase 1 Uniform</t>", {hint "RED"}];
This is on the end of this

oblique arrow
#

hint just shows a small hint in the top right corner

#

if you dont know a command you can just look up its wiki page

#

also with addAction have a look at example 5

tough abyss
#

Yeah seen, so if I write up something and test it. If it doesn't work would you mind taking a quick look at it?

oblique arrow
#

You can just post it here

tough abyss
#

Yeah roger cheers ๐Ÿ‘

oblique arrow
#

mmh it could, but it'd propably be easier to just use a getUnitLoadout and setUnitLoadout combo

tough abyss
#

I'm just gonna test it before hand ๐Ÿ˜†

oblique arrow
#

as in make an ai somewhere with simulation and damage disabled, and give that the loadout you want the people to have

#

call that ai something like _loadoutbase

cosmic lichen
#

Why a unit?

#

Make a loadout config

oblique arrow
#

true that works too

cosmic lichen
#

and load that with setUnitLoadout

oblique arrow
#

I've just never done it before

tough abyss
#

_unit setUnitLoadout (configFile >> "EmptyLoadout");

#

I saw that but wouldn't know how to make a config ๐Ÿ˜ฌ

cosmic lichen
#

read ๐Ÿ˜‰

warm hedge
#

Read before doubt, BIKI is always your friend ๐Ÿ˜„

tough abyss
#

๐Ÿ˜† Yeah now looking through the forums I realise this lmao

#

Any ideas, I couldn't find the full example on the BIKI?

warm hedge
#

The examples are listed below ๐Ÿ™‚

cosmic lichen
#

you are missing a 'this' @tough abyss

#

also, shouldn't setUnitLoadout not be part of the add action?

#

ah also

#

use if (isLocal this) then { your code };

#

This is an init field which is executed globally and JIP

#

So ppl will repeatedly get these action added if a player joins

tough abyss
tough abyss
cosmic lichen
#

read please

#

Check the syntax

tough abyss
cosmic lichen
#

Don't worry

#

All good

warm hedge
#

Everyone starts from nothing

tough abyss
#

Hey, new to scripting (the wiki has been a big help) but I'm looking to add a script for individual player respawn tickets. I am sure I read somewhere that it is possible.

little raptor
#

you could've found that with a simple googling:
arma 3 add respawn tickets

tough abyss
#

Ok. I use that one for global tickets. How do I translate that to individual players so I can add to when a an objective is taken by that player. Simply reading the wiki is easy, but interpolation is not really my strength.
@Leopard20 no need to be rude

finite sail
#

#makingyourselfpopular

tough abyss
#

No really trying to be popular just asking a question.

finite sail
#

the answer to your question is on the page you were given a link to

#

hint: for the individual players, choose the appropriate respawn template

#

hint2 description.ext file is where it lives

tough abyss
#

Ah right got it now, missed it first time round. Thanks, appreciated :)

finite sail
#

๐Ÿ™‚ welcome

winter rose
cosmic lichen
#

It's not like the wiki has no search...

winter rose
little raptor
#

let's not panick everyone! meowsweats

little raptor
winter rose
#

nah ๐Ÿ˜„ I like mayhem ๐Ÿ˜„

still forum
little raptor
#

who gave him his Nitro back?! ๐Ÿ˜„

ripe sapphire
#

hey guys what is up

#

how do you adjust volume of vanilla music that is played through playMusic?
ex.

playMusic "OM_Intro";
winter rose
ripe sapphire
#

thanks lou! it wasnt mentioned in the playmusic wiki, so i was confused

#

is it possible to apply db + 10 on the volume of vanilla tracks?

winter rose
ripe sapphire
#

thanks for the help!

hollow thistle
#

IIRC you can do something like 0 fadeMusic 2 to make it louder.

#

At least it was working at some point.

still forum
tough abyss
#

Apologies for a mundane question, but if I want to trigger an event, such that, when player open a crate's inventory, it will be closed immediately, what trigger could I use for that ?

winter rose
tough abyss
#

as in, per my understanding, containeropened could be use to activate something, in the event that the container is opened

winter rose
#

do you want to prevent container usage, or close the interface after some point?

tough abyss
#

my intention is to prevent container usage indeed

winter rose
#

then use InventoryOpened, check that the _box corresponds to the wanted one, and return true

tough abyss
#

I will give it a go ! Many thanks for your advice !

ripe sapphire
#

if you just want to prevent usage, wouldnt disabling simulation on the crate be easier?

tough abyss
#

so my first thought was, having some kind of code to immediately close the container inventory in InventoryOpened condition when I want to prevent container usage

little raptor
#

@tough abyss

then use InventoryOpened, check that the _box corresponds to the wanted one, and return true

player addEventHandler ["InventoryOpened", {
  params ["_unit", "_container"];
  _container == MY_container
}]
#

prevents opening the inventory on MY_container for player

#

please use syntax highlighting for your codes (see the pinned messages)

tough abyss
little raptor
#

no, that's wrong

tough abyss
little raptor
#

the way event handlers work is that you add them, and when the engine detects the event, the code fires

#

now can you see what the problem would be if you did that?

tough abyss
#

by best guess the weapon case itself can not open the container, hence code will never be fired

little raptor
#

also, containerOpened can't prevent opening the inventory

little raptor
# tough abyss by best guess the weapon case itself can not open the container, hence code will...

well no not that.

  1. you add the EH to a UNIT:
  2. as I said, the code fires when the inventory opens. this is the code:
 params ["_unit", "_container"];
  _container == playerWeaponCase

so I use it in the event handler like this:

player addEventHandler ["InventoryOpened", {
  params ["_unit", "_container"];
  _container == playerWeaponCase
}]

and this is what runs by the event handler when you open the inventory

If you're confused why there's no true at the end, remember that _container == playerWeaponCase is a "condition" (a boolean), and it returns true/false when it evaluates

tough abyss
#

ohhhhhhhh

#

hmmmm

#

Many thanks for your advice, I do admit that, I am still having a bit of a trouble understanding params at the moment

little raptor
#

params is simple

#

when you have an array, params assigns the elements of the array to the variable names you provide:
for example:

[1, 2, 3] params ["_a", "_b", "_c"];

it creates the 3 "private" variables: _a, _b and _c
and _a is 1, _b is 2 and _c is 3

#

if you use params without any array before it (like that previous code), it takes _this as the array

#

so the previous code could also be written as:

_this params ["_unit", "_container"];
#

(_this is a "magic" variable created by the engine)

tough abyss
#

That indeed makes alot more sense.

#

I think I would need a few moment to absorb all of that, as I'm indeed practicing with arma 3 scripting only recently.

#

But thank you so so much @little raptor for taking your time explaining it to me ๐Ÿ˜„

little raptor
#

np

tough abyss
#

@little raptor I'm so sorry for the inconvenience, indeed your code works as intended, However, I do admit that I still do not fully understands how this part:

_container == playerWeaponCase

managed to disable opening inventory.

Hence, in the case that I want to trigger opening the inventory again, what approach should I use ? And if possible, would you mind explaining the logic behind this

_container == playerWeaponCase

being able to disable the inventory ?

little raptor
#

@tough abyss
well, the event handler says that I should return "true" at the end to disable the inventory right?
so that means if I use anything that gives me a "true", it works
you asked you wanted to disable the inventory for a certain box, so I use the == operator to compare _container and playerWeaponCase and see if the two match:
https://community.bistudio.com/wiki/a_%3D%3D_b
if you look at the command, it says it returns a "boolean". aka true/false
so the command checks the condition:

_container == playerWeaponCase

and
if they're the same -> returns true (inventory disables)
if not the same -> returns false (doesn't affect the inventory)

#

of course, you could've written it as:

if (_container == playerWeaponCase) then {
  true
} else {
  false
}

but that's redundant

#

because if you look at the if command:
https://community.bistudio.com/wiki/if
it also takes a boolean as the condition (if boolean then)
so you just give it a boolean to give you boolean! ๐Ÿ˜„ (a boolean can only have two values, so you can manipulate it without an if)

tough abyss
#

Ohhhhhhhh

#

now that makes alot of sense

#

Many thanks for your help ๐Ÿ˜„ I'll take abit to absorb it into my head ๐Ÿ˜„

little raptor
#

ok! ๐Ÿ˜‰

tough abyss
#

Currently making a SP mission in Eden, want a video I made to be played from the player or screen possibly immediatly once the mission starts as a sort of briefing. Any help would be wonderful. Thank you

little raptor
#

so you want it to be played from like a monitor object or on the user's screen?

tough abyss
#

Im inexperienced at coding arma 3... So i suppose a monitor object. Yknow how you can put a custom texture on those monitor objects? Would it be possible to play a video on those?

tough abyss
# little raptor ok! ๐Ÿ˜‰

Apologies for asking again :/ But indeed, now that I understand the

_container == playerWeaponCase

is used to compare when those two are a match or not, and at true, inventory is dissabled.
However, the part that is still troubles me is that, which part in this:

player addEventHandler ["InventoryOpened", {
  params ["_unit", "_container"];
  _container == playerWeaponCase
}]

is the code that decides, at true, inventory is disabled ? Since param assigns variables to _this, but what in _this decides the inventory is dissabled ?

#

Maybe you know a few ways to play videos in arma 3 if so id love to know bc im really unaware

little raptor
#

_this is a magic variable

#

it's already available

#

params is simply assigning what _this (an array) contains to new variables

#

so it is defining _unit and _container for you

#

naturally you can name them whatever you want:

params ["_dude", "_box"];

because they're just variable names

tough abyss
#

just as an example ofc !

little raptor
#

yes

#

it disables it altogther

tough abyss
#

ohhhhh

#

so right now, I am having the dissable code running in an if statement

#

when I switch the condition to else

#

the dissable code still functions

#

@little raptor should I put a code in the else statement to override this ?

player addEventHandler ["InventoryOpened", {
  params ["_unit", "_container"];
  _container == playerWeaponCase
}]
little raptor
tough abyss
# little raptor not sure what you mean you can post the whole code

Right now, my structure is like this:

if (StoponKill == true) then
        {    
            player addEventHandler ["InventoryOpened", {
            params ["_unit", "_container"];
            _container == playerWeaponCase
            }];

            
        }
        else
        {    
              Something other random code 
            }];

My Intention is, when the else condition is triggered, the inventory for playerWeaponCase is openable again.

#

@little raptor well ok ill take a look. Thank you

#

Hmmm ok so... I take my mp4 (will probs have to convert to ogv but no biggie. And i basically use this cmd in the init for the mission?
The function is called or spawned again with another video, for example "\a3\missions_f_exp\video\exp_m04_v02.ogv"["\a3\missions_f_exp\video\exp_m04_v02.ogv"] call BIS_fnc_playVideo;

little raptor
little raptor
little raptor
#

for one thing, it will throw an error

tough abyss
#

Oh wow wonderful find Leopard. That's for sure what im looking for. With that Armaholic Mod I can just upload my briefing video on yt and then i can cast it basiclaly to a screen.

#

Thanks so much

#

Yea i can easily follow these directions. Nice

little raptor
tough abyss
finite sail
#

@tough abyss please report back if you get that working, I never could

robust hollow
tough abyss
#

Ik dw

#

Misworded

exotic flax
#

either 2n*2n or 2n*1n (so 512px by 512px, or 1024px by 512px)

#

which is required for in-game textures anyway

robust hollow
#

check an existing texture

exotic flax
#

You can check the source files

robust hollow
#

getObjectTextures _infostand, follow the file path in the arma files and open the image

exotic flax
#

although just checked it for you and it's square (default is 256x256)

lean anchor
#

is there a way to respawn vehicls with AI crew and init? i am wanting to use AI as CAS and im needing to simply spawn them and have them re spawn with a certain init field applied

round scroll
#

not sure on respawn besides scripting it completely though

hallow mortar
#

the Vehicle Respawn module has an Expression field which I believe can be used to target the respawned vehicle for code

#

you should also be able to use the Respawn event handler (note: you will need to re-add the EH as part of the code executed by the EH)

timid niche
#

does onEachFrame have a big performance effect?

robust hollow
#

depends what you do in it

#

eg:
onEachFrame {} unnoticeable
onEachFrame {allMissionObjects ""} very noticeable

timid niche
#

makes sense

sand pivot
#

Are some ofp commands the same with todays arma?

warm hedge
#

Most of

ripe sapphire
#

Hi

#

Does a disabled simulation object has significantly bigger performance impact compared to simple objects?

warm hedge
#

Damn you beat me to it

#

Basically Simple Objects have better performance, according to the pic

ripe sapphire
livid wraith
#

are displayEventHandlers persistent after the display is closed, or do you have to add them each time the display is opened ?

ripe sapphire
#

Another question does having a lot of game logics bad for performance?

robust hollow
finite sail
#

how many is a lot, @ripe sapphire ?

#

I've got between 60 and 100 depending on which map, i store data on them

ripe sapphire
#

Last comment says be careful when using it in MP, as it creates game logics

#

So i was wondering why

finite sail
#

following advice is accepted at own risk

#

I wouldnt worry about it too much

#

unless you're making hundreds

#

yes, you need to use createunit, which is sent across the network, so making lots of them during runtime, at the same time, will generate a lot of traffic

#

there's no createunitlocal.. I make mine before the mission is proper running, are you able to do that?

ripe sapphire
ripe sapphire
finite sail
#

yeah, moslty... lots of traffic will cause stutters, but tbh, they come with the territory in this game if you're spawning stuff during runtim

#

oh, they are edenplaced? well that's ok then

#

they are generated outside of runtime

ripe sapphire
#

Nice thank you

#

Another question, is it possible to disable eden placed modules, and activate them after a trigger?

#

I want to activate a tracers module after a trigger

#

Tried doing enablesimulation false and then set to true but that doesnt seem to work (tracers wont fire at all)

willow hound
#

Have you tried syncing the trigger and the module?

little raptor
#

a module is a function, and it executes when the module initializes

#

enabling it doesn't mean the function will execute

ripe sapphire
#

I see

oblique arrow
ripe sapphire
#

How do i find out what functions the module calls?

exotic flax
#

check the source code

little raptor
#

function

#

open the module in config viewer and find its function

#

but you're better off creating the module manually with createVehicle

#

if what ansin11 and Pi123263 said doesn't work

ripe sapphire
little raptor
#

I'm not a mission maker so I have no idea what they're talking about! ๐Ÿ˜„

ripe sapphire
#

Wait you can create modules with createvehicle???

little raptor
#

you can

#

but you're better off creating the module manually with createVehicle

ripe sapphire
#

๐Ÿ˜ฎ

little raptor
#

but some modules only work at mission init

#

like the curator (Zeus) module

ripe sapphire
#

I think iโ€™ll just go with that, as i can just do that in an sqf instead of making triggers again

exotic flax
#

does it? I create those after mission start without a problem ๐Ÿคทโ€โ™‚๏ธ

little raptor
#

iirc yes.
or maybe it was the high command module?
or maybe both?
I don't remember which one it was

ripe sapphire
#

So i find the module classname in config editor and then createvehicle it right?

#

How do i adjust the module parameters in this way?

little raptor
#

createUnit is better

#

create a sideLogic group and create the module in it

little raptor
exotic flax
little raptor
#

I think you'll have to use the alternative syntax with init

#

not sure

exotic flax
#

because even I get confused by all the information posted in this channel ๐Ÿคฃ

little raptor
#

@ripe sapphire yeah I was right.
use the alternative syntax of createUnit

ripe sapphire
#

Aaahhh i see

#

I will try it thanks guys

finite sail
#

guys.. is there a way of getting a linefeed into a setMarkerText?

#

i've tried formatting a /n and a \n

#

i can never remeber wich it is

oblique arrow
#

can markers even me multiline? cant remember if I've ever seen one

finite sail
#

i never have

oblique arrow
#

*be

finite sail
#

ive tried using format to get a lf in using

#

toString [0x0D, 0x0A]

#

but its ignored

vague geode
#

Is there any way to get any information about the "spotted enemy"-markers on the map (e.g. vehicle type, position etc.)?

willow hound
# ripe sapphire Yeah i havent tried this

That's the whole point of modules - do be used in the editor. The Create Task / Set Task State modules for example, what would be the point of making them if you can't easily set them up in the editor? At least those two work with triggers and I'm sure most or at least many others do too.

oblique arrow
#

I dont think I've had a module that didnt work with triggers? I havent used them all with triggers yet though

ripe sapphire
#

I know, but i dont like using many triggers

#

Triggers are loops that check for a condition

willow hound
#

(Some of) the ORBAT modules might not play with triggers, dunno.

ripe sapphire
#

So they will affect performance

willow hound
#

Which module are you trying to use?

oblique arrow
ripe sapphire
willow hound
ripe sapphire
#

yes, thank you

fair drum
#

so I have this

https://pastebin.com/maWV8syX

but for some reason, it will place me in a parachute and all AIs running it on a listen server, but any other player, it will not place the player in a parachute and they fall to their death. I don't think i have any locality issues on this one, could I get a check?

fair drum
#

๐Ÿ˜ฆ

#

i see ty

vague geode
still forum
#

read what the wiki says on the parameters

#

at the end, in parenthesis

fair drum
#

@vague geode

#

"since Arma 3 v2.01.146752"

vague geode
#

I thought we had version 2.01.146752 already but I just checked and it's only 2.00.146773 so that explains it.

oblique arrow
#

.01 is dev branch @vague geode

#

stable = straight, dev branch = not straight

#

.00/.02 = stable

vague geode
#

Is there a way to get the position of a unit in a players group from the unit itself (whether the unit is number 1 or number 4)?

little raptor
#

I've never tried it so I don't know

stable badger
#

Hi everybody.

I created a mod who have most animation.
On my config.cpp I have an init who execute my : trico.sqf
my trico.sqf change the animation of the object like this :

_feu animate ["red",1,true];
sleep 30;
ect ...

My animation will be remoteExec the same time on everyClient ?

little raptor
#

it executes for everyone when you create the object

#

but the code will be unscheduled

#

sleep 30;
thus your code must be spawned

stable badger
#

my code is execVM from the object ๐Ÿ˜„

little raptor
#

for speed

stable badger
#

no just a while trop like that :

_feu = _this select 0;

while {true} do
{
    _feu animate ["bas",0,true];
    sleep 25;
    _feu animate ["bas",1,true];
    _feu animate ["mid",0,true];
    sleep 5;
    _feu animate ["mid",1,true];
    _feu animate ["haut",0,true];
    sleep 30;
    _feu animate ["haut",1,true];
};
little raptor
#

the command has global effect

#

so it must only be executed on the server

#

so at the top, put this:

if !isServer exitWith {};
stable badger
#

So if i'm on editor i can't see the animation ?

little raptor
#

I mean it is executing for everyone.
but the command has Global effect
so you're executing duplicate commands
in other words, you're wasting the network bandwidth
and slowing down the game

#

when a command has global effect, only one computer must execute it

hollow lantern
#

do Land_Runway_PAPI have a specific need for code to work or how does the engine handles them? I have created them on Malden on the Pegasus Island but they don't seem to work on the Airfield no matter what.
Did a createVehicle first, then switched to a 3DEN collection for easier use in the editor and placed them via 3DEN then. Still no luck.

The official placed PAPI of the big runway on Malden is 143m away from the threshold, despite DTA stating a requirement of 1000ft (304m) but neither of those distances work to get it to life.
It either always shows a red-on-red or white-on-white light. No matter what, the red-on-white never occurs.

calm badger
#

any way to get the muzzle name of a modded vehicle without directly asking the makers?

#

trying to follow a scripted bombing tutorial but I need the muzzle name for the RHS Mig-29's bombs

robust hollow
#

try sitting in the vehicle, select the bombs and use currentMuzzle player in debug ๐Ÿคท

calm badger
#

Thanks, will try

hollow ibex
#

Is there anyone that is good with EOS system I added a custom faction and the units spawn but the tanks have an issue they will shoot at me but wonโ€™t move around. I have files and the error log to show but is a lot of info to post was wondering if I may DM anyone with info to assist.

#

I spent over 10 hours now fixing the errors but canโ€™t get the tanks to work

winter rose
hollow ibex
#

Oh okay I should have thought of that Iโ€™ll do that and post again soon thank you Lou

sonic linden
#

hi whats the best way to get the exact range between a player and a missile hit ?
I tried something like this, but it dose not work only returning 1000000000m

AM_debug = 0;
player addEventHandler ["Fired",{
    _projectile = _this select 6;
    systemchat str _projectile;
    AM_debug = 0;
    _track = [_projectile] spawn {
        params ["_projectile"];
        while {_projectile distance player > AM_debug} do {
            AM_debug = _projectile distance player;
            sleep 3;
        };
        copyToClipboard str (AM_debug toFixed 10);
        systemchat str format ["Range: %1 m!",  AM_debug toFixed 10];
        true
    }
}];
ebon citrus
#

Because the projectile dies

#

And gets sent to Brazil

#

You need to get the position where the missile hits by recording where it was at when it was last alive

sonic linden
#

can you maybe provide me an example i cant get it to work

leaden summit
#

Basically I've put down some weed plants and when the player drops an incendiary grenade in that area I was going to trigger some smoke and fire modules and then after a few seconds setdamage 1 the plants

exotic flax
#

Well, you could try to use the "FiredNear" Event Handler to check if someone threw a grenade in a certain area.

Although the script (by pierremgi) in that forum post is doing exactly what you want; it will check if a grenade is inside the area and you could even check if it's on the ground and not moving.

leaden summit
#

I tried that script but as soon as the mission starts the trigger shows as activated

#

I assume because it's set to true

ebon citrus
#

I'm not at the luxury of milling around arma today. Sorry

#

but you can make a while-loop which checks the missiles "alive" state

#

and if it's alive, records the last known position

#

simply getpos

#

once the loop is exited, the missile is no longer alive and the last position is the position you want

#

so jstu change your while loop to:

while {alive _projectile} do {
            AM_debug = _projectile distance player;
        };```
robust hollow
#

I'd use waituntil instead so it isnt updating more than once per frame

#

a quick test showed while updating the var ~150 times per frame, which some may say is excessive.

#

it would depend on fps i guess, but still waituntil or a short sleep is advisable.

ebon citrus
#

because once the missile is "dead" it doesnt have a position anymore

#

you can slow down the checks by introducing sleep

#

to the loop

robust hollow
#
waitUntil {
    _alive = alive _projectile;
    if _alive then {AM_debug = _projectile distance player};
    !_alive
};```
ebon citrus
#

i see

robust hollow
#

not as nice to look at but would update more frequently than while with sleep

ebon citrus
#

you could make it a draw eventhandler too

#

it can be run in unscheduled environment since it isnt all that intensive task

robust hollow
#

true, and now you mention that, if using cba you could use the each frame handler.

ebon citrus
#

get a bit more accurate result

#

i mean missionEventHandler

#

this here

robust hollow
#

yea, the cba thing is the same thing but on eachFrame instead of draw, and it handles deleting "events" for you.

ebon citrus
#

i gave "draw" as just one example

#

came off the top of my head for having worked with UI more

fair drum
#

_localOffset: ARRAY The model space position offset that projectile should be homing towards to

can i get an explanation of this so I know how to use it?

#

is this the projectile heading?

#

BIS_fnc_EXP_camp_guidedProjectile

robust hollow
#

this is how it is used in the function

private _targetPos = if !(_localOffset isEqualTo [0.0, 0.0, 0.0]) then {AGLToASL (_target modelToWorldVisual _localOffset)} else {getPosASLVisual _target};
#

so you would use it if you want the projectile to aim for a position relative to the position of the target

chilly wigeon
#

Anyone have any pro tips for silently checking if a file exists on a dedicated server?

#

I've been using this:

params ['_path'];

private _exists = if (hasInterface) then {
    private ["_ctrl", "_fileExists"];
    disableSerialization;
    _ctrl = findDisplay 0 ctrlCreate ["RscHTML", -1];
    _ctrl htmlLoad _path;
    _fileExists = ctrlHTMLLoaded _ctrl;
    ctrlDelete _ctrl;
    _fileExists
} else {
    !((loadFile _path) isEqualTo "")
};

_exists

Which I could have sworn worked on the server, but threw a message in the rpt and that was it. But now it's actually causing the server to kick back to the mission select screen when run on PreInit and I find myself questioning if I ever tested it after I wrote it like 4 months ago and if it ever worked.

robust hollow
#

if possible, executing in postinit works fine

chilly wigeon
#

Unfortunately I need it for PreInit as well, trying to make easy mission scripts where folders can just be deleted and the system detects that on its own.

vague geode
#

Is there a scripting method to force AI to take cover (or alternatively go prone)?

ebon citrus
#

@chilly wigeon make a variable and check if the variable is flipped

#

*flag

#

If youre talking like addons

#

Oh wait, mission notlikemeow

#

My bad, didnt notice that

#

@vague geode you can force the prone action, if that's what you mean

#

You can also set the AI behaviour mode

#

Whether it's calm or otherwise

#

You can also write your own FMS for the AI

#

To make it do what you want

vague geode
#

@ebon citrus Thanks, I'll see what I can do.

little raptor
still forum
#

can just use loadFile but it'll throw errors

robust hollow
#

that was the issue. during preinit, using loadfile on a missing file skips the mission

little raptor
#

@still forum

Which I could have sworn worked on the server, but threw a message in the rpt and that was it. But now it's actually causing the server to kick back to the mission select screen

#

not sure why it happens but the OP says it does

still forum
#

oof

#

yeah i hate that error in log == fail mission

#

My server has that stuff disabled because its too annoying ๐Ÿ˜„

vague geode
winter rose
slow isle
#

is there a way to make AI ignore the formation?

#

basically setting the formation to none

winter rose
slow isle
#

it would be the same as the AI not being in a group

#

but when they are in a group I can do stuff easier in eden

little raptor
#

the AI move in a group to make path generation faster.
what you ask means each AI will have its own path generation, thus slowing down the game

slow isle
#

I prefer this

#

due to my situation

#

I will explain further

little raptor
#

but if you still want to do that despite what I said, you can either give them individual move orders, or put them in different groups

slow isle
#

Here is a picture of my AI

#

1 sec

#

I want them in a group for ease of access of behaviors and other things

#

but I don't want them in a V formation when not moving

#

or is it impossible

#

I get all of these handy options

#

and the option to write a script to all

little raptor
slow isle
#

thanks

fair drum
#

anyone else get script errors when using RHS united states vehicles? something in their FCS script is undefined

fair drum
#

it seems to be with the main cannon. let me see if i can get a screen

#

wonder if its gonna be in the .rpt, let me look

#

it has to do with the variable _toSelect

little raptor
#

dunno
I just tested a couple of tanks, bradleys, strykers. no errors
if there's an error report it on their discord feedback tracker

fair drum
#
12:16:55 unable to get word:'laserdesignator' in protocol:'radioprotocoleng'
12:16:55 Error in expression < = [_v] call rhs_fnc_ammoIndexing;


_v selectWeaponTurret [(_magazines # 0),[0]>
12:16:55   Error position: <selectWeaponTurret [(_magazines # 0),[0]>
12:16:55   Error Type Any, expected String
12:16:55 File \rhsusf\addons\rhsusf_c_heavyweapons\functions\rhs_firedFCS.sqf [RHS_fnc_firedFCS]..., line 28
12:16:57 Error in expression <Turret [_w,[0]];
_v selectWeaponTurret [_toSelect,[0]];
};

private _readdFCS = >
12:16:57   Error position: <_toSelect,[0]];
};

private _readdFCS = >
12:16:57   Error Undefined variable in expression: _toselect
12:16:57 File \rhsusf\addons\rhsusf_c_heavyweapons\functions\rhs_firedFCS.sqf [RHS_fnc_firedFCS]..., line 37
little raptor
#

๐Ÿคท post it on their feedback tracker

vague geode
vague geode
#

Is there a way I can change the combat mode for a single unit without affecting the rest of the group (by scripting)?

cosmic lichen
#

@vague geode

vague geode
#

Ok, I'll wait...

little raptor
#

there is a way to do it in the stable

#

but not as clean

vague geode
#

Go ahead...

little raptor
#

let me dig it up
not in the mood to type!

winter rose
little raptor
#

yeah

#
_units = groupSelectedUnits player; // just some array of units
_originalGrp = group (_units#0);
_sideUnits = side _originalGrp;
_tempGrp = createGroup _sideUnits;
_units joinSilent _tempGrp;
_tempGrp setCombatMode _desiredCombatMode; //e.g "RED"
_units joinSilent _originalGrp;
deleteGroup _tempGrp;
#

you also need to save the team (assignedTeam), then re apply it

#

also, the unit will forget its last command when it joins back!
so it just follows the leader

slow isle
#

what should I add //here// call BIS_fnc_removeRespawnPosition; to refer to a synced module

#

or it doesn't work like that

#

the code is stored in a trigger

slow isle
#

I'm talking just in general, I'm using this code as an example

#

I think I didn't ask my question correctly, i'll try again

#

How should I refer to an "object" which is synced to a trigger

#

basically to replace this or objectName

little raptor
#

try the synchronIzedObjects command

slow isle
#

will do

little raptor
slow isle
#

ty

#

so just to clarify, this is how it should look like: synchronizedObjects call BIS_fnc_removeRespawnPosition;?

#

because this example confused me so much _objects = synchronizedObjects _logic;

#

and what do the underscores mean _genericKeyword ?

#

and also what is 1 in this case [west, 1] call BIS_fnc_removeRespawnPosition;
It is called "id" but what does it do?

little raptor
slow isle
little raptor
# slow isle that's the article I got it from

when you use that command it gives you the ID

_id = ([west, [0,0,0]] call BIS_fnc_addRespawnPosition) select 1;

which you then use with the remove command:

[west, _id] call BIS_fnc_removeRespawnPosition;
#

but again, explaining this is pointless since you don't know any SQF

slow isle
slow isle
#

or should it be in the respawn module

little raptor
slow isle
slow isle
little raptor
slow isle
#

I would guess this is supposed to be in the trigger (deactivation) [west, _id] call BIS_fnc_removeRespawnPosition; and this in _id = ([west, [0,0,0]] call BIS_fnc_addRespawnPosition) select 1; init.sqf? Or where should I search for the id? in the trigger or?

little raptor
#

I can't really explain this without you knowing some SQF (and what you say makes no sense)

when you use the trigger as a respawn, the game simply uses its position ([<target>,<position>] call BIS_fnc_addRespawnPosition; )

there's no way to know the ID unless you save it yourself (which means you'll have to execute the command yourself, which means you should know some SQF to be able to do it)

#

and SQF is really simple. like I said, it only takes you a couple of days to learn if you've done some programming before

slow isle
#

Did I make my question clear

slow isle
willow hound
willow hound
slow isle
#

couldn't we just call the respawn with it's variable name? example: respawnPosName call BIS_fnc_removeRespawnPosition;

slow isle
slow isle
#

but begs another question - Can't I "disable" the respawn instead of removing it?

#

for example if I disable it's simulation would it still be "existing"

willow hound
#

I don't know that. You can just try though.

slow isle
#

will do

#

It does disable it!

#

That makes it so much easier

#

thanks

fair drum
#

which command lets you compare data types? trying to write a check for object or group

hollow thistle
tidal swallow
#

Could someone find where ; is missing in this code?

fair drum
#

@tidal swallow i just threw it in visual studio code with a sqf-vm server and it doesn't show its missing any semicolons

robust hollow
#

the error should tell you roughly where

tidal swallow
#

oh nevermind

#

lmao

#

i forgot the ;

#

ffs

#

lmao

tidal swallow
robust hollow
#

search it, itl be the first result

#

or you can download sqflint/sqfvm use them in cmd

tidal swallow
#

awsome thank you

fair drum
#

so I'm trying to pull the value for a reload rate of an artillery between shots. I'm looking through the base config for the vehicle and I'm not finding anything of value. Is there a particular value I'm looking for?

winter rose
astral tendon
#

https://community.bistudio.com/wiki/setGroupId
this script only returns a empty array, any other way to get the available keyword?

"if ((configName _x) select [0, 5] == 'group') then {
    diag_log ('%' + configName _x);
    for '_i' from 0 to count _x - 1 do {
        diag_log ('* ""' + configName (_x select _i) + '"" โ†’ ' + getText ((_x select _i) >> 'name'));
    };
}; false" configClasses (configFile >> "CfgWorlds");
winter rose
#

you always return false, soโ€ฆ yes, empty result it is

astral tendon
#

so... whats the point?

winter rose
#

๐Ÿคทโ€โ™‚๏ธ
have something logged in the rpt

astral tendon
#

๐Ÿ™„

exotic flax
#

List of available keywords from config
It simply dumps all keywords in the log files (hence the diag_log), which is more useful than trying to do the same in SQF.
If you need the list in SQF just return true the moment it reaches the keyword(s) you need.

astral tendon
#

All I actually want was to just copy that array to a notepad file for later use.

neat sun
#

anyone know how to display a player name as text on the screen?
Im going for the green text they had at the start of MW2 campaign missions that showed date location and player name

winter rose
neat sun
#

thanks chief

exotic flax
slow isle
#

why doesn't this code in the onPlayerRespawn.sqf? this addAction["Open Arsenal", {[_this select 0, player, true] call ace_arsenal_fnc_openBox},[this]];

exotic flax
slow isle
#

player addAction["Open Arsenal", {[_this select 0, player, true] call ace_arsenal_fnc_openBox},[this]]; this now works

#

I changed this to player

#

thanks

exotic flax
#

you also need to change the [this] at the end to [player]

slow isle
#

hmm seems to work with it

#

I'll just keep it because it works

exotic flax
#

although it works, since _newUnit is also the player

finite bone
#

I'm trying to create a teleporter using triggers that teleports all the players that belong to a specific group "X" and is inside the trigger box/area to a different spot. My initial searching in google came down to this code:

Condition: this && (player in thisList)

On Activation: player setPos [4061 + random [-10,0,10],1434 + random [-10,0,10],1];```

This teleports all the players in the trigger box to the location. How do I modify this so that only players from the group ``Rangers (Forward Recon)`` inside the trigger zone is teleported and all others can still be in the zone?
finite bone
#

Nvm, found the solution!
Change the condition to this:

this && player in thisList && groupId (group player) == "groupname"```
real tartan
#

I have array of class names of (vanilla + modded) uniforms. Is there are a way to identify/select vanilla uniform from that array?

real tartan
#
_uniforms select { getText (configfile >> "CfgWeapons" >> _x >> "author") isEqualTo "Bohemia Interactive" };
slow isle
#

I think the second this is the error but idk what with to replace it

#

I tried doing this but to no success enteringObject = thislist select 0 && side enteringObject != blufor

#

What I want to do is make this for AI units too, not only players this && playerSide != blufor for debugging

#

because I don't have a friend to test it with rn

willow hound
willow hound
slim verge
#

? There is an incremental count when creating ppeffects that persist outside of the mission and even engine restarts. Is it possible to reset this, if so will it have any negative effects

slow isle
slow isle
#

is there a way to increase a vehicle's hitpoints with a script? If not, is it possible to allow vehicle damage but not destroy it and it remains drivable? Example: HMG shooting helicopter; Heliparts are yellow/red but don't get any more damage, hence the vehicle can't be destroyed

finite sail
#

in the BI respawn system using template menuposition, is there any way of getting which respawn object the player chose?

#

i can get the respawn itself using the respawn EH and I run a script fired from that

#

which happens when they chose a position from the menu and click respawn

#

but WHICH position. is what I'm after

exotic flax
#

getPos?

steel fox
#

Wouldn't it be simple to just find the position the player is less then idk, 5 meters from. Then you know where they spawned.

steel fox
exotic flax
#

but you already know where those positions are, so all you really need is the position of the player and check which one is the closest ๐Ÿคทโ€โ™‚๏ธ

finite sail
#

sometimes, those positions are on amoving vehicle

#

if a player clicks, they get run ovrer by the vehicle

exotic flax
#

๐Ÿคฆโ€โ™‚๏ธ
in that case checking on 'onPlayerRespawn' won't do much, since that gets executed after spawning anyway

finite sail
#

yes

exotic flax
#

but you could try the same method as got getting the role and loadout from that menu:

_rList = uiNamespace getVariable (["BIS_RscRespawnControlsMap_ctrlRoleList", "BIS_RscRespawnControlsSpectate_ctrlRoleList"] select (uiNamespace getVariable ["BIS_RscRespawnControlsSpectate_shown", false]));
_rName = _rList lbText (lbCurSel _rList);

_rName = "Name of Role";

Just check if you can do the same with the positions

finite sail
#

ooo that sounds hopeful

exotic flax
#

@finite sail
BIS_RscRespawnControlsMap_ctrlLocList
BIS_RscRespawnControlsSpectate_ctrlLocList
I believe these are the ones you need ๐Ÿ˜‰

finite sail
#

these are variables in the uinamespace?

agile pumice
#

What vector commands do I need to return objects only in the player's screen space?

little raptor
#

and make sure the result falls within the screen area

agile pumice
#

Could something similar to this also work? (proof of concept)

_units = ASLToAGL getPosASL player nearEntities [["Man"], 20];
_unit = {player getRelDir _units == 0}; 
finite sail
#

that's role, @exotic flax , not the respawn position the pl;ayer selected

little raptor
#

plus what you wrote will throw an error

#

and it doesn't even execute

agile pumice
#

I am aware, that's why I stuck the proof of concept there

#

I couldn't remember the syntax for using eval on an array with a boolean

little raptor
#

you need findIf

#

_array findIf {_condition} != -1

agile pumice
#

got ya, thank you

quartz coyote
#
ESM_spectatorUI = true;
ESM_spectatorUIEH = (call BIS_fnc_displayMission) displayAddEventHandler ["keyDown", {
    if ((_this#1) in actionKeys "cameraInterface") then {
        systemChat "STEP 2"; // Debug
        ESM_spectatorUI = false;
    };
}];```
For some reason, I can't find an ``actionKeys`` that could trigger my EH ... I'm in Spectator Slot but this is not firing when I press Backspace.
fossil yew
#

stupid question probably

I have a type name (class name). I want to find a config entry for that class name. How?

#

"(configName _x) == '29rnd_300BLK_STANAG_T'" configClasses configFile doesn't work

#

Something like configOf but with class name... ๐Ÿ™‚

little raptor
little raptor
fossil yew
#

I don't know if class is a magazine, weapon, display or anything

little raptor
#

well you'll have to do a search then

#

but that is extremely slow

#

if you know it can belong to some parent class, then you can narrow down the search

#

such as:

[configFile, configFile >> "cfgVehicles", configFile >> "cfgAmmo", configFile >> "cfgMagazines", configFile >> "cfgWeapons"] findIf {isClass (_x >> _className)}
#

this will cover over 90% of typical classes in the game
but if you want to search in the whole config, you can write a recursive function for that
and once again I warn you that it is extremely slow

agile pumice
#

for some reason this is still returning my player in the array?
player nearEntities [["Man"], 20] - [player]

little raptor
#

wrap the first expression in parantheses

agile pumice
#

so like _units = (player nearEntities [["Man"], 20]) - [player];?

little raptor
fossil yew
#

thx Leopard20 ๐Ÿ™‚

exotic flax
finite sail
#

I'm still fiddling with it, thank you ๐Ÿ™‚

willow hound
finite sail
#

the other vars are returning any at the moment, so its possible im doing something wrong

#

but I am still going

#

thanks for help

quartz coyote
quartz coyote
agile pumice
#

findIf appears to only work with one bool.

_units = (player nearEntities [["Man"], 20]) - [player];
_inScreenSpace = (count (worldToScreen getPos _x)) > 0;
_isClose = (player distance _x) <= 20;
_index = _units findIf {_inScreenSpace && _isClose};
_unit = _units select 0;
hint str format ["%1, %2", (count (worldToScreen getPos _unit)) > 0, (player distance _unit) <= 20];
//hint str _unit;

if ([_unit, true] call ACE_captives_fnc_canSurrender) then {
    [_unit, true] call ACE_captives_fnc_setSurrendered;
}

unit will surrender (ignoring the &&) but will hint true and false so both are not actually true..

winter rose
#
hint str [_inScreenSpace, _isClose]
little raptor
#

your code is wrong in all places

winter rose
#

but since your code throws an error โ†‘

little raptor
#

I meant you should use worldToScreen with inArea

willow hound
quartz coyote
little raptor
#

@agile pumice

_screenArea = [[0.5,0.5], safeZoneWAbs/2, safeZoneH/2, 0, true];
_units = ((player nearEntities [["Man"], 20]) - [player]) select {worldToScreen ASLtoAGL getPosASL _x inArea _screenArea};
#

and for the love of God, don't use getPos
I'd remove that stupid command if I was a dev
(I mean it is useful in some places but most people don't know what it is)

agile pumice
#

that inarea command threw a elements provided error

little raptor
#

fixed

#

it required 3 elements

#

I was using only 2

agile pumice
#

oh I see, elements for the screenarea

little raptor
tough abyss
#

question on BIS_fnc_randomPos function. For the parameter blacklist, areas could be: Location - location. Can I blacklist locations like "NameCity"," NameVillage"? I've tried several different variations of the array, but it throws an error of undefined variable.

_rndmRad = random [2000,2500,3000];
_blacklist = ["Airport","NameCity","NameVillage"];
//_rndmPos = [[[position player, 3000]],["water"]] call BIS_fnc_randomPos;
_rndmPos = [[[position player,_rndmRad]],["NameCity"], {isOnRoad _this}] call BIS_fnc_randomPos;
little raptor
#

@tough abyss see the pinned messages for syntax highlighting

#

sqf goes directly after ```
i.e. ```sqf

#

no line break, no space

#

anyway, what you're writing is not providing a location

finite sail
#

comment "Hi, I'm James Gastovski"

little raptor
#

[NameCity,NameVillage]

#

these are not defined

#

that's why you get undefined var

#

["NameCity","NameVillage"]
the game thinks you're providing markers

#

with those names

#

location is a special data type in sqf

tough abyss
#

@little raptor ok, I understand. I need to get those locations first, or create an array of those locations. I have a method I've used in the past. I was hoping to use the "NameCity" within the function. I see the link "Locations Commands" at the top of the wiki.

#

Thanks

little raptor
#

NP

tough abyss
#

And I'll work on my syntax highlighting skill, or lack there of....

little raptor
finite sail
#

it was confusing the fiirst time i did it ๐Ÿ™‚

tough abyss
#

yea I corrected to that. And it didn't take. Oh well.

finite sail
#

but its pretty simple really

tough abyss
#

I've got bigger issues as you can tell.

little raptor
#

ok

hollow lantern
#

how is the "Scan the Horizon" command done? Currently trying to figure out if there is a engine implemented way.
Otherwise a setFormDir with random 360 was my second thought

little raptor
fair drum
# winter rose it should be a weapon or magazine information I believe

it looks like its under the weapon config. so I have these lines I've found

configfile >> "CfgVehicles" >> "rhsusf_m109_usarmy" >> "Turrets" >> "MainTurret"  //["rhs_weap_m284"]
configfile >> "CfgWeapons" >> "rhs_weap_m284" >> "reloadTime"

how would I go about combining this to pull any reload time off of any vehicle?

winter rose
brazen lagoon
#

this is a bit more of a CBA question than just a plain arma scripting q, but

#

I'll ask anyway

#
_obj_to_owned_map = ["#CBA_HASH#",["c_15","c_6","c_0","c_2","c_62","c_10","c_39","c_42","c_36","c_40","c_17","c_29","c_28","c_43","c_41","c_44","c_11","CUSTOM_6950","CUSTOM_6805","CUSTOM_15041","c_19","c_12","c_14","c_7","c_38","c_37","c_13","c_34","c_51","c_53","c_9","c_50","c_8","c_5","c_33","c_54","c_24"],[["CUP_O_SLA","CUP_B_HIL"],["CUP_O_SLA","CUP_B_HIL"],["CUP_O_SLA","CUP_O_SLA"],["CUP_O_SLA","CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA","CUP_B_HIL"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_O_SLA"],["CUP_I_PMC_ION"],["CUP_I_PMC_ION"],["CUP_I_PMC_ION"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"],["CUP_B_HIL"]],any];

_filtered_objs = [] call ALiVE_fnc_HashCreate; 
{ 
 // Filter out all objectives with multiple groups 
 _cluster_id = _x; 
 _factions = [_obj_to_owned_map, _cluster_id] call ALiVE_fnc_HashGet; 
 if ((count _factions) == 1) then { 
  [_filtered_objs, _cluster_id, (_factions select 0)] call ALiVE_fnc_HashSet; 
 }; 
} forEach _obj_to_owned_map select 1; // Iterate over all keys

_filtered_objs```
#

if I paste this in my console _filtered_objs is just an empty hashmap

little raptor
brazen lagoon
#

oh that would make sense, will try it

#

yep, fixed it

#

thanks!

little raptor
#

np

brazen lagoon
#

I need to get better about using the parentheses aggressively

#

arma order of operations is weird.

little raptor
#

it's not weird

#

it's actually more consistent than some other languages

little raptor
#

it does exist

#

just not documented

quartz coyote
#

Ah I see

#

I hadn't understood what you meant.

brazen lagoon
#

@little raptor I'm just used to indexing in an array being high priority i guess

#

@winter rose are you telling me to edit the cursing out?

little raptor
#

yes

brazen lagoon
#

sure

brazen lagoon
#

wdym

little raptor
#

it has higher priority

brazen lagoon
#

like array#1?

little raptor
#

yes

brazen lagoon
#

weird, why does nobody use that?

little raptor
#

because it's kinda new

brazen lagoon
#

ah

little raptor
#

implemented in v1.82

#

not too new

brazen lagoon
#

makes sense

little raptor
exotic flax
#

It just has no benefit unless you need it ๐Ÿคทโ€โ™‚๏ธ which 99% of the people don't

brazen lagoon
#

yeah but it just seems like

#

more logical to me for array ops to be highest priority

little raptor
#

if you know what you want it's very useful

#

saves you from all those pesky parantheses

brazen lagoon
#

but thats probably just because I have stockholm syndrome from using c-like languages where that's the case

winter rose
#

because myArray[0]

little raptor
#

@brazen lagoon also, there will be actual hashmaps in v2.02

fair drum
# winter rose >> CfgWeapons >> (configName of the first) >> reloadTime

I guess I'm not understanding config manipulation as this is my first time doing it.

Some things I've tried at just pulling the classname of a vehicles weapon...

_vehicleClass = typeOf arty1;
_vehicleTurret = getText (configFile >> "CfgVehicles" >> _vehicleClass >> "Turrets" >> "MainTurret");
_vehicleTurret;
//Returns ""

_vehicleClass = typeOf arty1;
_vehicleTurret = getArray (configFile >> "CfgVehicles" >> _vehicleClass >> "Turrets" >> "MainTurret");
_vehicleTurret;
//Returns []

guess I'm just not sure which commands I need to be looking at to actually pull a value off of it

brazen lagoon
#

@little raptor omg you're joking

little raptor
#

it's already in dev branch

brazen lagoon
#

is there a hashmap wiki article I can look at?

#

lmao leopard's too fast for me

#

this is great!!

little raptor
fair drum
#

so I'm going to try something and see if i get the syntax right

willow hound
#

MainTurret is not a config entry, it's a config (sub-) class (indicated by the capital first letter). As such, you can't extract a value from it with getText or getArray, because a class has no value.

fair drum
#

yeah I JUST figured that out. I wasn't deep enough

#

so in the end, I now have

_vehicleClass = typeOf arty1;
_vehicleCannon = getArray (configFile >> "CfgVehicles" >> _vehicleClass >> "Turrets" >> "MainTurret" >> "weapons") select 0;
_cannonReload = getNumber (configFile >> "CfgWeapons" >> _vehicleCannon >> "reloadTime");
_cannonReload //Returns: 6 which is the correct value

so it was my own stupidity causing blindness to seeing the stupidity

little raptor
fair drum
#

how do you mean and why would it be better? faster?

little raptor
# fair drum how do you mean and why would it be better? faster?

no just better

_vehicleClass = typeOf arty1;
_reloadTimes = getArray (configFile >> "CfgVehicles" >> _vehicleClass >> "Turrets" >> "MainTurret" >> "weapons") apply {getNumber (configFile >> "CfgWeapons" >> _x >> "reloadTime")};
_reloadTimes pushBack 0;
_reloadTimes sort false;
_reloadTimes#0
#

and no errors

slow isle
#

Is it possible to give player units more hitpoints?

little raptor
#

hitpoints are defined by the config (and model)
it cant be scripted

exotic flax
#

Although you can script incoming damage

reef grove
#

aynone have experience with dedmen's intercept-database able to help me resolve a few issues?

queen cargo
brazen lagoon
#

lol

queen cargo
#

arr[0][1] = 10 gets (_arr select 0) set [1, 10] with sqc

tough abyss
#

Sorry to ask, but is there any way for me to have a script checking if an ace interaction action has been added to object ?

#

to be specific, I wanted to execute a script if an ace interaction action has not been added to an object

oblique arrow
#

Hey peeps I could use some help, I'd like to get the position of a marker in initServer.sqf,
I currently have _spawnPos = missionNamespace getVariable "marker_rad_1";
and then getPos _spawnPos,, but that tells me that _spawnPos isnt defined

#

(note the, in the getPos is intended)

exotic flax
#

@oblique arrow use getMarkerPos instead

#

so _spawnPos = getMarkerPos "marker_rad_1";

oblique arrow
austere hawk
umbral nimbus
#

Im looking for a way to detect shells/bombs falling in an area and have AI respond to it.
Getsupression won't work because I also want them to respond when the bb falls hundered of meters away from them.

Practical example:

  1. Artillery shell hits ground
  2. AI start running to specific positions
fair drum
austere hawk
#

they do, but its not mandatory to name them such - so some vehicle configs might not be compatible with whtaever you do in your script, if you hardcode it that way
You can find the turret dynamically, if mainTurret is not available

austere hawk
still forum
reef grove
#

well i would hope so seeing as how you're one of the devs on it lol

reef grove
still forum
#

Afaik it does

reef grove
#
  1. I'm getting an error and I have no idea why

SQF:

_conn = dbCreateConnection "testdb";
_prep = dbPrepareQuery ["SELECT ? FROM ? WHERE ? = ?",['surname, uid','characters','uid','76561198106099573']];
_exec = _conn dbExecute _prep;
_res = dbResultToArray _exec;

Error:

_exec = _conn dbExecute _prep; _res = dbResultToArray> Error position: <dbExecute _prep; _res = dbResultToArray> Error Intercept-DB exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? WHERE ? = ?' at line 1 at SELECT ? FROM ? WHERE ? = ?```
still forum
#

Is that question mark thing the correct way to do it? I don't have the docs in my head right now

reef grove
#

according to docs it was