#arma3_scripting

1 messages · Page 745 of 1

sonic sleet
#

Man this, This is VERY not friendly to noobs lol

open fractal
#

at least you get the tools in this game

#

once you get the hang of sqf the ai becomes the annoying part to deal with

sonic sleet
#

rip

#

OH I LEARNED SOMETHING AWESOME
You can highlight an entire chunk of code and hit TAB and it indents all of it

#

Amazing

#

Do I need a Semi Colon at the end of this?

private _uniform = selectRandom [
    "CUP_O_TKI_Khet_Partug_08",
    "CUP_O_TKI_Khet_Partug_07",
    "CUP_O_TKI_Khet_Partug_06",
    "CUP_O_TKI_Khet_Partug_05",
    "CUP_O_TKI_Khet_Partug_04",
    "CUP_O_TKI_Khet_Partug_03",
    "CUP_O_TKI_Khet_Partug_02",
    "CUP_O_TKI_Khet_Partug_01"
]
winter rose
#

nopenopenope

#

yes

sonic sleet
#

wait

#

wha

winter rose
#

depends

sonic sleet
#

OH

#

the Select random?

winter rose
#

no, no
only the file's final semicolon is not needed, but it is always a good thing to have - you don't want to look for it when you add lines to your script

sonic sleet
#

is there any problem with adding a Semicolon on the Last one in the FIle?

winter rose
#

never

sonic sleet
#

k

winter rose
#

add it, good practice, saves headache

sonic sleet
#

yeah good to know

open fractal
#

the compiler doesn't see the line breaks and indents, so you need to separate things out with the semicolon

sonic sleet
#

Oh thats, thats a very simple way to make a disgusting image that makes alot of Sense

#

Thanks

winter rose
#
private




_a=


5



;
```is the same as```sqf
private _a = 5;
sonic sleet
#

ewwww

#

I get it but ew

winter rose
#

so if you do

private _array = [
1
]

hint "hello"
```it's the same as doing```sqf
private _array = [1] hint "hello"
```and the engine says "wait a minute"…
sonic sleet
#

Yeah, I understand that on a Whole other level now

#

Cheers

#

Ive also now got a Cursed image of all this code compiled in my head. So. Thanks.

open fractal
#
private _array = [1];hint "hello"
sonic sleet
#

Stop

#

Put a space in there

#

Please

winter rose
#

P L E A S E

open fractal
#

i put it in the debug console, ghost, what did it say on the top right of my screen?

winter rose
#

goodbye

open fractal
#

i am unstoppable

sonic sleet
#

noooo

open fractal
#

lou has been defeated crabrave

#

shit i gotta go

sonic sleet
#

I like how the Ingame Arsenal calls it "Facewear" But SQF, says no. "Goggles"

#

Gl man

#

Please tell me Lou you're still here

open fractal
sonic sleet
#

god

#

why

open fractal
sonic sleet
#

NOOO

winter rose
winter rose
open fractal
#

shhh

sonic sleet
#

I see

#

Oookay

#

Got all the "goggles" Cough Facewear. and Headgear done. Time for script time

#

I assume

_unit forceAddUniform _uniform;

Removes overrides the Previous Uniform since it says "Force"

open fractal
#

I’d put money on it

winter rose
#

it's a bit different than that

sonic sleet
#

oh

#

please

winter rose
#

addUniform replaces the uniform as well
forceAddUniform is to add the uniform to an enemy side

sonic sleet
#

OH

winter rose
#

you can see its wiki page, it allows to assume the minimum possible amount 😉

sonic sleet
#

ah

#

okay so how do I call this function again

#

GH_civLoadouts

open fractal
#

GH_fnc_civLoadouts

sonic sleet
#

oh

open fractal
#

so

#

you need to pass the unit to the function

sonic sleet
#

So

this GH_fnc_civLoadouts
open fractal
#

No

winter rose
#

👀

open fractal
#

[this] call GH_fnc_civLoadouts

sonic sleet
#

so

#

Oh

#

I was close

winter rose
#

arguments call function 😉

sonic sleet
#

AHH the Arguments

#

Is it obvious I've never coded XD

open fractal
#

neither have I

sonic sleet
#

lol

#

Alright test time!

open fractal
#

be you define _unit in the function

sonic sleet
#

huh

#

GReaaaat question let me go check..

#

Yeah how how

open fractal
#

you can either write
params [“_unit”];
or
private _unit = _this select 0;

#

both of these functionally do the same thing

winter rose
#

the former the better 👀

winter rose
sonic sleet
#

so..
params [“_unit”]; does what

open fractal
#

it takes the argument you provide and slaps it into _unit

sonic sleet
#

so

#
params [“_unit”];
removeVest _unit;

_unit addUniform _uniform;
_unit addVest _vest;
_unit addBackpack _backpack;
[_unit, _weapon, 5] call BIS_fnc_addWeapon;
_unit addHeadgear _headGear;
_unit addGoggles _goggles;
open fractal
#

if there’s two arguments it would be
params [“_unit”,”_otherOne”]

sonic sleet
#

so to make sure we are on the same pag

open fractal
#

yeah assuming everything is defined above

sonic sleet
#

This thing spawns units (agents) and by typing
params [“_unit”];
it magically knows that I want _unit to target that Agent?

#

_unit isnt defined anywhere else

open fractal
#

so with params you’re telling it that whatever argument you call the function with gets turned into _unit

#

_unit can be anything

sonic sleet
#

so params [“_unit”]; make whatever its called to the _unit?

#

SO whatever runs the function become the _unit?

open fractal
#

no

#

whatever argument you call the function with

sonic sleet
#

oh

#

so "this"

#

Oh

#

Thats why he said

#

Gotcha

open fractal
#

[GhostHeart] call fn_myFunction

#

_unit becomes GhostHeart

sonic sleet
#

k

#

okay PERFECT

#

the params mean whoever calls?

open fractal
sonic sleet
#

Wait

#

Wait

open fractal
#

params is anything you put in that arguments field

sonic sleet
#

Yeah so

this call fn_myFunction

the "This" Is calling the fucntion so it becomes the _Unit no?

open fractal
#

If you write [12345] call myFunction then _unit becomes 12345

sonic sleet
#

Yeah

#

So Params says whatever calls it becomes it

open fractal
#

“this” isn’t calling the function

#

It’s an argument

#

It’s the input for the function

#

it’s what you’re feeding it

sonic sleet
#

Okay then what does "This" do then

open fractal
#

if you put it in the units init field “this” represents the unit

sonic sleet
#

k

#

OH

#

it RUNS AS THIS

#

like

open fractal
#

so you’re inputting that unit to the function

sonic sleet
#

THis Object

#

this thing

#

Please say yes

#

and not😠

open fractal
#

you’re feeding the unit into the function and it gets spat out clothed

sonic sleet
#

Gotcha

open fractal
#

it’s the same as writing the unit’s variable

sonic sleet
#

Okay problem it didnt work

open fractal
#

write some systemchat lines in the function so you can see if it’s being called

sonic sleet
#

oh I was missing a }; on the Description one sec

open fractal
little raptor
#

wat?

open fractal
#

params likes strings

little raptor
#

wat?

#

does that look like a string to you??

#
params [“_unit”];

vs

params ["_unit"];
open fractal
#

sonic sleet
#

fun fact Im getting an error with that Exact thing

little raptor
#

which is?

sonic sleet
#

wtf are those quotes

#

Invald number in expression

little raptor
#

well _uniform is not defined

sonic sleet
#

it is

#
private _uniform = selectRandom [
    "CUP_O_TKI_Khet_Partug_08",
    "CUP_O_TKI_Khet_Partug_07",
    "CUP_O_TKI_Khet_Partug_06",
    "CUP_O_TKI_Khet_Partug_05",
    "CUP_O_TKI_Khet_Partug_04",
    "CUP_O_TKI_Khet_Partug_03",
    "CUP_O_TKI_Khet_Partug_02",
    "CUP_O_TKI_Khet_Partug_01"
];
open fractal
#

“””””

sonic sleet
#

ew

little raptor
#

I don't see it defined in the previous code

sonic sleet
#

says

params ["_unit"];

Invalid number expression

#

huh is there some way I can link the whole thing?

#

I was told by Lou not to drop alot lol

little raptor
open fractal
sonic sleet
little raptor
sonic sleet
#

Function

#

one sec

#

using Civilian Presence Module
"Code on Unit created"

this call GH_fnc_civLoadouts
#
class CfgFunctions
{
    class GH
    {
        class Loadouts
        {
            class civLoadouts {};
        };
    };
};
open fractal
#

are you sure “this” works with the module

sonic sleet
#

This 100% works

little raptor
#

I don't think they have a this

sonic sleet
#

one sec

#

it does one sec

#

I made it work with this but with setloadout (getloadout) etc

#

Lemme see if I still got it

#

OH

#

its _this

#

so

#

does that Params work with _this?

open fractal
#

yeah

sonic sleet
#

hmm got an error still

open fractal
#

what error

slim stag
#

Idk if this goes here or not.

#

But does anyone have any tips for ai inserting under fire?

sonic sleet
#
...
...
...
_unit a...'
Error Invalid number in expression
Line 193
slim stag
#

Like, AI usually flees or lands somewhere else away from the firefight, but I don't want that obviously.

open fractal
winter rose
sonic sleet
#

is it bad to replace _unit with just _this

open fractal
#

Yes

#

the function doesn’t know what _this is

#

that’s why you pass it

sonic sleet
#

ah

#

Are we sure it works with _this

open fractal
#

what you can do is you can type
systemChat str _unit;
after params and it’ll chat to you in-game what it thinks _unit is

sonic sleet
#

Agents

#

All agents

#

Which is correct

#

wait

#

im confused

#

it works now

#

?????????????????????

winter rose
#

some wrong save/load before testing perhaps ^^

open fractal
#

maybe because you backed out and saved

#

Lou you’re fast

sonic sleet
#

Maybe, but like

winter rose
sonic sleet
#

I changes the ingame _this

#

Would I have to Re save the sqf because of that?

winter rose
sonic sleet
#

to add "systemChat str _unit;"

winter rose
#

and the test before that, no?

sonic sleet
#

Unless I thought I saved before but didnt?

winter rose
#

ah well

sonic sleet
#

Im so confused

#

But IT WORKS

#

Its Beautiful

sonic sleet
#

yay 60 Agents roaming a city

winter rose
#

welcome to Armagic

sonic sleet
#

😄

open fractal
#

Aren’t you glad you weren’t writing out all those arrays in the little module box

sonic sleet
#

Honestly

#

I would've done WAY less in that

#

But because I had an array, I went WAy overboard on the Options lol

#

SO yes

#

Okay so now Ive got 2 new things to tackle

#

OOOOH IVE LEARNED SO MUHC,
I was just thinking, I want to make vehicles drive through and despawn once they leave the area.
I Know how to make an Array of Vehicles and pick a Random one now pog

#

Cheers everyone. Its time for sleep

winter rose
#

'night! 👋

stuck rivet
#

trying to make random waypoints, but I need a way to check that waypoints aren't put on top of each other. Is there a way to check if two arrays are or are not the same?

winter rose
#

or you could remove the used array from the pool of arrays

stuck rivet
#

ah thanks saved me from lot of for loop shenanigans

#

i didn't see multidimensional arrays in the wiki examples nor do they mention it(position coordinates are arrays themselves). Is multidimensional arrays possible in arma scripting?

winter rose
#

yes of course 🙂

#
private _arrayLv2 = ["array"];
private _arrayLv1 = [["arrayLv2 v1", "v2", "v3"], _arrayLv2, _arrayLv2, ["lol"]];
```etc
stuck rivet
#

