#arma3_scripting

1 messages · Page 611 of 1

brave jewel
#

||```sqf
{
if (_spawnchance select 4 > floor(random 100)) then //attachments
{
_weapon = selectRandom _weaponArray ;
_compatibleItems = [];
{
_slot = getArray (configFile / "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> _x >> "compatibleItems");
if (count _slot > 0) then {
_compatibleItems pushBack (selectRandom _slot);
};
} forEach ["MuzzleSlot", "CowsSlot", "PointerSlot", "UnderBarrelSlot"];

            hint str _compatibleItems;
            if (count _compatibleItems > 0) then {
            _attachment = selectRandom _compatibleItems;
            _holder = "WeaponHolderSimulated" createVehicle [0,0,0];
            _holder setPos _x;
            _holder additemCargoGlobal [_attachment, 1];
            };
        };
    } forEach _buildingPos;
crude vigil
#

Did you check the configs of the weapons at all?

#

before u wrote this script?

#

I mean I dont know what weapons are in your weapons pool but the weapons Im looking at, most of them only have compatibleItems defined only in muzzleSlot

brave jewel
#

Well I thought RHS would have done it correctly 😄

#

||```sqf
_weaponArray = [
"rhs_weap_ak74",
"rhs_weap_ak74m",
"rhs_weap_aks74u",
"rhs_weap_akms",
"rhs_weap_aks74",
"rhs_weap_akm",
"rhs_weap_ak74n_npz",
"rhs_weap_ak74m_npz",
"rhs_weap_akmn",
"rhs_weap_m4",
"rhs_weap_m16a4",
"rhs_weap_m4a1",
"rhs_weap_hk416d10",
"rhs_weap_mk18",
"rhsusf_weap_MP7A2",
"SMG_01_F",
"SMG_05_F",
"sgun_HunterShotgun_01_sawedoff_F",
"rhs_weap_M590_8RD",
"rhs_weap_M590_5RD",
"rhs_weap_Izh18",
"rhs_weap_makarov_pm",
"rhs_weap_tt33",
"rhsusf_weap_glock17g4",
"rhs_weap_cz99"
];

crude vigil
#

Well, there is no compatibleItems array in config for those weapons at all. (Ofc I didnt check all of them)

brave jewel
#

Oh, well I guess I have to create another array with all of the muzzles then ._.

crude vigil
#

I personally dont know what defines a weapon and an attachment compatible, so I would suggest you to find that out and check it. Dont trust stuff labeled as Info. :P

#

When you are writing stuff that would target config, check the addresses yourself.

#

simply open the weapons and follow the config line you wrote

#

see if it is defined

brave jewel
#

Yea I checked somestuff but well I could only find this muzzles[] = {"this","SAFE"};

#

Some stuff is defined like this: ||CowsSlot ->compatibleItems[] = {"optic_Nightstalker","optic_tws","optic_tws_mg","optic_NVS","optic_DMS","optic_LRPS","optic_ams","optic_AMS_snd","optic_AMS_khk","optic_KHS_blk","optic_KHS_tan","optic_KHS_hex","optic_KHS_old","optic_SOS","optic_MRCO","optic_Arco","optic_aco","optic_ACO_grn","optic_aco_smg","optic_ACO_grn_smg","optic_hamr","optic_Holosight","optic_Holosight_smg","optic_Hamr_khk_F","optic_SOS_khk_F","optic_Arco_ghex_F","optic_Arco_blk_F","optic_DMS_ghex_F","optic_ERCO_blk_F","optic_ERCO_khk_F","optic_ERCO_snd_F","optic_LRPS_ghex_F","optic_LRPS_tna_F","optic_Holosight_blk_F","optic_Holosight_khk_F","optic_Holosight_smg_blk_F","optic_Holosight_smg_khk_F","optic_Arco_AK_blk_F","optic_Arco_AK_lush_F","optic_Arco_AK_arid_F","optic_DMS_weathered_F","optic_DMS_weathered_Kir_F","optic_Arco_lush_F","optic_Arco_arid_F","optic_Holosight_lush_F","optic_Holosight_arid_F","ACE_optic_Hamr_2D","ACE_optic_Hamr_PIP","ACE_optic_Arco_2D","ACE_optic_Arco_PIP","ACE_optic_MRCO_2D","ACE_optic_MRCO_PIP","ACE_optic_SOS_2D","ACE_optic_SOS_PIP","ACE_optic_LRPS_2D","ACE_optic_LRPS_PIP"};||

#

should be possible then I guess

crude vigil
#

That is not the CowsSlot in the weapon though

winter rose
#

…why the spoiler stuff

crude vigil
#

He probably thought , it is one of those that goes downward and not occupy much place

brave jewel
#

thought you could expand it :X

crude vigil
#

the thing you printed here is actually located in configFile > CowsSlot..

#

not in the location defined in your script..

brave jewel
#

What I see for the AK74 is: rhs_weap_ak74 -> WeaponSlotsInfo -> CowsSlot f.e

crude vigil
#

yes but u doubleclicked Cowsslot , didnt you :P

#

which led you to completely another dimension

brave jewel
#

true :x

#

😄

crude vigil
#

click it once to highlight a class, then see the values on the right side..

#

as for the correct way to get attachments, learn how an attachment is done config wise and just use it. If you are not able to figure out, I am sure #arma3_config will be willing to help you.

brave jewel
#

for the rhs_weap_m4 I can see the slots we used in the script but I have no idea what to look for on the right side

#

I probably will do that

crude vigil
#

well, you see the slots, click on them once, highlight them and you ll see what that class contains(for m4, there is no compatibleItems defined as you can see)

brave jewel
#

oh so there has to be something like compatibleItems[] = stuff?

crude vigil
#

yes

brave jewel
#

I think I get it now 😄

#

Thanks! 🙂

crude vigil
#

No worries. Good luck!

brave jewel
#

Thanks for all the help with the script as well! 🙂 You're a godsend 😄

winter rose
#

a devilsend then?

brave jewel
#

Depends 😄

spark turret
#

is there a script command to pardon a player with the ace framework?

winter rose
#

most likely an ACE function, if any
otherwise, addRating for vanilla

spark turret
#

Ill look into that thanks

slate cypress
#

When playing a sound from an object using say3D, is there anyway to synchronise the sound for JIPs? I’m aware there is an offset parameter but it only allows an offset in seconds. Is there something more fine?

winter rose
#

Nope
That or split in shorter sounds

winter rose
#

What is the use case @slate cypress?

ebon citrus
#

I.e. setup a task in the scheduler of each client that waits until a specific point of time and then executes the command

#

That's as far as you'll get in terms of synchronizing tasks

#

Take a look at the article and read the description

#

@slate cypress ^

winter rose
#

depending on the use case… because if it is a looping sound, please make it a local script

dim terrace
#

@brave jewel you can use already existing function bis_fnc_compatibleItems

#
  • in CBA you have variant of that function which let you even filter types of accessories
vestal estuary
#

So I’m trying to make a teleporter for a milsim server that I work with on the dev front and I know how to make a simple addiction teleport scroll wheel menu action BUT is it possible to add multiple actions to one poll with different locations? If so would I be able to just add multiple arrays with the names and locations?

winter rose
#

Yes and multiple addAction

vestal estuary
#

So just different lines with the addiction command line?

winter rose
#

Yup (addAction though 😁)

vestal estuary
#

yeah my bad, thank you

tough abyss
#

objects attached to simple objects via attachTo seem to ignore all setVector related commands? anyone knows something about this?

warm hedge
#

Yes it works. Do setVector* after attachTo

tough abyss
#

that's what I did

#

I attached an arrow in debug console then ran the setvector commands but it didn't move

#

works fine with non-simple objects but not simple ones somehow

warm hedge
#

Ah, Simple Objects. I missed to read that words

copper raven
#

simple objects don't have any physx, all u can do is just set their position

warm hedge
#

It's false also. Doesn't have PhysX doesn't mean you can't rotate pitch/bank

tough abyss
#

just noticed vectorWorldToModel doesn't really work on terrain objects because the returned vectors seem to be rotated

#

goodness arma is weird

winter rose
#

if you setVectorDirAndUp then setDir, it resets the other settings

tough abyss
#

i only used setvector

young current
#

what is it you are trying to do?

tough abyss
#

gave up on setDir long time ago

young current
#

something with terrain objects?

tough abyss
#

attaching stuff to terrain objects

young current
#

like what

#

and why attach?

tough abyss
#

for normal object (cars planes etc) vectorWorldToModel gives the correct relative orientation, but for terrain objects it returns a rotated vector

#

yea i suppose with terrain and simple objects i can just leave my objects unattached since they won't be moving anyway xd

#

but still

young current
#

and why I ask is to determine are you trying something that can be achieved

crude vigil
#

yea i suppose with terrain and simple objects i can just leave my objects unattached since they won't be moving anyway xd
@tough abyss unless destroyed.

tough abyss
#

what do you mean?

young current
#

problem with terrain objects is that they can also be scaled

crude vigil
#

Buildings are sinking into terrain when they are destroyed and a ruin object is created on their position.

young current
#

so please explain cleary what are you trying to achieve

tough abyss
#

