#arma3_scripting

1 messages ยท Page 597 of 1

ebon citrus
#

@warm venture rcon command on a schedule

#

there is a shutdown-command for rcon, if i recall correctly

#

if nothing essential needs to occur at shutdown, you could just aswell just terminate the task

warm venture
#

Yeah but what can you do for countdown announcements and such?

ebon citrus
#

rcon

warm venture
#

and automatically terminating the task

ebon citrus
#

that's down to the linux distro

warm venture
#

well right now I just run service arma3 restart

#

to restart the server

ebon citrus
#

sure

#

do that every 4 hours

warm venture
#

I want it automatic tho

ebon citrus
#

yes

#

make a script that does it automatically every 4 hours

#

take a pick

#

there are like more ways than grains of sand in sahara

warm venture
#

right well

#

would probably need a linux script to auto restart every 4 hours

#

then a separate script on the arma server to do the announcement

ebon citrus
#

or use rcon

warm venture
#

like..battlewarden?

ebon citrus
#

no

warm venture
#

cause I also want an icon on the hud

ebon citrus
#

rcon

warm venture
#

that says how long until restart

ebon citrus
#

icon on the hud?

#

ok...

warm venture
#

I can do that part

ebon citrus
#

ask there questions related to gui

warm venture
#

my point is I need some kind of global var that updates every minute

#

that I can reference

ebon citrus
#

you do?

#

in pseudo-code:
when time > notify of restart time
update hud

warm venture
#

Returns time elapsed since mission started (in seconds). The value is different on each client. If you need unified time, use serverTime.

ebon citrus
#

yes?

#

i dont see what's the issue here

#

you have a public value right there

warm venture
#

alright so this must be in seconds

ebon citrus
#

yes?

#

you divide seconds by 60 to get minutes

warm venture
#

yes

ebon citrus
#

and minutes by 60 to get hours

warm venture
#

that part makes sense

#

alright

#

so

#

now just have to do the restart script..

ebon citrus
#

which distro of linux do you have?

warm venture
#

Ubuntu

ebon citrus
#

๐Ÿคฎ

#

JK, sec

warm venture
#

so

ebon citrus
#

you have cron/crontab

warm venture
#

just make a loop with a sleep..?

ebon citrus
#

no

#

what is with you people and loops ๐Ÿ˜…

#

just schedule a task

warm venture
#

just what google comes up with

#

yes i have cron

ebon citrus
#

ok, pseudo-script:

-terminate process if exists
-start process
-schedule THIS task to rerun in 4 hours

warm venture
#

so it probably needs to point to a .sh file

#

would be cool if I could just run a command

#

woo god it

ebon citrus
#

do note, this is an arma 3 scripting channel. Not an ubuntu support-forum ๐Ÿ˜…

tough abyss
#

I want to save the player's team color so that they will have the same team color when respawning. I don't know much about scripting, how would I do this?

brave jungle
#

The colours via assignTeam correct?

tough abyss
#

Yes

brave jungle
tough abyss
#

It says it works globally but doesn't in testing

brave jungle
#

it will, the wiki doesn't usually lie ๐Ÿ™‚

#

Sometimes it does ๐Ÿ˜„

still forum
brave jungle
#

If thats at me, it'll work don't hate me ๐Ÿ˜„

#

Very messy tho

tough abyss
#

Wait hold up I might have gone full smoothbrain

#

At least on local it automatically saves color if you click save load out

brave jungle
#

Now i'm confused ๐Ÿ˜… Where do loadouts come into this ๐Ÿ˜„

tough abyss
#

I have no idea, but it seems to save the team color with that box checked

brave jungle
#

The following might work...

#
//note: specific to each player - written off the top of my head
player addEventHandler ["Killed", {
  params ["_unit", "_killer", "_instigator", "_useEffects"];
  _unit setVariable ["JIM_Team_colour", assignedTeam _unit];       
}];

player addEventHandler ["Respawn", {
  params ["_unit", "_corpse"];
  _unit assignTeam (player getVariable "JIM_Team_colour");
}];


//I dunno if this would work either, depends if this info is kept after the player respawns...
player addEventHandler ["Respawn", {
  params ["_unit", "_corpse"];
  _unit assignTeam (assignedTeam _corpse);
}];
#

I think my condition is wrong there, but i'm sure someone will point it out ๐Ÿ˜‰

tough abyss
#

No I'm saying it is literally built into the game already

#

I don't need to script anything

#

It does it for you automatically

#

I'm a dumbass lmao

brave jungle
#

Oh

#

Right

#

๐Ÿ˜„

silk carbon
#

Right now all my files in my script (like my .sqf + .hpp files) are in the main mission directory, as a way to stream things better how can I move this to like a /functions folder or something?

This is my initPlayerLocal.sqf atm:

params ["_unit"];
if (getPlayerUID _unit in ["76561198101943969"]) then {
    _unit addAction ["Admin Menu", "openDialog.sqf"];
};```
winter rose
#
_unit addAction ["Admin Menu", "myDirectory\openDialog.sqf"];
#

if you feel at ease, you can also take a look at CfgFunctions @silk carbon

silk carbon
#

Hi thanks for that, the issue I have is when I do that it refuses to open the actual GUI itself

winter rose
#

then the issue is elsewhere

silk carbon
#

Do I need something in my description.ext to also point to the folder?

winter rose
#

your script or description.ext may refer to some other files, their references should be updated accordingly

smoky verge
#
{
    control = "combo";
    property = "UniqueProperty";
    displayName = "Custom Combo Attribute";
    description = "This combo has three values.";
    expression = "_this setVariable ['%s', _value];";
    defaultValue = 0;
    typeName = "NUMBER";
    class Values 
    {
        class None
        {
            name = "Value 0";
            value = 0;
        };
        class Info {
            name = "Value 1";
            value = 1;
        };
        class Debug {
            name = "Value 2";
            value = 2;
        };
    };
};```

anyone knows what should I use in `expression =` if I want it to change textures?
not sure how it works exactly
warm venture
#

in a bit of a predicament

#

so I have it setup in a cronjob on linux to restart the server every 4 hours, then a script on the server itself to do the announcements. If I wait until its auto restarted, the messages will be synced up with the restart, but if I put in a new mission file it wont be

winter rose
snow badge
exotic flax
#
  1. create unit with preferred loadout
  2. open console (ESC once)
  3. copy&paste script in console
  4. execute script
  5. ...
  6. Open any editor (Notepad will work)
  7. CTRL+V to paste whatever in on your clipboard (automatically added by script)
  8. profit ๐Ÿ™‚
snow badge
#

Oh you're a saint thank you my friend!

#

Can I execute the script on Zeus as well? @exotic flax

#

As in: Execute the Script on a Unit while in the Zeus Interface with help of Achilles instead of using Eden?

exotic flax
#

Well, the script (by default) takes the loadout of the player (so you), but you should be able to change that to call it on any unit.
And you should be able to execute the code with Achilles/ZEN, although that wouldn't make a lot of sense since you'll need to make configs out of them anyway; so doing that in the editor is a lot easier, faster and safer

smoky verge
warm venture
smoky verge
#

?

fair drum
#

Trying to do one of these findIf. Not sure what I am doing wrong though. Trying to activate a trigger if any of the cargos are present.

[cargo1,cargo2,cargo3] findIf {_x in thisList} == 0;

fixed it... I'm a dumb dumb. make sure your activation is set to anybody

ornate prairie
#

how would one lock a player in a vehicle? Removing the get out and eject options entirely for a scripted ride?

fair drum
#
if (player in car) then {
    
    car lock lockstate; // lockstate can be [0,1,2,3] where 0 - unlocked, 1 - default, 2 - locked, 3 - locked player

};
hallow mortar
#

For future reference you can totally stack OR operators

#
(cargo1 in thisList) or (cargo2 in thisList) or (cargo3 in thisList)``` would be totally fine
#

Referencing an array is definitely smarter for longer lists though

fair drum
#

its still not working how I'd like. it seems to only detect one of the cargo crates, the other two don't trigger it... I bet it is something simple I'm missing

hallow mortar
#

Are you testing them one after the other in the same instance? If so, could it be that the trigger is not set to be repeatable?

#

If not, can you narrow down which crate is being detected?

fair drum
#

yeah i was. but even before I triggered it, the first crate I moved it returned false, it wasn't till the second one was added that it threw true. let me test with repeatable

#

mk so even with repeatable on or off, cargo1 is the only one that is throwing true

hallow mortar
#

And this is using the findIf code?

fair drum
#

yes [cargo1,cargo2,cargo3] findIf {_x in thisList} == 0; and I'm evaluating it on debug as I move different crates in

#

cargo1 is the only one that throws true

#

[cargo1,cargo2,cargo3] findIf {_x in (list supplyEnd)} == 0; for debug

#

supplyEnd is the trigger

hallow mortar
#

you're absolutely 100% sure that the other crates are named correctly as in the code? Not crate2 or cargo1_2 or anything?

fair drum
#

yes sir

hallow mortar
#

For ease of testing I recommend setting the trigger to hint "DETECTED" or systemChat "DETECTED" on activation, so you can be sure there's no difference between trigger and debug detection

fair drum
#

mk I'll try that

hallow mortar
#

It's probably not the issue, the debug code looks fine, but it's a good testing principle and should save a little time

fair drum
#

mk

#

yup still only cargo1 pops the trigger

#

let me try it with or operators and see if it works. if it does, there has to be a theory problem with FindIf I'm missing

hallow mortar
#

found the theory problem. Took me a minute of staring at the documentation to spot it

#

findIf returns the index of the element it evaluated true for - that is, the position in the array. Only cargo1 is position 0 in the array, which is what you're actually checking for

#

Change == 0 to != -1

fair drum
#

okay I see it now

#

tricky

#

yuppers that fixed it ty for the spot

ebon citrus
#

is there a known issue with setUnitLoadout resetting ammo-count in magazines?

#

oh yeah, i see it now

#

NOTE: Empty or used magazines in loadouts will be refilled under specific circumstance, even if the refill argument is false. This seems to happen if amount of used magazines is 2 or more.

#

for cockerel's sake

#

ok..., i get it

#

i'll make my own setUnitLoadout with cardgames and professional street artists

#

done

#

what is the actual problem with this game ๐Ÿ˜…

#

i've had the time of my life trying to do this

vague geode
#

How can I add the action "hideBody" to a player in a way that it is only shown/available if that player looks at a corpse? (e.g. like rearm is only awailable when you look at a vehicle/corpse/ammo crate etc.)

tough abyss
#

maybe try player addaction ["Hide Body", {hideBody body1}];

#

where player is you, and body1 is the corpse name

#

@vague geode

warm hedge
#

He's asking for more generic way. I suppose:

_player addAction ["Hide body",{
    hideBody cursorObject
},nil,1.5,true,true,"","cursorObject isKindOf 'Man' and !alive cursorObject"];```
vague geode
#