i see thanks

frosty scarab
#

anyway to change colorBackgroundActive of a button

#

via scripting

#

or does anyone know a workaround

#

or a way in config or scripting to remove the hovering (colorBackgroundActive) color altogether would work

steel fox
#

Just set it to the same color as the normal background color?

frosty scarab
#

I need to change the normal background color dynamically however

#

but you can't change the focus color dynamically

steel fox
#

Use a non button UI class and use a mouseDown eventhandler to make it a button?

frosty scarab
#

I will try that thanks

#

what non ui class would you recommend?

steel fox
#

Just an RscText and shape it like a button?

frosty scarab
#

I don't do dialog very often sorry

steel fox
#

But what are you doing that requires a dynamic hover color?

frosty scarab
#

its not dynamic hover color per say

#

I wanted to remove hover color altogether

#

one solution to that would be have it dynamic so I can set it to whatevers underneath

#

which would give the impression it is removed

steel fox
#

So you just what a clickable that doesn't do any thing that a button does? Yeah, just use a CT_TEXT with an eventhandler.

frosty scarab
#

Yea exactly

#

It basically just needs to change color as soon as its clicked

#

it was just a square

steel fox
#

CT_Static = RscText but just don't give it any text.

#

And give it an onMouseDown UI eventhandler. That will react to buttons clicks.

frosty scarab
#

cheers man

steel fox
#

Np

hollow plaza
#

How would I go about making a script where it'd set the hitpoint damage for all of a players' body parts using a saved getAllHitPointsDamage array. I found similar cases but they all seemed to have a little bit of a difference and I'm not confident in my ability to fit them to the needed purpose.

little raptor
hollow plaza
#

Huh, it seemed to work for a second there.

#

Oh right, there we go, of course it needed to be (_hitDamage select 2), I must've accidentally put in the wrong one after already having it right.

little raptor
#

Create an invisible man instead

dusky pier
#

Good evening!
Could you help me, please?
I trying to check if player stay on the top of the vehicle.

Tryed to do it with boundingBoxReal and worldToModelVisual, but it looks not so good
Is exists any another way to check this condition?

Edited
Find solution - done it with:
https://community.bistudio.com/wiki/lineIntersectsWith

winter rose
#

so nope, not through script

little raptor
#

There is a vanilla soldier that is invisible

dusk gust
#

Theres technically 2 ways to do with with script

little raptor
#

VirtualMan_F

dusk gust
#

"U_VirtualMan_F"

#

Damn beat me to it lmao

dusk gust
dusky pier
little raptor
#

surfaces one is more flexible

#

not sure which LOD the with one uses, but using the GEOM LOD in surfaces variant can easily double the performance (the GEOM lod is typically the simplest lod in all models)

dusky pier
opal zephyr
#

Hiya, im trying to set the animation of a simple object in the form of a player model. Its giving a generic error

_d = typeOf _x;
_p = getPosASL _x;
_p = _p vectorAdd [0,0,1];
_t = getObjectTextures _x;
            
_as = animationState _x;
            
_s = createSimpleObject [_d,_p];
_s setObjectTextureGlobal [0, _t select 0];
_s setObjectTextureGlobal [1, _t select 1];
        
[_s,["","",0,0,[_as, 0.5]]] call BIS_fnc_adjustSimpleObject;
cosmic lichen
#

@opal zephyr What's _x?

#

Also, those variable names aren't helpful

opal zephyr
#

_x is part of a foreach for an enemy ai

#

All the variables that are used are set in that code chunk I sent, I dont know what you mean by they arent helpful

#

is it maybe because im using "createSimpleObject" and not "BIS_fnc_createSimpleObject"?

cosmic lichen
#

Dunno, your code generally looks okay.

#

add some debug_log after each line to see where it fails

opal zephyr
#

Its failing with the last line, everything else completes successfully and outputs cleanly

little raptor
opal zephyr
#

do they support any kind? The simple object spawns t-posed which makes sense, I was hoping to switch it to a standard standing with rifle pose instead

little raptor
#

No. Only model animations

opal zephyr
#

something like this?