@young current this is what I'm trying to do
first spawn an object B (like a bomb for eg)
then determine the surface S that player is looking at and its normal (with lineIntersectsSurfaces)
if S belongs to an object C, attach B to C (here's where trouble begins)
normally, I just use vectorWorldToModel to transform B's absolute orientation to C's relative orientation, and then use setVectorDirAndUp on B after it's attached
but with terrain objects, vectorWorldToModel doesn't return as expected, for example, the vectorUp that B is supposed to use, after transformation to C's relative coordinates, somehow pitches 90 deg to the side (tested on a rock on Stratis)
and if C is a simple object, setVectorDirAndUp straight up doesn't work, B's orientation is reset to [0,1,0][0,0,1] and ignores subsequent setVectorDirAndUp commands

young current
#

so some sort of attach bombs to any surface type of deal

tough abyss
#

right\

young current
#

do you use the normal returned from the line intersect command?

tough abyss
#

yea

#

like this ```sqf
myobj setPosWorld _pos;
myobj setVectorUp (_with vectorWorldToModel vectorNormalized _normal);

where `_with` is the obj the surface belongs to, and `_pos _normal` are provided by line intersect command
#

https://imgur.com/JVXfPBA
notice how the explosives are oriented correctly on the right (manually placed hesco block) vs the left one that comes with the map

young current
#

the blocks are facing different ways though

#

is it same if they face the same direction?

still forum
#

vectorWorldToModel
that will rotate it to the objects rotation, and produce the result you show

tough abyss
#

@still forum what do you mean? If i understand correctly vectorWorldToModel will only rotate a vector so that when the object is attached its orientation doesnt change wrt player

still forum
#

The "normal" is already facing away from the surface

#

which is what I'd think you'd want

tough abyss
#

don't think obj setVectorUp _normal will work because after the object is attached setVectorUp will only take vectors in the target object's coordinates

so if the target (car for eg) has pitched or banked itself then the attached object will look different

young current
#

did you try it?

tough abyss
#

i remember trying that a while ago when i first learned about the command but im doing that again now just to be sure

#

yea now the terrain object looks fine but manually placed ones broke xd
https://imgur.com/a/dQEmDfQ
again left-most is built-in, and the two on the right are placed in zeus

ebon citrus
#

Ugh, i'll go buy some PC parts tomorrow and try to help debug this. sippu

tough abyss
#

aww

young current
#

@tough abyss add check for terrain object or placed object and alternate the method?

ebon citrus
#

Granted the problem still persists

tough abyss
#

@young current some terrain objects work fine but others dont...
I tried sticking the bomb on a porta potty -- ok
a built-in military cargo house -- ok
a built-in hesco -- correct up, incorrect dir
another built-in hesco -- incorrect up

mrw https://youtu.be/WyT0If4jRPI?t=158

#

suppose i could just not attach at all when encountering a terrain object but like taya said i still need to babysit the object if building is destroyed

ebon citrus
#

The only uniform factor in BI terrain objects is that they arent uniform

void ivy
#

Starting to do research on a fully clientside second-screen mod using a web-based interface. Key question for me right now is finding the right solution to connect SQF to a database. Anyone have any suggestions on that?

ebon citrus
#

Extdb3?

young current
#

@tough abyss are you sure the attached object goes down with the structure destroyed anyway?

ebon citrus
#

Or use python or "c/c++ interface

young current
#

as I dont think it will

void ivy
#

@ebon citrus My c++ is pretty weak, but didn't realize that a python extension had been written. Good to know!

ebon citrus
#

Pythina or something like that

#

Look it up

#

Pythia

tough abyss
#

@young current the charges blow up when i End-key the building in zeus

#

so im guessing the explosives are taken care of

ebon citrus
#

You cant end key terrain objects

tough abyss
#

it's manually placed

ebon citrus
#

Yes, but what about terrain objects

young current
#

possibly it ends everything in certain range

ebon citrus
#

Nah, it doesnt

tough abyss
#

is there a way to kill terrain buildings without things that also explode?

ebon citrus
#

Setdamage?

tough abyss
#

want to make sure I don't trigger the explosion

young current
#

setDammage

tough abyss
#

how to I get a reference to the building though?

ebon citrus
#

Cursorobject?

tough abyss
#

riiight

ebon citrus
#

Also, remember that not all terrain objects have configs

#

So some commands dont work on them

#

Notably small stuff like chairs and so on

#

It's really random aswell

#

If it returns an empty string, it might aswell not exist gor half of the commands

#

Arma bug, possibly too late to fix

tough abyss
young current
#

can you give example on what does not work?

ebon citrus
#

That blue bench on altis

#

For example

young current
#

but what commands

ebon citrus
#

Ehhh, i didnt really dwell into all of them

#

One of the guys here was looking into it

#

I know for a fact that typeOf or any config related doesnt work

young current
#

well naturally if they have no config

ebon citrus
#

So i guess anything that relies on getting any information related to the config wouldnt work

young current
#

although Id wager the benches have configs

tough abyss
#

literally just turned around and found a camping table with no typeOf...

ebon citrus
#

But we dont know which ones they are withiut trying

#

Modeltoworld could be one of these

#

Some of the benches do, some dont

young current
#

I dont think it has any problems

ebon citrus
#

It' entirely random

young current
#

no its not.

#

😛

ebon citrus
#

It is

#

Literally one type of bench has typeof and another doesnt

young current
#

different objects can be of different simulation type which can affect how commands work

ebon citrus
#

Both benches, the other one has slightly different model

young current
#

get me pics and locations then

ebon citrus
#

Can i DM you?

#

I'll hit you up with all the objects without typeOf's tomorrow

#

If you cant be asked to wait, go sround altis with typeof Cursorobject and you'll see it for yourself

#

Couldnt believe it for myself at the start either

#

But that's just how it is

#

Maybe compression?

#

Some information is lost?

young current
#

just get a pic of couple of them and where they are on map and I take a peek.

#

and link the pic here somewhere and tag me

ebon citrus
#

Can i dm you?

#

I'll drop you one i have in my phone memory

#

Too much compression

#

@young current "Land_Bench_02_F"

#

Find on of those

#

Theyre everywhere on altis

#

Cant miss em

young current
#

this one has a config then?

copper raven
#

some of those builtin structures aren't "actual objects", they're like trees and stuff like that, you can find many of those

young current
#

its possibly related to the simpler simulation type yeh

#

you can still get the object with cursorObject though

#

it just does not have typeOf

ebon citrus
#

The map object doesnt have a config

#

The object itself has a config

young current
#

the above is config for that object

ebon citrus
#

But the map object doesnt

young current
#

and with the land_prefix it is connected to that map object

ebon citrus
#

If it had a config, it would return its config

#

But the fact that it returns nothing means it has no config

young current
#

ok sure fine

ebon citrus
#

Well, i say that

#

But i dont know

#

A simple object maybe?

#

But that doesnt explain why some of the objects have references seemingly randomly

#

And some dont

young current
#

simulation type

ebon citrus
#

But why?

#

The objects exist

#

They have configs and all

young current
#

that you have to ask programmer

ebon citrus
#

Why has one type of object been switched to simple objects

#

And one not

#

Seemingly randomly

young current
#

probably so that the simulation stays simpler and eats less performace

ebon citrus
#

That's what i mean

young current
#

for instance in this are I tested I could only find the houses to work with typeOf

#

and those have the more advcanced simulation so their doors and lights work

ebon citrus
#

Which map?

young current
#

Altis

ebon citrus
#

Not advanced simulation

#

Just simulation

#

Then you werent looking

#

I found plenty of seemingly simple objects that had simulation

#

And then some didnt

young current
#

¯_(ツ)_/¯

ebon citrus
#

All simulated objects ofcourse have

#

Could be just inconsistency that is so commonplace woth BI

#

But yeah, returning to the original topic at hand

#

I dont think you need to attachTo terrain objects

#

Or you can check if they are type of house

#

If the typeOf returns and empty string, dont attachTo @tough abyss

#

The object msot likely has no damaged model amyways

tough abyss
#

I've tried a couple ~~buildings ~~ objects that don't have typeOf (lots of them on stratis air base) but not all of them act weird

#

and many buildings that have typeOf act weird on the other hand so i'm not sure typeOf is related

ebon citrus
#

Will have to take a look tomorrow

#

I dont have my PC with me and im regretting it now

#

So i'll just go and pick up some parts tomorrow

#

Store's not open on sunday unfortunately

tough abyss
#

you mean you got rid of the old pc?

#

wait i thought you work for BI

young current
#

only the green names work for BI

tough abyss
#

ah ok

ebon citrus
#

@tough abyss no and no. I am on leave from home atm and didnt pack a PC with me. Only a laptop. I also dont work for BI. I wish i did

#

Theyre not hiring janitors atm, though. I currently work to kill time until time kills me

tough abyss
#

I currently work to kill time until time kills me
@ebon citrus words to live by

uneven glacier
#

Anyone knows if its possible to create a script that enables air vehicles to change the flight model?

#

So for example you would have a helicopter with a custom action that if you enable, it will then fly as a fixed wing aircraft

tough abyss
#

is there any restriction on what aircraft needs to be used? otherwise you could just use a vtol

uneven glacier
#

Problem is that VTOLs have weird little quirks

#

Like throttling to 0 and vectoring down when you open a map

#

And for silly reasons, we need a vehicle to be able to just hover steady while doing other things. VTOL hovering is fine if you're actively doing it but once you need to multitask (Like also flying a drone) it's basically impossible

tough abyss
#

i think that command is designed to animate stuff so it won't provide realistic flight model

uneven glacier
#

Yeah, that would work for hover. However another reason is a skill gap. Some people aren't comfortable landing a VTOL versus a helicopter so it lowers accessibility

#

Honestly I didn't expect it to be possible but thought I'd ask before dismissing the idea 🙂

tough abyss
#

maybe config is better suited

uneven glacier
#

Config hardwires the flight model. Thought a script might be able to switch them somehow

#

Again, a long shot. Thanks for entertaining the idea 😄

tough abyss
#

i guess a dumb idea would be to have 2 vehicles in config and switch them mid mission by deleting and spawning another at same time, same place xd

#

#RedneckScripting

uneven glacier
#

Yeah that would be funny

#

Especially if you want to maintain all the fuel and ammo information as well as make sure all the passengers stay inside

young current
#

that does sound like how simplest terrain objects should be

tough abyss
#

the wiki could really use some edits

#

those things aren't mentioned at all

#

so turns out some terrain objects can't be attached to, you can check by calling attachedTo after attachTo to see if the object really was attached, because if not, setVector commands will continue to use world space rather than the target object's own coordinates, which explains why my explosives were pointing the wrong way before

strangely even though the charges arent attached to a building, they still blow up when the building dies but regardless case closed
https://imgur.com/a/sApueC4

@young current @ebon citrus thanks for the help!!

#

it doesnt hurt characters though?

#

are splash damages treated differently for soldiers and ammo?

#

hmm, maybe it takes out half health regardless of object type

#

since it takes a lot of bullets to detonate the charge

#

wait i thought the charges dont fall to the ground

#

i put a bunch of them on a building and they stayed there, without disabling simulation

#

i remember they do.. when I used ace explosives placement they drop to the ground i think, but apparently not with my mod

#

i think so too

fair drum
#

so my players play with 3rd person turned off but they want 3rd person for vehicles. I noticed that if I do a camera switch forcing 3rd person while in a vehicle, it forces it back to first person. does this mean that I have to alternatively turn 3rd person on in difficulty, then force people into first person instead?

#

since that new difficulty setting isnt out yet

fair drum
#

so I wrote this while turning on 3rd person in difficulties:

//Call in onPlayerRespawn.sqf

while {alive player} do {

    if ((cameraOn == player) and (isNull objectParent player)) then {
        if (cameraView == "External") then {
            player switchCamera "Internal";
        };
    };
};

and it does work, wondering if its going to be too intensive to run for players during the mission as its constantly going.

grim coyote
#

Atleast add a sleep timer there

copper raven
#

i'd say use eachframe instead

digital hollow
#

How can I check if Zeus is in the curator map?

still forum
#

check if the display is open. findDisplay with the correct IDD, the IDD you can find in a AIO Config, just search for "Display" in the config, and find the correct one

copper raven
fair drum
#

How long is a frame then?

exotic flax
#

depends on the FPS of the server (frames per second)

#

or client when client-side

fair drum
#

Oh derp. I wasn't thinking it was tied to that. I forget that server fps does not mean graphical.

slate cypress
#

@winter rose It doesn’t require looping a single sound but instead cycling through random sound files one after the other.

sacred turret
#

what are the differences between left side arguments vs right side arguments (the left side is who's "calling" the function?)? does the _ in the function's name actually makes any difference or its a simple naming convention (seems like it has something to do with the scope or access modifiers?)?

ebon citrus
#

@sacred turret [tag]_fnc_[function name] is a must

#

Also what do you mean left and right parameter?

#

For engine-commands?

sacred turret
#

whats the difference between placing a parameter before or after the funcion

Also what do you mean left and right parameter?
@ebon citrus

winter panther
#

I don't think there's a practical difference, it's just the way each command is implemented

ebon citrus
#

@sacred turret those are commanzs

#

Commands*

#

And no, there is no real meaning

#

Just follow the sybtax

#

Syntax*

winter panther
#

in some cases left side arguments could be considered the "caller". For example in "group setFormation formation", it's like doing "group.setFormation(formation)" in other languages

sacred turret
#

in some cases left side arguments could be considered the "caller". For example in "group setFormation formation", it's like doing "group.setFormation(formation)" in other languages
@winter panther yeah thats what I thought

winter panther
#

but there are exceptions, like the parameters of execVM

ebon citrus
#

Just read the syntax

#

call for example takes the parameter for the left argument and the function name for the right

sacred turret
#

Just read the syntax
@ebon citrus always, just asking for curiosity or better understanding

ebon citrus
#

Yep, there is no real common convention

#

Best is to just read what to pass it and where

winter panther
#

it was a bit confusing for me when I started learning SQF, but as long as you keep the wiki close to you, you won't have problems, and you'll remember the syntax of each command after a while

ebon citrus
#

Fortunately the biki is 99% accurate

winter panther
#

about the "_", I think it's a naming convetion. All private variables are usually declared like that. I'm not sure the SQF engine cares about the underscore or not

#

you could try tho

ebon citrus
#

kills 99%of the confusion

#

?

#

_ is for private variables

#

But i thought we were talking about functions

winter panther
#

yeah he asked many things in the same line haha

ebon citrus
#

Also, just define private variables like so private _myVariable

winter panther
#

also yeah, he said functions

ebon citrus
#

Dedmen says it is less intensive than just doing _myVariable

winter panther
#

I guess he means variables

ebon citrus
#

And also more secure

#

Youre less likely to override your variables

winter panther
#

but does declaring a variable as "_myVariable" actually makes it private?

#

or you need "private" anyways?

#

I think the question was about if the underscore does anything with the variable or it was just a naming convention. I always declare my variables as "private _myVariable", but I don't know if declaring them as "private myVariable" makes any difference

ebon citrus
#

@winter panther you dont need it but you should use it

#

There was some practical difference

#

But when you want to use private varisbles, just do private

#

Here is the answer:
Recursive loops require the use of private. Without it, your variables will be overwritten.

#

So your variable might be overwritten from another scope unless you private it

#

It is NOT global, though

#

Even if you forget to private it

#

If you want to know the specific details, i suggest you ask Dedmen

cold night
#

i don't want to bother anyone in the midst of conversations but i was wondering if anyone could help me with a problem i've been facing for the past 2 days. I'm having an issue where when i spawn variable or non-variable attack helicopters i jump in and i get kicked out and told "you are not yet qualified to fly this, please wait x amount of minutes"

winter panther
#

sounds like a mod

ebon citrus
#

This is a mission

#

Side thing

cold night
#

correct

winter panther
#

or that too

cold night
#

idk about side thing

ebon citrus
#

Are you running conquest or somrthing similar

cold night
#

its a domination mission. i have a server setup for my clan

ebon citrus
#

Yep, domination

#

Have a look through their settings

#

It should be somewher ein there

cold night
#

settings in game? or through mission directory? cause i keep thinking it has something to do with the file explorer. but im no genius

ebon citrus
#

Read the mission documentation

#

Usually they have one

#

No, it has nothing to do with file explorer

#

This is not a scripting question

cold night
#

cause i managed to fix an issue where it was only allowing CUP and when i went into x_setup.sqf and removed #define CUP it fixed the issue but now i have this issue

#

oh im sorry

ebon citrus
#

It's alright, you didnt interrupt anything important

cold night
#

just joined didnt really know where to post

ebon citrus
#

No harm done

cold night
#

you guys/girls have a wonderful night

ebon citrus
#

@plain sky wrong channel

#

Watch the language

#

Also, wrong channel

#

Man, i wish Lou was on

#

@meager ember there is a troublemaker here

cold night
ebon citrus
#

Yeah, either one. Someone there might have experience with Domination

cold night
#

okay thank you very much and i hope you have a great night

ebon citrus
#

It's really more of a configuration issue

meager ember
#

!purgeban @plain sky 30d spamming OT in wrong channel, personal attacks on members, homophobic slur

ebon citrus
#

You too, have a good one

lyric schoonerBOT
#

*PewPewPew!!*
RIP @plain sky

ebon citrus
#

Cheers

cold night
#

cheers

meager ember
#

ergh, tried not to use it actively with doublequotes 🤷‍♂️

#

welp, you get the point

ebon citrus
#

Sure thing. It's usually so that Lou happens to be here

#

But it seems he is intensily developing script atm. We both know Lou doesnt actually sleep

sonic thicket
#

Hey everyone, I've been trying to get a part of my script to work as I intend it to work but keep walking against a seemingly invisible wall.

The script plays a sound at the player with a sleep period determined by the distance between the player and the entity attacking the player. It's a mini horror script. The closer the entity gets the faster the heartrate goes.

First I tried the most simple way, executed in another script.sqf with a bunch of sleeps but the sleeps failed drastically. Eventually after much trial and error I came up with the following script but for some reason sleep seems to be consistent, however _mathdistance definitely works as intended.

Is the limitation of sleep a single second?

[_zombie, _distance, _unit] spawn {
_zombie = _this select 0;
_distance = _this select 1;
_unit = _this select 2;
    if (_distance <= 100) then {
        _mathdistance = _distance / 10;
        playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
        uiSleep 0._mathdistance;
    };
};
sonic thicket
#

Well, i got it working, the issue was that it was nested in another while loop

#

Here's the code for who's interested

                        [_zombie, _unit] spawn {
                            _zombie = _this select 0;
                            _unit = _this select 1;
                            while {alive _zombie && alive _unit} do {
                                _distance = (_zombie distance _unit);
                                if (_distance <= 100) then {
                                    _mathdistance = _distance / 10;
                                    playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
                                    uiSleep _mathdistance;
                                    systemchat (format ["%1",_mathdistance]);
                                };
                            };
                        };
ebon citrus
#

Also you cant do a division of 10 by doing 0.myVariable giiggles

#

That doesnt work logically or in syntax

#

Anyways, good work fixing it

#

And well handled while loop. Only thing i could say is to use private when defining private variable and params instead of this select x

#

Remember to call spawn the script again if the zombie or the player dies

#

Also take a look at say2d instead of playsound3d/say3d.

#

Or playsound

#

Playsound would probably be the best

real mango
#

playSound3D could become an issue in MP environment as player will hear overlapping heartbeats and moreover it is affected by the hearing distances ^^

#

playSound is 100% local, no one else would hear it! 🙂

#

@sonic thicket I would have doubts about spawning a function for each zombie though, because I assume you'd have multiple zombies, right?

ebon citrus
#

Yeah, but it seems that isnt the intention this far

frosty stratus
#

Can anyone guide me in the correct direction, I am trying to detect if a hand held laser designator is active and if its active turn it off from within a script on the player itself

real mango
#
if (isLaserOn player) then {
  player forceWeaponFire [currentWeapon player, currentMuzzle player];
};
#

sorry, missed the second part

#

that should do it @frosty stratus

frosty stratus
#

Thanks dude, makes me feel dumb for not thinking of something so simple first

real mango
#

🙇‍♂️

sonic thicket
#

@real mango Thanks for the tips, that also includes you @ebon citrus the 0. Was a “I'm beyond logical let's do weird stuff move“ that I tend to resort to when learning new languages 🥳

As for the intention of the script, I use zombies from ravage as base model to run the AI on as a evil deerthing shooting a man might be pure irony yet not within the scope of a horror script.. Unless it's a "B" type script of course. (the ones where cars also fly around n stuff)

I'll make sure to change the heartbeats to local only! Script is pretty sick and 100% works so far added in some creepy wendigo sounds from until dawn in it as well. Now all that is left is to make a bloody mess whenever that thing manages to grab someone
😄

#

Oh yeah, the script has a chance of 40% to run once between midnight and 03:00 AM

real mango
#

Nice stuff!
What I meant with my question was to point out that the script wouldn't work with multiple zombies as the heartbeats would overlap incoherently 😛

sonic thicket
#

Ohh, I thought because of multiple clients

#

In that case I won't need to worry :) it's always just 1 for a random player, if it manages to kill the player it will search in a 500m radius for a new player and target it. If it finds nothing it despawns

real mango
#

Fair enough then!

ebon citrus
#

@sonic thicket can i seek inspiration from your script?

#

Im working on an amateur extension to the Enoch environment

#

I like the idea youre doing here

sonic thicket
#

I would be honored haha :) I'm pretty proud of it as Its my second script and it already works so well

real mango
#

I've no idea what the heartbeat you are using plays, but for the sound design part I would have gone with a BPM (beats per minute) variable, starting from a baseline 60 (no minimum then) and going up to 200+ as a function of the distance.
Then use the BPM to compute how much to sleep in between two type of sounds systolic (stronger beat) and dystolic (weaker one) to give the impression of an actual heart slowing down and speeding up 😄

#

I think ACE does it somewhat like that

sonic thicket
#

Just figured out [] spawn too, which is an amazing function

The heartbeat was taken from the Arma sound files directly, there is So much more then the list online makes you think there is

#

It wouldn't hurt to add in bpm but so far it does sound quite good

real mango
#


[_zombie, _unit] spawn {
    params [["_zombie", objNull, [objNull]], ["_unit", objNull, [objNull]]];
    while {alive _zombie && alive _unit} do {
        private _dist = _unit distance _zombie;
        private _BPM = (200-1.4*_dist) max 60;
        if (_dist <= 100) then {
            playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
            private _sleep = 60 / _BPM;
            sleep _sleep;
        };
    };
};

revisited with the BPM

#

and how I would write it with the two heart sounds:

#define BASELINE_BPM 60
#define MAX_ALLOWED_BPM 200

[_zombie, _unit] spawn {
    params [["_zombie", objNull, [objNull]], ["_unit", objNull, [objNull]]];
    while {alive _zombie && alive _unit} do {
        private _dist = _unit distance _zombie;
        private _BPM = (MAX_ALLOWED_BPM-1.4*_dist) max BASELINE_BPM;
        private _i = 0;
        if (_dist <= 100) then {
            private _soundName = ["heart_1", "heart_2"] select (_i % 2 == 0);
            playSound3D [_soundName, _unit];
            private _sleep = 60 / _BPM;
            _i = (_i + 1) % 2;
            sleep _sleep;
        };
    };
};
#

feel free to take inspiration if you like or give it a try, but "heart_1" and "heart_2" must be two location of heart sounds 😛

silent latch
#

anyone know the size limit to ones name?

real mango
#

Steam names are limited to in length to 32 chars

#

Arma profile names should not exceed 24

silent latch
#

now lets just say, what kind of errors do you think ill get with my name over 100 chars

#

because my name is over 100 chars

real mango
#

what do you mean with "your name" exactly? steam name? in game profile?

silent latch
#

ingame name

#

and so far profilenamespace is not having a good time

real mango
#

Well when you violate the original constraints set by the developers anything becomes possible

sonic thicket
#

i'll send you the script once it's done Nica, may you wonder 🙂

umbral nimbus
#

Before im cause myself a headache...

#

can I nest a foreach command?

#
   {script blabla _foreachinex} foreach myarray2;
} foreach _myarray1;```
copper raven
#

why wouldn't you be able to?

warm hedge
#

_foreachinex?

#

*_forEachIndex?

umbral nimbus
#

why wouldn't you be able to?
@copper raven yeah it works 😅

#

_foreachinex?
@warm hedge it returns index of the forEach loop

warm hedge
#

It doesn't. _foreachinex isn't defined

umbral nimbus
#

it will

warm hedge
#

Look at the spell

umbral nimbus
#

dude its an example

warm hedge
#

Wha...

umbral nimbus
warm hedge
#

I know about _forEachIndex but I'm not sure what you're talking about

umbral nimbus
#

problem is allready solved.
The code above was just a quick example. So didnt mind the typo

proud carbon
#

what is the best way to get an enemy Jet to target A player jet?

real mango
proud carbon
#

Thanks man

vague geode
#

Is it possible to change the position from which people disembark from a vehicle? E.g. make people disambark either through the CH-67 Huron's left or right door instead of through the ramp?

young current
#

Only if you script the getOut eventhandler to move them. And only then if the vehicle is configured in player centric GetIn an out animations

quasi rover
#

Contact image can't use? e.g. "\a3\data_f_contact\logos\picture_ca.paa"

young current
#

Can't use where?

quasi rover
#

normal Arma3 platform, not Contact platform.

young current
#

What are you trying to do?

warm hedge
#

If you don't load Contact, you can't

quasi rover
#

When I use the file link, error is displayed " not found". and I use it for cfgHints.

young current
#

Then you don't have that file

#

If you don't have contact running you can't use its files

#

Solution is buy and run contact

quasi rover
#

I have Contact DLC.

young current
#

Do you run Arma with it?

quasi rover
#

No..

young current
#

Well then the files are not active

quasi rover
#

thanks guys.

real mango
#

I remember a feature request for such a thing @eager pier not sure if implemented yet

real mango
uneven glacier
#

Hey, I'm trying to look through documentation and I'm probably being blind but can't see what function ace jamming is using? Basically trying to write a script where targets that get hit in a blast radius of a certain grenade get their weapons jammed

sonic thicket
#

So, i've been struggling with making sure the script only runs once per time, as in a queue of 1. However when executed i'm facing a "Error missing ;" while I have no clue where it's missing. Here's the script that has that issue;

waitUntil { if (isNil _queie) do {
        _queue = true;
        publicVariable "_queue";
        [_zombie, _unit] spawn {
            _unit = _this select 1;
            _zombie = _this select 0;
            while {alive _zombie && alive _unit} do {
                _distance = (_zombie distance _unit);
                if (_distance <= 100) then {
                    _mathdistance = _distance / 20;
                    if (_distance <= 10) then {
                    playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
                    uiSleep 0.5;
                    } else {
                    playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
                    uiSleep _mathdistance;
                    };
                };
            } else { setvariable ["_queue", nil]; };
        };
    };
};

And here is the one that runs fine but does not has a queue limiter on it;

[_zombie, _unit] spawn {
    _unit = _this select 1;
    _zombie = _this select 0;
    while {alive _zombie && alive _unit} do {
            _distance = (_zombie distance _unit);
            if (_distance <= 100) then {
                _mathdistance = _distance / 20;
                if (_distance <= 10) then {
                playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
                uiSleep 0.5;
                } else {
                playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
                uiSleep _mathdistance;
                };
            };
    };
};

Does anyone has any idea of what I did wrong and how I could correct it? Thanks a ton in advance!

copper raven
#

unary setvariable doesn't exist

sonic thicket
#

Ah blast indeed, _queue = nil;

#

thanks 😄 But..... I just realized this isnt going to work anyway XD

#

well.. not really

copper raven
#

why do you spawn again

#

inside the waitUntil

#

and yeah well, _queue obviously isn't defined in that scope

sonic thicket
#

Well, trying to figure out how to script in general so it's definitely on the clumsy side

copper raven
#

wait, that script has so much wrong in it, just noticed 😄

sonic thicket
#

The second one does work though 😄

#

without error

copper raven
#

yeh, i mean't the first one

sonic thicket
#

The thing is, what I actually want is to calculate the _distance of the closest entity that has a certain type of helmet

copper raven
#
private _fnc_getClosestObjectParamsFiltered = {
    params [
        ["_objects", [], [[]]], 
        ["_origin", [0, 0, 0], [[]], [2, 3]], 
        ["_predicate", {true}, [{}]]
    ];
    _objects = _objects select _predicate apply {[_x distance _origin, _x]};
    _objects sort true;
    _objects param [0, [0, objNull]]
};

[<units>, <origin>, {headgear _x isEqualTo "...whatever headgear..."}] call _fnc_getClosestObjectParamsFiltered params ["_closestUnitDistance", "_closestUnit"];
sonic thicket
#

@copper raven Thanks 🙂 I've tried using it by replacing just the following line but it sadly didn't worked. Reason I've replaced the isEquelTo is because they all share those prefixes

[_zombie, _unit, {headgear _x find "NWTS"}] call _fnc_getClosestObjectParamsFiltered params ["_closestUnitDistance", "_closestUnit"]; 

It's my first time looking at a function so while I can somewhat follow how it works I'm still missing why it doesnt work, my guess is the "Find" change being the culprit though

copper raven
#

find doesn't return a boolean

#

either add a != -1, or just use in

sonic thicket
#

Ahh ofcourse, I feel stupid for missing that 😄

#

restarting scenario, it should work now 😄

copper raven
#

also what is _zombie?

#

doesn't sound like array of units

#

what I actually want is to calculate the _distance of the closest entity that has a certain type of helmet
you need to pass array of entities into the function, it will then return you the closest one to the given origin

sonic thicket
#

Hmm, yeah ill make that into a nearentities

real mango
#

the sorting is a bit overkill imho 😄 why not just using find? 😮

sonic thicket
#

It needs to find the closest entity of an array and then check if that entity has the helmet, my guess the sort is to short them from closest to furthest

copper raven
#

the sorting is a bit overkill imho 😄 why not just using find? 😮
he wants to find the closest unit that wears a certain helmet

sonic thicket
#

I haven't slept much so pardon all my grammar mistakes 😛

real mango
#

nearEntities should do that by itself iirc

copper raven
#

yea well, i thought he had an array of them initially

real mango
#

oh fair enough then

sonic thicket
#

I probably should leave this till tomorrow 😅

sonic thicket
#

I dont know how I didnt got to the realization, but this script works as it should now :)

                        while {alive _zombie && alive _unit} do {
                            _wendigoradar = _unit nearEntities ["zombie_runner", 500] select 0;
                            if ((headgear _wendigoradar) find "NWTS" != -1) then {
                                if ((alive _wendigoradar) && (alive _unit)) then {
                                    _distance = (_wendigoradar distance _unit);
                                    if (_distance <= 100) then {
                                        _mathdistance = _distance / 20;
                                        if (_distance <= 10) then {
                                        playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
                                        uiSleep 0.5;
                                        } else {
                                        playSound3D ["A3\Sounds_F\characters\human-sfx\other\heart_4_1.wss", _unit];
                                        uiSleep _mathdistance;
                                        };
                                    };
                                };
                            };
                        };