@warm hedge Indeed, I am. Thanks, I'll test that.

#

@warm hedge Perfect. Thanks alot.

#

I suppose there isn't already a localized string for "bury" or something to that effect, is there?

winter rose
#

there is a "hide body" in-game action already, no?

vague geode
#

@winter rose Normally? No, at least not as far as I know.

winter rose
#

not "by default", but some classes could do
it has to do with unit trait iirc

#

ah no, I was mistaken - it was doable in older titles, IDK how/if one can access it again

vague geode
#

@winter rose As I said I have never encountered it and appart form UAVHacker I have played with all unit traits already, if I am not mistaken.

#

BTW how can I enable vehicle in vehicle transportation because for some reason I can not load anything into the Blackfish vehicle transport, not even a quad? Do I have to add the LoadVehicle, UnloadVehicle and UnloadAllVehicles actions manually?

winter rose
#

the vehicle transport blackfish can without doing anything

vague geode
#

That's what I thought but stragely I can not load any vehicles in there... I even tried multiple times on different days.

winter rose
#

and without mods and only in Eden?

vague geode
#

@winter rose Yes, I just tried it with the Xi'an and it worked just fine...

unkempt sorrel
#

this is a little bit of code i wrote up, thing is, the addEventHandler is broken though... any thoughts?

winter rose
#

@unkempt sorrel plz use ```sqf (see pinned message)

vague geode
#

@winter rose Never mind. I just missed the sweet spot. ๐Ÿ˜…

winter rose
#

heh ^_^

#
params["_unit"];

_unit addAction [format["<t color='%1'>Climb Ladder!</t>","#32CD32"], {
    if (isNull cursorObject) exitWith {hint "No object found to climb.";};
    
    _obj = cursorObject;
    _ai = _this select 0;
    _climb = _ai action ["ladderUp", _obj, 0, 0];
    _group = group _ai;
    _event = _ai addEventHandler ["AnimDone", {params ["_ai"]}];
    _move = _group commandMove position _obj;

params["_obj", "_ai", "_climb", "_walk"];

    if ((["ladder", toLower str _obj] call BIS_fnc_inString) || (["pier", toLower str _obj] call BIS_fnc_inString)) then {
        _climb;
    }}];

params["_ai", "_group", "_obj", "_unit", "_move"];

    if (_ai addEventHandler ["AnimDone", {params ["_ai"]}] = true) then {_move};
#

@unkempt sorrel โ†‘

unkempt sorrel
#

thank you! i literally tried for 5 min and accidently did it once and couldn't figure it out lol

ebon citrus
still forum
#

someone is calling that function with wrong parameters

ebon citrus
#

usually it would give an error of wrong parameters

#

so the error is not handled in this script

still forum
#

it does give an error of wrong parameters

ebon citrus
#

but inside the script

#

so the script is handling wrong parameters within itself

still forum
#

the "param" wants a string, but a array was passed as arguments to that function

ebon citrus
#

i see

still forum
#

its reporting wrong parameter passed in _this to that function

ebon citrus
#

but it's not reporting where that wrong parameter was passed

still forum
#

jup

ebon citrus
#

it usually reports where the wrong parameter was passed

still forum
#

no

#

param/params don't

ebon citrus
#

yes?

still forum
#

they don't know

ebon citrus
#

ok

#

so the point now is to go through all of my code and see where the wrong argument is being passed?

winter rose
#

follow the white rabbit the rpt

ebon citrus
#

this is the rpt

#

the error is thrown inside an arma 3 script

winter rose
#

no, this is patrick

ebon citrus
#

and the path ends there

winter rose
#

what I mean is, you may have another, previous bad call that calls this function with these (wrong) parameters

ebon citrus
#

but there is no way to backtrace it

still forum
#

ArmaDebugEngine would print you a full calltrace to RPT

winter rose
#

how is that not vanilla already?

unkempt sorrel
#

adding an event handler to an if and then hasn't been working for me, am i just dumb? lol

ebon citrus
#

i dont think you can add event-handlers to operators ๐Ÿ˜…

unkempt sorrel
#

makes sense man, im new to coding so, learning curve xd

#

scripting

#

whatever to call it

smoky verge
#

I'm trying to change an object texture (even in eden) according to a dropdown combo menu in its attributes
I know its not complete but am I doing this right?


private ["_logo"];

_box = _this select 0; 
_logo = switch (_box setObjectTextureGlobal [0, " "]) do {
    case 0: { logoA };
    case 1: { logoB };
    case 2: { logoC };
    case 3: { logoD };
    default { logoA };
}; ```
winter rose
#

no

smoky verge
#

I tried ok? notlikemeow

winter rose
#

I take that logoA..D are for selections 0..3?

smoky verge
#

yeah
they're not the exact names but thats just so I know which logo goes where

winter rose
#
private _textures = [logoA, logoB, logoC, logoD];
for "_i" from 0 to 3 do {
  _box setObjectTextureGlobal [_i, _textures select _i];
};
ebon citrus
#

i cant take this ๐Ÿ˜…

#

for instance, there is now over 300 lines of code to determine WHAT TO PICK UP

#

and we haven't even gotten to actually picking up anything yet

smoky verge
#