_tank animate ["Wheel_podkoloL6", 0.5, true];```
little raptor
#

Yes. But characters don't have such animations

opal zephyr
#

damn

#

Thanks for the help

wary python
#

is there a way to check if a magazine is compatible with a given weapon?

little raptor
wary python
#

does this work with all modded mags aswell or just basegame?

little raptor
#

All

wary python
#

nice, thanks a lot

dapper cairn
#

Question... if I put the GM6 Lynx sniper on a autonomous turret is there a way I can enable zeroing on it? (Using ACE on the server)

wide prairie
#

Has setAnimSpeedCoef gotten changed in a recent update? It no longer seems to have a lasting effect anymore causing me to have to use a while loop that keeps executing it which I don't remember being the case previously

bitter jewel
#

do you mean setAnimSpeedCoef

#

how long does it last

#

for me it has lasted at least a minute now

#

perhaps you are using a mod that uses setAnimSpeedCoef

#

?

wide prairie
wide prairie
wide prairie
winter rose
#

vaaanilla? 👀

bitter jewel
#

my unit has kept its animSpeedCoef for 25 minutes now

wide prairie
#

Just loaded up vanilla and tested and it works fine

#

pain

#

Loaded up cba and ace only and now it no longer works

finite mica
#

So there is a line of code somewhere in this composition that is faulty and I need to delete it, is there a way that I can search for this line of code with out having to check every object for it?

reef walrus
#

ACE uses it for its stamina system

tough parrot
finite mica
#

I wanna say I know how to do that but Im very technology stupid

tough parrot
#

checkbox at bottom of save dialog

#

file is in the my documents/arma 3/missions

finite mica
#

Nvm I just accidentally clicked on an object and found the line of code 😂😂😂

#

It’s my lucky day

turbid crag
#

How does Arma clean up weapon holders when deleting corpses?
It seems to tied to the corpse somehow - I'd like to know if I can access that information and manipulate it?

warm coral
#

can someone explain to me how i can find the projectile of say a turret etc

bitter jewel
warm coral
#

yeah but dont you need the projectile name for "_projectile" for it to work?

willow hound
#

No. If you use params as shown on the linked page, the local variable _projectile contains the projectile object.

undone dew
#

I'm trying to use the location of a trigger that's being used to run a script in the script to spawn AI at - how do I do this? I swear I've seen it somewhere and can't remember how to set it up, it was something like
Trigger OnAct:

[_thistrigger] execVM "randomEncounter.sqf";

In randomEncounter.sqf:

params ["_thisTrigger"];
_pos = [_thisTrigger, 0, 25, 50, 0, 0.4, 0] call BIS_fnc_findSafePos;
_grp01 = [_pos, west, (configfile >> "CfgGroups" >> "West" >> "rhs_faction_usarmy_wd" >> "rhs_group_nato_usarmy_wd_infantry" >> "rhs_group_nato_usarmy_wd_infantry_team")] call BIS_fnc_spawnGroup;
willow hound
#

Try with [thisTrigger] execVM "randomEncounter.sqf"; 🙂

undone dew
#

ahhh it works, thank you!

willow hound
#

Didn't the game complain about the undefined variable (_thistrigger)?

opal zephyr
#

Does worldToScreen work in multiplayer?

undone dew
distant oyster
opal zephyr
distant oyster
#

it will work for the players but not for the dedicated server itself. about the second one: I am not too sure but I don't think so. test it

opal zephyr
#

hmm, I dont think I know this enough to follow why the dedicated server would even be able to see it. Does that mean the actions performed by worldToScreen can only happen clientside and nothing can affect the server?

distant oyster
#

no i mean that the dedicated server has no "screen"

#

so ofc worldToScreen will not work

#

the dedicated server is its own instance, just like a client/player is

opal zephyr
#

ah ok, thankyou!

undone dew
#

how can I make a trigger wait for a condition to be set by the script that the trigger runs? I have this in the triggers onAct:

[thisTrigger] execVM "randomEncounter.sqf";

How can I make the trigger wait until the script is done to repeat?

undone dew
#

if I have this in the trigger Condition:

this && rndEncVar

and this in onAct:

handle = [thisTrigger] execVM "randomEncounter.sqf";
rndEncVar = false;
null = [] spawn { waitUntil { scriptDone handle }; rndEncVar = true};

How/where can I declare the rndEncVar variable so that it starts true and the trigger can be triggered when the player enters it, and then it waits until the script to be done to set rndEncVar back to true?

cold mica
undone dew
#

hrm, it would need to be true for the condition instead of false but that might work

cold mica
#

I have two respawnPoints, Respawn Point A and Respawn Point B.

I have a bunch of code in onPlayerRespawn.sqf that runs when a player respawns in either Respawn Point A or Respawn Point B.

However, I want to run new code when a player respawns at Respawn Point A but not when they're at Respawn Point B. Any ideas how to this?

tough parrot
#

if (_playerPos inArea) { yourcode } is cheap way, but perhaps you can also get the "control" (gui widget) that selects the respawn point and add a callback to the respawn button with your code

cold mica
#

Does onPlayerRespawn.sqf run before or after a player respawns?

tough parrot
#

I would say after because event listeners get the event message after the event.

cold mica
#

Then I'll try the cheap method. Thanks

grim cliff
#

i have a question about BIS_fnc_holdactionadd

#

i have this command set up in a script that is run on every client

_Medic_action = [player,  
    "Use Medikit",  
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",  
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",  
    "alive _target && 'Medikit' in itemcargo _this && damage _target >= 0.05 && (typeOf _this) == 'B_medic_F'",  
    "alive _target  && alive _caller && 'Medikit' in itemcargo _this ",  
    {if ((typeOf _caller) == "B_medic_F") then [{
        _caller switchMove 'AinvPknlMstpSlayWrflDnon_medic'
    },
     {_caller switchMove 'AinvPknlMstpSlayWrflDnon_medicOther'}];
    },  
    nil,  
    {_target setdamage 0;},  
    {_caller switchMove 'AinvPknlMstpSlayWrflDnon_AmovPknlMstpSrasWrflDnon'},  
    [],  
    6,  
    999,  
    false,  
    false,  
    true 
    ] call BIS_fnc_holdActionAdd;

it was working but after changing some irrelevant data it doesn't.
it only works for the unit with the classname of "B_medic_F"
i have tried getting this to run seperatly in onplayerrespawn.sqf WITH respawnOnStart = 0; in description.ext.
it used to show up for every player but now it only shows up if the B_medic_F is injured

#

right after this i have a switch that applies certain commands to units, but i moved this out of there because i needed the action on every unit

#

is there something im missing? does the command need to be executed on the server for each unit in the playable units?

dapper cairn
#

is there a way to attach a trigger to a unit

grim cliff
#

to what end?

dapper cairn
#

Attaching a trigger to a AI to move past the players so they all have a script go off when in a stationary position. Or i may save the trigger as a custom composition and see if placing it on the units will set it off

grim cliff
#

so you are trying to check if players are moving in proximity to the ai?

opal zephyr
#

worldToScreen is proving to be incredibly inaccurate to what is on screen and doesnt relate to fov/zoom in any way. Despite my best efforts I cant find a way to adjust the bound of wordToScreen, or impact the safezones. Im trying to efficiently determine whether or not something is in view depending on what the player can actually see, like based on getObjectFOV.

opal zephyr
#

Maybe I can create a virtual square on the screen and change its size based on fov, and then do worldtoscreen or something

#

I guess a question to go with that, is can I create a hud element placed at the x and y that worldToScreen creates so that I can see if the output is accurate or not??

opal zephyr
#

Kind of, the starting size need to match the players fov though

tough parrot
sonic sleet
#

I'm having trouble getting 'Agents' From Civilian Presence Module to run.
They all walk be default.
I tried using setSpeedMode But I believe that Requires a Group and if I recall correctly 'Agents' are empty and arent a Unit nor in a Group,
Any ideas on how to force them into Running/Jogging?
Noticed there was a forceWalk but no forceSprint

tough parrot
#

they run if you pull a gun...

sonic sleet
#

lol I want them by Default to run

tough parrot
#

iirc they flee to cover position

sonic sleet
#

I have a town of Agents making the town feel alive. I want some to jog some to run. Gives a bit of Randomness. This way enemy Players can Blend in more

paper fulcrum
#

hey, I want to execute a simple code when the player presses "ALT+LMB" combo. I read a bit on BIKI but couldn't manage to write the code

warm hedge
paper fulcrum
#

aww I'm on 2.06

#

what if I change the combo and just check for "L" press

warm hedge
paper fulcrum
#

will take a look thanks

dapper cairn
#

Question. I added the GM6 Lynx Sniper to a autonomous turret (nato) but I can't zero with it. Is there a script to add zeroing?

#

Or am I SOL?

warm coral
#

okay so im having a slight issue and i dont know how i can do it and im completly lost on how to make it work.
what im trying to do is im trying to let players shoot stationary artillery with a addaction. only issue is the projectiles of the artillery hit waaaay to close and i intend it to shoot near the player but it wont reach so my solution was for it to drop a bomb in a 500m radius around a random player. but i just cant find a way to delete the artillery projectile

warm coral
#

so deleteVehicle _projectile ? thats legit all i could figure out so far and im not even sure if thats how it works

winter rose
#

yup

warm coral
#

so thats it? no eventhandler nothing just deleteVehicle _projectile in the init?

winter rose
#

ah, no

#

not in the init 😄

#

what I don't get is why do you want to fire but not fire but create but delete

in human words, outside scripting; what effect do you want?

warm coral
#

okay so basicly im trying to make it fire. but delete the projectile

#

so i can then use a whole seperate script to just "simulate" artillery fire around the player

winter rose
#

im trying to make it fire. but delete the projectile
no, that's not what you want 😄

warm coral
#

is there a better way?

winter rose
#

what you want is a shot to happen that would not hurt players 😉 I mean, in the goal you are trying to accomplish 🙂

#

but most likely, yes, that's how we are going to proceed 😄
add a fired Event Handler, delete projectile, and spawn a script that will create an artillery shell near player(s) 🙂

warm coral
#

do you maybe have a quick example? because i tried my best and the params confused the hell out of me on the community page 🙃

little raptor
dapper cairn
little raptor
dapper cairn
#

Well I mean.... I did it

winter rose
warm coral
dapper cairn
#

un1 being the name if the remote sniper

willow hound
warm coral
#

yeah thats the plan, so it doesnt directly hit the player just around them. i dont intend to kill them off, would be kinda unfair in a pvp scenario :P

little raptor
warm coral
willow hound
#

I meant doing something like this ...

private _pos = getPosASL TargetPlayer;
//Find a random position, between 100 and 200 meters away from _pos:
_pos = _pos getPos [100 + random 100, random 360];
Artillery doArtilleryFire [_pos, AmmoType, 1];
```... instead of deleting the projectile and simulating the impact.
copper raven
#

vectorAdd

willow hound
#

Good idea meowcamera

#

There are too many commands, I forgot about getPos 😄

manic grail
#

is there a way to make an uniform randomizer spawn in uniforms with ammo in them?

hushed tendon
#

Like on the ground?

grim cliff
# little raptor I don't see what you're asking You've clearly told the script to only show the a...

Well there's an issue. You're right about _this not being defined in the condition for progress, that should definitely be _caller.
_Target is a special variable that is assigned inside of bis_fnc_holdactionadd to refer specifically to the object the action is attached to.
_this and _caller are also special variables assigned from the function.

I think the issue I have been having is related to locality.