#

I should probably reference the _zombie with the _wendigoradar as they should match when I put in multiple entities

vague geode
crude vigil
#

@vague geode setSkill is not a command required to be broadcasted. If you execute it in the correct place(owner of the AI), then the AI will act based on the skills you set. There is only 1 AI behaviour in multiplayer, it is not like everyone gets an AI difficulty based on their selections. That would mean a completely asynchronous multiplayer game, so nope. You do not need to execute it remotely, nor does it need to be broadcasted.

vague geode
#

@crude vigil Ok, thanks.

silent latch
#

anyone know if createAgent is local or global?

#

it does not define it on the wiki page

exotic flax
#

If not defined it's 99% local (unless command contains the word "global").

wind ingot
#

methods/functions to be private also need _ like normal variables right? (and private key word)

still forum
#

only local variables can be private

#

_ == local

tough abyss
unique sundial
#

yes, write extension. also arma bit wise functions are limited to 24bit numbers, your example is overflowing

tough abyss
#

why 24, just wondering?

unique sundial
#

because everything is float in sqf

tough abyss
#

riight ok

ebon citrus
#

because everything is float in sqf
We all float down here

#

🤡

vague geode
#

Is there an easy was to check whether there are people as passengers in a vehicle or not? The number of passengers doesn't matter I only need to check if there are any as part of the condition of an addAction action.