oh @winter rose I didn't mention that this is a function called from a dropdown combo control

        class SZ_custom_logo
        {
            control = "combo";
            property = "SZ_custom_logo";
            displayName = "logo";
            description = "This combo has three values.";
            tooltip = "N/A";
            expression = "_this setVariable ['%s', _value, true]; 0 = [_this] spawn SZ_fnc_changelogo;";
            defaultValue = 0;
            typeName = "NUMBER";
            unique = 0;
            condition = "1";```

in the rare chance its actually correct
will the lines you wrote work with it?
ebon citrus
#

this is like a department store that sells only ducttape

#

@smoky verge why is it spawned?

#

wouldn't "call" suffice here?

smoky verge
#

I guess so?
for some awful reason I though spawn worked in eden too?
it seems to work for the mod I'm referencing from

ebon citrus
#

spawn = Adds given set of compiled instructions to the scheduler. Exactly when the code will be executed is unknown, it depends on how busy is the engine and how filled up is the scheduler.
call = Adds given set of compiled instructions to the current stack and waits for it to finish and return, provides an option to pass arguments to the executed Code.

smoky verge
#

I guess both work
don't think engine would be too busy in eden

ebon citrus
#

there is no other valid excuse to use spawn unless you need to run it in scheduled environment, as far as i know

#

it would work, but it's extra

#

"unnecessary"

smoky verge
#

yeah it looks less performant than call

ebon citrus
#

and it's a-sync

#

anything you do inside the spawned script cannot be used in the script calling it

#

so if you change a picture and depend on that picture having been changed, then think twice

#

it's a bad habit to use the scheduler when not needed

#

get rid of it

#

โค๏ธ

smoky verge
#

yeah I did thanks
so how does Lou's script recognize that LogoB happens when the dropdown selection 2 is selected?

exotic flax
#

it doesn't?

ebon citrus
#

use index?

#

instead of _value?

winter rose
#

I take that logoA..D are for selections 0..3?
I meant by that
logoA โ†’ selection0
logoB โ†’ selection1
logoC โ†’ selection2
logoD โ†’ selection3

ebon citrus
#

he meant how will the script know which one is selected

#

easiest way is to use the index of the selection

#

this way Lou's script works easy peasy

exotic flax
#
_box = _this select 0; 
_logo = switch (_box) do {
    case 0: { logoA };
    case 1: { logoB };
    case 2: { logoC };
    case 3: { logoD };
    default { logoA };
};
_box setObjectTextureGlobal [0, _logo];

^^

winter rose
#

params

exotic flax
#

assuming logoA/etc. are strings with paths to actual files

smoky verge
#

yeah

ebon citrus
#

ok...

#

binoculars are an "ITEM"

#

but they dont show up in itemCargo

#

bug or intentional?

unkempt sorrel
#

does someone have a script or an idea on how to make like a 3 meter teleport for ai towards the direction their facing?

ebon citrus
#

getRealDir, getRelPos and setposATL should suffice

winter rose
#

aren't they a weapon

ebon citrus
#

nope

#

@unkempt sorrel following script teleports the player 3 meters to the direction they are looking at (2d):

_target = player;
_pos = (_target getRelPos [3, (_target getRelDir player)]);
_target setposATL [_pos select 0,_pos select 1,_pos select 2];```
#

just change _target to your AI

unkempt sorrel
#

Haha! thanks man, i appreciate it, maybe my ladder script will work after all `:D

ebon citrus
#

ah, manouer

#

hold on

unkempt sorrel
#

oh okay lol

ebon citrus
#

i repurposed the script

unkempt sorrel
#

thx โค๏ธ

ebon citrus
#

there

#

you dont need to use getreldir

#

i just find it to be the most reliable

#

@winter rose BIS_fnc_itemType returns binoculars as "item"

#

HMD is an item too

#

and HMD is listed in itemCargo

#

but binoculars are NOT listed in itemCargo

#

BINOCULARS ARE LISTED UNDER ``weaponCargo`

#

im making a bug-report

winter rose
#
player addWeapon "Binocular"
```looks like a discrepancy
ebon citrus
#

this is just inconsistent

winter rose
#

yep, but I doubt it will be fixed - it might break plenty of backward compat' ๐Ÿ˜ฆ

ebon citrus
#

done

#

probably just a config-change

#

and if anything relies on broken code, then the code is broken and needs to be fixed aswell, no?

#

ok, anyways, is there any way to pull from the config if an item is binoculars?

#

a config-entry that dictates the slot, perhaps?

#

because i need to make a case JUST for binoculars ๐Ÿ˜…

exotic flax
#

check "simulation type" ๐Ÿ˜‰

ebon citrus
#

i wish they would change HMD and binoculars config to "weapon"

#

wait

#

HMD and binoculars are under CfgWeapons

exotic flax
#

checking the ACE arsenal script... binocs have either simulation = "Binocular" or simulation = "Weapon" && type = 4096 in their configs

ebon citrus
#

HMD is also type 4096

#

simulation it is

unkempt sorrel
#

is there a way to set a timer or something before it runs a script?

ebon citrus
#

triggers and just spawn-sleep combo

unique sundial
unkempt sorrel
#

so could i set a trigger for an action command to do something else after it runs?

ebon citrus
#
[] spawn {
  sleep 10;
  [] call yourScript; 
};```
#

this runs "yourScript" after 10 seconds, give or take

unique sundial
#

trigger can be set to delay triggering after activation condition is true

unkempt sorrel
#

yeah all i need is something simple like that, basically trying to get the ai to teleport at the top of a ladder onto the building so they dont break their legs `D:

unique sundial
#

use setVehiclePosition

unkempt sorrel
#

why? is it more reliable for what im doing? ๐Ÿ˜„

unique sundial
#

it places object on surface

ebon citrus
#

Killzone, HMD and binocular dont work on containers/vehicles

#

also, i need to get the item type in general

#

not just when it's in player slot

#

these items can also exist in inventory, such as backpacks

smoky verge
#

sorry for the intrusion but I've used @exotic flax's script
_box = _this select 0; _logo = switch (_box) do { case 0: { logoA }; case 1: { logoB }; case 2: { logoC }; case 3: { logoD }; default { logoA }; }; _box setObjectTextureGlobal [0, _logo];
of course with file paths to the paas instead of LOGOA,B, etc..
I can see the drop down menu in attributes
but the texture doesn't change neither in eden or ingame

ebon citrus
#

@smoky verge use codeblocks

unique sundial
#

i was trying to point out they are classified as different inventory items @ebon citrus

ebon citrus
#

yes?

#

that doesnt help anything

nova zinc
#

@smoky verge what?

ebon citrus
#

it doesnt change the fact that the binocular is classed as an "item", yet acts EXACTLY like a "Weapon"

unique sundial
#

it is special case afaik perhaps by design or by mistake however it is too late for that

ebon citrus
#

it's a config change...

smoky verge
#

sorry @nova zinc I was trying to create an attribute to change an object texture in eden with a dropdown list
similar to the rhs vehicles

ebon citrus
#

too late for config change?

#

to make everyone's lives simpler?

still forum
#

it's a config change...
its not

unique sundial
#

config changes could be very dangerous

still forum
#

ALOT of things depend on the binocs working the way they are

#

and you cannot possible even know all of them

ebon citrus
#

it's not changing how they work

still forum
#

to make everyone's lives simpler?
you mean your life, doing this VERY specific thing that you're doing

#

yes it is

nova zinc
#

you mean the random/custom decal system ?

smoky verge
#

yeah

ebon citrus
#

ok, anyways

#

@unique sundial is there a reasonable way to get the specific behaviour necessary to use with a specific item?

#

since BIS_fnc_itemType doesnt work

smoky verge
#

@nova zinc if I understood correctly they use a control combo tied to a custom function
is that right?

ebon citrus
#

currently, what i must do is first determine if an item is in the CfgWeapons, then check whether it is a binocular simulation type to determine whether it goes to the toolbelt, binocular slot or nvg slot

nova zinc
#

you can define a specific decal if you need to

#

or just let one be assigned randomply

#

the entire decal system is in place for stuff like random text on abrams barrels, etc

smoky verge
#

I've also seen the option to completely change a vehicle texture
like from desert humvee to woodland humvee

ebon citrus
smoky verge
#

?

ebon citrus
#

that's to change the vehicle texture

smoky verge
#

I know setObjectTexture
my problem is implementing it in the combo control

nova zinc
#

can you be more precise about what you want to achieve?

unique sundial
#

you can check inventory slot the item belongs from config

ebon citrus
nova zinc
#

coz i can't figure it out

ebon citrus
#

that's not reasonable

nova zinc
#

most functions and scripts used mod wide are in rhs_main

unique sundial
#

what do you want itemType to say

ebon citrus
#

if an item acts like a weapon through and through, then why does itemType say "Item"

#

and why is it inconsistent with HMD?

#

HMD is listed in itemCargo

#

Binoculars are not

#

yet both of them are items

unique sundial
#

iโ€™m asking you if there was a itemType command what should it return for various inventory items

ebon citrus
#

be consistent

#

whatever it says, it needs to be consistent with the commands used to manipulate it

#

atm, there are 3 different behaviour for "Item"

#

one which acts like an item, One which is listed in ItemCargo, but acts like a weapon and one which acts like a weapon and is only named an item

#

classifications have no purpose if they are not consistent

exotic flax
#

It's not that complicated ๐Ÿคทโ€โ™‚๏ธ

_item = "some_binoc_class";
_config = configFile >> "CfgWeapons" >> _item;
if (
   toLower getText(_config >> "simulation") == "binocular"
   || getNumber(_config >> "type") == 4096
) then {
   hint "these are binocs";
};
unique sundial
#

iโ€™m sure all this info can be accessed from config but you are calling it inconvenient so what should such command return to make it convenient

ebon citrus
#

consistency

#

im calling for consistency

exotic flax
#

we're talking about Arma... Consistency does not apply here ๐Ÿคฃ

ebon citrus
#

if BIS_fnc_itemType returns just whatever then the whole command is without purpose

#

and tbh, it has been consistent up till this point

#

and i wonder why

#

why go through all this work to then mess it up with 2 items

unique sundial
#

bis_fnc_itemType is not a command but script function you can open it up and see what it does and why it returns inconsistent result

#

my guess it returns type for the use with arsenal

#

arsenal is not THE inventory

ebon citrus
#

that is not true

#

the arsenal is a type of inventory

#

and the arsenal makes a distinction between HMD, Binocs and other tools. How?

unique sundial
#

no inventory is what you get when you press I

#

it is engine driven

ebon citrus
#

it is not THE inventory

#

but it is AN inventory

unique sundial
#

arsenal is scripted armoury

ebon citrus
unique sundial
#

edited happy?

ebon citrus
#

petty

#

anyways

unique sundial
#

I guess you donโ€™t want to have a civil conversation, suit yourself

ebon citrus
#

How does the arsenal make the distinction between HMD, Binocs etc.

#

and is this functionality exposed to sqf?

still forum
#

Same kinda discussions every day basically. Not worth pouring much time into

exotic flax
#

all functions are exposed in SQF... just the commands aren't :/

ebon citrus
#

that is your personal opinion

#

but the question is legitimate

still forum
#

and is this functionality exposed to sqf?

arsenal is scripted armoury

#

it is scripted.. So.. do you think its exposed to script?

ebon citrus
#

how to make the distinction between different tools. Binocs, HMD, GPS, etc.

still forum
#

bis_fnc_itemType is not a command but script function you can open it up and see what it does and why it returns inconsistent result

#

look it up.

#

its there.

exotic flax
#

I just don't understand the problem... it is the way it is, and there are solutions available either in the code (since it's SQF), or in mods (like ACE which does the same thing)

ebon citrus
#

the problem is that i need to reliably and reproducibly produce the item-type based on its behaviour

exotic flax
#

did you see the script I posted? that is working 100%

ebon citrus
#

that wouldn't work

#

looks like it

exotic flax
#

in that case does ACE Arsenal not work ๐Ÿคทโ€โ™‚๏ธ

ebon citrus
#

time for Nca_fnc_itemType

#

it wont work in my use case, which is

to reliably and reproducibly produce the item-type based on its behaviour```
#

the answer seems to be "No"

#

so i'll just do it myself

#

something about sending a child to a task

spark turret
#

how does arma AI know to differentiate an enemy from a friednly? especially if both look the same. anyone know a bit more about that?

smoky verge
#

side

spark turret
#

no, i mean do they just magically know which side it belongs to after some time? or do they instantly know? etc

#

what affects that knowledge etc

smoky verge
#

I think at a certain range they have some doubts
but up close you could be their genetic clone with their same gear and they would still shoot at you

mental wren
#

Hello all, I was looking around to see if it's possible to make patches which have dynamic text on them. For example I found this:
https://forums.bohemia.net/forums/topic/160703-attachto-object-to-backpack/
If there's anything similar out there that works (specifically on chest-rigs or uniforms), it'd be highly appreciated to get some examples that I can look at in terms of their code and texture setup

smoky verge
#

@winter rose I've tried the script you made and it didn't seem to help
the drop down menu works pretty fine but it doesn't actually change logos

#

without giving me any error in eden or packing

unique sundial
#

@mental wren you could use setObjectTexture on quite a few things including backpacks. The post you linked to is not a good solution

mental wren
#

Hmhm, but then how would I be able to generate the text texture?

#

I basically want to use it for name tag patches which go on a velcro spot on most of our vests

#

so get player name -> generate the texture -> put onto vest

unique sundial
#

you canโ€™t generate text, the only feature available is number plates for vehicles that can do that. you can have images that you can use as textures with writing on them

snow badge
#

@exotic flax Hey sorry for pinging you again but I tried what you did (went in-game and executed the script as player via Debug Console) but when I tried CTRL+C, I got no result and nothing copied to clipboard.

#

Could you maybe help me again please?

#
[
    ["_object",player,[objNull]],
    ["_class","REPLACE",[""]],
    ["_displayName","REPLACE",[""]],
    ["_icon","\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",[""]],
    ["_role","Default",[""]],
    ["_conditionShow","true",[""]]
];

private _indent = "    ";
private _class = format ["class %1",_class];
private _displayName = format ["displayName = ""%1"";",_displayName];
private _icon = format ["icon = ""%1"";",_icon];
private _role = format ["role = ""%1"";",_role];
private _conditionShow = format ["show = ""%1"";",_conditionShow];
private _uniformClass = format ["uniformClass = ""%1"";",uniform _object];
private _backpack = format ["backpack = ""%1"";",backpack _object];
private _export = _class + endl + "{" + endl + _indent + _displayName + endl + _indent + _icon + endl + _indent + _role + endl + _indent + _conditionShow + endl + _indent + _uniformClass + endl + _indent + _backpack + endl;
private _weapons = weapons _object;
private _primWeaponItems = primaryWeaponItems _object;
private _secWeaponItems = secondaryWeaponItems _object;
private _assignedItems = assigneditems _object;
// From BIS_fnc_exportLoadout START
private _fnc_addArray =
{
    params ["_name","_array"];
    _export = _export + format [_indent + "%1[] = {",_name];
    {
        if (_foreachindex > 0) then {_export = _export + ",";};
        _export = _export + format ["""%1""",_x];
    } foreach _array;
    _export = _export + "};" + endl;
};

["weapons",_weapons + ["Throw","Put"]] call _fnc_addArray;
["magazines",magazines _object] call _fnc_addArray;
["items",items _object] call _fnc_addArray;
["linkedItems",[vest _object,headgear _object,goggles _object] + _assignedItems - _weapons + _primWeaponItems + _secWeaponItems] call _fnc_addArray;
// From BIS_fnc_exportLoadout END
_export = _export + "};" + endl + "// Visit https://community.bistudio.com/wiki/Arma_3_Respawn for detailed information";

copyToClipboard _export;
_export```
exotic flax
#

See the 2nd last line, it will automatically put the export to the clipboard (and the last line as output).

#

So either paste it directly to a file (without CTRL+C), or select the console output and CTRL+C that before pasting it in a file.

snow badge
#

Well, I did that. I put the script above into Debug Console and did a Local Exec while playing as the unit with the loadout - it returned nothing.

exotic flax
#

Got any errors (direct or RPT)?

#

Because for me the script works without problems

ebon citrus
#

am i reading this wrong or does this have a purpose:

[
    ["_object",player,[objNull]],
    ["_class","REPLACE",[""]],
    ["_displayName","REPLACE",[""]],
    ["_icon","\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",[""]],
    ["_role","Default",[""]],
    ["_conditionShow","true",[""]]
];```
snow badge
exotic flax
#

Ahhh... Make sure you remove the comments (parts with //) because the console doesn't like them

snow badge
#

What do you mean Direct or RPT?

#

I'll try that now

ebon citrus
#

params

#

youre missing code

exotic flax
#

@ebon citrus that's on purpose

ebon citrus
#

nope

#

it's missing code

#

also, make sure to call it properly

exotic flax
#

I'm sure he C&P-ed the correct code

snow badge
#

@exotic flax I could kiss you right now, it finally put something out!

{
 displayName = ""REPLACE"";
 icon = ""\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"";
 role = ""Default"";
 show = ""true"";
 uniformClass = ""U_O_R_Gorka_01_camo_F"";
 backpack = ""B_ViperLightHarness_oli_F"";
 weapons[] = {""arifle_AK12_lush_F"",""hgun_Rook40_F"",""Binocular"",""Throw"",""Put""};
 magazines[] = {""16Rnd_9x21_Mag"",""16Rnd_9x21_Mag"",""SmokeShell"",""SmokeShell"",""SmokeShellGreen"",""SmokeShellBlue"",""HandGrenade"",""HandGrenade"",""Chemlight_green"",""Chemlight_green"",""Chemlight_blue"",""Chemlight_blue"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_F"",""30rnd_762x39_AK12_Lush_Mag_Tracer_F""};
 items[] = {""FirstAidKit"",""FirstAidKit"",""H_Booniehat_taiga""};
 linkedItems[] = {""V_CarrierRigKBT_01_light_Olive_F"",""H_HelmetAggressor_cover_taiga_F"",""G_Tactical_Black"",""ItemMap"",""ItemCompass"",""ItemWatch"",""ItemRadio"",""ItemGPS"",""O_NVGoggles_grn_F"",""muzzle_snds_B_lush_F"",""acc_pointer_IR"",""optic_Arco_AK_lush_F"","""","""","""","""",""""};
};
// Visit https://community.bistudio.com/wiki/Arma_3_Respawn for detailed information"```
exotic flax
#

:D

snow badge
#

OK now let's see if this loadout works with my description.ext...

#

Huh, still doesn't work... let me try this again.

ebon citrus
#

double quotes

#

you need single quotes

hazy trail
#

Does anyone know how to change locality of an occupied vehicle from a client to a server? I know to use setGroupOwner (and setOwner), but no combination seems to work correctly. The most direct solution, setGroupOwner the crew, both crew and vehicle end up on the server - but the driver dismounts and has no gear. Doing a direct setOwner on the vehicle before or after the setGroupOwner doesn't change that.

exotic flax
#

if you C&P manually you'll need to replace the "" (double quotes) to " (single quote), otherwise it should work automatically

ebon citrus
#

@hazy trail vehicle needs to be empty

snow badge
#

Also sorry if that looks ugly, I don't know how to copy-paste code into Discord

ebon citrus
#

pastebin and sqfbin are a thing you can use

chilly wigeon
#

Thats not the whole code is it? there isn't more than 20 lines there

exotic flax
#

or use:
```sqf
// your code
```

snow badge
#

Let me try again, and paste the full description.ext

ebon citrus
#

for long code, pastebin is prefered

snow badge
#

Understood.

ebon citrus
#

makes it easier to read and doesnt spam the chat

snow badge
#

Yeah, completely understandable.

ebon citrus
#

error?

snow badge
#

The Loadout still works perfectly fine and I can use it, but I'm confused what causes it

#

Yes, is there any way to copy the full error Arma 3 pastes on my screen?

ebon citrus
#

RPT

#

im just asking which error

snow badge
#

"Error Type String, expected number"

tropic willow
#

so, im trying to figure out the createVehicle commmand, can someone explain it to me? i am trying to create a red chemlight so i can attach it to an AI

#

im struggling to figure out how to code it, yet i have seen examples.

exotic flax
tropic willow
#

yea.
its my first time dabbling with code really, what really ended up happening was me getting confused, (whats ah1w????)

#

i just need to know how to make a chemlight spawn, where to type the command, and how to attach the dang thing to an AI

#

...might be a bit much..

exotic flax
#

well... "just need to know" is not really how it works when learning how to program a (new) language ๐Ÿ˜‰

tropic willow
#

okay

astral dawn
#

I certainly remember that I could detect car horn with some Fired event handler... is it not the case any more? Or I might be wrong. ๐Ÿค”

shrewd bough
#

What about this makes it only run once?

[] spawn { 
 waitUntil {inputAction "User20" > 0};   
 ThisCar say3D ["horn1", 300, 1]; 
};

I removed the horn from the car, and bound Custom 20 to Left Click so it's like using the horn. However, while it works, it only works once. Is it something I did?

robust hollow
#

it isnt a loop

shrewd bough
#

What can I change to make it loop then? I'm not exactly a coding person, as much as I should be.

#

Honestly, I'm stitching together stuff I find on the wiki, so I don't even really know what some of this means.

robust hollow
#

here is one option. you may want to add an exit condition in place of true.

[] spawn { 
    while {true} do {
        waitUntil {inputAction "User20" > 0};   
        ThisCar say3D ["horn1", 300, 1]; 
        waitUntil {inputAction "User20" == 0};   
    };
};
shrewd bough
#

Thank you kindly. I'll be just a second to try that.

robust hollow
#

another option that doesnt involve a loop is a key press event handler. This example uses key up, but im not sure if the input action is returned to 0 by the time keyup executes so keydown may be a better option as long as you prevent it spamming the sound.

(findDisplay 46) displayAddEventHandler ["KeyUp",{
    if (inputAction "User20" > 0) then {
        ThisCar say3D ["horn1", 300, 1]; 
    };
    false
}];
shrewd bough
#

The second one doesn't seem to work, but the first one does. Sadly, it's
spamable, but it's not that bad I guess.

robust hollow
#

could add a sleep after the say3D line for the duration of the horn

shrewd bough
#

Would that just look like:

[] spawn { 
    while {true} do {
        waitUntil {inputAction "User20" > 0};   
        ThisCar say3D ["horn1", 300, 1];
        sleep;
        waitUntil {inputAction "User20" == 0};   
    };
};

?

robust hollow
#

sleep <seconds>;

shrewd bough
#

Right.

#

Doesn't seem to work, or I did it wrong.

#

Alright, what I screwed up was putting it above the waitUntil. I moved it under it and it works fine. You're a broski, BTW.

shrewd bough
#

@robust hollow Would it be possible to make it so only the driver can do this? I found something that I think does that, but I'm not certain.

#
(driver (vehicle player)) isEqualTo player
#

Would using this help me with that?

robust hollow
#

yes it would

shrewd bough
#

Would the waitUntil be changed to:

waitUntil (driver (vehicle player)) isEqualTo player AND {inputAction "User20" > 0};

?

robust hollow
#

waitUntil {(driver (vehicle player)) isEqualTo player AND inputAction "User20" > 0};

shrewd bough
#

I should include it in the curly braces? That must be where I went wrong.

robust hollow
#

you may also want to be checking if the unit is in a vehicle though. because they can be the driver of themself when they are on foot

shrewd bough
#

All this is in the init of the vehicle, so that shouldn't be a problem, right?

robust hollow
#

no, the code doesnt execute "on the vehicle", it executes when the vehicle is created

#

so it would be almost the same as executing from the init.sqf for example

shrewd bough
#

How would I check if they're in it too?

robust hollow
#

you could do waitUntil {driver ThisCar isequalto player && inputAction "User20" > 0};

shrewd bough
#

I have it as

waitUntil {(driver ThisCar) isEqualTo player AND inputAction "User20" > 0};  

and it seems to work fine. Thank you kindly, again.

bold kiln
#

I know this is something super simple and I'm just not seeing it. (even if it is "you can't")
I have a UserAction that needs to execute an animateSource and turretLock statements.
I thought I could do them both in like an array or something without having to make a new file and spawn it in
know how to do it?

winter rose
#

@bold kiln you can separate two statements with ;

light badge
#

Hi all, maybe what I'm asking for is a bit complicated, but, is there any way to block to pick up clothes from a dead body when looting?

Only to take access to the backpack, vest and main inventory.

Something like the Tarkov looting system.

winter rose
#

I hoped it was only about Warlordsโ€ฆ

astral dawn
#

Ace cargo attaches cargo box to vehicle with negative vertical offset, so it is in fact under the terrain

#

Although it can be attached with positive offset too. But what if it flips over...

astral dawn
#

What's the best way to detect when player uses car horn? Fired and FiredMan event handlers don't work. Currently investigating solutions with detecting mouse button presses on display... ๐Ÿ˜ฆ

winter rose
#

"Fired" EH on the vehicle itself doesn't work?

astral dawn
#

"Fired" EH on the vehicle itself doesn't work?
No

compact maple
#

Hello. How can I pass a param in addMissionEventHandler ?

warm hedge
#

Make it global is a common way

compact maple
#
a = "blabla";
//Add a Draw3D EH on the player, start from the victim, to the shooter's position
    private _id = addMissionEventHandler ["Draw3D", {
            hint a;
    }];
#

so this can work ?

warm hedge
#

Yes

compact maple
#

Thank you

fair drum
#

I thought you couldn't pick up enemy uniforms anyways

#

@light badge

ebon citrus
#

you can force one to a unit

#

in vanilla

#

@light badge yes there is

#

if you dont wish to re-write the whole inventory, then just add an EH on the uniform slot to detect when it's being dragged

#

or similar magic

hazy trail
#

I use the curator events to spot a Zeus placing a vehicle. I then want to initialize that vehicle, but I want to do with server code. I tried telling ARMA to setOwner the vehicle, which is quick, but the turrets only move over later, preventing me from changing them - unless I modify my code to remoteExec wherever the turret might be. I don't want to do that. As a workaround, I deleted the unit that the Zeus placed and had the server create a new one in its place.

#

The twist here is that ARMA will delete the old one and the new one if I create the new one too quickly.

#

I put in a sleep 0.1 to at least cause a round trip through the script scheduler, but if the server is loaded down, that short sleep isn't enough and the vehicle will again be deleted. Does anyone know what's happening here? Is there something that I can wait for to know when the coast is clear?

hazy trail
#

On a hunch, I put in a waitUntil { isNull _vehicle } before moving on to position the replacement at the exact same posASL, vectorDir and vectorUp. That seems to do the trick. No losses of replacement vehicles, even when the server is heavily loaded.

#

A different hunch, which I thought more reasonable, was that I was reusing a variable in the deletion process. So I deleteVehicle _vehicle, where _vehicle is not local, then immediately _vehicle = _replacement, then carry on using _vehicle. But avoiding an overwrite of _vehicle didn't affect the outcome at all; I always lost the replacement vehicle.

unkempt sorrel
#

is there a way to force a unit to walk a certain direction for a few feet? my move commands dont work since the ai is on top of a building so it just paths off every time unless i doStop him

fair drum
#

So I have the following:
https://pastebin.com/sk642aT2

It works for listen and SP. wondering if it would work on dedicated too when called into the init.sqf

ebon citrus
#

is suicideBomber a variable name for a unit in the mission?

fair drum
#

yuppers

#

a playable character

ebon citrus
#

nope

#

allUnits returns all units, not just those which are local

#

allUnits is also wuite a hefty list to be iterating over in a while-loop-kinda

#

well, you have a sleep 1; there

fair drum
#

i could change it to look at a unit's side.

ebon citrus
#

what's the purpose of this?

#

i feel like there oculd be an easier way

fair drum
#

just want to make it so my suicide bomber players can actually get in range to do something without getting gunned down

ebon citrus
#

make them civilian

#

?

fair drum
#

but get gunned down if they get too close so they would be suspicious

ebon citrus
#

ok, make it captive

#

and if it gets too close, set captive to false

#

just check the distance between target and the player

fair drum
#

i want it for any enemy unit. main idea is to commit war crimes but I don't want them running rampant through enemy bases. so thats why I felt I needed to do a full unit check for distance

ebon citrus
#

knowsAbout is not a check for distance

#

it's a check if the unit is aware

fair drum
#

oh is knowsAbout the only issue?

ebon citrus
#

yeah, and the logic

#

the logic works

#

although not really delicate and efficient

#

but it does the joob

#

knowsAbout does not work in mp in this way

fair drum
#

yeah I'm still learning to getting my coding more efficient

ebon citrus
#

if you run this code on the server, then yeah, but then you cant use "player"

#

since all AI is local on the server

#

"maybe"

eternal ferry
#

How can I set CfgWeapons "dispersion" variable to 0 for all weapons (even if changing weapons after mission initialization) in the Eden editor?

ebon citrus
#

you cant change configs in-game

eternal ferry
#

How can I disable bullet spread then?

ebon citrus
#

if you want to change the config, then you need to write a config-replacement mod

eternal ferry
hazy trail
#

@eternal ferry You can change the weapon sway and recoil effect on a player by player basis. If you turn them both off, you get very predictable rounds.

eternal ferry
#

already in my init

#

this setCustomAimCoef 0;
this setUnitRecoilCoefficient 0;
this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}];

hazy trail
#

So you want lasers? ๐Ÿ™‚

eternal ferry
#

for what im trying to do yes

#

I need minimum error

hazy trail
#

In your Fired handler, set the bullet velocity to something very high.

eternal ferry
#

I need drop

#

Im making charts of mil dot corrections for weapons in 25m increments

hazy trail
#

You can alter the velocity any way you want. The projectile is yours to do with as you like.

eternal ferry
#

It needs to be unmodified or the charts are meaningless

hazy trail
#

The starting premise was dropping the dispersion. Do that with your FiredMan event.

eternal ferry
#

How may I ask?

hazy trail
#

You want to avoid rounds fanning out, right? So set their velocity (very carefully) such that they always follow the direction that th ebarrel is pointing.

#

The technique may be too crude for what you're after.

eternal ferry
#

that's what im worried about

hazy trail
#

If you're trying to come up with tables, can't you statistically remove the dispersion?

eternal ferry
#

its a random value

hazy trail
#

So if you average over a large sample, you remove the randomness

#

Median. Whatever.

eternal ferry
#

yeah

#

thats what i've been doing

#

but its still inaccurate and much more time consuming

hazy trail
#

This is not a player-accessible feature, right? This is just for your table building process?

eternal ferry
#

it is a feature that uses a variable to randomize the spread, im trying to set it to 0 so I only need to shoot and record once

hazy trail
#

Understood, but if you're the only one using it to record values, then you can put together a quick mod that sets the dispersion of all weapon types that you're using. Or wherever it can be injected into the config.

#

Then you do your recordings and you're done. Toss the mod.

eternal ferry
#

that's what nica recommended but I've got no experience making mods.

#

I was asking if it can be modified with scripts

hazy trail
#

Take a look at "LAMBS Supression" mod. It's about as tiny as they come, and it only fiddles with a couple config entries. Right up your alley.

#

Yeah, I understand, but the most interesting config stuff just isn't accessible.

eternal ferry
#

"This is a small mod which alters Arma AI Brain config settings to create an AI more susceptible to suppression and stress."

hazy trail
#

This is where I pointlessly observe that a mission should simply be a mod so that we get full access to everything. Unfortunately, description.ext gives us very limited access.

eternal ferry
#

how does that mod have anything to do with what im talking about?

hazy trail
#

You can crack open that mod (it's a PBO, so you just unpack it and look it over) and use it as a template to set dispersions the way you want them.

eternal ferry
#

But its for AI, wont it need significant changes to use it on a player unit?

hazy trail
#

It modifies a config entry. You don't care which entries he's modifying. You modify the entries that you want.

eternal ferry
#

ah, i see

hazy trail
#

Remember that the config is just a big table of data. It's the dumping ground for all the static data that the programs, missions and mods draw on.

eternal ferry
#

I wonder if I could just use the equations the internal mechanics use, omitting the dispersion of course. I could then autofill and calculate the values for any weapon.

hazy trail
#

You mean, duplicate the ballistics calculations?

eternal ferry
#

Are the ballistics mechanics publicly known or protected IP?

#

yeah

hazy trail
#

They're undoubtedly highly protected

#

I doubt you could duplicate them.

#

Your best bet is to do that mod to get the dispersion to zero, then record what actually happens. When they change the engine (unlikely at this point, but possible), you'll be all set to record everything all over again.

#

I would think that a statistical solution would work best. Write scripts that will spawn up the units and weapons that you need, freeze them into a firing position, have them fire a crap ton of rounds, record them all and then save and process the data.

#

You shouldn't have to do much manually.

#

You could also ask on the forums if anyone has already set all this up. There are some folks who look very hard at ARMA's ballistics. Bohemia recently modified the sights on some weapons because they were off a fraction. Somebody picked up on that. Either experimentally or just by being very observant.

tiny wadi
#

If I have an array of players and I am checking a variable on each of their objects for true/false would this be the best way?

waitUntil { { if !(_x getVariable ["readyStatus", false]) exitWith { false }; } forEach _list; true };```
ebon citrus
#

no

#

because it would jsut always exit with the first run

#

youre always returning true

tiny wadi
#

Shouldn't the exitWith cause the true to never be run?

ebon citrus
#

no

#

because it exits into the waitUntil loop

#

from the forEach loop

tiny wadi
#

ah

#
waitUntil { { private _return = true; if !(_x getVariable ["readyStatus", false]) exitWith { _return = false; }; } forEach _list; _return };```
ebon citrus
#

nope

#

_return is out of scope

#

if you really want to do it this way:

waitUntil {
  private _return = false; 
  {
    if !(_x getVariable ["readyStatus", false]) exitWith { _return = true; }; 
  } forEach _list;
   _return 
};```
#

so as soon as readyStatus of one unit is "false" the waituntil will exit

#

or if you want it the other way around

#
waitUntil {
  private _return = false; 
  {
    if (_x getVariable ["readyStatus", false]) exitWith { _return = true; }; 
  } forEach _list;
   _return 
};```
tiny wadi
#

oh i misplaced my return

fair drum
ebon citrus
#

yeah

#

that would make the unit not be shot at until they are closer than 20 to a blufor unit

#

you might also want to consider distance2d

#

that way units in towers would act the same way

#

"perimeter guards"

fair drum
#

hmmm fair point

#

i guess the next question is will the unit be reset to captive if they respawn or do I need to write a new code in there to reset it?

ebon citrus
#

better safe than sorry

short sparrow
#

Hi, I want to execute a function when a player disconnect from server. I tried to use addMissionEventHandler ["HandleDisconnect" ... ] but it seems that doesn't work properly (its never called), any idea? Thanks

ebon citrus
#

server side or client side @short sparrow

short sparrow
#

Sever side, I realize that the problem was that I cannot use the command "execVM" inside the eventHanddler. I need to call a script from the event and this script may take a few seconds to finish (it writes to a database )

astral dawn
#

typeOf returns "" on some terrain objects although they clearly have class name, benches for instance. What should I do about it?

#

I need to get the class name of the object.

ebon citrus
#

example?

#

what object for example?

astral dawn
#

"Land_Bench_02_F"

#

But if I create it with createVehicle, typeOf returns proper class name

ebon citrus
#

works for me

astral dawn
#

Where did you find this bench on the map?

ebon citrus
#

how are you getting the object?

astral dawn
#

cursorObject

ebon citrus
#

hmmm, give me an example oin the map

#

i want to make sure

astral dawn
#

you said that it works for you, I thought you have found one on the map already

#

let me find it

ebon citrus
#

i used one that i spawned in through the editor

astral dawn
#

ah ok, but that's the point, spawning it works well

ebon citrus
#

fopund one

astral dawn
#

give me a second

ebon citrus
#

found one, so no need

#

yeah, youre right

#

@astral dawn make a bug report?

astral dawn
#

Maybe what I am doing makes no sense, because the game couldn't have obviously been released for 7 years with this error?

ebon citrus
#

what do you want?

astral dawn
#

I want to get class name of the object... because i have a list of objects I greatly care about, because I want my bots to sit on them ๐Ÿ˜„

#

So there is a match between class name and offset to place the bot

#

I can do it with model of course, I can still get model with getModelInfo

ebon citrus
#

mmmh

astral dawn
#

๐Ÿค” but if it's indeed broken, I might have lots of problems in other places of my code. I initially thought that I get "" only for objects like trees. Didn't care much to check it.

ebon citrus
#

mmmh

#

always test code

astral dawn
#

Well no it's not such a big issue, I cared mostly about houses before, and they all have typeof ๐Ÿค”

exotic flax
#

I believe terrain objects are handled different from editor/script placed objects, since the model exists, but not the class reference.

ebon citrus
#

mmmh

#

they might be baked into the terrain

#

houses are not since they need simulation

#

optimization measure?

astral dawn
#

houses are not since they need simulation
also electric poles because they need it too

#

yes seems to be the case

exotic flax
#

well, not all objects are available in 3den (scope stuff), so therefor can't be accessed from scripts, but can still exist when placed directly in the terrain

#

or just have the models "baked" in the terrain

astral dawn
#

garbage bin can be destroyed, but typeof is ""

#

I think it has same sim type as fence

jade abyss
#

no type == no config.cpp entry
You can still place it with createSimpleObject

astral dawn
#

how does it get to cfgVehicles without config.cpp entry?

jade abyss
#

?

astral dawn
#

๐Ÿค”

#

Well, the bench is clearly in cfgVehicles config class. You say that it doesn't have a config.cpp entry. How does it get there then?

#

Also I created the bench with createVehicle, not createSimpleObject.

jade abyss
#

Maybe you just didn't aim properly?

#
while{true}do
{
  hintsilent str [getModelInfo cursorObject, typeOf cursorObject];
};

*edited

astral dawn
#

I checked with near objects command. The bench from map returned "" type, the bench I placed manually returned proper type.

jade abyss
#

exec this and check the hintbox

astral dawn
#

Well it's not the case obviously... since I got the object list with near objects command.

jade abyss
#

Description:
Returns the config class name of given object or "" if object does not have a config class.

astral dawn
#

I can clearly see this class name in cfgVehicles in config viewer in game.

#

We are talking about "Land_Bench_02_F" .

jade abyss
#

Yes, you mentioned that before.

frail ledge
#

Some objects on the map don't have classes. I thought it was mainly things that land conform like walls but I guess benches as well? How I got around that was I got the modelInfo of the object, trimmed the .p3d off the end of the model name using BIS_fnc_trimString and added a "land_" prefix to it. Then I check if that isClass in cfgVehicles. I think most of the model names are the same as the classname minus the land_ prefix.

jade abyss
#

What returns getModelInfo cursorObject ?

astral dawn
#

It gives good model info, that's what I'm currently going to use as workaround

jade abyss
#

So the issue is?

astral dawn
#

The remaining issue is that it's not convenient at all and the wiki information doesn't make sense

#

Yes thanks @frail ledge , my case is easier, I am going to post-process the existing class name list I have and replace class names with model paths ๐Ÿ™‚

restive leaf
#

The wiki information makes perfect sense... It says Find objects (Units, Vehicles, Dead, Map Objects) in a sphere with given radius so things without a class in CfgVehicles are returned...

astral dawn
#

I meant that the wiki page for typeOf doesn't make sense. If it returns "" doesn't mean that there is no config entry.

#

It means anything and we don't know what exactly.

exotic flax
#

it means that the object isn't placed with a config entry

restive leaf
#

If the bench was placed as a map object it wouldn't have the land class...

exotic flax
#

but I agree that it's not very clear what the difference is

astral dawn
#

Ok, so bench I can place myself has only one thing in common with the object already on the map, and this common thing is model path. Then it makes sense.

restive leaf
#

Basically... normally, tbh, that only applies to trees, bushes and some small props... I guess benches - especially with a Land_ class I would have expected it to show in typeOf myself

#

If it aint Land_ you're generally on your own ๐Ÿ˜‰

exotic flax
#

if placed outside game, you won't be able to work with it ๐Ÿ˜‰

astral dawn
#

if placed outside game, you won't be able to work with it ๐Ÿ˜‰
Either I really must go sleep now or you said something very strange ๐Ÿ˜„

restive leaf
#

Just don't expect typeOf to work with your cactus plant ๐Ÿ˜‰

exotic flax
#
hint typeOf "Cactus";
// return: OUCH!
fair drum
#

alright back to this boy now that I've done further debugging...https://pastebin.com/p2tBvz8M

when a player does not select the suicide bomber kit, it throws an error stating suicideBomber is undefined obviously. How could I go about doing a check at start efficiently to bypass all of the code if someone does not select that kit?

hallow mortar
#
if !(isNull suicideBomber) then { ... };``` is what immediately springs to mind
fair drum
#

hmmmmmm interesting. I'll have to add isNull to the thinktank up stairs. i'll try it out.

ebon citrus
#

dont

#

incorrect usage of isNull

fair drum
#

yeah doesn't work

#

still undefined

ebon citrus
#

you have a foundational issue with your code

#

is it precedent that the user may switch to the "suicideBomber" mid mission?

fair drum
#

or they may choose to not select it at all so object never spawns

ebon citrus
#

is the object a player slot?

fair drum
#

yup, just a unit that has playable check marked and the var suicideBomber. if AI is turned off, it will never be created

ebon citrus
#

will you have to account for JIP?

fair drum
#

unfortunately yes, because this playerbase loves to click continue and rush into the mission before everyone is ready.

#

or connected

ebon citrus
#

ughhh, ok

#

make a public array

#

and add "suicide-bombers" to that array

#

through whatever means you prefer

#

then check if player is in said array

#

not exactly elegant

#

but it works

#

assuming you dont have to account for security all that much

fair drum
#

nah its a pw protected server that is only used for ops

ebon citrus
#

yeah, just do that

#

you can just have an action on an object that lets the players pick the suicide-bomber option

#

this action would add the players to the suicide bombers array

fair drum
#

good to know but its only going to be a potential of one person selecting that suicide bomber slot

ebon citrus
#

then switch the array for a variable

#

or keep it an array

#

i dont care

#

make a condition on the addaction which checks that the suicidebombers list is empty

#

that way, give or take(some lag) only one player can be a suicide-bomber

#

or idk

#

add it to the init of the object that it sets itself as the suicideBomber

#

and in init set some empty helipad as suicideBomber

#

so as soon as the player connects, the helipad is no longer the suicideBomber, but the player-objec

#

and then your condition fills

fair drum
#

oh thats an interesting perspective... that just might work

ebon citrus
#

also

#

make sure the script is only running on the server

#

stop adding pebbles on this house of cards, btw

fair drum
#

lol i guess that happens when you are learning. its like I have an idea with a very small amount of knowledge on how to execute then I keep reading, add some, read some more change some etc etc etc. at least its a good learning experience

ebon citrus
#

it's good

#

but dont expect it to work out well like that

#

at some point youre better off starting all over again

fair drum
#

yeah I might have to... the idea I had is that I have a unit that has a bomber load out that is playable and I want him to be captive unless he enters the near range of an enemy unit. it seemed like a simple idea, but now that I'm running into things like JIP and servers and stuff its messing the original idea up

ebon citrus
#

everything gets more complicated when you add in JIP and multiplayer

#

but it's very simple if you know what to do

#

your script is a good start

#

but you need to make a decission

#

do you want it to run server-side or client-side?

fair drum
#

server-side would be better since as I get further into this stuff I bet its going to be more important since I'm making multiplayer scenarios

ebon citrus
#

uhhh...

#

ok, well youre in luck

#

you know that init field?

#

in the editor

#

for units and objects

fair drum
#

yuppers

ebon citrus
#

ok

#

supposedly, it runs every time someone connects

#

for all objects

#

which have it, that is

#

ok, now name a dummy-object as "suicideBomber"

#

and then add to your unit's init field suicideBomber=this

#

supposedly, that should make it so that the init-field overrides the object-variable

#

maybe

#

and that's it

#

now just make sure that your script runs ONLY on the server

#

a simple isServer is good enough

fair drum
#

i understand all of that and will try it, but its kind of like putting a Band-Aid on it don't ya think? it will get me through this one time, but I need to learn how to do this right in the future.

ebon citrus
#

yes

#

but i cant help with that

#

if you cant ask the right questions, i cant help you

fair drum
#

nor do I expect you too lol, you've been as helpful as you can

ebon citrus
#

honestly, i haven't

#

i'm just tired

#

i've been trying my best to teach myself all night

fair drum
#

your bandaid works perfectly btw

unique sundial
#

if (!isNil "suicideBomber" && {!isNull suicideBomber}) then {...} @fair drum

vague geode
#

Is there any way to save data beyond mission/server restart? (E.g. player scores for a rank system. I don't have access to the server's startup parameters so just adding -ranking=<filename> is not possible)

winter rose
#

if you know when restart is supposed to happen, you can save data to profileNamespace (and use saveProfileNamespace to save it to file) @vague geode

vague geode
#

@winter rose The question is can I save it to a server file to avoid manipulation?

winter rose
#

it would save it to server's profile

vague geode
#

@winter rose So I just need to let the server execute the saveProfileNamespace command and it will autometically save the servers profileNamespace but how do I load it again?

robust hollow
#

profileNameSpace getvariable ...

#

as long as the setVariable/getVariable/saveProfileNamespace are executed on the server

vague geode
#

What I mean to ask was whether the server autometically loads the saved data into its profileNamespace again on restart...

robust hollow
#

yes it automatically loads the selected profile's variables/values into profileNamespace when it starts up

#

same as how a client does

winter rose
#

you just have to get them and re apply them manually obviously
e.g```sqf
private _health = damage player_1;
profileNamespace setVariable ["player1_health", _health];
saveProfileNamespace; // not to be used too frequently (file operation)

/// Server restart

private _player1Damage = profileNamespace getVariable ["player1_health", 0];
player_1 setDamage _player1Damage;

vague geode
#

@winter rose So what you are saying it that it does autometically load the saved data into the server's profileNamespace again, right? So I can just profileNamespace setVariable ["var", value]; //server restarted// profileNamespace getVariable "var";?

topaz fiber
#

Just want to pop in to say thanks to everyone thatโ€™s helped me over the last few week with my (countless?) questions.

#

I put together a mission last night front to back with everything Iโ€™ve learned and it went really well

robust hollow
#

@vague geode yes, that is correct

#

as long as you do a saveProfileNamespace before the server restarts so it writes the variables to a file so it can load them when it starts back up

winter rose
#

@vague geode yes. what @robust hollow said โ†‘

#

gg @topaz fiber, never hesitate! ๐Ÿ‘

topaz fiber
#

I mean, itโ€™s classic cheese, start at downed heli, destroy the AA to call in CAS

#

But the guys I play with are kinda new and easily pleased ๐Ÿคฃ

fair drum
#

is there an alternative to knowsAbout? can't use it for my MP game cause of its locality

winter rose
#

what do you want to do, what is the use case?

stable juniper
#

is there a way to put videos inside arma 3?

robust hollow
#

yes, .ogv files i think

fair drum
#
({(_x knowsAbout unit > 1.4)} count allUnits == 0)

unit is a player controlled unit with a var. but as far as I know, I can't use it like this in a MP setting

vague geode
#

I have another question: There is this "surrender" action where the unit puts its hands behind its back and is unable to do anything. 1. is it possible to allow it to move? 2. is there a way to check whether or not a player is currently surrendering to e.g. take him/her captive?

stable juniper
#

how would one go about doing that if you dont mind explaning it to me?@robust hollow

warm hedge
#

There's no walking surrendering animation in vanilla Arma

robust hollow
#

@stable juniper you convert your video to the ogv file type, put it in a pbo, then play it on a rscvideo ui control

winter rose
#

@fair drum not like this no.
is it AI checking or only players knowsAbout?
you could do a server-side

[west, east, resistance] findIf { _x knowsAbout unit > 1.4 } == -1
fair drum
#

AI is checking a player unit yes

winter rose
#

then server-side for AI check

fair drum
#

what is making this server side vs the original. I know yours does a lot less calculations that way and I need to start doing that

winter rose
#

yours could work server-side too
AI groups are usually on the server (or headless client)
so doing a side-wide check does this

also [west, east, resistance] findIf { _x knowsAbout unit > 1.4 } may not be completely correct, his own side may of course know him

fair drum
#

how do I go about throwing all units of a side into an array for a findIf command?

fair drum
#

i'm just doing a [arrayofallsideunits] findIf {_x distance2d unit < value} == -1

winter rose
#
private _westUnits = allUnits select { side _x == west };
fair drum
#

ahhhh gotcha

winter rose
#
private _result = allUnits findIf {
  side group _x in [east, west]
  && { _x distance2D unit < value }
};
if (_result == -1) then {
    // no enemies close to unit
};
```simplified

_geek waaar!_
unkempt sorrel
#

Is it okay if i post a kinda long script?

#

idk the limit or whatever

warm hedge
#

2000 characters is the limit I think?

unkempt sorrel
#
params["_unit"]; 

_unit addAction [format["<t color='%1'>Climb Ladder!</t>","#32CD32"],
{
    // ensure cursor object is valid
    if (isNull cursorObject) exitWith {hint "No object found to climb.";};

    // initialize variables
    _object = cursorObject;
    _ai = _this select 0;

    // check if cursor is on ladder or pier
    if ((["ladder", toLower str _object] call BIS_fnc_inString) || (["pier", toLower str _object] call BIS_fnc_inString) || (["building", toLower str _object] call BIS_fnc_inString)) then 
    {
        // make ai climb ladder
        _ai action ["ladderUp", _object, 0, 0];

        // add event trigger for ladder loop
        _ai addEventHandler ["AnimStateChanged", 
        {
            params["_unit", "_anim"];
            if (["ladder", toLower str _anim] call BIS_fnc_inString) then 
            {
                // add additional event trigger for finished ladder climb
                _unit addEventHandler["AnimStateChanged", 
                {
                    params["_unit", "_anim"];
                    if (["dnon", toLower str _anim] call BIS_fnc_inString) then 
                    {
                        hint "walking foward";
                        // walk forward
                        _pos = (_unit getRelPos [-2, (getDir _unit)]);
                        _unit setVehiclePosition [[_pos select 0,_pos select 1,(_pos select 2)+200], [], 0, "CAN_COLLIDE"];
                        doStop _unit; 
                        _unit removeAllEventHandlers "AnimStateChanged";
                    }
                }];
            }
        }];
    };
}];```
#

i finally got that ladder script to work

#

just gotta work on descent now lol

robust hollow
#

BIS_fnc_inString is case insensitive by default so you could remove all those tolowers if you wanted.

final marlin
#

For ACE3, any idea how to apply ace_medical_statemachine_fatalInjuriesPlayer - cardiac arrest only to specific units rather than blanket change it for everyone in the addon setting?

Tried _this setVariable ["ace_medical_statemachine_fatalInjuriesPlayer",1,true]; but to no avail.

unkempt sorrel
#

@robust hollow i think my friend said that the toLower part doesn't make it case sensitive and compiles all that data from the string

robust hollow
#

the toLower part doesn't make it case sensitive
technically correct, though by default BIS_fnc_inString does toLower for you, which is why you shouldnt need to do it yourself here.

also in some cases you shouldnt need str either. things like str _object is correct, turning the readable object return into a string for comparison, but others like str _anim is unnecessary as _anim is most likely already a string.

Not major issues, and hardly even minor issues. Just very very small things that can give you the slightest bit better performance ๐Ÿ‘Œ

winter rose
#

@final marlin tried true instead of 1?

unkempt sorrel
#

@robust hollow thanks man! ill take that into account, it's my very first script, and i only did it cause my ai could never climb a ladder lol

#

plus a lot of it was my friend so i never got the chance to really create a script from the ground up yet :D

short fossil
#

Does any body know a script for Connecting or synchronizing the Camera Module to a Monitor so It live feeds I am quite new to the Scripting and want to look into it but I just couldn't find a script for it?

exotic flax
#

Not sure if the Camera Module is suited for that, although you can use camCreate to create a (virtual) camera and have the output rendered on an object (like a laptop or TV screen) with setObjectTexture

short fossil
#

Could you give me the full script if its possible?

exotic flax
#

I have one available but is useless when not used in the same context as I do...
You'll be able to find several examples on the wiki, the forums and elsewhere on the internet.

#

do note that this Discord is for helping others, not writing/building stuff for free...

short fossil
#

Okay, thanks anyways.

smoky verge
#
params["_v","_t","_tex"];

_n = (getArray (configfile >> "cfgVehicles" >> typeOf _v >> "hiddenSelections")) find _t;

_v setObjectTextureGlobal [_n, format['\mod\data\%1.paa',_tex] ];

can anyone help me understand what this exactly does?
I'm trying to repurpose it but whatever I do it doesn't seem to work

exotic flax
#

_v = object (like a vehicle)
_t = original texture path/name
_tex = custom texture name

smoky verge
#

yeah I imagined that part
this sqf is called from a function which is called from a config attribute
still not sure if it does what I expect
pretty sure it changes a texture but not sure according to what

exotic flax
#

and it will replace the original texture with the custom texture, based on the index of the found hiddenSelections

smoky verge
#

and where would this index be?
and how does it decide which texture to pick out of it?

#

if you remember this is about that dropdown menu I've been talking about lately

exotic flax
#

so if the object has:

hiddenSelections[] = {'textureA.paa', 'textureB.paa', 'textureC.paa'};

and you call:

[VehicleClass, 'textureB', 'myCustomTexture'] call MY_fnc_someFunction;

Than textureB will be replaced with myCustomTexture

smoky verge
#

oh this is interesting
from the caller it uses something similar to that 2nd line you used

expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
#

maybe I don't need to modify anything else and instead I need to fill the hiddenselection index wherever that is

exotic flax
#

ahhh... crap... hiddenSelections (used in the script) will take the name of the selection, instead of the texture itself, so 'camo1' is correct

#

as long as 'camo1' exists of course

smoky verge
#

camo1 exists but hiddenselectionsTextures[] = {""}; is empty
should I just dump all the paths of all the textures I'd want to use?
but by doing so how will I know which one I need to use

exotic flax
#
[_this,'camo1',_value] call SZ_fnc_changeFlag

This should work, since it will simply set the texture of 'camo1' to _value

#

or better said '\mod\data\value.paa'

smoky verge
#

so I have to somehow tie each of the values to a texture?

            expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
            defaultValue=0;
            typeName="STRING";
            
        class Values 
                {
                class logoA {
                    name = "logoA";
                    value = "logoA";
                    };
                class logoB {
                    name = "logoB";
                    value = "logoB";
                    };
                class logoC {
                    name = "logoC";
                    value = "logoC";
                    };
#

could I just put the path in each value =

exotic flax
#

the value of those items is the name of the file, which must be in \mod\data\ (so change that in the function file to the correct location of your assets)

smoky verge
#

I somehow understand the sense
I'll make some tests

#

@exotic flax so the script seems to work fine but the textures don't show up

winter rose
smoky verge
#

it doesn't give me a texture not found error
nor pboproject gives me any error

exotic flax
#

in that case the paths to the textures are most likely incorrect

smoky verge
#

if they were incorrect pboproject wouldn't be able to pack
I know because they were before I tried again

exotic flax
#

but pboproject doesn't check if scripts are working correctly ๐Ÿ˜‰

smoky verge
#

only hint I'm getting is a rvmat not found when I place the object for the first time

#

error that doesn't show up if I use the texture normally without this script

#

maybe the path in the function
not sure if I've done that part right

exotic flax
#

add the following line at the bottom of your function file:

systemChat format["_t: %1 - _n: %2, _tex: %3, _result: %4", _t, _n, _tex, format['\mod\data\%1.paa',_tex]]; // and set correct path in format as well

and check the results

#

_result should point to the correct file

smoky verge
#

where would it show up?

exotic flax
#

in chat

smoky verge
#

I guess I have to start the mission for that

exotic flax
#

you can replace systemChat with diag_log to dump it in the RPT instead

barren spire
#

can I make the AI shut up while still allowing sideRadio to work?
(enableRadio shuts the AI up, but also the sideRadio command)

smoky verge
#

so the systemChat doesn't pop up so I must guess the function is not being played at all

winter rose
warm hedge
#

Don't know where you put that but chat doesn't exist in the first frame. You'll need to suspend or use hint

smoky verge
#

like a sleep 5; ?

warm hedge
#

That will do. Only 0.1 or so will do though

smoky verge
#

oh got it

topaz fiber
#

Guys, is there a reason a script would work once then not? I have a kinda standard save loadout of death on player killed and then empty gear and load from saved loadout in playerrespawn. Works first time then second time I respawn I get the basic loadout of the unit. Not what I set in the editor

#

Or what I had when I died. ๐Ÿคท๐Ÿผโ€โ™‚๏ธ

winter rose
#

maybe because you reference the unit object itself
when you respawn, you become another "object"

warm hedge
#

How did you do actually?

topaz fiber
#

Hmm. Itโ€™s from a script I see used in a lot of tutorials etc

#

player setVariable ["Saved_Loadout",getUnitLoadout player];

winter rose
#

if it doesn't use event handlers, it is probably the issue yes

topaz fiber
#

THEN THIS

#

oops

warm hedge
#

Where did you put it? An event script?

topaz fiber
#

first onPlayerKilled.sqf
second onPlayerRespawn.sqf

smoky verge
#

@exotic flax the chat doesn't show up even with the sleep
I'm almost completely sure the function is not being called
and I'm not sure why
~~maybe I'll just have to use

expression = "[_this,'camo1',_value] call SZ_fnc_changeFlag"

instead of

expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
```~~
nevermind still doesnt
warm hedge
#

Hmm. Probably because I'm not really familiar with how those event scripts work, I don't see the issue (in my brain) right now...

topaz fiber
#

ha, neither do i. Whats worse is i sware i copied them from another mission where it works

warm hedge
#

This is not something to solve the issue though those โ€œremoveโ€ scripts in onPlayerRespawn.sqf are not necessary, since setUnitLoadout will replace everything in this context

topaz fiber
#

i did think that, i was just trying to fix it, i started with just the setUnitLoadout

#

whats really meting my brain is that it works the first time i respawn and then not again

#

is respawning through the menu different to actualy being killed?

smoky verge
#

sometimes I see the game acts differently when you hit respawn in the menu and when you get killed by an enemy
could it be that?

topaz fiber
#

need to test i think

#

And by test I mean repeatedly throwing myself on grenades ๐Ÿคฃ

smoky verge
#

lmao

exotic flax
#

Check the mission settings regarding respawns, since it might be possible that no scripts are called at all

smoky verge
#
expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";

why wouldn't this work
if I read it correctly when the starting value is not logoA then the _value will be the one in the function, which takes the value from the bottom list
checks out

still forum
#

where is that "expression"? config where?

#

where does _value come from?

smoky verge
#

sorry @still forum
didn't want to clog the chat by reposting the whole thing
here is the control combo

        class SZ_custom_flag    
        {
            control = "combo";
            property = "SZ_custom_flag";
            displayName = "logo";
            description = "This combo has 3 values.";
            tooltip = "Choose the logo to use on the box";           
            expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";
            defaultValue=0;
            typeName="STRING";
            
        class Values 
                {
                class logoA {
                    name = "logoA";
                    value = "logoA";
                    };
                class logoB {
                    name = "logoB";
                    value = "logoB";
                    };
                class logoC {
                    name = "logoC";
                    value = "logoC";
                    };

and this is the function that I'm 90% sure it doesn't call for some reason

params["_v","_t","_tex"];

_n = (getArray (configfile >> "cfgVehicles" >> typeOf _v >> "hiddenSelections")) find _t;

_v setObjectTextureGlobal [_n, format['\box\data\logo\%1.paa ',_tex] ];

sleep 2;

systemChat format["_t: %1 - _n: %2, _tex: %3, _result: %4", _t, _n, _tex, format['\box\data\logo\%1.paa',_tex]];
still forum
#

I'm 90% sure it doesn't call
add logging

smoky verge
#

thats what the bottom systemChat does thanks to Grezvany
but it doesn't show up

#

and there are no errors
so I'll just guess its not being called

#

oh forgot to specify
the second part is actually an sqf called by a function
can I not just call the sqf instead of the function?

still forum
#

how is "a sqf" different from a function?

#

functions are usually also in sqf files

topaz fiber
#

maybe because you reference the unit object itself
when you respawn, you become another "object"
@winter rose could you explain this a little? Thanks

winter rose
#

when you spawn, you are a unit (unitA)
you die, you transfer from unitA (corpse) to unitB (new unit)
values set with setVariable may not transfer

smoky verge
#

@still forum was trying to understand why it wasn't being called
I'm trying to simply call the sqf ingame from the console

topaz fiber
#

@winter rose thatโ€™s really interesting. Thanks.

#

I would prefer it to be โ€˜will notโ€™ instead of โ€˜may notโ€™

#

May not adds too much confusion โ˜บ๏ธ

winter rose
topaz fiber
#

So that explains why it works once? ๐Ÿค”

winter rose
#

again, not really sure

what I would do is:

_newUnit setUnitLoadout getUnitLoadout _oldUnit;
```This would make the unit respawn with the loadout at the time of death (if that's what you want?)
topaz fiber
#

Yeah. Just for the player to respawn with exactly the same as what they had when they died

winter rose
#

that should do the trick
I was not sure if you wanted them to always respawn with the same loadout, defined at the beginning

smoky verge
#

@exotic flax ran the systemChat manually and the paths match

still forum
#

I don't understand what you mean by "call the sqf" think_turtle

smoky verge
#

I just executed the sqf from the console to see if the path used matches with the one that shows up

#

this stuff

systemChat format["_t: %1 - _n: %2, _tex: %3, _result: %4", _t, _n, _tex, format['\box\data\logo\%1.paa',_tex]];
#

so the clear problem is that the espression doesn't call the function for some reason
and I'm clueless on why

topaz fiber
#

again, not really sure

what I would do is:

_newUnit setUnitLoadout getUnitLoadout _oldUnit;
```This would make the unit respawn with the loadout at the time of death (if that's what you want?)

@winter rose as simple as putting that in the onPlayerRespawn.sqf?

winter rose
#

I think so yes

#

don't blame me if your computer crashes or your ex comes back

smoky verge
#

I can blame you for my ex leaving me๐Ÿ˜ญ

winter rose
#

perhaps, I travelled a lot

smoky verge
#
expression = "if(_value != 'logoA')then{ [_this,'camo1',_value] call SZ_fnc_changeFlag}";

if I understand correctly this line would need to be costantly active during eden wouldn't it?
because it will need to constantly check if _value is not logoA
maybe thats what I'm doing wrong?
but again
its a config so it shouldn't need anything to be activated

fleet stirrup
#

Could put it on an event handler?

smoky verge
#

not sure it could help

#

how would it know I'm choosing which selection

#

this single line has been driving me insane for 3 days

#

I've seen this happen so I know its possible
just don't understand why it works for rhs and not for me

winter rose
#

you didn't pay the SQF tax

smoky verge
fleet stirrup
#

I'm new to this conversation, is there a reason for checking if the value is not LogoA?

smoky verge
#

well if the value is not logoA(the default one) it means the user has selected another one

#

and will use the texture assigned to the new value

fleet stirrup
#

It will also be called if you had changed it to logo b and want to go back to logo a no?

smoky verge
#

I havent made it but judging by the fact the rhs one works I'd say yes
still can't get it to work tho

digital jacinth
#

Short question, do I have the Mandela effect for thinking there is an sqf eventhandler for reload start and reload end for units? I was looking at the wiki and I swear that existed, or rather the reload start eh was introduced at some point.

still forum
#

one was requested

#

doesn't exist

digital jacinth
#

Damn...

smoky verge
#

shortened to the possible causes and I think the problem is this part
if(_value != 'logoA')then

#

don't see anything wrong though

still forum
#

Arma can't play mp3's

hushed tendon
#

any others?

smoky verge
#

I think it uses ogv

hushed tendon
#

Might be a bit of a question but can someone possibly provide me with a script that can play a random ogv when player dies?

still forum
#

ogg/wss

#

ogv is video

smoky verge
#

oh right

hushed tendon
#

dang it

still forum
#

killed eventhandler
selectRandom
playSound

can't write full script now but these are the pieces

smoky verge
#

look them up in the biki to understand how to mix them

hushed tendon
#

sure but i might be back in an hour

astral dawn
#

Any ideas how to set trigger's refresh interval to a different value if it's attached to an object?

half hornet
#

is there a way to modify the positions of bones on an object via scripting?

still forum
#

no

#

unless you make a animation and start it via script

half hornet
#

damn, was hoping to make something more dynamic

hushed tendon
#

if (alive player AND !(player getVariable ["ACE_isUnconscious", false])) then
{
_sounds = ["sound1","sound2","sound3"];
playSound (_sounds select ([0,(count _sounds)-1] call BIS_fnc_randomInt))
};

That Script good?

still forum
#

(_sounds select ([0,(count _sounds)-1] call BIS_fnc_randomInt))
badcode