I kinda got it working. It seems stable but the start condition is starting to grow to the point it might have to be defined as a function, but that's for another time.
My current solution is to keep the medic_action local to the medic instead of assigned to each player, using cursorObject instead of _target, and a terrible idea I had was for the cursor object to be captured in a variable during the start code and using that variable with {command, variables} remoteExec ["command" , 0, false];
Seems to be stable. I will paste the code later. I'm at work.

little raptor
#

they are not defined in the codes

#

well except for _this ofc

manic grail
#

nah on ai

#

aka when you place down a group it randomizes their uniforms but still keep the ammo for their guns

grim cliff
grim cliff
little raptor
#

yes
at least according to the wiki (and my personal experience) it doesn't define those variables. that's why the wiki shows params. otherwise it would just mention them as "special variables"

grim cliff
little raptor
#

it is

#

they're not predefined

#

it just passes you an array and it's up to you to handle it

grim cliff
#

Then I'm really curious why it did work. What is happening inside of bis_fnc_holdactionadd;

little raptor
#

¯_(ツ)_/¯

grim cliff
#

_caller, _this, and _target never had to be defined with Params for the conditions. Is the variable left open for the script too?

little raptor
#

either the wiki's wrong and those are special variables (predefined), or you're wrong and it didn't work

#

conditionProgress:...
Special arguments passed to the code: _target, _caller, _id, _arguments

codeStart: Code - Code executed when action starts. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments"];

grim cliff
#

Hang on I just got home, let me get the baby set, and I'll log in and get that code

distant oyster
#

that's probably why it worked without params?

little raptor
little raptor
grim cliff
#

So _caller & _target really is available as a var in the code sections?

little raptor
#

yes

grim cliff
#

So in other words I got lucky with my noob mistake of not defining Params

little raptor
#

yes

tough parrot
#

confused about what modelPos param is in "obj modelToWorldWorld modelPos". I assumed modelToWorldWorld would be equal to selectionPos vectorDiff _vehiclePosASL.

#

vectorAdd rather. e.g., if vehicle is at 100,100,0 and selection is 1 meter up, selection asl would be 100,100,1.

little raptor
#

not necessarily. depends on object's orientation

#

in what you said you just assumed the vehicle was upright

#

if it was upside down it would be 1 meter lower

tough parrot
#

so is modelPos just an offset? selectionPosition modelToWorldWorld [0,0,0] would be the plain ASL of selection?

little raptor
#

that's wrong

#

the command format is OBJECT modelToWorldWorld ARRAY(pos)

#

what you meant was _obj modelToWorldWorld (_obj selectionPosition "selection")

tough parrot
#

so if selection is part of a tank, object would be the tank

little raptor
#

yes

#

selection is the name of the bone in the model

#

and modelPos is its relative position (in model coordinates)

cunning oriole
#

Is there a command to check what scope a player has on their gun like the currentWeapon command returns the gun that the player has?

#

I have had a look in the weapons group but can't find anything

cunning oriole
#

yes thanks

#

ig i can just select the element i need etc

copper raven
#

it doesn't provide magazine though

cunning oriole
#

yh thats fine only need to check their scope

#

cheers

livid wraith
#

is there any way of extracting the ASL pos of a marker ?

#

the extra param for getMarkerPos returns Z, but in the form of AGL/ASLW, but those pesky waves are messing things up ....

tough parrot
livid wraith
#

yes

#

since waves are dynamic, the ASL height will almost always be +/- off ASL

little raptor
livid wraith
#

according to the Biki, PositionAGL is the same as PositionASLW

little raptor
#

it's not

#

only on water they're the same

#

plus that has nothing to do with AGLtoASL

livid wraith
#

yes sorry, over water, Z is the same as ASLW

tough parrot
#

in what way is it messing up?

little raptor
livid wraith
#

the problem is, my marker is over water, and with getMarkerPos we get AGL, which is ASLW

little raptor
#

an AGL pos is dynamic

#

so when you convert it to ASL the wave effect will go away

little raptor
#

not just get it once and save it into a variable

livid wraith
#

yes

edgy aspen
#

Does anyone know a good way to ensure that an AI unit in a custom faction always spawns with a certain goggle slot item? Instead of randomized.

#

The units are created in ALiVE orbat and then spawned in zeus.

brazen lagoon
#

anyone here got sog pf that can test something for me?

#

When I'm doing getLightingAt player anywhere on the Khe Sanh map, I get VERY high brightness values, when previously it's been between 0-1

#

it's returning [[0.947977,0.944228,1],1500.93,[0,0,0],0] when I expect it to be like, 0.5 or something.

little raptor
brazen lagoon
#

interesting. how would I get just an idea of how bright it is at a player then?

little raptor
#

¯\_(ツ)_/¯

#

Maybe a config value defines the base values during night and day

young current
brazen lagoon
#

@young current basically how bright it is taking into account overcast/time of day/rain/etc. worst case I can just use time of day + overcast + rain and merge them together myself though

young current
#

Ye but I mean you use it for something I'd assume

brazen lagoon
#

@young current set camo value dynamically

open fractal
#

so dont ask why

#

but i decided i wanted an array of every helmet

#

and i'd like to ask

#

why does every helmet class have a Headgear_H_ prefix rather than just H_?

#

let me find an example

#

so if I want to give the player a combat helmet it would be player addHeadgear "H_HelmetB" but in the config viewer it's listed as Headgear_H_HelmetB

warm hedge
#

Wrong, CfgVehicles is not CfgWeapons

open fractal
#

oh damn

#

that would be the issue

#

I'm looking in the wrong place

#

thanks 👍

#

why is it listed in both?

warm hedge
#

One as placeable object, one as the equipment

open fractal
#

i see

#

is there a config entry to indicate that it's headgear?

#

or would I go off of the prefix?

warm hedge
#

Name of a config never means anything but a value indicates

open fractal
warm hedge
#

I don't recall which value of CfgWeapons entry does

#

but i decided i wanted an array of every helmet
Means something you can use with addHeadgear right?

open fractal
#

yes

warm hedge
#

Secs plez

open fractal
#
_helmets = "getText (_x >> 'vehicleClass') == 'ItemsHeadgear'"
 configClasses (configFile >> "CfgVehicles");
{
    _helmets set [_forEachIndex, configName _x select [9]]
} forEach _helmets;
player addHeadgear (selectRandom _helmets);
#

This works but I should probably get CfgWeapons figured out if I'm going this route

#

also mods are a thing

warm hedge
#
"getNumber (_x >> 'ItemInfo' >> 'type') == 605 and getNumber (_x >> 'scope') == 2" configClasses (configFile >> "CfgWeapons") apply {configName _x}```
open fractal
#

oh apply is good to know

#

thank you

warm hedge
#

Yeah that's a godsend

open fractal
#

why type?

#

oh i see it

#

'ItemInfo' >> 'type'

open fractal
open fractal
#
if ((uniform _unit == "U_I_CombatUniform") || (uniform _unit == "U_I_CombatUniform_shortsleeve"))
#

any way to shorten this?

#

say I wanted it to be 5 different uniforms, would each of those conditions need to be written out?

#

or since it's the same uniform check can it be abbreviated?

copper raven
open fractal
#
if ((_a == _b)||(_a == _c)||(_a == _d)||(_a == _e)||(_a ==...
#

what I mean is could this be condensed?

warm hedge
#

What sharp. said sqf (_a in [_b,_c,_d,_e])

#

Case sensitive tho

open fractal
#

oh i see

#

i got confused because i already did ```sqf
if ( "U_I_CombatUniform" in (uniform _unit))

#

i was so close yet so far

#

thanks sharp

#

and polpox

#

again

warm hedge
#

Anytime

sonic sleet
#

Getting an Error with the _unit forceSpeed _civSpeed; Line
Doesnt like me using a Var instead of a Straight Number. What did I do wrong?

params ["_unit"];
private _civSpeed = selectRandom ["1","3","5"];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
warm hedge
#

_civSpeed is a string than a number

sonic sleet
#

How do I change that?