queen cargo
vague geode
#

@queen cargo Thanks alot.

queen cargo
#

np

ebon citrus
#

count fullCrew _target>0;

#

Drop that in the condition field

umbral nimbus
#

ok I'm giving myself a head ache.

check this code

#

    {clearWeaponCargoGlobal _x, clearMagazineCargoGlobal _x, clearItemCargoGlobal _x, clearBackpackCargoGlobal _x} foreach _objectsarray;
    _content = (profilenamespace getvariable ["testpers_persistentobjects",[]]);


    {
            {XXXXX addItemCargoGlobal [ 
                    _x, 
                   ((((_content select _forEachIndex) select 4) select 1) select _forEachIndex ) 
                   ] 
            } foreach (((_content select _forEachIndex) select 4) select 0);
    } foreach _objectsarray;```
queen cargo
#

```sqf

umbral nimbus
#

where XXXX is I had _x

#

which is obviously wrong

#

where XXX is should be the object referenced in "...foreach _objectsarray"

queen cargo
#
{
  private _x = "foo"; // implicit by foreach
  private _uper_x = _x;
  [] call {
    private _x = "bar"; // implicit by foreach
    diag_log _x; // "bar"
    diag_log _uper_x; // "foo"
  };
}```
umbral nimbus
#

ah

#

so I should do this:

#
        private _upper_x = _x;
            {_upper_x addItemCargoGlobal [ 
                    _x, 
                   ((((_content select _forEachIndex) select 4) select 1) select _forEachIndex ) 
                   ] 
            } foreach (((_content select _forEachIndex) select 4) select 0);
    } foreach _objectsarray;```
#

right?

queen cargo
#

more or less (naming is irrelevant, so you might also just name it _x0 or whatever)
also, the ```sqf was also directed to you 😉 adds syntax highlighting to discord

vague geode
#

Is there an easy way to find out if a plane or helicopter is low and slow enough for the AI to disembark when ordered to?

crude vigil
#

@vague geode getPos and velocity?

wind ingot
#

Also, although not usually possible from action menu, you could potentialy eject passengers by script, even though is not technically safe to "Get Out". But I could be wrong

vague geode
#

@crude vigil Thanks. Will use those in combination with BIS_fnc_objectHeight...

#

@wind ingot At least for aircraft the NPCs will not jump to their deaths by ejecting if they don't have a parachute.

crude vigil
#

Well you can always add an action. meowhuh

vague geode
#

@crude vigil Nope, that's what I presupposed. If you just command them to get out they won't do so until you're on the groud, whether they have a parachute or not unless you make them believe the plane will crash (e.g. by just switching to the co-pilot seat) but even when you force them to eject with an action they will only do so if they have a parachute.

crude vigil
#

Yes, that is why I suggested to add an action.

#

instead of using an existing action

vague geode
#

@crude vigil Either you don't understand me or the other way around.

I meant forcing them out by using NPC action ["Eject", vehicle NPC];.

crude vigil
#

action command is for existing actions, provided by the engine. Addaction is a command that allows you to put scripted actions.

#

Since it is scripted by you, you can do whatever you want, without being limited to AI decisions.

vague geode
crude vigil
#

That is not something I am denying? You are correct.. That is an existing action.

vague geode
copper raven
#

will

crude vigil
#

Yes, that is what I am saying. If you want to give ability to player to order AIs to disembark the vehicle , forcefully, you can combine moveOut and addAction together.

vague geode
#

Yeah, but why would you want to force your subordinates jump to their death?

crude vigil
#

I dont know what you are trying to make so?

#

It is not always death scenario.

#

Thought you could be wanting them to jump from not ground zero but from a little height.

#

Otherwise, why are you even trying to find out the heli velocity/position for unit to disembark? If you give getOut order, they will execute it the moment it is possible to do.

#

You do not need to check if it is suitable to getOut and then issue the order.

sonic thicket
mortal crypt
#

Hey I am trying to clear the pylons out on a helicopter.

{
  _vehicle setPylonLoadout [_x,""];
}forEach _allPylons;```
It clears all Pylons but the pilot and gunner still have the weapons shown (without ammo) when they reenter the vehicle. Is there any way to remove that?
vague geode
#

@crude vigil I was not trying to check whether it's save to disembark to then issue the order. I thought I needed to check it to spot another process but I found a way around.

ebon citrus
#

@sonic thicket what is pastebin.pl? It doesnt seem to load

mortal crypt
#

Thanks will try that later.

sonic thicket
astral bone
#

Hello! I am curious... So, I'm trying to get into scripting and no doubt it could be done better but- If I wanted to change a value between key presses, how would I do that?
Basically, trying to make my own crude NPC-Player dialog and have an array containing the speech text. However, variables made locally, before definig the event handler can't be used in an event handler code. Thus, trying to add to a value to say "We are here in the dialog, and thus here in the array" is tricky...

#

ooo

umbral nimbus
#