warm hedge
#
private _civSpeed = selectRandom [1,3,5];```
#

Not sure if forceSpeed even works for units tho

sonic sleet
#

Using it for Agents

#

Ive tested it, it works just failed at getting that Var to work. Awesome so Quotes mean "this text" while no quotes mean the value of it. Thanks

warm hedge
sonic sleet
#

Thanks

#

Huh, quite confused now. No errors.
But the Agents still spawn with forcewalk true Using a Civilian Presence Module spawners etc.
I currently have the Agents getting random kits and those are working perfectly. So I know "_unit" Is targeting them.
Strangely still this code isnt turning "forceWalk" Off

#

params ["_unit"];

private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;

Cut the rest out

#

If I run this on the Agent Directly in the Execute box. It works. but through my Function through the "Civilian Presence" "Code On Unit Created" It wont work.
Again, the rest of the code regarding What clothing what Guns they spawn with are in the Exact same Config. So That all works. But for some reason, these few lines dont run?

willow hound
#

Maybe the effect of those lines is undone by something that is executed after the On Unit Created code (for example the code that orchestrates the civilian presence behaviour).

sonic sleet
#

Ah, I did notice by default Agents are "forceWalk true" How would I counter that then?
Only thing I can think of is Label each new Agent with some Variable and if they have it Then run the script above.
Once Script is done then Remove Variable.
But I assume there is a easier way?
Going to be heading to sleep so if anyone figures it out please at me

open fractal
#
{_unit = _x;
private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;} forEach GH_allAgents;
#

try running this after you spawn the agents

drifting portal
#

Is it possible to have a player select an option through addAction command when they are in a camera POV? (not their player's camera, another camera object)

drifting portal
open fractal
#

Control over the unit is not given to the player. Use selectPlayer or a combination of switchCamera and remoteControl to achieve this.

drifting portal
open fractal
#

you’ll have to try it

drifting portal
#

what I meant was if you are switched to camera, not an AI unit

open fractal
#

If it doesn’t work with the camera you can disable simulation on an ai

unkempt bay
#

Hello, I'm struggling with the say3D execution in MP it's not heard by other players...
Is there a trick to make it audible in MP ?

// File: rcc_zeus_soundbox.sqf
// Parameters _unit, _prefixSoundName, _maxCount
//
// spawn Say3D sound russian dialog version
//
params ["_this"];
private _pos = _this select 0;
private _unit = _this select 1;
 
//if unit is empty/null/player, exit
if (isNull _unit || !(_unit isKindOf "CAManBase") || isPlayer _unit) exitWith {
    systemChat "Selection not valid";
};
 
RCC_fnc_sayDialog = {
 
    params ["_unit"];
 
    private _count = missionNamespace getVariable "CountSound";
    private _soundName = "";
    private _prefixSoundName = "RussianDialog";
    private _maxCount = 11; // value to define according to number of soundVariations
 
    if (_count >= _maxCount) then {
        _count = 0;
        systemChat str "Restart soundbox";
    } else {
        _count = _count + 1;
    };
 
    missionNamespace setVariable ["CountSound", _count, true];
 
    _soundName = [_prefixSoundName, _count] joinString "";
    _unit say3D _soundName;
 
};
 
["zen_common_execute", [RCC_fnc_sayDialog, [_unit]], _unit] call CBA_fnc_targetEvent;

https://pastebin.com/jKbFuwd9

Thanks...

unkempt bay
#

But CBA_fnc_targetEvent is supposed to do the same

little raptor
#

idk what it does

#

¯\_(ツ)_/¯

#

But if you don't hear the say3D then the problem is obviously the locality

unkempt bay
#

alright, thanks

hollow lantern
#

I think I have a logic error: I want to enable a trigger for friendly people to a side:
Condition:

{[west, side (group _x)] call BIS_fnc_sideIsEnemy} count thisList == 0```
Activiation:
```sqf
{[_x] call ace_medical_treatment_fnc_fullHealLocal} forEach thisList;```
#

however the trigger is not firing. I guess my condition is the issue here

quasi sedge
#

init.sqf

if (isServer) then {
    setTimeMultiplier 120;
};
#

Not sure why it's not working in multiplayer

sharp grotto
#

works for me, did you try to execute after server is properly started ?

winter rose
quasi sedge
#

ty, with added sleep all working great!

little raptor
#

And third of all, you can't do what you want with a trigger alone

hollow lantern
#

What is needed then? What's the trigger limitiation?

proper sail
#

Quick question; if you do player action...

#

Will it always work even if the player cant perform the action themselves in normal circumstances?

#

i.e is it forced

little raptor
proper sail
#

action command

little raptor
hollow lantern
#

that is true

proper sail
#

ok thats what i was looking for

#

thanks

quasi sedge
#
sleep 20;
setTimeMultiplier 120;

while {true} do {
sleep 140;
0 setOvercast 1;
0 setRain 1;
forceWeatherChange;
};

this code correct (maintain good weather)?

#

initServer.sqf

quasi sedge
#

🤦🏼‍♂️

winter rose
#

I'd say

sleep 1;
setTimeMultiplier 120;

[] spawn {
  while { true } do
  {
    0 setOvercast 0;
    0 setRain 0;
    forceWeatherChange;
    3600 setOvercast 0;
    3600 setRain 0;
    sleep 3600;
};
#

although, rain cannot happen if overcast is not > 0.7 so you should be safe

#

just setOvercast should be enough

hollow lantern
little raptor
#

ofc not

hollow lantern
#

yes, I might also need to add that the trigger has a delay of 20 seconds before activating.

#

but I got your point now

low remnant
#

probably an often asked question, but how do you add an action to a vehicle so that only someone in the drivers seat can use said action?

 
 this addAction["an action",
  {
   hint "1";
  },
  nil,
  1.5,
  true,
  true,
  "",
  "{(driver _target) isEqualTo _this}"];```
does not seem to work
proven charm
low remnant
#

mustve deleted that bracket copying into discord.

proven charm
low remnant
#

that did it, thx

hushed tendon
#

Is there a way to store files on a dedicated server and call them during the mission?

sand rune
#

Hi, is it possible to make BIS_fnc_EXP_camp_playSubtitles work in tandem with an audio source for dialogue at the same time? I'm trying to see if there's a way to use subtitles with audio in a clean way like "player say"/"playsound" where titles[] is played and called at the same time the audio is, but instead I want to use the BIS_fnc subtitles.

limber panther
#

hi, sorry for late reply, this is not possible. If player once gets marked as teamkiller, he stays like that until he reconnects, because regaining positive rating won't put him back into blufor side

hushed tendon
hushed tendon
#

Ty

limber panther
#

Hello! Can someone assist please? Players on my server are getting (as part of the mission) marked as teamkillers. But this causes problems. Disabling negative points or adding to players big score doesn't work. So i would like to make a script, that will pop a message and/or play a sound in loop to those, who become teamkillers

#

So is there a way to detect players who get into this group?

fair drum
limber panther
hushed tendon
#

Also I'm looking for the server to save audio files as well

#

Could I possibly get a short example of what it would look like if you were to save a file with a function and then call the function during the mission?

thorn widget
#

out of intrest how am i ment to use endLoadingScreen if i cant access the debug?

fair drum
limber panther
fair drum
#

it fixes your marked as teamkilling issue completely without causing a break in the gameplay loop

limber panther
fair drum
#

as it is currently written, initPlayerLocal

limber panther
cold mica
#

Why do some scripts check isServer?

hushed tendon
#

Because it’s best performance wise unless you need to use something local

cold mica
#

how is it different than sticking the code into initServer.sqf? Performance wise, that is

hushed tendon
#

InitServer is a scheduled environment but sometimes you have code in an unscheduled environment that should only run on the server

fair drum
#

that is misguided imo. performance doesn't matter as much when the mission hasn't even started yet

#

the real reason things check isServer is because sometimes the script is run on a local machine. for instance, lets say i want to create 50 units at the start of the game using init.sqf. If i don't do a isServer check, 50 units will spawn every single time a client loads the mission plus the server

#

@cold mica

#

or if you use a init box, those boxes are run every single time the mission is loaded on each machine, included on clients that are JIP so you can accidentally run your script much more than you want

cold mica
#

oh cool. In that sense, it fulfills the same role as initServer.sqf

fair drum
#

i wouldn't say same role. it fulfills its own role, especially for things that are not an init script

#

like mid mission scripts/functions

little raptor
opal zephyr
#

It feels like checkVisibility using the players eyes pos fails if they have any equipment on their head, like goggles or bino's in front of their face.. Is this really the case? I suppose I could just move the point a couple inches in front of the players face to fix this?

#

Also would this mean the model of the enemy im checking if I can see would also interfere with the calculation?
Edit: I guess I can add the enemy model to the ingore2 slot

#

^edit to this, it seems like its just when equipping binoculars that it breaks

#

After looking it seems the binocular command gives the string of the binocular I have equipped but not the object name. Is there a way to convert this string to an object name or to get the object name of the binoculars? Im thinking if I can get this then I can exclude it in the checkvisibility

winter rose
opal zephyr
#

So checkVisibility is inherently broken when having binos equipped?

#

and theres nothing I can do to fix it?

winter rose
#

you can offset the starting position yes

opal zephyr
#

alright, thank!

torpid mica
#

I still have a problem with my code which uses the ACE Rearm Framework. Can somebody help me there? I took a look into the CBA Settings but didn´t found anything about rearm (as earlier suggested)

trg_1_1 setTriggerStatements["this", "[Munitionsauffueller_1, 666] call ace_rearm_fnc_setSupplyCount;", 
                             "ammo_left = [Munitionsauffueller_1] call ace_rearm_fnc_getSupplyCount; hint str ammo_left;"];

the problem is that i always get -1 as "ammo_left" and i am now pretty sure that the getSupplyCount doesn´t work properly.. Does somebody know a solution or a workaround?

hollow thistle
#

I will repeat what I said last time, if your rearm is set to unlimited then it will always return -1 as supplies are infinite.

#

ACE Logistics > Rearm > Ammunition supply

torpid mica
digital wasp
#

can anybody help me?

#
2:27:20 Error in expression <is_inFriendlySector",false];
}
forEach (bis_fnc_moduleSpawnAI_groupsWest + bis_f>
 2:27:20   Error position: <bis_fnc_moduleSpawnAI_groupsWest + bis_f>
 2:27:20   Error Undefined variable in expression: bis_fnc_modulespawnai_groupswest
 2:27:20 File A3\Modules_F_Heli\Misc\Functions\ModuleSpawnAISectorTactic\main.sqf..., line 167```
#

for some reason i cant use ai sector tactic module, its broken

winter rose
#

seems so

digital wasp
#

what do i do?

#

@winter rose

winter rose
#

@vad1m4#9679

digital wasp
#

what?

winter rose
#

if it is broken, you cannot use it

digital wasp
#

how do I fix it? I really need to use it

winter rose
#

perhaps it needs other modules to work properly, idk
have you tried to google it?

digital wasp
#

what can I use instead to spawn ai and make them capture a sector?

digital wasp
winter rose
#

try without mods

digital wasp
#

spawn ai module is from CBA_A3, I'm gonna load that only and try

#

same thing

winter rose
#

see their documentation, I don't think such big mishapp' would happen

fair drum
#

lets see a screenshot of how you set up your module

digital wasp
#

one second, I've reinstalled the mod

hollow thistle
#

bis_fnc_moduleSpawnAI_groupsWest does not look like anything CBA

sonic sleet
#

Where did I mess up here
Init ```sqf
GH_allAgents = [];

agentSpeed.sqf
```sqf
[] spawn {
    while {true} do {
    _unit = selectRandom GH_allAgents;
    private _civSpeed = selectRandom [1,3,5];
    _unit forceWalk false;
    _unit forceSpeed _civSpeed;
    sleep random[1,5];
    };
};

No errors just doesnt do anything

grim cliff
# little raptor yes
                            [player,   
                             "Treat Unit",   
                             "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",   
                             "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",   
                             "vehicle _this == _this && alive _this && alive cursorObject && lifeState cursorObject != 'INCAPACITATED' && group _this == group cursorObject && 'Medikit' in itemcargo _this && damage cursorObject >= 0.05 && (typeOf _this) == 'B_medic_F' && _this distance2D cursorObject <= 2.5",   
                             "alive patient && _caller distance2D patient <= 2.5",  
                            {[_caller,'AinvPknlMstpSlayWrflDnon_medicOther'] remoteExec ["switchmove", 0, false];
                                patient = cursorobject;
                                },   
                             nil,   
                             {patient setdamage 0;},   
                             {[_caller,'AinvPknlMstpSlayWrflDnon_AmovPknlMstpSrasWrflDnon'] remoteExec ["switchmove", 0, false];},   
                             [],   
                             6,   
                             999,   
                             false,   
                             false,   
                             true  
                             ] call BIS_fnc_holdActionAdd;

heres that code from the other day

hushed tendon
#

also you could just do [] spawn agentSpeed.sqf; instead of using spawn in the sqf

#

but that's only if everything in the file should be using spawn, but it doesn't really matter I think

grim cliff
#

question: does anyone know how i can check if western sahara dlc is currently enabled?

sonic sleet
#

This works in the Debug

_unit = selectRandom GH_allAgents; 
private _civSpeed = selectRandom [1,3,5]; 
_unit forceWalk false; 
_unit forceSpeed _civSpeed;
sonic sleet
#
[] spawn agentSpeed.sqf;
{
    while {true} do {
    _unit = selectRandom GH_allAgents;
    private _civSpeed = selectRandom [1,3,5];
    _unit forceWalk false;
    _unit forceSpeed _civSpeed;
    sleep 1;
    };
};

I mean that doesnt work either

hushed tendon
#

Should be:
Some Place | Example: initServer.sqf

[] spawn "agentSpeed.sqf";

agentSpeed.sqf

while {true} do {
    _unit = selectRandom GH_allAgents;
    private _civSpeed = selectRandom [1,3,5];
    _unit forceWalk false;
    _unit forceSpeed _civSpeed;
    sleep (1 random 5);
};
sonic sleet
#

ah lemme try that

fair drum
#

or

[] spawn {/*code here*/}
sonic sleet
#

tried that didnt work either

hushed tendon
#

yeah like I said it doesn't really matter which way you use spawn

sonic sleet
#
[] spawn 
{
    while {true} do {
    _unit = selectRandom GH_allAgents;
    private _civSpeed = selectRandom [1,3,5];
    _unit forceWalk false;
    _unit forceSpeed _civSpeed;
    sleep 1;
    };
};
``` No errors just doesnt work
fair drum
#

on the phone, help u in a bit

sonic sleet
#

cheers

hushed tendon
#

Works for me

sonic sleet
#

you're spawning them via Civilian presence module and it works?

hushed tendon
#

nah just changed

_unit = selectRandom GH_allAgents;

to

_unit = man1; //Named Unit
fair drum
#

how are you adding the agents to the GH_allAgents array

sonic sleet
#

init.sqf

GH_allAgents = [];
hushed tendon
#

and do you ever add any units to the array after that?

#

bc if not you are selecting nothing bc it's an empty array

sonic sleet
#

huh thought init constantly ran

#

Its not an empty array

fair drum
#

an init is a one time thing

sonic sleet
#

[Agent 0x1b5c0100,Agent 0x4fb3c0c0,Agent 0x4dc10100,Agent 0xdf668140,Agent 0x61490080,Agent 0x67e88100,Agent 0x41ee8180,Agent 0x674580c0,Agent 0x6f234140,Agent 0xb9c88080,Agent 0x61048100,Agent 0xa9f0a180,Agent 0x49dec0c0,Agent 0xd30fc140,Agent 0x6f2100c0,Agent 0x1c798140,Agent 0x41c1a140,Agent 0x702c6180,Agent 0x41d64180,Agent 0x1bf88180,Agent 0x619a0140,Agent 0x6794e0c0,Agent 0xfd38e1c0]

#

Okay so, how do I get it to keep updating? Add it to the loop then?

fair drum
#

how are you creating the agents

hushed tendon
#

why do you need to keep updating it? Does the number of units change?

sonic sleet
#

Yes

#

Civilian prescene module

#

It spawns Agents in and deleted them over time depending on time/waypoints they get to

#

It basically recycles them

hushed tendon
#

So what you need to do is run a while loop getting all civs in the radius of the module and add them to the list / reset the list

fair drum
#

no, there is an expression box

sonic sleet
#

^

fair drum
#

that you can apply to each unit as they are spawned

hushed tendon
#

oh there is?

sonic sleet
#

Yes

hushed tendon
#

never used it before, sorry about that

fair drum
#

so you need to pushbackunique into the array

sonic sleet
#

all good its cool module though

#

so just type in pushbackunique??

fair drum
#

no. give me a few min, still on phone

sonic sleet
#

k

fair drum
#
GH_allAgents pushbackUnique _this;
hushed tendon
#

well you need to remove them from the list when they are deleted right?

sonic sleet
#

yes

hushed tendon
#
GH_allAgents deleteAt (GH_allAgents find _this);
sonic sleet
#

where would I put that

hushed tendon
#

or

GH_allAgents=GH_allAgents-[_this];

not sure which one is more performant tho

hushed tendon
sonic sleet
#

well I will be having around 120 Agents if that helps

#

k

hushed tendon
#

Shouldn't have to worry about performance tho

sonic sleet
#

Alright so I must be doing a good somewhere Ill post it all one sec.
No errors still
Cone On Unit Created

_this call GH_fnc_civLoadouts;
GH_allAgents pushbackUnique _this;

Code On Unit Deleted

GH_allAgents=GH_allAgents-[_this];

agentSpeed.sqf

[] spawn 
{
    while {true} do {
    _unit = selectRandom GH_allAgents;
    private _civSpeed = selectRandom [5,5,5];
    _unit forceWalk false;
    _unit forceSpeed _civSpeed;
    sleep 1;
    };
};

init.sqf

GH_allAgents = [];
hushed tendon
#

It not work?

sonic sleet
#

I dont see any Agents running

#

I even changed the speed to only run so if the code every hits them it should make them run

#

[5,5,5]

hushed tendon
#

On a side note if the mission is multiplayer don't use init.sqf instead use initServer.sqf

sonic sleet
#

ah good to know, currently in editor but it Will be Multiplayer so Ill move that over

hushed tendon
#

Use hint str _unit in the code and see if a hint with a unit pops up

sonic sleet
#

nothing

#

I checked the array

#

Plenty there

#

small cut of it [Agent 0xba6c8080,Agent 0xba84c0c0,Agent

#

oh interesting

hushed tendon
#

So this hints nothing?

_unit = selectRandom GH_allAgents;
hint str _unit;
sonic sleet
#

I slapped in into the agentSpeed

#

Turns out its not even running it looks like had it hint "1" each time it runs nothingf

#

Ill run that 1 sec

#

that works

#

in debug atleast

#

so

[] spawn 
{
    while {true} do {
    _unit = selectRandom GH_allAgents;
    private _civSpeed = selectRandom [5,5,5];
    _unit forceWalk false;
    _unit forceSpeed _civSpeed;
    hint str 1;
    sleep 1;
    };
};

Isnt even running it seems

#

I put that hint str 1 Doesnt come up at all

hushed tendon
#

oh I just realized you never called the sqf

sonic sleet
#

?

hushed tendon
#

in initServer.sqf run [] call agentSpeed.sqf;

sonic sleet
#

thought thats what the [] spawn {} was for

#

aight'

#

huh says errror missing a ";"

hushed tendon
#

In the agentSpeed.sqf?

sonic sleet
#

No from that line you sent

#

Initserver.sqf

#
GH_allAgents = [];
[] call agentSpeed.sqf;

error missing ; line 2

hushed tendon
#

oh sorry forgot the "agentSpeed.sqf"

#

needs to be a string

sonic sleet
#

oh

#

now its same line

Error call: Type String, expected code
hushed tendon
#

Sorry I'm very tired apparently and confusing your code with mine

sonic sleet
#

XD all good

hushed tendon
#

change call to execVM

sonic sleet
#

ooooo

#

Its looping

#

Yaaay I see one running

hushed tendon
#

There we go. Sorry it took longer

sonic sleet
#

all good, so whats execVM do?

hushed tendon
sonic sleet
#

Cheers!

hushed tendon
#

Make sure to use the wiki a lot. It may solve many of your problems

sonic sleet
#

Yeah, very new but I usually use it for a couple hours until Im at a lost before I come here

#

Thanks again

open fractal
#

why not forEach

#
{
    private _unit = _x
    private _civSpeed = selectRandom [5,5,5];
    _unit forceWalk false;
    _unit forceSpeed _civSpeed;
    } forEach GH_allAgents;
sonic sleet
#

Because I want their speed to be able to be changed

open fractal
#

changed how?

sonic sleet
#

Like I want it to Randomly pick an Agent and change their speed even the same one over and over

#

The whole goal is for Taliban players to be able to blend in with Agents.
If I was only able to get the Agent to only Permanently Run then well, if the Players saw a Taliban Stop running and jog, Well thats a player

#

Unless im misunderstanding how forEach works?

open fractal
#

forEach just executes the code for every element in the array

#

so i see how this example doesnt apply

sonic sleet
#

Ah, that is good to know though

#

Currently im now on the Next plan. Making Vehicle Traffic. Which is becoming more difficult than the Agent stuff XD
Currently placed a few Map markers for Positions on map.
Basically going to get AI Vehicles to Drive to "parkSpots" and then sleep for X time and go pick another spot.

Though struggling on how to find out once they arrive to the end of "move"

sonic sleet
#

wow, that exists huh

#

Thanks

#

Was about to go down the rabbit hole of "setDestination"

little raptor
fair drum
#

there are already a few civilian vehicle scripts you can plug into your mission. save you some time.

sonic sleet
#

Currently trying to get Civilians to run Errands from their Homes, leave randomly, go to one of a few options and then stay there for a bit. come back and repeat.
This is my current Idea. Anyone have any better ideas?

if x random y time and no player nearby (short) then
_homeStand = getPos _this; //save current Standing Position and facing?
go to vehicle assigned //parked (Civ's Vehicle) (struggling with assigning)
once inside car save parkSpot
_homePark = getPos _this 
_this move selectRandom["shop","friends house","work"];
on destination exit vehicle Loiter for x random y time and no player nearby (short) then
getPos of Vehicle
Move to vehicle
Once inside
_this move _homePark;
When unit ready, Exit
_this move _homeStand;
Repeat.
#

The reason is, This gamemode is Nato vs Taliban. both teams are Players.
Taliban are blending in as Civs. Ive got Civ Agents everywhere also with Civ Units that I as Zues can mess with.
I want a way for Taliban to be able to blend in with Vehicles.
So if I can set Certain homes up with cars. The cars leave come back. Then it'll make it harder for Nato to find the Talibans bases

paper fulcrum
#

Is it possible to add a sensor to a vehicle?
For example , I want a Littlebird with an active radar

mental wren
#

When/where would be a good place to call createDiaryRecord in script to also show it on the map briefing? Basically the same way the module does it?

#

I tried initPlayerLocal.sqf and init.sqf but no luck

cosmic lichen
mental wren
#

I did a big facepalm

#

I was adding it to a non-existing subject

#

🤦‍♂️

#
player createDiarySubject ["radio_net", "Radio Net"]; // <-- was missing this
player createDiaryRecord ["radio_net", ["Radio Net", "This is my cool radio net"]];
winter rose
#

they exist, they were introduced with Old Man

exotic yarrow
#

Hello everyone, I need help. I'm trying to add pylons to a helicopter from special categories ||(Like CAS, Ground Suppression, etc)||.
I get categories like this:

private _pylons = "true" configClasses (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Components" >> "TransportPylonsComponent" >> "Presets") apply { configName _x }; // getting the category names
private _pylonsData = _pylons apply { getArray (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Components" >> "TransportPylonsComponent" >> "Presets" >> _x >> "attachment") }; // getting an array of pylons from these categories

And then in the script I add them to the helicopter like this:

_pylonsData = _pylonsData select _selectedIndex;

{
    _vehicle setPylonLoadout [_forEachIndex, _x];
} forEach _pylonsData;

But the problem is that with such an addition, the pylons may become completely out of place, for example, they should be under the wing, but they become above it.
Does anyone have any ideas on how to adequately add pylons so that they are normally attached to their places?

winter rose
#

I am not on PC, but try the wiki

round blade
#

Hey folks, I need to make a script for an m1 carbine so if I attach a weapon attachment which has a fore-grip (an M3 Infra red night scope) I swap out the weapon for one with the right hand animation so the unit is grabbing the foregrip rather than the furniture.

What would be the best way to go about this in terms of which event handlers to use? Off the top of my head I see it being relevant to check on init & InventoryClosed, but curious if there's anywhere else that could catch me out where the attachment could change

paper fulcrum
#

aw that's quite sad

little raptor
#

They're in cfgMagazines iirc. Use config viewer to find them
Their names are pretty obvious too. E.g item_money iirc was for money

winter rose
#

(weirdly)

little raptor
little raptor
#

Items are never in cfgAmmo thonk

little raptor
round blade
#

I don't think I explained myself well - I will be switching out the weapon class for one that has a different handanim

#

I have that side of it in hand, I'm more curious about best approach to triggering when to do it

little raptor
#

E.g if you use inventoryClosed, etc. that won't cover the case where the unit attaches the item via Arsenal

#

or scripts

#

Don't attachments have some sort of EH themselves?

#

for mounting/unmouting? thonk

round blade
#

oh that's interesting

little raptor
round blade
#

yeah that's not preferable

#

I wonder if I just put it on the init for the weapon attachment if that will do it

#

I'm more interested in catching when it's been attached to change it out, I doubt players will very often remove it

austere granite
paper fulcrum
#

is it possible to hide foilage ingame just like in eden with "CTRL+G"? I read that it cant be done due to technical limitations yet curious

paper fulcrum
#

I recall setTerrainGrid just gets rid of grass

#

CTRL+G removes leaves from trees and bushes as well

sand summit
#

this may be the single dumbest question i've ever suggested, but can i have a recursively defined variable?

#

like for example

#

if i had a value i wanted to change when an object was hit with a bullet, relative to itself, decreasing by the damage amount?

#

wait, nevermind. i had an idea that should achieve the same result

unique sundial
sand summit
limber panther
#

Hello!
I would like to make a script for locking and unlocking vehicles but i found several scripts for that on wiki so i would like to ask, which one is the best for use. I found these three as the most suitable:
https://community.bistudio.com/wiki/lock
https://community.bistudio.com/wiki/setVehicleLock
https://community.bistudio.com/wiki/lockCargo
So far what i see, lock and setVehicleLock are identical scripts (do the same thing) - the only difference is in possible states where lock can be just locked/unlocked and setVehicleLock can be "UNLOCKED" "DEFAULT" "LOCKED" "LOCKEDPLAYER". Basically i need to lock a vehicle so that the player won't be able to get in. On the other hand i use ACE mod and ace allows interactions with vehicles and therefore i think, that ace can allow players to get into locked vehicles (judging by lock description that says "...but will not stop player getting into or out of vehicle via script commands... ") So here comes the lockCargo do i understand it correctly, that lockCargo does exactly the same thing as lock and setVehicleLock but in addition to it, it also prevents players from getting in via script (ace) ? So is lockCargo the best to use or am i wrong and i should use some other script? Thanks for help.

little raptor
limber panther
little raptor
#

Like I said, ACE does check lock status

#

lock/setVehicleLock is the first thing you should try

limber panther
low remnant
#

anyone know how to add a cooldown to an action added with addAction?
idea I've been running with so far is the following function

Mission_fnc_canUse = { 
    params ["_target"]; 
    private _cooldown = 180; 
    private _canSpawn = false; 
 
    private _current = time; 
    private _last = _target getVariable ["Mission_lastActionTime", -1e9]; 
 
    if (_last + _cooldown < _current) then { 
        _target setVariable ["Mission_lastActionTime", _current]; 
        _canSpawn = true; 
    };
_canSpawn
};

and then doing

"[_target] call canUse"

as the addAction Condition, but it doesn't show up.

limber panther
#

hello @little raptor sorry for bothering, i just wanted to tell you what i found out about those scripts:
lockCargo locks all seats in vehicle except driver seat
lock and setVehicleLock work identically and lock all seats including driver seat
all three of them disable ace interactions with the vehicle, if set to locked

Thank you for your help and patience, i hope this helped you at least a little 🙂

proven charm
#

@low remnant I would just set variable when the action is used.

#
// Init this somewhere:

lastActUsedTime = -1e9;

// Set when action is used:

lastActUsedTime = time;

// Then check for cooldown:

if((time - lastActUsedTime) >= 180) then
{
 // Action can be used again
};
brazen lagoon
#

anyone have any suggestions on how to make it so I can load the sog pf bicycles into a cargo vehicle?

low remnant
proven charm
#

edited my post a bit

low remnant
#

where do i init global variables? can i do it on the object?

proven charm
low remnant
#

and there is no other way? cause if i wanted to have multiple instances i'd have to add a seperate global var for each object

proven charm
#

you can add multiple addactions that use the same cooldown variable but if you want each object have it's own cooldown then use your code instead of mine. Hope I was able to show you some new stuff here

low remnant
#

well the trouble is my code doesnt work

proven charm
low remnant
#

...cause it continually evaluates of course 🤦

proven charm
#

yes

acoustic abyss
#

Hello sir. I found this message while searching for "car radio". Figured I shouldn't reinvent the wheel and bother people here for help. Did you ever get it working properlY?

little raptor
radiant yacht
#

does anyone know if there is a script name for enabeling and disabeling the "show model" on objects?

radiant yacht
#

I'll test it out, thanks

dapper cairn
#

so im trying to make a script for teleporting all players to a position after the trigger is activated. Trying to fade to black, teleport, change to night, then fade back in. Thought i had it figured out but i guess not

dapper cairn
#

right now I have a old script im trying to repurpose for the fading into/out of black

#

one sec

#
if (isServer) then {
    [] spawn {
        [0, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
        sleep 6;
        private _pos = getPosATL c2;
        deleteVehicle c2;
         {_x hideObjectGlobal false} forEach [t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24, t25, t26, t27, t28, t29, t30, t31, t32, t33, t34, t35, t36, t37, t38, t39, t40, t41, t42, t43, t44, t45, t46, t47, t48, t49, t50, t51, t52, t53, t54, t55, t56, t57, t58, t59, t60, t61, t62, t63, t64, t65, t66, t67, t68, t69, t70, t71, t72, t73, t74, t75, t76, t77, t78, t79, t80, hemtt_1];
           [1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
    };
};
#

That is the script im taking the fade to black from

#

and thats all I have

#
if (isServer) then {
    [] spawn {
        [0, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
        sleep 6;
      [[[[[insert time and teleport script here im guessing]]]]]
           [1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
    };
};
little raptor
#

just put 0. or [0,-2] select isDedicated for every client except dedicated server

little raptor
little raptor
#

use something less performance heavy, like markers for example

dapper cairn
#

bro i dont fucking know, someone else in here wrote up the code, i just did what i was told

#

all im trying to do is figure out how to teleport all the players on the activation of a trigger, i already figured out the time part of it, now i need to figure out how to teleport them all

little raptor
radiant yacht
open fractal
#

and i say this as someone who writes goofy code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
winter rose
#
UH addAction ["retract ladder", { hideObjectGlobal LD }, nil, 1.5, true, true, "", "_this in _target"];

UH addAction ["deploy ladder", { hideObjectGlobal LD false }, nil, 1.5, true, true, "", "_this in _target"];
```if you lok closely, the error is in `hideObjectGlobal LD false`
radiant yacht
#

well i've been looking at that

winter rose
#

what does Syntax 2 say?

radiant yacht
#

would it be LD hideobjectglobal false then?

#

in that order

radiant yacht
#

😆 thanks lou

winter rose
#

I also added an example as hideObjectGlobal only works if executed on the server, so here your action only works if player-hosted and done by the server-player

radiant yacht
#

so, this won't work in multiplayer?

winter rose
#

no, but it can, see example 3 🙂

radiant yacht
#

oh, had to refresh the page

winter rose
#

blobdoggoninja 💥 ☁️ 😁

radiant yacht
#

the myobject is just the object, right?

winter rose
#

yes yes, only a var name

opal zephyr
#

When using checkVisibility to determine if I can see any part of an enemies bounding box, is it just as simple as using boundingBoxReal and plugging that info into checkVisibility?
Edit: no it is not...

grim cliff
#

anyone have any idea how i can detect if a missilepod on a helicopter is hit? getallhitpoinsdamage isnt showing any damage

limber panther
#

Hello! I've got a problem and it's really weird. I've done this many times and always worked, this time it doesn't. Anyone got any idea what's wrong?

Simple: when vehicle gets locked or unlocked, it should play a sound (say3D). Everything works fine but no sound can be heard. The sound just doesn't work. Sound file is in proper folder and should be properly defined in description.ext just like any other sound. And this is the script, that should play it: ```sqf
this addAction ["2013 Chevy Silverado FDNY Ambulance", {
private _vehicle = createVehicle ["Fox_Silverado", [12565,12686]];
_vehicle addAction ["Last 112 call", {
[caller_position] spawn gps_fnc_main;
}];
_vehicle addAction ["Last 911 call", {
[caller_position2] spawn gps_fnc_main;
}];
[_vehicle, true] remoteExec ["enableDynamicSimulation", 0];
_vehicle setVariable ["ace_medical_isMedicalVehicle", true, true];
_vehicle addBackpackCargoGlobal ["TFAR_rt1523g", 1];
_vehicle addItemCargoGlobal ["ACE_SpraypaintBlack", 1];
... ... ...
_vehicle addItemCargoGlobal ["kat_bloodIV_AB_250", 20];
_vehicle setvariable["fw_owner",player,true];
_vehicle lock true;
_vehicle lockInventory true;
_vehicle addAction ["UNLOCK", {
params ["_target", "_caller", "_actionId"];
private _owner = _target getVariable["fw_owner",""];
if (_owner==player) then {
_target lock false;
_target lockInventory false;
[_target, [ "lock", 500, 1]] remoteExec [say3D, 0];
};
}];
_vehicle addAction ["LOCK", {
params ["_target2", "_caller2", "_actionId2"];
private _owner = _target2 getVariable["fw_owner",""];
if (_owner==player) then {
_target2 lock true;
_target2 lockInventory true;
[_target2, [ "lock", 500, 1]] remoteExec [say3D, 0];
};
}];
}];

grim cliff
#

are you calling the lock sound from a subdirectory?

limber panther
grim cliff
#

is the sound defined in cfgsounds?

limber panther
still knoll
#

is the sound issue the same with playSound3D?

limber panther
grim cliff
#

im looking at the command on the wiki, and it looks like only one say3d command will play sound at a time.

#

is it possible that another sound is playing?

limber panther
limber panther
#

only 1 sound at a time

still knoll
limber panther
still knoll
#

after doing the UNLOCK actiion, the vehicle gets unlocked?

limber panther
#

yes, everything else works fine, locking/unlocking mechanism works without any problem even when repeatedly used

still knoll
#

playsound3d doesn't require you to write a cfgsound entry it only needs a path to the sound file, also it doesn't need remoteExec because it's global effect

#

just putting that out there...

grim cliff
#

i wonder what kind of crazy thing happens if you do remoteexec 0 the command

limber panther
#

(yes the sound file is in .ogg format)

grim cliff
still knoll
#

yes

grim cliff
still knoll
#

that's why you don't remoteExec 0 global effect commands

grim cliff
#

that sounds like something really fun to do on a server where i have admin. just sneak in a predator sound and ruin everyones night in a forest in the middle of tanoa during a contact themed mission

opal zephyr
#

Is there a way to return all operatable vehicles with isKindOf? Without going through every type, like "tank" "car", etc

still knoll
opal zephyr
#

What would I be getting the parent of?

still knoll
#

mmm nvm, I misunderstood your question

opal zephyr
#

ah ok, thanks

#

is there somewhere I can get a list of classes that isKindOf can use?

still knoll
#

like a list of all CfgVehicles?

opal zephyr
still knoll
#

there is a config viewer in the game

opal zephyr
#

how do I access it?

still knoll
#

in the editor, tools menu

opal zephyr
#

thanks

#

great... the searchboxes dont work

still knoll
#

I use the advanced developer tools addon

#

works fine

opal zephyr
#

hmm didnt have what I was looking for though, aw well

open fractal
#
[_target, "lock", 500, 1] remoteExec ["say3D", 0]; 
#

try this

#

you don't want extra brackets for remoteExec

#

you have extra parameters

#
[_target, "lock", 500] remoteExec ["say3D"]; 
#
unit1 setFace "Miller";
// becomes
[unit1, "Miller"] remoteExec ["setFace"];
``` https://community.bistudio.com/wiki/remoteExec
#

command name should be a string as well

#

keep using Say3D, you're just using remoteExec wrong

grim cliff
#

does anyone know where i can find the aircraft arsenal? i know it somewhere in the game