more or less (naming is irrelevant, so you might also just name it _x0 or whatever)
also, the ```sqf was also directed to you 😉 adds syntax highlighting to discord
@queen cargo

I know, it was directed at me.
And indeed understand naming is irrelevant

thnx! it works now.
I run into a new issue though. Ill post that later

mortal crypt
#

@mortal crypt https://community.bistudio.com/wiki/removeWeapon
@ebon citrus It was removeWeaponTurret sqf { _vehicle removeWeaponTurret [getText (configFile >> "CfgMagazines" >> _x >> "pylonWeapon"),[-1]]; _vehicle removeWeaponTurret [getText (configFile >> "CfgMagazines" >> _x >> "pylonWeapon"),[0]]; } forEach getPylonMagazines _vehicle; just if someone is interessted.

crude vigil
#

@astral bone Event handlers' codes can be fed either as string or code. Yes, it is impossible to pass local variables into your addEventHandler code, however if you write your code in string format, you can easily pass variables into your code string to be executed.

private _myString = "You somehow shot yourself!";
private _player = [player] call BIS_fnc_objectVar;
//Function above assigns a variable to object(also gives us the variable name and we need it because we need something we can pass to our code, ehm string!
player addEventHandler ["FiredMan", format ["hint '%1'; %2 setDamage 1;", _myString,  _player]];

May take some time to get used to it. meowthis

astral bone
#

I was able to get around it, not sure how good this is, but eh. Basically I set a variable on the dialog. Since that is being passed in the even handler via the _this, at the first position

crude vigil
#

Of course there are other ways, just wanted to let you know it is not completely impossible to pass some stuff into it.

astral bone
#

Aye :P

#

New question: Best way to only allow an action if the object is alive? (In this case, an NPC)
Would I use addaction and have the condition by "getdamage this < 1"? Seems to be working rn, but curious if theres a better way

#

May I post images about my results of the script here?

#

Oh

#

Er... How do I get the variable name, set in EDEN editor...

crude vigil
mortal crypt
#

Use alive

mellow obsidian
#

Hey, just have a question and want to see if someone can point me in the right direction.
I want to create a gamemode with capturezones, however I would like to move away from squared areas.
So my plan was making something like this: (Image showing how the map might look while zomed in)
https://gyazo.com/4411102d5158ce5ed6234c9c4048df6f
When captured the zones could change color or something along lines, however its the diffrent shapes im after.
Then when one zoomes out of the map a bit it would change over to something like this: (Image of outzomed map)
https://gyazo.com/d72479bbb5fff4c53c320aa75373fb68

I hope I've been able to explain what Im trying to achive, feel free to ask questions regarding it or/and point me in some direction

exotic flax
#

afaik you can only make squares and circles (and eclipses), so no custom shapes.
If you really want it than you probably have to use custom images which you can place over the map.

mellow obsidian
#

Ah I see, but then It would be harder for me to detect when someone is within an area correct?

copper raven
mellow obsidian
#

Cheers sharp, was looking at this earlier aswell. But can I use this to detect if someone is within the Polygon?

copper raven
#

perhaps

mellow obsidian
#

Oh, missed that one. Cheers man

#

Any insight on how to draw the area if the map is zoomed out x amount? What Im going at is if theres a way to detect the map being open and zoomed out a certain amount?

copper raven
mellow obsidian
#

I see, I'll give this a go. Thanks for pointing me in the right direction!

tough abyss
#

Heloo everyone!

I am trying to open a door on a specific part of the Destroyer object ( ** Land_Destroyer_01_base_F ** ) at the start of a mission, using scripting.

Most likely I need to use the animateSource command like this:

Land_Destroyer_01_interior_03_F animateSource ["Door_1_source", 1, true];

But how do I refer to the specific sub-object?
NearestObjects gives me this list:

[player1,1780012: <no shape>,<No group>:0 (Logic),destroyer,230aa414580# 1779916: destroyer_01_interior_03_f.p3d,230aa412bd0# 1779912: destroyer_01_hull_03_f.p3d,230aa41b4d0# 1779913: destroyer_01_hull_04_f.p3d,230aa422420# 1779917: destroyer_01_interior_04_f.p3d]

I apparently can't use destroyer_01_interior_03_f.p3d,230aa412bd0# 1779912 as the object name.
Any clues?

tough abyss
#

@tough abyss Howdy! Thanks. The destroyer (named "destroyer" in my mission 😄 ) is split into several static objects. Each static object has its own config, and it's own list of doors (starting from "Door_1_source"). Do you know how I would assign a variable name to that specific static (sub)object?

halcyon hull
#

Is it possible for a script to capture the map icons/lines/curves a user places on the map to be stored in some file, like the vars-file? I.e. with Antistasi, or many other missions recon is important and that information could be useful in multiple (multiplayer) sessions. So it would be nice if those could be redrawn from some sort of save. Does the game allow such a thing?

tough abyss
#

@tough abyss you could just use [<stuff from nearestObjects>] select {typeOf _x == "<sub object class name>" } to get a list of your sub objects

#

and then select the one you want with #

#

@tough abyss Thanks!

I used your command like so:
nearestObjects [player, [], 50] select {typeOf _x == "Land_Destroyer_01_interior_04_F" };
-and it spit out this:

[232caf1b7a0# 1779917: destroyer_01_interior_04_f.p3d]
However, when I use this in the animateSource or animateDoor command, I get this error:

Error Missing ]
It doesn't normally do that when I give it a named object. Replacing the [] around the name with quotations gives a Error Generic Error in Expression . What am I missing in the syntax?

#

there's no such thing as named object. when you give your object a name N in editor, what really happens is an object is created and assigned to variable N

#

so with the example above, i think you'll want something like ```sqf
_filtered = nearestObjects [player, [], 50] select {typeOf _x == "Land_Destroyer_01_interior_04_F" };
_filtered # 0 animateDoor [<fill out the blanks here>]

#

Fair enough. Correction "when I give it a variable name "

#

where _filtered is a list containing objects of type Land_Destroyer_01_interior_04_F

#

Does the pound sign (#) mean "select" in this case?

#

yes. it's a short syntax for select <number>

sonic thicket
#

Could anyone tell me where variables are stored and how I can get rid of them? I just noticed that variables might be persistent over restarts lol

tough abyss
#

Ah. Learning lots of things here.

So as I understand, there is no direct way to refer to the sub static object. It must be searched for.

Thing is, the result of the nearestObjects returns one object (see above). When I use it in this line:

[232caf1b7a0# 1779917: destroyer_01_interior_04_f.p3d] animateSource ["Door_1_source", 1, true];
I get the aforementioned error. The same occurs when I paste the entire nearestObjects command. Am I missing something?

#

animateSource expects an object as its first argument. you are giving an array instead

#

also 232caf1b7a0# 1779917: destroyer_01_interior_04_f.p3d is not a variable or object. it's the text representation of the object that the debug console shows you

tough abyss
#

You're completely correct. Sloppy mistake. Using your commands to create the array, then using that array, does indeed execute without errors.

I then had to triple-check that I had selected the correct sub-object (turns out it was destroyer_01_interior_03_f). Holy cow this is tedious.

But seriously, thank you.

sonic thicket
#

So, I have been struggling at this script for too long then is good for me. I've tried various method but without luck.

There's something wrong with this string that should execute between 19:00 and 04:00

waitUntil { sleep 1; if (daytime >= 19.0) && (daytime <= 4.0) exitwith {true}; };

Do stuff when it passes

Could someone please help me out?

#

Hmm and there's another error with that I just realized... hmmm

#

I found a solution I think 🙂 finally

sonic thicket
#

All right, i give up.. I've been trying this for a long time.

while {true} do {
    if ((daytime >= 23.0) && (daytime <= 6.0) && (_nighttime == true)) then {
        execVM "Enviromental\CreeperStalkerScript.sqf";
        _nighttime = false
    };
    if ((daytime <= 23.0) && (daytime >= 6.0) && (_nighttime == false)) then {
        _nighttime = true
    };
sleep 10;
};

What I want this to do is execute a script once every day between 23 and 6 but it just keeps spewing errors at me =/

#

If anyone would be willing to help me out it'll be appreciated 🙂

tough abyss
#
waitUntil {daytime > 23};
while {true} do {<do creepy stuff>; sleep 3600 * 24};

how about this

exotic flax
#

if we would know the error we could help you better 😉

#

and the code by Wipeout won't work, since it will simply start the script the first night and then keep running even during the day

tough abyss
#

he said he wants it to run every day

exotic flax
#

indeed, and not start once and keep it running day and night without stopping it

#

@sonic thicket so the initial script is (almost) doing what needs to be done, but without knowing the error it's impossible to say what is going wrong

tough abyss
#

once the script is spawned it can only stop itself

#

that local variable does nothing, so it's okay to keep the loop running

#

also

#

== can't compare boolean

crude needle
#

@sonic thicket Not exactly sure what you want the script to do but I can see immediately:

_nightTime = true;
// wrong
if (_nightTime == true) then {/*do stuff*/};
// Right
if (_nightTime) then {/*do stuff*/};
sonic thicket
#

oh blast yeah and !(_nighttime)

exotic flax
#

or use isEqualTo, or wait will 1.99 rolls out 😉

tough abyss
#

what about 1.99?

exotic flax
#

new patch will add some fixes including bool == bool support

crude vigil
#

still, dont do it in this scenario meowthis

sonic thicket
#

its even missing ;

#

A fallback would be nice, such as if (_variable = "variable does or does not exist"||isNil) then { do stuff };

#

basically accounting for whenever a variable is empty

sonic thicket
#
_nighttime = true;

while {true} do {
    if ((daytime >= 19.0) && (_nighttime)) then {
        execVM "Enviromental\CreeperStalkerScript.sqf";
        _nighttime = false;
    };
    if ((daytime <= 19.0) && (daytime >= 4.0) && !(_nighttime)) then {
        _nighttime = true;
    };
sleep 10;
};

This seems to work 😄

#

Is there a way to stop enviromental sounds? ( Creaking trees and such are pretty neat at night but I wonder if I could stop all the other sounds such as insects and birds )

warm hedge
#

enableEnvironment

sonic thicket
#

thanks! 😄

finite jackal
#

@tough abyss our community uses it for roughly 600 mission objects and have not seen any issues from it

west grove
#

@sonic thicket I think you can dramatically increase that sleep in your code, unless you have a very fast day/night cycle

#

also why not a simple waitUntil {condition} in the loop

#

your code looks kinda overcomplicated to me

astral dawn
#

Does arma fully dispose of deleted objects? Ping me if you know please.

What if I do createLocation and delete it 10, 100 thousands of times? Does it free the resources entirely or it still has something somewhere?

astral bone
#

Why is it that I can't use sleep in init without spawn? Is it the fact it's a unscheduled environment?

astral dawn
#

yes

astral bone
#

So, if I want a while condition with sleep, using it in a spawn function, it should continue and not stop after the 10,000 iterations?

astral dawn
#

yes

astral bone
#

Ok thanks! :P

#

How might I find only certain object within a given area? Specifically, only finding people, AI or players

astral dawn
#

it will list all men

exotic flax
#

nearEntities is faster for (moving) units/vehicles

#

it just doesn't return in order of distance

astral bone
#
[this] spawn {
while {true} do {
uiSleep 1;
if(count(_this nearEntities ["CAManBase", 10])>0)then{
_this switchLight "ON";
}else{
_this switchLight "OFF";
}
}
}

It apparently is getting 1 argument, but it expects 3?

astral dawn
#

it does
[this] nearEntities ["CAManBase", 10]
I assume (because you pass [this] as argument to spawn)

#

so it thinks it's an array -> it thinks it must be an array of numbers -> there must be 3 numbers in this case

exotic flax
#

type: String or Array of Strings - type(s) to search for

astral bone
#

Huh?
Wait, is _this not the same as this? Do I need to do a select for 0 then?

astral dawn
#

yes or just pass this instead of [this]

#

no, this and _this are different

astral bone
#

Huh... I can just pass this instead of [this], so this spawn works and so would [this] spawn?

exotic flax
#

yes

astral bone
#

Ah ok. Unrelated note... well sorta... SQF is a custom language made for arma 3 or am I mistaken?

exotic flax
#

SQF is the scripting language for the RV Engine, so all OFP and Arma games, but also DayZ, TKOH and TKOM

#

but yes, it's a "BI-only" language

hollow thistle
#

DayZ does not use SQF.

#

TKOM also.

queen cargo
#

In theory, one can Code stuff in sqf-vm that... Just works 🤪🤪

#

(cmd Applets written in sqf are possible)

sonic thicket
#

Hey guys, is there a way to turn on/off each environment individually? Like
enableEnvironment false;
but then

enableEnvironment [night,false];

ebon citrus
#

Use the command to false at night and enable it at day?

jade abyss
#

DayZ does not use SQF.
@hollow thistle *anymore (to be overprecise 😛 )

digital hollow
#

Is there a command to get the game setting UI colour? Would be nice to match scripted icons to fit.

winter rose
#

@digital hollow yes, see BIS fnc getColor (or something like that, sorry not at home ^^)

digital hollow
#

I always forget to check bis_fncs

#

BIS_fnc_displayColorGet

winter rose
#

Yay! Couldn't have remembered, disconnected from the wiki far too long 😁

sonic thicket
#

@ebon citrus night as a enviroment sound controller. These are the possible values:

rain, night, wind, daytime, meadows, trees, houses, forest, sea, coast, altitudeGround. alititudeSea, shooting, deadbody and fog

Dependent on where a person is these environment sound controllers will kick in. I am looking for a way to disable some of these sounds or enable them.
Currently the only way seems to be to disable all environment sounds and then adding back in the ones I want. I'm currently setting the spooky mood of the wendigo script and I'd have to say being in the forest without any sounds except those screaming beasts can be quite creepy

ebon citrus
#

They might have a solution for you

sonic thicket
#

Hmm, i have not yet. Ill ask there if my current method starts to get too complicated 🙂

vernal venture
#

I'm not able to sit down in game to test this, I'm spitballing on my tablet, but does this little snippet seem like it'll work in an addaction call? Current it works with 'playerSide == West'.

if(playerRole == Sniper) then      
   {      
    default {[sniper_box, _caller] call ace_arsenal_fnc_openBox};       
   };
old canopy
#

Hey guys, is there a script that after a player dies or is killed their mic/caps button automatically turns on for a certine about of time. Thx pls @ me if you think it’s possible

exotic flax
#

@vernal venture it would work if Sniper was defined (like west is)

vernal venture
#

So then I'd have to use the class name of the unit I spawn in and made playable, wouldn't I?

exotic flax
#

although mixing up if () then { with a default doesn't make sense either, default only works with switch () do {}

#

well, playerRole doesn't exist either, so I assume you managed to get that variable somewhere, similar to Sniper

vernal venture
#

Maybe I'm thinking roleDescription

exotic flax
#

could be, never used it

#

so perhaps roleDescription player == "sniper" works, but no idea what the exact values are

vernal venture
#

@old canopy ACE mutes you when you're dead, so it's possible.

#

I'll have to test it tonight when I'm back at my PC, but it seems like I want some variation of that. Thanks, @exotic flax

old canopy
#

@vernal venture now I know nothing about deving but I would really like to see it on a server that I’m an admin on. The servers called Frag Squad CQC it’s a sandbox FFA CQC server

#

After a player is killed their on the floor for 5 seconds before they go back to spawn and from there they can spawn back in at a new location

#

However I would like to see players mics opening after their killed by another player for possibly 3 seconds

#

By any chance is there a current script for that which I can steal/use

exotic flax
#

to hear raging kids screaming for 3 seconds? 😮

old canopy
#

Yeah

#

Very egotistical combat roleplayers calling each other very naughty words

#

The best of Arma 3’s MK-1 players

#

Is there a script though for it

winter rose
#

COD style

old canopy
#

Yeah lol that’s it

#

MWF style

#

3 second voice activity

#

Before it shuts off again

#

If anyone knows a script or knows where I can find one pls @ me it would be much appreciated

winter rose
#

But nope

#

No scripting command can influence microphone activation

old canopy
#

FEelsBadMan thx though

exotic flax
#

afaik VON is disabled when someone is dead or even when unconscious (not sure since I only play with ACE). So I believe the only best to do it is prevent someone from actually dying, but them in a "death" pose/animation (so VON IS still possible) and after 3 seconds really kill them and respawn

hallow mortar
#

afaik VON is disabled when someone is dead or even when unconscious
It is not. VON is enabled when unconscious, and enabled in spectators-only mode once dead.

ornate prairie
#

theoretically, could i use unitplay to fly a helicopter to a pickup zone, attatch it to an invisible static object with BIS_fnc_attachToRelative at the end of the unitplay script, and then use another unitplay and detach once the player is onboard?

#

it would be attached to prevent the helicopter ai from trying to leave, it has to stay there for an undetermined amount of time while the player gets to it
i feel like this would create a relatively seamless extraction effect

tough abyss
#

@ornate prairie I guess I'm not getting the problem exactly. Couldn't you create two different unitplays (just activate and copypaste the output it once you landed and again when you take off), then play them each with a different trigger. Should be fine for flying the helicopter in, then sending it back when the player is onboard. You might want to " allowDamage false " however, in case Sgt Murphy comes along during the mission 😄

ornate prairie
#

the problem is if you just unitplay a helicopter in to land, the ai will then take over. In most situations, especially in ones where there is enemy fire nearby, vanilla ai will simply take off as soon as it has control

tough abyss
#

I had a different question. How can you get the jets (eg Black Wasp) to start the mission with their canopies closed? Tried to use

this animateDoor ["canopy_hide", 0, true];

Which seems to activate the closing animation. But I want it closed at the start, not closing. Anyone know?

ornate prairie
#

i dont trust the heli ai; even if you give them a land waypoint they will touch the ground and immediately take off again because they deem it unsafe

#

change the 0 to a 1

#

or no

#

hmm

tough abyss
#

@ornate prairie disableAI "move" works, I believe. But you can also completely disable the AI, and only give the heli 2 unitplays. One for landing the heli, and another for taking off once the player is on.

ornate prairie
#

thats true but in my experience the ai will leave the engine at neutral level which is some cases leads to the heli slightly hovering into the air, too high to board

#

the command you gave is supposed to do it instantly
i would try to see if its possible to swap animatedoor out with animate or something similar

tough abyss
#

@ornate prairie We seem to both not buy into each other's advice :D. I can send you a mission (my own) where I have a heli waiting at one end of the island with the pilot set disableAI "move"; that activates a unitPlay once the players set off an alarm (trigger).

#

There's been no hovering (yet) hehe.

ornate prairie
#

it may have been the aircraft i was using lol
it was a theory anyways, ive done extractions before just differently

tough abyss
wind ingot
#

I'm having a runtime error with some scripts and I'm unsure of the cause.
I used to have some UI resources with inline script. To organize my code, I replaced the inline with a method callout with parameter.

onCheckBoxesSelChanged = "[_this select 2] spawn vphud_dialog_txtCheckBoxCh;";

However ingame I'm getting the following error from the method:

23:32:08 Error position: <{
params ["_in"];
if (_in == 1) then {
v>
23:32:08 Error Missing ;
Which doesn't make sense because the method isn't missing anything.

vphud_dialog_txtCheckBoxCh {
    params ["_in"];
    if (_in == 1) then {
        vphud_crosshair_toggle = true;
    } else {
        vphud_crosshair_toggle = false;
    };
};

I feel like I'm looking at wrong place and is a problem with the inline method callout...

cunning crown
#
vphud_dialog_txtCheckBoxCh {
                          ^ missing =
wind ingot
#

OMFG

#

Thanks

#

Totally missed that out

warm hedge
#

Also this could be simplified like sqf vphud_dialog_txtCheckBoxCh = { params ["_in"]; vphud_crosshair_toggle = (_in == 1); };

wind ingot
#

Because of that, i went for makepbo instead of addon builder and found some delightful memes
"Remove this line, it is no use to you, and deadly to the engine."

errant timber
#

Hey. Does anyone know how to disable the pressure plate ability on explosives? I got IEDs in my mission but I want them to be remote controlled only.

#

Couldn't find any scripts which disable this.

wind ingot
#

It's properties/attributes don't have any checkbox for that option? AFAIK, IEDs used to be actually quite dificult to trigger because they would only detonate with remotes

#

Or are you confusing with mines like anti tank or anti personel?

errant timber
#

wait a sec

#

I'm talking about for example IEDLandSmall_Remote_Mag. Even though it has "remote" in the name ACE lets it have the ability to be triggered by a pressure plate

#

How does one go to a single item's properties? I couldn't navigate singular weapons through the config viewer

ebon citrus
#

@errant timber that's ACE stuff

#

and you find the item in config viewer and then you click on it

errant timber
#

I found it but it didn't have any lines mentioning pressure plate

#

only "remote"

#

I think ACE itself has some script where all IEDs can be triggered by pressure plate

#

I have yet to find it though

wind ingot
#

Instead of using hints for debug (and the limited watch variables), is there a way to log to the rpt manually?

ebon citrus
sonic thicket
#

I am getting some odd behavior with:

10 setfog 1;

This command for example does not work, changing the 10 to 0 does work and then changing from foglevel 1 to foglevel 0 with

10 setfog 0;

Does work. I have disabled all the mods, disabled all the scripts and it turns out it's due to something I did in the mission itself. It feels like as if I am trying to find a needle in a haystack so I was wondering if anyone here had this issue before and/or perhaps knows what settings could cause this?

sonic thicket
#

It turns out i didnt saved my weather settings last time when I checked that to be the cause

#

glad that it's something I missed 🙂 keeps the solution as simple as it can get

robust hornet
#

anyone know something I can add to an AI's init so they always walk around with a launcher equipped?

hollow thistle
#

strip them of primary weapon/ammunition

upper rose
#

I'm working on creating an if-then argument in my mission init file to check to see if Ace is running. I understand there is a code for activated add-ons... But I'm having some trouble typing it out... Does anyone have any familiarity?

#

I would like to have my mission check to see if AC is running and then run a script in response

#

Ace is meant to be optional

cunning crown
#

activatedAddons returns a list with all active addons, you just have to do if (<ADDON NAME> in activatedAddons) then {} else {}

astral bone
#

I'm having some issues...

hint "Test";
["maxwell_minefield_symbol"] spawn BIS_fnc_showMarker;
["maxwell_minefield"] spawn BIS_fnc_showMarker;
_repcom = missionNamespace getVariable ["rep_command" , objNull];
_repcom sideChat "Be advised - we think minefield";

and

hint "Test";
_repcom = missionNamespace getVariable ["rep_command" , objNull];
_repcom sideChat "Be advised - we think minefield";
["maxwell_minefield_symbol"] spawn BIS_fnc_showMarker;
["maxwell_minefield"] spawn BIS_fnc_showMarker;
#

I tried these inside a trigger

#

But, nothing else happens after showing test. (Which was to make sure it was working at all xD)

#

Doesn't say anything in the chat, and doesn't change the alpha of the markers

#

(Also, the msg was shortened during debugging, thus the thing that looks kinda funny of just "We think minefield" xD)

#

Type is none, Activation is any player and activation type if present. No timeout/countdown...

#

Markers would be anything on the map, right?

#

Like, an eclipse, a minefield marker

#

Yea

#

Yea, so I put it under "Variable Name" on Marker: Init yea?

#

And not the text one

#

Yea. Do the trigger and the marker need to be under the same layer?

#

that didn't work either... 3:

#

Yea

#

I put a hint after too, to make sure

#

First says "test" second says "he" (b/c why not) I enter the trigger and I see he on the side of my screen

#

Huh... Put another hint that was doing "hint str(_repcom)" and it shows the variable name of repcom and not objNull so... sidechat also isn't working..

#

Ok

#

Uh... Well, setMarkerAlpha 1; works fine. The show marker wasn't tho.

#

As for the side chat, I might have an idea...

hallow mortar
#

Also, sideChat is a local command. This is probably not the issue in this specific case but you will need to make sure to execute it locally for everyone you want to be able to see the message, in order to make it work in multiplayer.

astral bone
#

Server only is off but I still can't get the guy to say anything...

hallow mortar
#

try specifying the duration and target alpha parameters for bis_fnc_showmarker

astral bone
#

wait..

#

xD

#

I forgot to give myself a radio

#

I'm smart :3

#

xD

#

I'll make sure to use it and complain when it doesn't work perfectly ;P xD

#

jokes

#

Yea, I just literally wanted to have it show/hide, nothing fancy with fading xD

sonic thicket
#

Hey everyone! I've been re-directed to #arma3_config yesterday, today I gave it a shot and was re-redirected to #arma3_scenario from which i was re-re-redirected to.. Well you guessed it Here again :D

Anyhow, during these past 2 days ( today and yesterday ) I've gained some information trying my best to get this working on my own. I failed so I now feel like having no choice but to resort to the great wisdom of #arma3_scripting community.

I am in search for a way to disable specific environmental sounds for a specific duration. E.G. the birds in a forest. What i have learned so far is that this is not an easy task and will (I think) not work unless I manage to create my own soundset without said birds and add it into the game with some sort of command or function I have no knowledge off while disabling the default soundset.

So as probably already is clear as day... I have no clue if this would actually work and where to find all the information to pull this off so would any of you have any clue on how to do this I'd absolutely love some of your insights and knowledge on the matter 🙂

winter rose
#

So I would say: disable environmental sounds

Then, create sound sources of the wanted type.

Issue: people will hear the transition

sonic thicket
#

Yeah I noticed this Lou, already tried that approach :p

#

Tried to get as close as possible but its extremely hacky so it's bound to go wrong at some point

#

The whole idea is to kill the ambient life sounds as soon as a "Wendigo" screams, sound is super important when it comes to setting a atmosphere

#

Thanks for the tip though 🙂 I'll probably continue with adding stuff to the wendigo AI such as animations for jumping on a player, crawling towards players n such

winter rose
#

Unless you manage from the very beginning every ambient sound!

sonic thicket
#

Well, i think it is possible by creating the soundsets myself but that would involve an amount of time that is not really clear to me, a time that can be a day, a week or even a month

fleet stirrup
#

Hey there, I have an question about mutating arrays.

I know you can use the set variable to mutate an array in place, and that change occurs to all references of that array (since that's how references work) but I have an array that is a variable attached to a unit, that I am getting via getVariable. My question is do I need to setVariable it again afterwards, or should I be able to leave it? The extra command isn't too much of a problem, it was just an interesting thought.

I also wanted to make sure it is an actual supported thing to do rather than something that could work in some circumstances before I used that functionality in a script

winter rose
#

you don't need to, unless it's in MP and it has to be synchronised

#

(again, if I am not mistaken)

cunning crown
#

My question is do I need to setVariable it again afterwards, or should I be able to leave it?
Yes you do need to setVariable it again iirc

winter rose
#

FIGHT!

cunning crown
#

⚔️

winter rose
#

…try and thy shalt see @fleet stirrup 😅

hollow thistle
#

set mutates the array, which means that you do not need setVariable, the array is changed by reference.

#

However if you're doing it in multiplayer you need to mind that every client has own copy of this variable on the object. So if you want to have these changes on every client you need to re publish it.

winter rose
#

in your face @cunning crown ; IN YOUR FACE!1! *ahem*

cunning crown
#

Oh I didn't knew that getVariable returned a reference, my bad. Wiki is not clear, it's your fault @winter rose 🙃

lavish storm
#

hi, searching a script which removes the auto targeting and the "Vehicle 500m LEFT" thing 🙂

winter rose
#

Good luck!

#

@lavish storm see disableAI on the wiki

lavish storm
#

also working in multiplayer? @winter rose

winter rose
#

the wiki page should say it all - it works if you execute it where the AI is local

lavish storm
#

ty

ionic anchor
#

you could make a trigger that unlocks the door number on BLUFOR present with a countdown

sonic thicket
#

is there any way to check a units target?

Here's what i am trying to achieve;

while {alive _zombie && alive _unit && target = _unit } do {
chase the target script
}

while {!target = _unit } do {
destroy the target script
}

I know there's something that works in the dev branch but that wont be of help for some time to come 😦

#

The issue is that an enemy unit shooting at the zombie conflicts with the chase script which results in the zombie going for the shooter and then for the player each 5 seconds

tough abyss
#

so you're trying to make the zombie always chase player? is that the goal?

sonic thicket
#

Yes and no, it may get interrupted and kill something else but as long as it targets the player again.

Don't be fooled by thinking stereotypical zombie though, these things are heavily altered

#

Anyway.. There's some odd behavior where the AI starts running circles on which I will come back later today

tough abyss
#

i don't know what your idea of stereotypical zombie is, but in my mind when a zombie is attacking a target it just runs straight towards them, so maybe you could just determine if zombie is targeting player by checking if the heading of the zombie is more or less similar to the player's relative direction from the zombie
also i'm guessing doTarget doesn't work for you?

ebon citrus
#

@tough abyss this would work if the zombies were on a flat plain

tough abyss
#

yea i'm not sure how to handle when the zombie goes around obstacles

ebon citrus
#

Let the pathfindig deal with that

tough abyss
#

you mean PathCalculated event? does it automatically trigger without calling calculatePath manually?

ebon citrus
#

You can use doMove or moveTo

#

You can make an fsm script to run this

tough abyss
#

i think the problem is after moveTo the zombie might gets back to attacking some other npc, then @sonic thicket 's script kicks back in and sets the target back on player, causing the zombie to run around in circles

ebon citrus
#

If player detected > track
If not > loiter

tough abyss
#

i think that's why he needs to check if the zombie is interested in player in the first place

ebon citrus
#

FSM

#

This can be done through regular sqf

#

But it isnt exactly the best

#

And most certainly it is not the best performance wise

winter rose
#

as they say, you can kill someone with a drill and make a hole in a wall with a machinegun, but to each tool its purpose or it gets messy quickly

winter karma
#

did you try to sink it to teh arma 3 support module?

#

you need teh requester too and synch it to the provider

#

that is snchd to the arty you want to use

winter rose
#

Is the target in range?

winter karma
#

is out of minimal range?

sonic thicket
#

@ebon citrus @tough abyss Lots of thanks for giving this some thoughts, ill throw down some context to this thing now so that at the very least it's clear what happens and when. If you're still willing to help after knowing that It'll be appreciated a lot!

For all others, the "createunit" _zombie that gets a wendigo outfit and a player assigned with the following line ends up running in circles whenever something nearby shoots it.

_zombie setDestination [ASLtoATL getPosASL _unit, "LEADER PLANNED", true];

Out of the script that is 405 lines long this is the part where it goes wrong, I know this because the systemchat keeps looping. Oh and it keeps looping CORRECTLY but it never actually puts a proper setDestination down ( Do note this is still only happening after some unit other then myself fires a gun nearby )

        if ((_distance <= 500) || (_distance >= 80)) then {
        _zombie forceSpeed 20;
        _zombie setDestination [ASLtoATL getPosASL _unit, "LEADER PLANNED", true];
        systemchat "setDestination";
        systemchat (format ["%1",_unit]);
        };
        if (_distance <= 80) then {
        _zombie forceSpeed 10;
        _zombie setDestination [ASLtoATL getPosASL _unit, "LEADER PLANNED", true];
        systemchat "setDestination";
        systemchat (format ["%1",_unit]);
        };

Thoughts would go to "FiredNear" that is from the ravage mod itself which looks as following:

#
_zed = _this # 0;
_unit = _this # 1;
_distance = _this # 2;
_weapon = _this # 3;
if (isNil {_zed getVariable "_zTarget"}) then {
    _silenced = _unit weaponAccessories currentMuzzle _unit param [0, ""] != "";
    if (_silenced) exitWith {
        if (_distance < 20) then {
            _zed setDestination [ASLtoATL getPosASL _unit, "LEADER PLANNED", true];
        };
    };
    if (_weapon isEqualTo "Throw") then {
        _unit = _unit getVariable ["_lastProjectile", _unit];
    };
    _zed forceSpeed 10;
    _zed setDestination [ASLtoATL getPosASL _unit, "LEADER PLANNED", true];
};

That explains the stutter when an enemy unit is shooting which I will have to fix down the line but it does not explain the running circle behavior when the shooter is already down.

#

Here's the whole script: ( Im constantly testing and updating though ) https://pastebin.com/Q6YJDuH2
While nobody's answering I'll just keep updating this message so that I wont occupy whole pages on the discord and burry other's people questions in it.
So I've changed the following lines to the script:

            _zombie setDestination [ASLtoATL getPosASL _unit, "LEADER PLANNED", true];
            systemchat "setDestination";
            _poslocation = ASLtoATL getPosASL _unit;
            systemchat (format ["%1",_poslocation]);
            _explocation = expectedDestination _zombie;
            systemchat (format ["%1",_explocation]);

And it turns out that the _poslocation is exactly my location but the _explocation differs when the wendigo is running away.
So it got the order "SetDestination" and it correctly knows where to go but the AI ignored this and went for a random location?

vague geode
#

I noticed that there is a change in the group bar depending on which loadout I am using. When I am using a certain type of MG I am marked as a machine gunner just like the NPC units in the group have an icon thingy for their "profession". I was wondering if there was an easy way to find out what "profession" a (player) unit has if you can't go my the unit config class...

tawdry harness
#
while (_kPressed isEqualTo false) do { 
            if (vChange == 0) then {
                systemChat 'Channel Not Changed Recently';
            } else {
                systemChat 'Channel Changed Recently';
            };
            _kPressed = true;
        };```
Anyone know why arma spits out the error "Type Bool, Expected code" and it shows the '#' behind the while?
#

Context: This is in an DisplayAddEventHandler

exotic flax
#

because it's

while { ...code... } do { ...code... };
tawdry harness
#

ripp

#

Wrong brackets

exotic flax
#

easy to make mistake, especially when normally writing in other languages 😉

tawdry harness
#

Yea lmao

#

Thanks

versed belfry
#

hey guys, if anybody is able to help me I'll be grateful:
I am trying to have this script run when an action was used in-game:

[] spawn {
removeAllActions Device2;
hint "Searching Device";
sleep 20;
hint "Nothing was found";
};```
I basically want this script to only run if the one who is using the action has the variable name IT1 or IT2, if the one who is using the action doesn't have those variable names or have a different one then it would execute another script:
```sqf
hint "Access denied, engineer required";
};```
I got no idea how to do it, I've seen some stuff about "if", "then", and "else" but I don't know what to put after "if" so it is even more confusing.
sonic thicket
#

@versed belfry I'm not sure how to check whenever an action is performed but for the if part:

if ((player vehicleVarName isEqualTo "IT1") || (player vehicleVarName isEqualTo "IT2")) then {
Do stuff here
};
#

You should test that though, I'm brand new myself here so I may have gotten it wrong ( This is the first time I felt confident enough to reach out helping someone )

versed belfry
#

also no worries, thanks for trying 😅
I am quite new to it and having a bit of a problem recently understanding some things as well

sonic thicket
#

@versed belfry I made a mistake, sorry 😛 Here's the correct one :D

if ((vehicleVarName player isEqualTo "IT1") || (vehicleVarName player isEqualTo "IT2")) then {
systemchat "You are qualified as a engineer.";
} else {
systemchat "You are not qualified as a engineer.";
};
#

Or better:

if ((vehicleVarName player isEqualTo "IT1") || (vehicleVarName player isEqualTo "IT2")) then {
removeAllActions Device2; 
hint "Searching Device"; 
sleep 20; 
hint "Nothing was found";
} else {
hint "Access denied, engineer required";
};
#

Oh but sleep does not work unless its in a script

#

You can however execute a script from that line and add in the sleep 🙂 If you want that let me know

versed belfry
#

Almost working, right now it is always giving me the sqf else { hint "Access denied, engineer required"; };

#

even when I am using a unit with the var name IT1

sonic thicket
#

Hmm lets see

versed belfry
#

Not sure if this helps but:

Device2 addAction ["<t color='#FF0000'>Search Device</t>", "Nothing.sqf"];```
is added to a laptop that the players can interact with
sonic thicket
#

it1 right not LT1 ?

versed belfry
#

yep it1

sonic thicket
#

Ahh lol i see

#
_player = _this select 3 select 0;
if ((vehicleVarName _player isEqualTo "IT1") || (vehicleVarName _player isEqualTo "IT2")) then {
removeAllActions Device2; 
hint "Searching Device"; 
sleep 20; 
hint "Nothing was found";
} else {
hint "Access denied, engineer required";
};
#

And now it works! 😄

#

I hope lol ( at least we're getting closer )

versed belfry
#

still same problem

tough abyss
#

@sonic thicket i don't feel experienced enough in arma bots to give some concrete suggestion, but I think after your setDestination call either the built-in or ravage's modded ai fsm kicks in and decide the zombie better off chasing another destination. have you tried disabling zombie's ai features (eg. "FSM") or use moveTo/doMove as Nica suggested?

sonic thicket
#

oh damn forgot a select updated above script @versed belfry try it again 🙂

#

Yeah i tried doMove... i fixed it sorta... it still does the same thing but not infinitely, it eventually decided to come after me again but then still in a odd way

sonic thicket
#

its like its doing super ninja evasive maneuvers, it runs towards me and then buzzes off to make 2 circles and then decided its time to hit me

versed belfry
#
_player = _this select 3 select 0;
if ((vehicleVarName player isEqualTo "IT1") || (vehicleVarName player isEqualTo "IT2")) then {
removeAllActions Device2; 
hint "Searching Device"; 
sleep 20; 
hint "Nothing was found";
} else {
hint "Access denied, engineer required";
};```
I tried removing the underscores from before player after if and it gave me the problem of jumping to else
sonic thicket
#

Where is the nothing.sqf located? directly in the root folder of the mission?

versed belfry
#

yep

#

1 sec I might have found something

#

ok so the last script you send me works

#

it was me being an idiot and not sleeping for 24 hours and forgetting to add an I
so it was T1 instead of IT1

#

thanks a lot and sorry for me being an idiot

sonic thicket
#

Oh tell me about it haha, scripting can be extremely addictive 😛

#

@tough abyss Each 0.5 seconds the setDestination kicks in on the default zombie AI. making sure there are absolutely no conflicts within my own scripts it got a bit better but I think that is the culprit there. I will probably need to piggyback on the setdestination that is already there somehow. I dont really see any other solution but thanks to you I came to that realization so hopefully that will result into a "Thanks :D!" unless this theory is not correct. Then i'd have to curse you 😈

#

time for coffee lol

#

All right nevermind lol even regular zeds run off haha

pale ridge
#

so i want to add a simple script:
if damaged by bullet x
then add/raise ace_pain
now since i have almost no experince with scripting i thought i ask here if its possible to do and if someone is willing to help.
tho i don't know if that is going to heavily hit the performance

sonic thicket
#

That wont actually hit performance that much

#

add a script called initPlayerLocal.sqf to your mission root folder and add:

this addEventHandler ["HitPart", {
    params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
        _player = _this select 0;
        _currentdamage = getDammage _player;
        _newdamage = _currentdamage + 0.1;
}];

Take a closer look at https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Hitpart to determine if the projectile is of a certain kind, if the damage was direct (no splash) and so on

@pale ridge ^

pale ridge
#

oh ok i'll have a look

sonic thicket
#

@tough abyss HURRAYZ! I found the solution 😄 Instead of using CreateUnit I've used CreateAgent which ignores the fact he's fired upon! :D

The CreateUnit AI that comes with it prevents the Ai from doing suicidal actions so when something fires and the Ai has no gun... Well it would run away. and because I have a script that makes the unit run towards the player it results in... You guessed it... RUNNING CIRCLES :D

Im so glad I finally figured this out!

#

So if you ever want to make Ai do a charge, here's what you use 😄

sharp grotto
#

Is there any way to restrict/force the gamma settings ingame ? I want to get rid of the gamma cheesing at night (At least via ingame settings) 🤔

tough abyss
#

nice, didn't expect the solution to be so simple after all!

sonic thicket
#

It's always simple hahaha

#

well most of the times it is

sonic thicket
#

can anyone tell me if

_radar = player nearEntities ["man", 500] select 0;

Will always return a player if a player is within 500m ? ( even if a Ai is closer to _radar )

winter rose
#

it will return the first man in a 500m radius around the local player, most likely the local player itself

#

simplified:

player
sonic thicket
#

And what if it was executed from an AI? and then 10m from Ai is another Ai and then 20m from Ai is a player

winter rose
#

stahp and tell us what you are trying to do

sonic thicket
#

All right so in the following steps: Each 5 second _zombie checks what is around it in a 500m radius. ( _radar = _zombie nearEntities ["man", 500] select 0; )
Then it checks if _radar is an AI (anything that is not a zombie) that is aware of the _zombie through KnowsAbout >= 4 and attacks this AI.
Then it checks if _radar is a player and attacks the player.

So the result is the _zombie attacks and kills everything that becomes aware of the _zombie on it's path the the player.

@winter rose Sorry for the long wait, wanted to make sure I dont speak in hyroglyphs 😛

winter rose
#

I was fearing a wall of text, it's ok 😄

sonic thicket
#

haha, rather a formulated text 😉

winter rose
#

(if the zombie is enemy to said side)

#

so, if the zombie knows about the unit, but the unit doesn't know about the zombie, the zombie won't attack?

sonic thicket
#

I think that the zombie will attack the unit if it knows about it, that's already within the default ravage scripts and works fine. nearTargets is definitely nice but I'd have to use a foreach I think dont I?

#

Hmm actually... west is reserved for players ( i hope )

#

then i can use nearTargets select 2

winter rose
#

well yes, here you are "grabbing all men around zombie"
picking the first one (you don't check if there are any, so the first one might actually be the zombie itself)
then check knowsAbout (which is imprecise if not local)

sonic thicket
#

I have this line shoved in between as a filter to make sure it doesnt selects itself:

#
[_radar] spawn {if ((side _radar == east) || (side _radar == independent) || (side _radar == west)) exitwith {_unit = _radar; };};
winter rose
#
if (side _radar in [west, east, independent]) exitWith {};
sonic thicket
#

haha nice 😄

winter rose
#

because you will simply kill the spawn, nothing else - private variables do not port over spawn

sonic thicket
#

I have been wondering how far it exists but apparently only the current scope. nice to know that 🙂

winter rose
sonic thicket
#

I have seen that 😛 Couldnt make much sense of it at first though for some odd reasons and for some odd reason i thought exitwith only worked on whole different containers such as spawn {} but as of today everything starts to make sense in some magical way 😄

#

I think i have something I can put to the test again. And i wish i could've shown how amazing this whole thing looks

winter rose
#

so it would simply be```sqf
if (side _radar in [west, east, independent]) then { _unit = _radar; };

#

make sure _unit is defined before

sonic thicket
#

the whole script starts around the player that gets _unit assigned and creates a path towards the player from 100m away :)

The whole idea behind the knowsabout Ai stuff is because sometimes when the wendigo spawns there are AI in between the player and the wendigo.
I thought it would be cool to add screams in the distance when the wendigo kills the AI or when close up skeletons, blood explosions and that kind of stuff happens

reef edge
#

Is it intended that setMarkerPos also changes the alpha of the marker? When executing setMarkerPos on a marker that had it's alpha set to 0 by setMarkerAlphaLocal, the marker alpha is globally changed to 1.

winter rose
#

I don't think so, but there may be conflicts between local and global yes

obtuse quiver
#

So, i wanted to put the strigoi from alias in a mission but i don't know how, ( i watched the tutorial )

torpid pike
#

odd question but why does my character fall from the sky when i use setPos and the original co-ordinates they came from?

#

(it's on the USS Freedom)

#

from deactivation of trigger:

setPos (BIS_shooter_1 modelToWorld [0,0,1]); BIS_shooter_1 setDir 343.933;

#

is there an accurate way to get a character to always spawn at the given setPos? 😮

still forum
#

setPos is AGL/ATL

#

better use setPosASL or setPosWorld

torpid pike
#

got'cha, thank you ❤️

winter panther
#

is there any built-in way to make the scheduler execute a piece of code from start to finish without switching to another script?

#

actually, I just need to "block" execution of code while one script is writting a certain variable

#

to prevent the variable from being overwritten by another script

#
if (isNil "MISSION_enemySectors") then {
    MISSION_enemySectors = [_newSector];
}
else{
    _index = MISSION_enemySectors pushBack _newSector;
};

this is executed on init in many scripts. I need to make sure MISSION_enemySectors is not written by more than one script at the same time.

still forum
#

isNil {code to never interrupt here};

winter panther
#

ah nice! I didn't know isNil could be used that way. Thanks!

still forum
#

it will freeze the game till its done, so don't put too much code in there

candid cape
#

Hello, does anyone know how to run a script every X time ?

#

Thanks

warm hedge
#

while and sleep

candid cape
#

while {sleep 3} do {hint "hi"};

#

??

warm hedge
#
while {true} do {
    hint str time;
    sleep 3;
}```
candid cape
#

@warm hedge , that's a correct code ?

#
while { sleep 60*20} do {
[] spawn Life_fnc_srredp;
};
warm hedge
#

Why?

#

I told you the example

#

Also uhh L*fe? Hmm

candid cape
#

it's a tag lol

#

as if is arma_fnc

warm hedge
#

Anyway that's not what would work

candid cape
#
if {west countSide playableUnits > 9} exitwith {
while {true} do {
 [] spawn Life_fnc_srredp;
 sleep 60;
};
};
#

@warm hedge That's will work?

warm hedge
#

I guess so?

candid cape
#

Idk

#

I'm going to test it

fair drum
#

So I keep having issues with this for multiple ops, doesn't matter what mods I use. Some of my placed AI go into the seat chair animation when I never gave anything any animations either in scripting or in 3den enhanced... anyone else encounter this at all?

#

it doesn't show on listen server or sp, but when loaded into a dedi server, thats when I see it

torpid pike
#

right additional question (apologies), I need to know what they mean by actionID and could someone give me an example for use in a trigger (i'm trying to addAction then removeAction once outside of trigger box range)

fair drum
#

@torpid pike so when you use addAction, it returns a number that is the actions ID. say I have...

_myaction = player addaction ["BLARGGGGG",etc,etc]

when you call _myaction, it would give the addaction's ID number. if its the first one created, it will be "0"

#

you could then do player removeAction 0 to delete it

#

so in total you would have,

//Activation
_myAction = player addAction [stuffs]

//Deactivation
player removeAction _myAction
//or
player removeAction 0
torpid pike
#

thank you so so much that has helped tremendously!

oblique lagoon
#

Hello, I'm editing Enemy Assault mission but I cannot find any scripts that inhibits any player to revive friends. My description file is like below and is as my intension but only medic can revive people. We're not running any 3rd party revive scripts and made eden setting and description file same and not using "Multiplayer Lobby Setting" but cannot make any role can revive people.

ReviveMode = 1;                         //0: disabled, 1: enabled, 2: controlled by player attributes
ReviveUnconsciousStateMode = 0;         //0: basic, 1: advanced, 2: realistic
ReviveRequiredTrait = 0;                //0: none, 1: medic trait is required
ReviveRequiredItems = 1;                //0: none, 1: medkit, 2: medkit or first aid kit
ReviveRequiredItemsFakConsumed = 0;     //0: first aid kit is not consumed upon revive, 1: first aid kit is consumed
#

Can anyone give us some tips? What could be a problem? and when I apply player setDammage 0.5, player get incapaciated but where can I find documentation or code about it else than https://community.bistudio.com/wiki/Arma_3_Revive ?

winter rose
#

@oblique lagoon if you want only the medic to be able to revive, set

ReviveRequiredTrait = 0; // 0: none, 1: medic trait is required
```to 1
oblique lagoon
#

No, I want anyone to revive his friend

#

that settings are all right. but its not applied.

winter rose
#

are you sure this is description.ext (and not e.g description.ext.txt) ?
is the file in the proper dir, are you trying this in Eden Editor?

oblique lagoon
#

Yes... I have been scripting for a several years and even do GUIs...

winter rose
#

sorry for checking the basics, but you have no idea how many basic stuffs are missed by people 😄

#

but the Revive system only works on player units, not AI - if an AI is shot down, it doesn't go unconscious

oblique lagoon
#

Thats true. Not feeling offensiveness but wondering why some basic changes are not applied

#

Yes testing with my friend. Still only medic can revive and tring Multiplayer Lobby Setting" now

#
ReviveUnconsciousStateMode = 0;         //0: basic, 1: advanced, 2: realistic
ReviveRequiredTrait = 0;                //0: none, 1: medic trait is required
ReviveRequiredItems = 1;                //0: none, 1: medkit, 2: medkit or first aid kit
ReviveRequiredItemsFakConsumed = 0;     //0: first aid kit is not consumed upon revive, 1: first aid kit is consumed
ReviveDelay = 40;                        //time needed to revive someone (in secs)
ReviveMedicSpeedMultiplier = 2;         //speed multiplier for revive performed by medic
ReviveForceRespawnDelay = 10;            //time needed to perform force respawn (in secs)
ReviveBleedOutDelay = 300;              //unconscious state duration (in secs)```
#

Is there a chance if ReviveMedicSpeedMultiplier other than 1 or someting override ReviveRequiredTrait to 1?

winter rose
#

nope
any mods perhaps?

#

like, ACE?

oblique lagoon
#

No I'm testing with my vanilla setted server

winter rose
#

double weirdness intensifies

oblique lagoon
#

And no other medic scripts here...

#

Checked with VSCODE and searched all scripts that remove action or something asks BIS_REVIVE_UNC.... that thing

winter rose
#

try in a VR almost-empty mission?

oblique lagoon
#

There's no problem...

#

😦

#

What is really curious is that some codes that doesn't exist seem to be working in this mission

#

I dont find any script that kick squad leader from squad when he dies

#

but sometime it happens.

winter rose
#

zooo… something in your mission is weird and I don't know what

What is really curious is that some codes that doesn't exist seem to be working in this mission
are you certain you are editing the good mission directory? 🤣 hahaha

oblique lagoon
#

hmmmm...

oblique lagoon
#

@winter rose

{
    #include "\a3\Functions_F\Params\paramRevive.hpp"
};```
However if I use this method, is there a way to set default value of parameters?
winter rose
oblique lagoon
#

That seem to be colliding... Custom params can set default values in their hpp file but paramRevive is predefined one in a3 pbos...