#arma3_scripting

1 messages ยท Page 678 of 1

dense galleon
#

Are you using vanilla or a mod like ace3?

brazen lagoon
#

I can get AI to revive me by selecting them as their commander and telling them I'm injured

#

I was hoping I could just use that bc it's easier

#

but I'll probably just have to script it manually

pulsar bluff
#

here's a scripting example of auto medics

#

those ones will revive nearby incapacitated

#

and a video example

dense galleon
#

I used that one years ago but the vanilla revive system has changed since then it may be out of date but worth a try

#

Dont let that idea overwhelm you tho, it can be done in a simple way . Juat try to prioratize what you need , like get the ai to heal/revive you when you command/run script, then move on to the ai moving to your position to heal or detecting auto if you need help etc.

#

@pulsar bluff awesome ๐Ÿ‘ ๐Ÿ’ฏ

pulsar bluff
#

maybe others have easier script, but in script you can see it is not so simple

#

that one is meant for MP compatibility

#

you need to put them into "i want to revive this guy" state, but also pull them out of that state if conditions change (guy bleeds out or starts to get carried/dragged/in vehicle)

little raptor
#

You don't really need that.

The basics of all auto medic scripts:

  1. Detect that a unit is wounded (loop, event handler, etc.)
  2. Pick a near unit as a medic (usually his own team member), preferably one that has a medkit or the most FAKs
  3. Tell him to move to injured
  4. Heal. You can just use setDamage
    setHitIndex is another alternative.
#

If you want more detail you can make the healing part fancier

brazen lagoon
#

yeah that's why I was using the action

#

so they'd actually do the action

#

run the animation

little raptor
brazen lagoon
#

sure but how is this easier than just using action

little raptor
#

The action varient is a bit annoying
The unit won't get healed if he moves away

brazen lagoon
#

well they're immobilized

little raptor
#

Then u still have to use a command to un-immobilize them.
What's another playMove/playAction command?

dense galleon
#

Try using "HealSoldier" also, looks like a good place to start

cosmic lichen
warm hedge
#

Showerthoughts: Is is possible to get if BattlEye is running or not via script commands?

cosmic lichen
#

Don't think so

still forum
#

you can answer that yourself if you just think about it

smoky verge
#

has anyone ever tried making the civilians into a proper faction?
I'm trying to have them friendly to themselves but hostile to everything else
can't seem to find a solution for that

winter rose
#

what did you try so far?

smoky verge
#

nothing too incredible
I gave them a negative rating, which should assign them to what I think is called renegade faction
which sort of works but this means it will also shoot at other civilians even if they're also renegades

winter rose
#

โ€ฆsetFriend?

smoky verge
#

doesn't that only work between sides?
how could I use it?

winter rose
#

well, yeah, between sides

#

civilian is a side

smoky verge
#

oh I though you meant ait as a fix for the friendly fire

#

I'll try

#

alright it seems to be working
only two minor problems
the civilians now cooperate to fire on other factions but the other factions still don't shoot on them, luckly its not necessary for me, but there is still the other minor problem
the AI still tends to run away after a while
is that related to the courage setting?

winter rose
#

the other factions still don't shoot on them
setFriend

smoky verge
#

yeah I've used multiple setfriend so that every faction hates everything
still refuses to fire

hushed valve
#

I've got a question. I'm stupid, and I can't figure it out so I'm asking here. I need a script that would allow me to create an ACE arsenal which only uses the items placed inside using Zeus. I hoard weapons in the arma campaigns, and I just need a storage place. I know I can just put down more crates, but thats boring. I've looked at the ARMA3 wiki and the ACE wiki, but couldn't find anything. I've done scripting before, but this is just beyond my level. Is it even possible in the first place?

brazen lagoon
#

with the Explosion eventhandler, is it possible to get the causing explosion?

#

@cosmic lichen with the new setunitbehavior command it might actually be that easy. you can force their behavior to safe/careless and make them go somewhere and they'll ignore fire

cosmic lichen
#

Perhaps but I doubt it.

brazen lagoon
#

i mean the vcom ai dev has made videos showcasing it

#

and it definitely does actually work like that

#

if you use setUnitBehaviour "CARELESS" they will drop out of combat and listen to waypoints

dense galleon
#

@smoky verge unless something has changed the ai in arma 3 has always been hard coded not to shoot at the civilian faction, you would have to use forceWeaponFire, they wont do it on thier own. But players can shoot at them so they are good for making them say an HVT that will shoot and run to "avoid capture" and your ai team mates wont kill them so you can try to take them alive (if you use ace3 or something)

brazen lagoon
#

you also could set the side of the civvie

dense galleon
#

True but then they arent civilians anymore, but that is a way to use their skins so yeah

brazen lagoon
#

true

#

oh they want to actually keep them civilian

#

yeah idk then

austere hawk
#
    ["_x", 0];
    ["_y", 0];
    ["_z", false, [0]];
]; ```
Would this construct for _z work?  I want _z to be a number in case it is present in _pos, but another type if its not present/ not a number
copper raven
#

yes

winter rose
#

Will still throw an error if it is not a number (but works)

dense galleon
#

@hushed valve looks like you can use BIS_fnc_arsenal
to create the BIS arsenal on a box and make it availabe to players, it also says that you can whitelist what classes of equipment you want to make available, so my thought was you fill another box with stuff then return the classes of gear in the box so you can put them in the whitelist for your arsenal. I know you are looking for the ace version but this is a start

#

This page has some info on the subject

hushed valve
#

Right, thanks. Will look into that.

dense galleon
#

the page does say how to whitelist its just further down

little raptor
#

page mentions?

dense galleon
#

Read this page to add the weapon/item/etc. To the arsenal

#

@little raptor sorry i worded that wierd, the info on the page talks about/mentions the whitelist

little raptor
#

lol no I read it wrong! ๐Ÿ˜„

sonic thicket
#

Hello everyone, I have a object with variable _object1 and I am trying to get the location of that object by using

getPos _object1 ;
But for some reason it is not returning anything

fair drum
#

is _object1 defined?

#

in local scope?

sonic thicket
#

No it isnt, how would I make it globaly?

fair drum
#

also its best to be more specific on the type of position you want. getPosATL getPosASL etc

#

you should be minimizing global variables. is object1 what you named it in the editor?

sonic thicket
#

yes

#

well _object1

fair drum
#

okay, you need to read up on variable locality

#

do you understand what the underscore does?

sonic thicket
#

No i dont, figured it was a easy way of identifying something as a variable

fair drum
#

no, underscore makes the variable check in the scope of that particular script or scope (if using private)

#

globals do not have the underscore

#

read that link, it does pretty good at explaining it. especially the variable lifespan picture with the colored lines

sonic thicket
#

Ah i see, so removing the underscore makes it go a scope higher, Im familair with scopes but not cross eden/script

#

and its been a long while since I did scripting

fair drum
#

editor vehicleVar names should be without the underscore to make them global

#

and you reference it by using its global handle (without underscore)

sonic thicket
#

Thats nice to know, i've missed the meaning of the underscore till now

fair drum
#

pay attention to private as well. when you start getting complicated stuff, you can prevent/allow overwrites if using the same variable name in different areas.

sonic thicket
#

I avoid global variables as much as possible and made it a habit to _variable without even knowing its real purpose lol

#

it all makes more sense now too ๐Ÿ™‚ thanks!

tough abyss
#

Trying to make a custom multiplayer respawn, but I am sure it has been done before.
Want to have "SIDE" respawn with lots of AI to spawn from, but not a long list of playable units (the command https://community.bistudio.com/wiki/addSwitchableUnit seems perfect, but only singleplayer).

#

And if possible, restrict certain lobby roles to respawning/switching to certain AI units.

#

So for starters, anyone know a multiplayer version of "addSwitchableUnit" ?

fair drum
#

i don't think there is a mp version of that. how big of a list we talking?

#

there is no mention about removeSwitchableUnit being sp only, which means you can just remove unwanted units from the available list instead of add them to get the same result

tough abyss
#

Thanks for the advice. Well, the idea is that I'd like 6 lobby roles, but let's say 40 shared respawns for the players. The scenario idea is that they are playing out a two squads of a larger unit (platoon).

#

Of course you can place all those units and set Respawn = "Side". But of course, when you mark all those units as playable, you can a very long list of lobby roles. Would like to avoid that.

#

Secondary, restrict the lobby roles, so you have one group of (tanker) players that can respawn as tank crew members, and a set of rifleman roles that can only respawn/switch to riflemen.

tough abyss
brazen lagoon
#

How bad for performance do you think it is to have a waitUntil {!(alive _object)} running on any explosive?

fair drum
#

just a single one?

brazen lagoon
#

yeah just waiting until it's exploded.

fair drum
#

not much

#

but followup question

#

do you know when the explosive will blow up? like can you give me an instance?

brazen lagoon
#

no

#

its possible that it's an impact grenade

#

so that could take a half second, could take 15

fair drum
#

ah. okay. just for future reference, try to avoid waitUntils if you happen to know the definite time that something is going to occur. better to script directly then use a bunch of wait untils between scripts

brazen lagoon
#

yeah, that makes sense

#

I was ideally going to use an eventhandler, but I'm not sure if they work on ammo objects.

fair drum
#

which one were you going to use?

brazen lagoon
#

probably Killed

#

i think the problem is I'm worried its possible for the EH to run after the object has been destroyed

fair drum
#

could always experiment it by using "throw" check for _weapon on a fired event handler that stacks with a killed event handler on the object "throw" references. then use that killed event handler lol.

brazen lagoon
#

basically what I'm doing rn yeah

little raptor
#

afaik it won't work

brazen lagoon
#

its in the config for the Grenade class that it'll run this code on Fired

#

what won't work?

#

the killed EH?

little raptor
#

ye

brazen lagoon
#

oh weird. why?

#

(if you happen to remember)

little raptor
#

just doesn't work on ammo

brazen lagoon
#

oh odd

#

I would have guessed the killed EH would just fire when the object was no longer alive

little raptor
#

I think projectiles are created via a different mechanism in the engine
they're supposed to be more "frequent" than objects
so it kinda makes sense

brazen lagoon
#

yeah it does

little raptor
#

anyway, I've always wanted at least killed or deleted EH for them too
I've asked in #arma3_feedback_tracker . let's see what happens

worthy thicket
#

does commenting something out bassiclly just stop it from happening?

fair drum
#

yeah the interpreter just passes over it.

worthy thicket
#

ok so in regards to a sever my mission cycle is commented out would that be a issue if im just trying you do any mission?

fair drum
#
/*
this is a comment block
*/

// This is a comment line
#

anything that is in these gets passed over

#

if they are outside, then you are fine

#
//hint "I wont run";
hint "But I will"
#
/*
hint "I wont run";
hint "I wont run";
hint "I wont run";
*/
hint "I will run"
worthy thicket
#

ok that part makes sense

#

guess i dont know if it will have an issues until i try it then

brazen lagoon
#

god. what event handlers DO work on projectiles

#

is there info on that :v

little raptor
#

except if they're defined in the config

brazen lagoon
#

oh, those are the only EHs that work on stuff in CfgAmmo?

#

dang

#

shame only the fired EH type works for those

little raptor
#

fired doesn't work on them either

brazen lagoon
#

it does though, that's what I'm using right now to call my script

little raptor
#

do you add it to the ammo?

brazen lagoon
#
class CfgAmmo {
    class Grenade {
        class EventHandlers {
            class Kaboom {
                fired = "_this execVM 'sg_kaboom\kaboom.sqf';";
            };
        };
    };
};
#

this works

#

apparently this is a relatively new development

little raptor
#

well config variant works
I thought you meant script

brazen lagoon
#

oh no I was talking about other config event handlers that I could use

#

I wonder if there's a deleted EH there

little raptor
#

execVM
meowsweats

brazen lagoon
#

yeah yeah I'll fix it before I put it on the workshop this was just quick and dirty to make sure it works

leaden raft
#

Hi, could someone help me figure out which command i should use to remove the main rotor from a helicopter? I am currently using this command but it only damages the rotor :/ .. I found some tips on the net but I have trouble understanding them ๐Ÿ˜ฌ

heliname setHitPointDamage ["HitHRotor", 1];

brazen lagoon
#

is there a simpler way of converting a direction and distance to a worldspace vector than just doing the math myself

sonic thicket
#

Does anyone know the doorname for the BackAlley Wire Fence door in arma3? for use with Message6Exit animate ["Door_1_rot", 2];

fair drum
# leaden raft I am actually looking at that .. but I don't understand how to use it and even i...
/*
    Author: Joris-Jan van 't Land

    Description:
    Handling EH-based helicopter damage

    Parameter(s):
    _this: EH arguments (Array)

    Returns:
    Bool
*/

//TODO: use new EH which returns actualt hitpoint names?
if ((_this select 1) == "main rotor") then 
{
    private ["_heli"];
    _heli = _this select 0;

    if (((_this select 2) > 0.999) && !(_heli getVariable ["HSim_mainRotorDestroyed", false])) then 
    {    
        private ["_handle"];
        _handle = _heli execVM "hsim\air_h\data\scripts\main_rotor_destruction.sqf";
    };
};

true

this is the function pull from the game.

brazen lagoon
#

like its just distance sin whatever but if there's a function for it i'll use that

fair drum
brazen lagoon
#

nvm found it you can literally do this with getPos

sonic thicket
fair drum
sonic thicket
fair drum
little raptor
winter rose
brazen lagoon
#

yeah i found it

sonic thicket
#

Thanks guys ๐Ÿ˜„ Ill look that up for future use

fair drum
#

@little raptor did you take your mod down from workshop?

little raptor
#

no

sonic thicket
#

Hmm, neither of the animation names seem to work

leaden raft
fair drum
# little raptor no

hmmm i click on the steam link from my launcher and it says it longer exists. interesting

little raptor
#

wtf

#

yeah

#

it doesn't work

#

looks like a workshop bug

#

I can't access anything

fair drum
brazen lagoon
#

oh my god it works.

little raptor
#

is this how your workshop looks like?

#

only 3 items meowsweats
and the first 2 don't work

fair drum
#

you mean your submitted items?

#

or in general

little raptor
#

no

fair drum
#

let me check

#

yup same exact mods

#

and yours is the only one I'm subbed to

little raptor
#

the previews are gone too! ๐Ÿ˜„
I was freaking out for a second

leaden raft
fair drum
#

which heli you using?

leaden raft
#

WY-55 Czapla (I_E_Heli_light_03_dynamicLoadout_F)

fair drum
#

vanilla arma?

leaden raft
#

Yup

fair drum
#

AAF unarmed or armed

leaden raft
#

armed

fair drum
# leaden raft armed

so even setting specific parts of the heli, the rotors don't just fly off if thats what you want. even at full rotor damage, they just have holes in them. I also see no animation source for hiding the rotors or anything of that nature

#

even when crashing the heli the rotors don't come off.

leaden raft
#

Nop I just want to make it static crashed in a building but the blades go through the wall ...

leaden raft
#

But when using command to break it .. it only damage it at 100% but does not destroy it like a crash in a wall

#

Thx anyway for your answer ๐Ÿ˜€ !

leaden haven
#

SetObjectScale does work on a dedicated server, you have to run the command locally on every player.

little raptor
#

it will be fixed in the next version

leaden haven
#

Now I can have my mini tanks on a table.

scenic kestrel
#

Anyone figured out a way to remove a single backpack from a container?

fair drum
#

what class of backpack are you using

scenic kestrel
#

"B_AssaultPack_blk"

fair drum
#

wait one and i'll put something together

scenic kestrel
#

sweet. removeItem is great but wont do backpacks

little raptor
#

well you can always move them around! ๐Ÿ˜„

#

wait there's no command for that either meowsweats

#

I guess the best solution is to just transfer its contents

#

oh look workshop got fixed! ๐Ÿ˜„

fair drum
fair drum
# scenic kestrel sweet. removeItem is great but wont do backpacks

works.

if !(isServer) exitWith {};
private _box = boxname;
private _backpackType = "InsertClassHere";
private _numToRemove = 1;
private _backpackCargo = backpackCargo _box;

clearBackpackCargoGlobal _box;

if (({_backpackType in _x} count _backpackCargo) > _numToRemove) then {
    for "_i" from 1 to _numToRemove do {
        _backpackCargo deleteAt (_backpackCargo find _backpackType);
    };

    _backpackCargo apply {
        _box addBackpackCargoGlobal [_x, 1];
    };
} else {
    hint "Not enough backpacks for the amount you want to remove";
};
scenic kestrel
#

oh that is cool, and real simple too. thanks for working that out.

little raptor
scenic kestrel
#

should be a good fix for others loooking too! remove backpack, remove single backpack from player

#

it seems to just touch backpacks and put the rest back

#

SOO good, wow! thank you truly. Can i use this then?

little raptor
#

put items in them and they'll be lost

fair drum
#

yeah why not? made it for you. I'm sure you can go deeper and keep the backpack inventories, but I'll let you figure that out after seeing this shell.

scenic kestrel
#

I see, for its current use the backpacks will be empty as is. good to know.

dense galleon
#

@scenic kestrel ive been using with great results [box, itemclassname] call CBA_fnc_removeWeaponCargo; if you use cba

#

it can remove just one item from a container, including groundWeaponHolders and such

#

just use the same but CBA_fnc_removeItemCargo , CBA_fnc_removeBackpackCargo, and CBA_fnc_removeMagazineCargo for the other types

scenic kestrel
#

leave it up to cba to have a solution. thanks for the info johnweston

dense galleon
#

i got you fam @scenic kestrel

torpid quartz
#
"Money_roll" in (magazineCargo medBox);

Hey so yesterday I got some help to make this check to see if an item was inside a box.
How would I make it so I need 2 money rolls to make this condition true?

warm hedge
#

Use count

harsh vine
#
[]spawn {
while {true} do {
   My_Box2 addMagazineCargo ["Antimalaricum",1];//example: this adds magazines every 10 seconds.
  
sleep 10;
};
};
```How can i remove  one (1) magazine every 10 secs . lol i knw how to add but not to remove, besides i think the clearMagazineCargo will remove everything .
torpid quartz
#
VanMoney = {(Money_roll) in _table} count (magazineCargo medBox);

then in the conditions of another trigger

VanMoney > 1 = VanTrigger=True;

I'll give this a try

#

hmm actually no don't thin that will work.
Trying to make it so all 3 items (2 money roles and a flash drive) are in a box at the same time

"Money_roll" in (magazineCargo VanBox1) &&
"FlashDisk" in (magazineCargo VanBox1);

Was doing this, I'll try this instead

>1 = {(Money_roll) in _table} count (magazineCargo medBox); &&
"FlashDisk" in (magazineCargo VanBox1);
cosmic lichen
#
{_x == "Money_roll"} count magazineCargo _vehicle;
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
dense galleon
torpid quartz
#
"FlashDisk" in (magazineCargo VanBox1);```

getting there error that "Generic Error in expression"

also where would be the best place to run so this effects all players since this is for a MP game mode

missionNamespace setVariable ["VanMoney",2];

cosmic lichen
#

@torpid quartz VanMoney has nothing to do inside the condition

#

_x is the tested element

torpid quartz
#

how would i define _x as 2 or >2

cosmic lichen
#

To answer your second question. You have to make it public e.g.

setVariable ["VanMoney", 2, true];
#
_count = {_x isEqualTo "Money_roll"} count magazineCargo VanBox1```
#

there is even an example of this on the count page

#

Always good to read the docs

torpid quartz
#

yeah was looking at them and a forum topic to figure out my first attempt

#

and oh hey, should have kept scrolling there are more of them lol

#

hmm still getting generic error messages

_count = {_x isEqualTo "Money_roll"} count magazineCargo VanBox &&
"FlashDisk" in (magazineCargo VanBox);
init:
missionNamespace setVariable ["VanMoney", 2, true];
warm hedge
#
{_x isEqualTo "Money_roll"} count magazineCargo VanBox >= 2 &&
"FlashDisk" in (magazineCargo VanBox);``` or something
torpid quartz
#

oops hang on lol

warm hedge
#

Why you even need to declare VanMoney?

torpid quartz
#

ok no changing VanMoney to _x didn't fix it

torpid quartz
cosmic lichen
#

you should really read some docs

#

this contains pretty much everything you need to know.

torpid quartz
#

yeah might help when i'm running through wiki articles lol. thanks i'll take a read of it.

dusky pier
#

Hello, is possible to somehow modify CfgFunctions (which i defined in server pbo)
without restart server?

still forum
#

no

#

well filePatching

#

but that doesn't work for configs

distant oyster
turbid rapids
#

Could someone explain Nand for me?

"Nand returns true if not both values are true at the same time"

Struggling hard to make sense of this KEKW

vagrant parrot
#

and = and

#

Basically

if A = Green and B = Green
then do this

#

Nand = Not And

#

Also known as !&& in some languages

warm hedge
#

Not sure where you find this line tho...

brave lance
#

Hello its out of topic but i have sqf related question. Can i ask it?

#

Its so simple i made a zone trigger, and if move out side selected zone it will kill. Its working great. But only problem is when i enter any vehicle in game, i start taking damage.
Which is not i want.

#

Here is my sqf file that i was trying run in trigger zone.

warm hedge
#

Check the pinned please

brave lance
turbid rapids
#

@vagrant parrot So, if A is green, and B is green, but at the time of running the code, A is red and B is red, then trigger? Because it's !&&, right?

brave lance
#

Sorry.

warm hedge
#

I never said to delete it...

brave lance
#

It was kinda long and i don't want to destroy the whole chat with that sqf.

warm hedge
#

It doesn't matter. Let skipper skip ๐Ÿง

brave lance
#

aright

brave lance
#

any ways is there any thing wrong there?

vagrant parrot
#

I think hold up

warm hedge
#

So uhh, how did you run it?

turbid rapids
#

&& would be, if A = green && B = green, and they both are in fact green, then true.

#

!&& would have to be the opposite, no?

brave lance
#

It is running i as intended. Player outside the trigger zone are taking damage like pugb or h1z1 (ish). But when a player is in vehicle its always taking damage. Inside trigger zone or outside.

#

How do i fix it ?

vagrant parrot
#

Correct\

#

! is opposite of everything

warm hedge
#

Rephrase it. How did you put it into a trigger?

vagrant parrot
#

So lets say we have A and it's green
we program logically
If A exists (To check ofc if I dont' call something that doesn't exist) && = Green
it's true

Now if we do the opposite

#

A exists and It's Red
IF A EXISTS !&& = Green
It's true

#

@turbid rapids

#

Logical operators

#

Always use Binary

#

is shorter and less performance intense

#

even though it's a minimal difference

brave lance
warm hedge
#

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

turbid rapids
#

Yeah I was reading that page.

#

that's why I was asking

copper raven
turbid rapids
#

What happens if one is true and the other false?

pulsar bluff
#

whats the point of the new "setCombatBehaviour" command if its immediately overwritten by the combat fsm? only things like "setBehaviourStrong" are useful

copper raven
turbid rapids
#

And the inverse is true for &&, yeah?

#

If one is true, the other false, the result is false?

copper raven
#

without the inversion, yes

copper raven
#

๐Ÿค”

little raptor
#

it's only useful when you disable AUTOCOMBAT

#

(if you want to use combat-aware-safe, stealth should be fine)

cold cloak
#

hi folks, what piece of script would make the helis rotors spin when its simulation is disabled

little raptor
#

none

#

it's impossible

cold cloak
#

I think i saw one somewhere but cant find it anymore

little raptor
#

no you didn't. it's impossible

winter rose
#

it can have the rotating "look" (blurry blades), but a disabled simulation will stop the blades from rotating, definitely

dreamy kestrel
#

so... REGEX support is dev branch only right now? damn...

cosmic lichen
#

Don't even think it's on dev branch

cosmic lichen
#

yeah, that has already been added.

#

Don't fully trust those version numbers

dreamy kestrel
#

hmm okay

cosmic lichen
#

We add new commands as soon as we are know they are set in stone, although that doesn't has to mean that they are already available

dreamy kestrel
#

i.e. "I'm a coOkIe clicker" regexMatch ".*cookie.*" does not do anything

cosmic lichen
#

Added to the biki*

dreamy kestrel
#

oh well pff.... 'docs' is one thing, I thought we were talking "code on the ground", if you will

#

also just an observation, reading those pages, REGEX will be case insensitive? or case sensitive?

winter rose
#

as you wish with the i modifier

dreamy kestrel
#

ah ok I see. cool.

#

in terms of REGEX paradigms, seems close to PHP, in that family of regex?

dreamy kestrel
#

thanks...

little raptor
hollow thistle
#

It's using boost::regex

#

At least this is what dedmen said.

little raptor
#

dedmen said it was STL

hollow thistle
#

No

#

PHP is using PCRE which is a different library.

little raptor
#

oh he "switched"! ๐Ÿ˜„

little raptor
hollow thistle
#

both support perl syntax

brazen lagoon
#

any idea why this wouldn't be working as expected?

#
    [_unit, _direction_vector, _magnitude] spawn {
        params ["_unit", "_direction_vector", "_magnitude"];
        _str = format ["VECTOR: %1, MAGNITUDE: %2, UNIT: %3", _direction_vector, _magnitude, _unit];
        if (isPlayer _unit) then {
            _str remoteExec ["hint", 0];
        };
        [_unit, [_direction_vector vectorMultiply _magnitude, [1, 0, 0]]] remoteExec ["addForce", 0];
        sleep (ceil (_magnitude / 100));
        _str remoteExec ["hint", 0];
        _unit setUnconscious false;
    };
#

addForce is working correctly, but the setUnconscious doesn't get called

proven charm
#

_unit must local for setUnconscious

brazen lagoon
#

ah.

#

makes sense

#

technically addForce should also be local so I think I'll just remoteExec this spawned code

#

this is really odd. the magnitude value there being less than 100 should mean the spawned code isnt even run

#

oh, exitWith doesn't work how I think it does

cosmic lichen
#

!code @brazen lagoon

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
cosmic lichen
#

Seems like highlighting doesn't show on my phone. Ignore above if you've done it correctly

brazen lagoon
#

yeah i did

sharp grotto
#

Yea mobile version of discord does not show the highlighting

ember frost
#

hey ive got some popup targets in a small shoot house ive got setup but you cant reset the swivel targets using the "terc" like with the popup targets, is there something different to put there so they reset or different method to do it entirely?

shadow canopy
#

is there any best practices for what I should put in Extended_PreInit_EventHandlers versus Extended_PostInit_EventHandlers

still forum
#

Best practices?
You either need preinit or you need postinit

#

Not sure there are any practices. Use what you need

little raptor
copper raven
#

what do you mean? you have to call compile if you're using XEH, unless you like provide the code directly in the config

still forum
#

call compile is fine for one-time exec

copper raven
#

yep

#

and i mean it wouldn't make a lot of sense, you'd still end up having to call compile something that compiles init functions before you can call them in later init event handlers

shadow canopy
#

I think I understand

#

I also need to quickly refresh on pre vs post since its been a while

copper raven
#

there aren't any good practices, like Dedmen said, if you need to run something post init, do it in postinit, if you need preinit, do it in preinit etc

shadow canopy
#

Yea I completely forgot that post is scheduled and pre is non scheduled. I just knew that pre ran before init eh of units/vehicles and post ran after

still forum
# little raptor good practice

Wasting memory by storing something in ram that only runs once? Not really.
Also functions might not necessarily be ready at preInit

copper raven
shadow canopy
#

Oh I see

timber bear
#

anyone know how to use a trigger to set a specific time? (all my google research just gave me skip time haha) i dont care about the day but i want a trigger to set my mission time to night time for a specific task in that mission, skip time wont work because its a free roam mission and only 1 of the tasks has to be at night so i have no idea at what time it might get activated

dense galleon
timber bear
timber bear
# dense galleon <@!299017075702366208> it might be cool if you set the time multiplier and then...

ya that would be awesome! thanx man! However im using ravage and have a timemuliplier on by default but that shouldn't mess with it i dont think. But that should work i think! cause my task area is in the middle of no where with only 1 road leading in the rest is heavy forest, and once players enter this area it turns to night wolves start howling maybe throw in some other creepy noices haha

dense galleon
#

Mybe you can just use timeMultiplier to return what the current multipier is and then crank it up , waituntil desired time and set it back , the wolves sound cool btw good luck

timber bear
#

Oh ya that would work! and thanx man! appreciate it!

copper raven
tough abyss
#

Hey, so i need a command for the console that spawns a vehicle, that's also an arsenal. I've tried with

["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal;

But that just doesn't even spawn the vehicle.

dense galleon
#
_veh = "B_MRAP_01_hmg_F" createVehicle(position player); ```
#

You need the ; there

tough abyss
#

Tried that, it just spawns the vehicle without the arsenal

dense galleon
#

Also tell us more about what you mean by console?

tough abyss
#

The debug console

dense galleon
#

Oh ok

tough abyss
#

That one console that pops when you press ESC

#

Sorry if i'm not very detailed on this, i'm not that used to scripting

dense galleon
#
veh1 = "B_MRAP_01_hmg_F" createVehicle(position player);

["AmmoboxInit",[veh1,true]] spawn BIS_fnc_arsenal;
tough abyss
#

Ah, there it is. Appreciated a lot

pulsar bluff
#

@still forum how do we calculate how much force to apply with addForce, in order to move a physx object proportionally

#

like different force required for quad bike vs tank

#

but what value do we use

#

mass?

warm hedge
#

IIRC multiply with getMass will do

hardy sierra
#

Heyo guys, hoping I could get a bit of help with setting up 2 separate camera feeds onto two diff screens. One shows up with live feed but the other is just black. Here is the script code, copied from KillZoneKid's script: https://www.sqfbin.com/nazuyexudaxaboliwufe

#

Any help is greatly appreciated, I've been trying at this all night, it's 9am now lol

vagrant parrot
#

Did you figure it out @turbid rapids

crude vigil
#

@hardy sierra Wrap it up with spawn and put sleep 0.1 before 2nd setObjectTexture.

hardy sierra
turbid rapids
#

@vagrant parrot think so

vagrant parrot
#

๐Ÿ‘

little raptor
deft crater
#

Can anyone explain to me how to implement BIS Spectator to game when player dies, i know nothing and theres no good explanations i can find

willow hound
deft crater
#

right, thanks

slender beacon
#

If I set public variable of a global object a local script, would I be able to address the script globally?

winter rose
slender beacon
#

What would it return on a different machine then?

winter rose
#

either nil, scriptNull or you cannot broadcast it

slender beacon
#

got it

#

thanks

valid abyss
#

is there any way to make an entityKilled missionEventHandler hint something locally to the killer?

slender beacon
#

you can check if the killer is the local player and hint accordingly

valid abyss
#

Could you give me an example?

slender beacon
#

because player and hint are both clientside, you can do if (_killer == player) then {hint "got kill";};

valid abyss
#

I've tried that but it doesn't work

slender beacon
#

did you declare _killer?

brazen lagoon
#

anyone have any idea on how to keep dead units ragdolling?

#

I assume this is a performance concern as to why they stop ragdolling after a few seconds or so, but I'd like to be able to dynamically re-enable it

#

oh. and would it be possible do you think to override vehicle explosions? Like ideally I would subclass the #explosion object type but I don't think this is possible

#

oh it seems I likely already am

fair drum
#

is there a way to get the respawn location selected in the respawn position menu?

little raptor
fair drum
#

my respawn position scripts are a mess based on the player's position after respawn it moves them to one of the nearby spawn locations, probably not the best way to make a "respawn area"

dense galleon
#

@fair drum back to the drawing board then, that could in theory be cool but you would need alot of "spawn locations" or a very controlled "play area"

cosmic lichen
#

You can create your own respawn template with custom script. Maybe that works?

fair drum
#

well it works fine, but it sometimes throws people out of wack on the first mission spawn (respawnOnStart = 1). every other spawn works correctly

wind hedge
#

Has anyone experimented with the addForce command that now works on units? SQF _unit addForce [_unit vectorModelToWorld [0,-200,0], _unit selectionPosition "rightfoot"];

#

Don't know why the wiki uses the rightfoot selection for this?

#

and also does the -200 is the amount of force applied or just the direction?

little raptor
wind hedge
#

and the force amount?

little raptor
#

a value large enough to move the unit, but don't actually send him flying
I think it assumes that each person weighs 75 kg?

fair drum
#

why not use a trebuchet instead? they can use a counterweight to launch a 90kg stone projectile over 300 meters

wind hedge
finite imp
#

Hello Guys and Girls,

I'm trying to put an ambient sound into my mission, that plays around a certain object and should loop itself - and a second sound that should activate once a certain Hold-Action is started.

Currently I have the sounds inside the description.ext defined as follows:

class turnon
    {
        name = "turnon";
        sound[] = {"\Sound\turnon.ogg", db+5, 1};
        titles[] = {};
    };
    class humming
    {
        name = "humming";
        sound[] = {"\Sound\humming.ogg", db+5, 1};
        titles[] = {};
    };

(If I play the sound locally with the "playsound" command, everything is working, that feels like the sound is correctly defined to me)

The init of the object where the sound should be played from looks like this

playsound3D ["humming",xyz,false,4,1,50];
(xyz is the object variable)

I tried to omit the PosASL part of the array because I want the source object to be used as the emitter, but it doesn't work obviously. I tried entering the exact coordinates of the object before with [], but this did not work aswell. Any tips?

little raptor
finite imp
little raptor
little raptor
finite imp
little raptor
#

in case the game doesn't

finite imp
cosmic lichen
#

What is the best way to assign a side color to an object in a list? Getting the side from config and using BIS_fnc_sideColor doesn't work reliably since

configfile >> "CfgVehicles" >> "Land_Target_Dueling_01_F" >> "side" //Returns 8, which is sideEmpty โ†’ correct
but
configfile >> "CfgVehicles" >> "Land_Bench_05_F" >> "side" // Returns 3, which is sideCivilian โ†’ incorrect

#

any more reliable way?

#

Edit: I guess I have to combine "faction" and "side" -_-

past wagon
#

how do I find a list of radioNames from cfgRadio?

#

same with other configs, how can I access a list to view all my options. such as cfgSounds

little raptor
past wagon
#

how do I remote execute something in side chat? like what about the other parameters?

"Message" remoteExec ["sideChat"];
#

I need the side and the identity

little raptor
#

I think this will help:

past wagon
#

ok

#

ohhhh

#
[blufor, "Identity"] "Message" remoteExec ["sideChat"];
#

is that it?

little raptor
#

no

past wagon
#

idk if your message you linked helps tho

#

because I already know how to do it for systemchat

#

but now im doing it for side chat and i need other parameters and idk where to put em

little raptor
# past wagon idk if your message you linked helps tho

there are more examples! ๐Ÿ˜„
anyway:
you leftArg is [blufor, "Identity"]
rightArg is "Message"
just paste them in the template:
[leftArg, rightArg] remoteExec...

[[blufor, "Identity"], "Message"] remoteExec ...
past wagon
#

ohhh

#

i thought that the blufor, "Identity" was split into left and right args

little raptor
#

what's on the left of the command is leftArg
what's on the right is rightArg

#

either (or both) can be arrays with their own args

past wagon
#

yeah thats why I was confused

past wagon
#

this is the script I have, but its not working

waitUntil player inArea "marker";
[[blufor, "Some Person"], "message"] remoteExec ["sideChat"];
winter rose
#

()

past wagon
#

oh

#

better?

#

thanks

winter rose
#

โ€ฆ { }

past wagon
#

oh

#

lol

#
waitUntil {player inArea "marker"};
[[blufor, "BLU"], "message"] remoteExec ["sideChat"];
#

this still isnt working and im not getting an error message

#

will the first line detect when any player enters the zone?

distant oyster
past wagon
distant oyster
#

in that case it's fine

past wagon
#

ok

torpid quartz
#

Trying to make a trigger that kills anything that enters it, a death barrier for a PVP mode so players cant leave.

It's on any player present conditions with

condtion

this && (player in thislist)

activation

player setDamage 1;

this would only kill the players in the trigger right any not everyone on the server? just making sure since i can't get anyone to test right now.

crude vigil
#

Why though, there is already a function for that purpose.

torpid quartz
#

what's the function? been googling death trigger and kill barriers for arma and this is the best thing I've found so far. Down to try alternatives.

crude vigil
#

Module list > Other > Zone restriction

torpid quartz
#

oh cool didn't know about that, having a warning is pretty good. I'll give it a go

peak pond
#

Does headless client run initPlayerLocal.sqf?

fair drum
#

i don't believe so. try running it in init.sqf but have a if (!hasInterface && !isServer) then {}

peak pond
#

Ok, thanks

past wagon
#

so im still a little confused about different type of variables. global, local, private, etc.

what is the difference between _variable and variable?

cosmic lichen
past wagon
#

I already read the wiki page on variables and it just confused me more

warm hedge
cosmic lichen
#

variable is available everywhere on the client/server where it was initialized
_variable is only available in the script / scope it was initialized

past wagon
#

I'm sure it does, I just dont understand what its saying

past wagon
warm hedge
#
variable = 1;
[] spawn {
  // variable is alive here
  _variable = 2;
  // _variable is alive ONLY here
};
// _variable is no more
// variable is still alive```
past wagon
#

ok

#

thanks

past wagon
#

is getUnitLoadout not supposed to save your gun?

cosmic lichen
#

it saves everything

#

wait

#

define "save"?

past wagon
#

to a variable

#
loadoutOne = getUnitLoadout player;
cosmic lichen
#

Yes, it saves every item, including weapon

past wagon
#
_terrainobjects = nearestTerrainObjects [[11847.1,2544.43], [], 5];
{hideObjectGlobal _x} foreach _terrainobjects;

where am I missing a ; on line 1???

dusk gust
#

Seems like you have an extra semicolon before the forEach @past wagon

pliant stream
#

getUnitLoadout this doesn't apply to vehicles does it? Is there an equivalent command which does?

dusk gust
#

You would need to use something with getBackpackCargo, getMagazineCargo, and getWeaponCargo

#

Afaik there isnt one command to get it all

pliant stream
#

Sounds like it's still impossible to correctly serialise vehicle inventory all these years later

dusk gust
#

I just normally smash the results of the other commands together and compare that way

cosmic lichen
#

It is possible, but it needs scripting. There is unfortunately no command which handles it all

pliant stream
#

Iirc attachments on weapons in backpacks in vehicles was a problem?

dusk gust
#

Might only check current weapon tho

still forum
proper sail
#

Whats the reason that if i spawn a building item locally ingame (custom model). That half of the object has a null cursortarget and I can just pass through it? But if i place a new object next to it, the cursortarget of the original object now fully covers the model and I cannot walk through it anymore?

proper sail
#

yes

little raptor
#

lod issue

#

put it closer to origin ([0,0,0])

proper sail
#

Well wait, define big. Its a metalfloor from the original dayz if you remember that, but 4x in one model

#

Thing is if I spawn the object normally with createvehicle instead of createvehiclelocal there is no issue

#

thats what interests me

little raptor
#

try it closer to origin see if it still happens
if it doesn't it's the lod issue I said

proper sail
#

You mean move the object so its 0,0,0 to me in-game?

little raptor
#

setPosATL [0,0,0]

proper sail
#

ah ok

little raptor
#

that is if it's not water! ๐Ÿ˜„

proper sail
#

yeah rip thats water

#

chernarus time

little raptor
#

VR is the best for such tests

tough abyss
#

Hi Mates, i got some problems with params directives, maybe im to dumb to understand but maybe its another thing

#

I got the following definition and then call it, but it generates every time generic error

#
rebru_fnc_spawnCargoPlane = {
    params [ "_modulePos", "_cargoPlaneData", "_cargoData"];
    _modulePos params ["_modulePosX","_modulePosY","_modulePosZ"];
    
    hint _modulePos;
};

// Calling
[ getPos player, "test", "test"] call rebru_fnc_spawnCargoPlane;
little raptor
#

it's fine

#

except for the hint

#

that's what's giving you error

#

_modulePos is array

tough abyss
#

ah this is only possible with format right?

little raptor
#

str

tough abyss
#

like systemChat format["pos is %1", getPos player];

little raptor
#

str

#

hint str _modulePos

tough abyss
#

ah ok, thx i'll give it a try

little raptor
#

format works too but str is shorter

tough abyss
#

works, thanks a lot Leo

little raptor
#

np

pulsar bluff
#

does anyone have a repro for the flying tanks/vehicles issue?

pulsar bluff
#

can has?

little raptor
pulsar bluff
#

on stratis?

little raptor
#

yeah
I also mentioned the class name of the building in description

#

You can find one instance of this building about 800 m east of Stratis Airbase, next to the end of a road which you should be able to find easily (GRID: 025055). You can also place the building yourself (Land_i_Stone_Shed_V1_F)

proper sail
#

@little raptor I fixed it, it was the classic arma rooty tooty you have to put setPos after setvectordirandup else it breaks

slender beacon
#

when I call a code, does it inherit the this from the scope it was in?

willow hound
#

Do you mean _this or this?

little raptor
#

this, yes
_this, depends

slender beacon
#

this

#

thanks

pulsar bluff
#

@little raptor best i can do on short notice

tough abyss
#

@little raptor Is there a limitation of waitUntil in a function? Because i want to transfer my execVM Scripts into functions, but got generic error. My suggest is, that there is something different from call vs execVM?

little raptor
tough abyss
#
rebru_fnc_spawnCargoPlane = {
    params [ "_modulePos", "_cargoVehicle", "_cargoItems"];
    
    _modulePos params ["_modulePosX","_modulePosY","_modulePosZ"];
    _cargoVehicle params ["_faction","_cargoPlane", "_range" ,"_direction", "_height", "_speed"];
    _cargoItems params ["_cargoItem", "_cargoAmount", "_useChute", "_delay"];
    
    private _spawnPosition = [0,0,0];
    private _despawnPosition = [0,0,0];
    private _dropPos = [ _modulePos select 0, _modulePos select 1  ];
    
    // Spawn Cargo Plane
    private _veh = [_spawnPosition, _direction, _cargoPlane, _faction] call BIS_fnc_spawnVehicle;
    private _vehicle = _veh select 0;
    
    _vehicle flyInHeight 200;
    //_vehicle setVelocity _velocity;
    
    // Move to Position
    _vehicle doMove (_dropPos);
    
    // Warten bis da 
    hint str _dropPos;
        // GENERIC ERROR (but getPos _vehicle and _dropPos are defined and correct (3D Position))
    waitUntil { getPos _vehicle inArea [_dropPos, 100, 100, 45, false]; }; 
    
    // Move CargoPlane back to Spawn
    //_vehicle doMove (_despawnPosition);
    // Warten bis da
    //waitUntil { getPos _vehicle inArea [_despawnPosition, 200, 200, 45, false]; };
    // Delete Vehicle
    //{ deleteVehicle _x } forEach (crew _vehicle); deleteVehicle _vehicle;
    
    
    
};
#

the waitUntil directive works in execVM, but since i moved it into a function a generic error is thrown.

willow hound
#

The important question is: How do you execute this code?

tough abyss
#
[getPos player, [east,"RHS_TU95MS_vvs_old", 500 ,"N", 200, 200], ["CUP_B_Mastiff_HMG_GB_W", 1, true, 0.30]] call rebru_fnc_spawnCargoPlane;
little raptor
#

call

tough abyss
little raptor
#

where do you exec it from?

tough abyss
little raptor
#

you should spawn it

tough abyss
little raptor
#

yes

tough abyss
#

i'll try

tough abyss
proven charm
#

prints: [west,"testers"]

little raptor
#

you're printing _this

#

it doesn't change _this

proven charm
#

ah your right, my bad

#

then my problem has to be elsewhere...

flat eagle
#

so im trying to use the alive command to check if a helicopter is still "alive". but im having a hard time getting the alive command to see the variable i gave the helicopter

the code im using looks like this
(alive airframe1[select 2]);

keep in mind i spawned the helicopter using BIS_fnc_spawnVehicle

does anyone know how i can get the alive command to see the helicopter?

copper raven
proven charm
#

get the variable returned by BIS_fnc_spawnVehicle and use that for alive check

flat eagle
#

right

#

wouldnt the variable returned by BIS_fnc_spawnVehicle be the variable i gave the helicopter in the first place?

airframe1 = [getMarkerPos "mrk1", 140, "B_Heli_Attack_01_dynamicLoadout_F", _crew1] call BIS_fnc_spawnVehicle;

proven charm
#

if(alive (airframe1 # 0)) then {};

#

that should work

flat eagle
#

dude i was so close, thank you

proven charm
#

np

flat eagle
#

worked like an absolute charm again thank you

true frigate
#

Is there a way to find out if someone has been shot with scripts?

little raptor
#

shot with scripts
wat? blobdoggoshruggoogly

true frigate
#

Shot *Using scripts, my bad

fair drum
#

event handlers

true frigate
#

Im using ace medical, not sure if there is a way to detect if a player is damaged

true frigate
#

thank you ๐Ÿ™‚

leaden haven
#

If I am running the setobjectscale command in PreInit from server exec does this stop it from working with 2.04? It seems to be for me. Does just running it normally from server work for all clients? Thanks.

outer fjord
#

Is it possible to add a highlight around objects and units? Like a green border or something?

past wagon
#

can I check to see how many people are inside a marker area?

little raptor
leaden haven
little raptor
#

no need

#

use inAreaArray

past wagon
#

ok

#
ZonePopulation = allPlayers inAreaArray "Marker";
#

would that work?

#

what if I want to know how many blufor and how many opfor players are in the zone separately? kind of like KOTH

thorn saffron
#

Question: if you call a function will the script that called it wait until that called function finishes and then the calling script resumes?
If I want to fire off a function into the dark and let it do it's own stuff while my caller script continues regardless, what do I use? Is it spawn?

cosmic lichen
#

Where code starts scheduled
Important part

thorn saffron
#

Ah I see now.

little raptor
past wagon
fair gulch
#

Hello
i'm trying to override default K key action (Compass), but not working anyone know why?

(findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == 37) exitWith {true}"];
little raptor
#

it is

#

use mouseButtonClick event handler (or some other mouse EH)

true frigate
#

Im trying to set up a training scenario for a unit im in. One team of 5 people will defend an objective, one team of 5 will attack. Obviously, i dont want them killing each other, so i have an idea for a script which will check for if a player has been made unconscious, in which it will then:

Find the player that is unconscious,
Fully heal and revive the player,
Remove their weapons to simulate being dead.
Using Unit1 getVariable ["ACE_isUnconscious", false]; tells me if a unit is unconscious, but it doesnt check continuously. I dont want to use 10 different scripts for 10 different players, so my plan is to put that in a loop, like this:

  Unit1 getVariable ["ACE_isUnconscious", false];
  if Unit1 ACE_isUnconscious = true
  _Conscious = false```
would this work?
little raptor
past wagon
true frigate
past wagon
#

how do I get a number of units from that?

winter rose
#

count

little raptor
true frigate
#

How do i search the ACE repository sorry ๐Ÿ˜„

#

Like the github page or something ingame?

little raptor
#

I don't know if github has a file content search
if not you can clone it

willow hound
true frigate
#

Well, there's a new command ive never heard of

#

๐Ÿ˜„

willow hound
little raptor
winter rose
#

( ) indeed ^^

past wagon
#

can I do this to test what it returns?

ZonePopulationBlufor = Units west inAreaArray "Marker";
systemChat ZonePopulationBlufor;
winter rose
#

str

past wagon
#

how can I make systemChat say a variable?

cosmic lichen
#
systemChat format ["%1", _variable];
#

or simple, yet not accurate with strings

systemChat str _variable
past wagon
#

so would this work?

ZonePopulationBlufor = Units west inAreaArray "Marker";
systemChat str ZonePopulationBlufor
cosmic lichen
#

yes

#

as lou said before

#

why don't you just test it? It's not gonna kill your pc or something

past wagon
#

oh yeah

#

good idea

#

ok so I got what it returns

#

now how can I get a number from it?

#

i just need a number of how many units there are in the area

true frigate
#
while Unit1 = {Conscious1} do {
  Unit1 getVariable ["ACE_isUnconscious", false];
  if Unit1 ACE_isUnconscious = true;
  Conscious1 = false;
};``` apparently im missing a semicolon here, it may be a formatting issue, or i could be an idiot ๐Ÿ˜›
little raptor
#

or all of them! ๐Ÿ˜›

little raptor
true frigate
#

I believe Lou said it wouldnt work? ๐Ÿค”

little raptor
#

I did. but he fixed the error

true frigate
#

Ahhh sorry, let me try it ๐Ÿ™‚

#

sleep 1;

[Unit1] call ace_medical_treatment_fnc_fullHeal;
removeAllWeapons Unit1;``` this is the full thing at the moment, hopefully ive got everything else right
little raptor
true frigate
#

Well im testing it with a single unit to see if the idea works or if i have to scrap it
Yes, its supposed to be available to trigger by interacting with a laptop, after its run for all players, theyll be allowed to enter this Dead state once and it should reset them to normal after

little raptor
true frigate
true frigate
#

I believe there may be an issue with the fullheal script, ill try FullHealLocal

little raptor
true frigate
#

Ahhh so its a separate variable, nothing to do with weather it is conscious or not

true frigate
#

Alright, thanks for explaining it :)

little raptor
#

you might be able to capture the ace_unconscious state with that "event handler"

#

and then you don't need loops

true frigate
#

Im relatively new to scripting you see, and arma's language isnt like anything ive worked with before, so its quite a learning curve :D

#

With that said, you've been really helpful, thank you :)

little raptor
#

you can put a systemChat in it for testing

#

if it triggers, then you're in luck

#

that'd be a lot faster than a loop

#

@true frigate try this:

["ace_unconscious", {systemChat str _this}] call CBA_fnc_addEventHandler;
#

run it in debug console

#

then make yourself unconscious

#

see if you see a message

true frigate
#

It returned 12 by itself lol

little raptor
#

it's ok

#

that's the event handler ID

true frigate
#

Heyyy we got a message in chat

#

Just reads B Alpha 1-6:1 (MyName) True

little raptor
#

ok then, you can use it

#

see if this works:

["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
  [_unit] call ace_medical_treatment_fnc_fullHeal;
}
}] call CBA_fnc_addEventHandler;
#

make yourself unconscious again

#

this time you should be fully healed

true frigate
#

Fully healed, but not awake ๐Ÿค”

#

Nvm, just bled out

#

๐Ÿ˜‚

#

I know why

#

Remember i said FullHeal doesn't work

#

I need to change it to FullHealLocal :P

#

Hmm, still not working

little raptor
# true frigate Hmm, still not working

add a bit of delay:

["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
  [_unit] spawn {sleep 1; _this call ace_medical_treatment_fnc_fullHealLocal};
}
}] call CBA_fnc_addEventHandler;
true frigate
#

Is there a benefit to doing it this way? Because the way ive done it works, but im not sure on how to do it this way

true frigate
#

alright

past wagon
#
ZonePopulationBlufor = Units west inAreaArray "Marker";

how can I get a number of units in the area from this?

little raptor
#

Lou already told you

past wagon
#

he did?

little raptor
#

yes

past wagon
#

:|

true frigate
#

Eyyy the script works :)

past wagon
#

when

little raptor
#

you literally asked the same question :/

past wagon
#

ik but no one responded

true frigate
past wagon
#

wait what

true frigate
#

He replied "count"

past wagon
#

lmao why didnt i see that

#

thanks

true frigate
#

No worries

little raptor
#

but test it, cuz I'm not familiar with CBA

true frigate
#
["ace_unconscious", {
params ["Unit1", "_isUnconscious"];
if (_isUnconscious) then {
  [Unit1] spawn {sleep 1; Unit1 globalChat "Unit1 has been killed"; removeAllWeapons Unit1; _this call ace_medical_treatment_fnc_fullHealLocal};
}
}] call CBA_fnc_addEventHandler;
#

would this still work?

little raptor
#

no

#

don't touch unit

true frigate
#

it has to be _unit

little raptor
#

it works for everyone

little raptor
#

like x

true frigate
#

Is there a way i can display whoever has been killed? say, in that example, its unit1

#

would i put _unit there or?

little raptor
#

wdym "display"?

#

in chat?

#
[format ["%1 has been killed", name _unit]] remoteExec ["systemChat", 0];
true frigate
#

Yes

#

if someone is "killed", can i display their name and say theyve been killed?

little raptor
#

should work

copper raven
#

pretty sure that eh is fired globally

true frigate
#

I thought remoteExec didnt work well on servers?

little raptor
#

nvm

true frigate
#

is it because its in a script?

copper raven
little raptor
true frigate
#

Someone told me, when i was first learning to script, to always use Tags and functions in the Description.ext instead of remoteExec

#

Nevermind

#

Im an idiot

#

I was thinking of ExecVM ๐Ÿ˜‚

copper raven
#

i mean, it's your choice really, either you add it to the client owning the unit(then remoteExec), or all clients

#

i guess maybe first one is better

#

or not blobdoggoshruggoogly

true frigate
#

Listen its past midnight for me Leopard, im allowed to be a little slow :P

little raptor
#

ye

little raptor
copper raven
#

no, it calls an eventhandler lookup on all machines im pretty sure, then if they have it added, it runs the code

little raptor
#

@true frigate try this first:

["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
  systemChat format ["%1 has been killed", name _unit];
  if (local _unit) then {
    removeAllWeapons _unit;
    [_unit] spawn {
      sleep 1; 
      _this call ace_medical_treatment_fnc_fullHealLocal;
    };
  };
};
}] call CBA_fnc_addEventHandler;
#

add it in initPlayerLocal.sqf

true frigate
#

init means it loads on server start yes?

past wagon
#

how do I navigate to the conifg file?

true frigate
#

or when someone connects

little raptor
#

yeah

copper raven
true frigate
#

Ah you see i want it to be a one time thing that activates when someone interacts with a laptop

#

so i think ill stick with it being in an action

little raptor
true frigate
#

Yep, already done :)

little raptor
#

not sure why you'd want that

#

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

true frigate
#

Well everything in our training server is fully setup like that, you want a BRDM spawned for AT practise? Interact with a laptop. units spawned in a compound for CQB drills? Laptop ๐Ÿ˜‚

#

You get the idea :P

little raptor
#

what's wrong with them being revived at any time during the training?

true frigate
#

We may need to do medical training, if that occurs, having everyone autoheal might be a problem :D

true frigate
#

can i throw in a cheeky little _this setCaptive true;

#
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
  systemChat format ["%1 has been killed", name _unit];
  if (local _unit) then {
    removeAllWeapons _unit;
    [_unit] spawn {
      sleep 1; 
      _this setCaptive true;
      _this call ace_medical_treatment_fnc_fullHealLocal;
    };
  };
};
}] call CBA_fnc_addEventHandler;
little raptor
true frigate
#

sooo

fair drum
#

i need to learn those cba macros

true frigate
#
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
  systemChat format ["%1 has been killed", name _unit];
  if (local _unit) then {
    removeAllWeapons _unit;
    _unit setCaptive true;
    [_unit] spawn {
      sleep 1; 
      _this call ace_medical_treatment_fnc_fullHealLocal;
    };
  };
};
}] call CBA_fnc_addEventHandler;
little raptor
true frigate
#

Alright ๐Ÿ™‚

fair drum
copper raven
true frigate
#

setCaptive isnt working ๐Ÿค”

#

even tried it in debug menu with Unit1 setCaptive true;

past wagon
# copper raven >>

i just want to read the files so i have the strings to use. where can i find the config files in my file folders?

true frigate
copper raven
#

use loadFile then

fair drum
#

easy to navigate and search

past wagon
#

not in a script or anything

copper raven
#

๐Ÿค”

#

im not sure i understand what you want to do

past wagon
#

where are those files located

#

i just wanna know where to find the config files

#

@copper raven

copper raven
#

they're binarised

#

in addons folder

true frigate
#

I got everything working how i want it, now im gonna go to sleep, its 1:30am ๐Ÿ˜„

past wagon
#

what if I do a while loop inside a while loop?

#
ZonePopulationBlufor = Units west inAreaArray "ObjectiveMarker";
BPX = count ZonePopulationBlufor;
ZonePopulationOpfor = Units east inAreaArray "ObjectiveMarker";
OPX = count ZonePopulationOpfor;
ObjectiveScore = 0;

while { true } do {
    while { OPX >= BPX * 2 && ObjectiveScore < 300 } do {
        sleep 1;
        ObjectiveScore = ObjectiveScore + 1;
    };
    while { BPX >= OPX * 2 && ObjectiveScore > 0 } do {
        sleep 1;
        ObjectiveScore = ObjectiveScore - 1;
    };
};
fair drum
#

those won't loop at the same time

#

its going to wait for the first inside loop to finish, then go onto the second inside loop, then loop the outside

past wagon
#

yeah but when it goes to the loop outside, the whole process starts over, right?

fair drum
#

yes, it would go back to the first inside loop

past wagon
#

i know the two inner loops wont run at the same time

#

ok thanks

fair drum
#

and you'll want to add a brief sleep to the outside loop too

past wagon
#

outside the while { true } loop or outside the smaller loops?

little raptor
#

OPX => BPX
wat?

fair drum
#

>=

past wagon
#

if OPX is bigger than or equal to BPX, do the thing

#

got it

fair drum
#

reads just like you say it. you don't read... is equal to or greater than

#

it is unfortunate that the arma subreddit has devolved into an image posting board over the years...

past wagon
#

how can I use a variable array with setMarkerAlpha?
this is what im trying to do:

_objective = "Objective1";
_objective setMarkerAlpha 1;

will this work?

#

"Objective1" is a marker

fierce marlin
#

AKA Should I put (language == "Polish") or (language == "Polski")?

#

is going to assume classname.

warm hedge
#

className is the always goto when you're about to script something

#

Just the same thing that you won't put "Hunter" into createVehicle but "B_MRAP_01_F", classNames are always unique

past wagon
#

Does anyone know what might be the problem with my script?

//VARIABLES
ZonePopulationBlufor = Units west inAreaArray "ObjectiveMarker";
BPX = count ZonePopulationBlufor;
ZonePopulationOpfor = Units east inAreaArray "ObjectiveMarker";
OPX = count ZonePopulationOpfor;
ObjectiveScore = 0;
Objective = 1;
#
//OBJECTIVE SCORE
while { Objective <= 7 } do {
    _currentObjective = call {
    if ( Objective == 1 ) exitWith { "Objective1" };
    if ( Objective == 2 ) exitWith { "Objective2" };
    if ( Objective == 3 ) exitWith { "Objective3" };
    if ( Objective == 4 ) exitWith { "Objective4" };
    if ( Objective == 5 ) exitWith { "Objective5" };
    if ( Objective == 6 ) exitWith { "Objective6" };
    if ( Objective == 7 ) exitWith { "Objective7" };
    while { OPX >= BPX * 2 && ObjectiveScore < 300 } do {
        sleep 1;
        ObjectiveScore = ObjectiveScore + 1;
        _currentObjective setMarkerColor "colorRed";
    };
    while { BPX >= OPX * 2 && ObjectiveScore > 0 } do {
        sleep 1;
        ObjectiveScore = ObjectiveScore - 1;
        _currentObjective setMarkerColor "colorBlue";
    };
    if ( ObjectiveScore >= 300 ) then {
        Objective = Objective + 1;
        ObjectiveScore = 0;
        _objectivesChanged = call {
            if ( Objective == 2 ) exitWith { ["Objective1", "Objective2"] };
            if ( Objective == 3 ) exitWith { ["Objective2", "Objective3"] };
            if ( Objective == 4 ) exitWith { ["Objective3", "Objective4"] };
            if ( Objective == 5 ) exitWith { ["Objective4", "Objective5"] };
            if ( Objective == 6 ) exitWith { ["Objective5", "Objective6"] };
            if ( Objective == 7 ) exitWith { ["Objective6", "Objective7"] };
        };
        _previousObjective = _objectivesChanged select 0;
        _newObjective = _objectivesChanged select 1;
        _previousObjective setMarkerAlpha 0.5;
        _newObjective setMarkerAlpha 1;
        _previousObjective setMarkerColor "colorBlack";
        "ObjectiveMarker" setMarkerPos [getMarkerPos _newObjective];
        "ObjectiveMarker" setMarkerColor "colorBlue";
    }
    else {};
    _currentObjective setMarkerColor "colorGrey";
};
opfor addScoreSide 100;
sleep 5;
"SideScore" call BIS_fnc_endMissionServer;
warm hedge
#

What is the problem? I roughly read it and Objective = 1 is illegal

past wagon
#

why is that illegal?

warm hedge
#

= is to declare, not compare

past wagon
#

ohh yeah

warm hedge
#

So, what is the problem you're facing? Any errors? Without it we won't spend our effort to read it...

past wagon
#

yeah the thing is im not getting any errors

#

i havent been getting errors for some reason

warm hedge
#

Then you probably didn't even run it?

past wagon
#

lemme test again one sec

#

the script should definitely be running.

#

its in initServer.sqf and im testing on MP

copper raven
ripe sapphire
#

hey guys, in MP, is it possible to send people to spectator when they die, and after a certain trigger is activated spawn them again in a certain place?

#

example:

  • player dies
  • player spectates alive friend
  • alive friend secures objective
  • player is respawned at objective
willow hound
still forum
#
_currentObjective = call {
    if ( Objective == 1 ) exitWith { "Objective1" };
    if ( Objective == 2 ) exitWith { "Objective2" };
    if ( Objective == 3 ) exitWith { "Objective3" };
    if ( Objective == 4 ) exitWith { "Objective4" };
    if ( Objective == 5 ) exitWith { "Objective5" };
    if ( Objective == 6 ) exitWith { "Objective6" };
    if ( Objective == 7 ) exitWith { "Objective7" };
}

Well thats certainly a new and creative way of just to not wanting to use an array...

still forum
copper raven
#

either that or format

ripe sapphire
#

so even though i remove all respawn points they will still respawn after the timeout

#

is it possible to change respawn type mid mission? i dont know how to as respawn is defined in the description.ext

cyan dust
#

Good day. How do you get correct comparison for UAV drones and static weapons? I tried this, took names from A2 CFG, thought it didn't change, but it's not seems to be working

_isDrone = _object isKindOf "UAV";
_isStaticWeapon = _object isKindOf "StaticWeapon";
copper raven
#

private _isDrone = getNumber (configOf _object >> "isUav") == 1

#

StaticWeapon should work for statics

cyan dust
cyan dust
copper raven
#

if you didn't have object reference(only classname), then it would be correct to use the config lookup,

cyan dust
#

Yeah, that looks even better, thanks a lot ๐Ÿ‘

willow hound
ripe sapphire
#

i guess it can be a workaround, but will have to test

copper raven
glossy maple
#

Hello there,
Have a quick question : Is there a way to open the UAV terminal without having one in its inventory or gps slot?
For technical reasons I would have to be able to use the UAV terminal but keeping the GPS in the GPS slot.

I only found this command:
player action ["UAVTerminalOpen", player];
But according to the documentation and my tests, it requires the UAV terminal in the GPS slot.

copper raven
#

that command just simulates pressing "open uav terminal" in action menu

#

so if you don't have the uav terminal, you normally wouldn't get the action

#

means, it won't do anything

#

and as far as i'm aware, no, maybe you can try doing some UI hacking, and creating the UI manually blobdoggoshruggoogly (complete wild guess)

copper raven
#

loading sqf bytecode which has optimizations, i.e [0,1,2,3] literal normally is 5 sqf instructions, while optimized is just a single push instruction

surreal peak
fair drum
copper raven
#

no, it has nothing to do with that

fair drum
#

Can you do a quick example? Maybe I'll understand from that.

copper raven
#

sqf array is created by pushing all elements onto stack(push instruction per element), then popping them and pushing an array onto stack, if all elements in the array are constant, you can optimize it down to just directly pushing the array onto stack with its elements(because you know them at compile time)

#

hopefully this makes it easier to understand

[0,1,2,3] select 0;

//somewhere in init TAG_numbers = [0,1,2,3];

TAG_numbers select 0; // will be faster than above select
#

it's still not perfect because in the init, it'd still be 5 instructions, but atleast you save some runtime later

fair drum
#

Oh so it's something I already do. I never just list an array before a modification. It's always stored before hand.

copper raven
#
[0,1,2,3] select 0;
//is
push 0
push 1
push 2
push 3
makeArray 4
push 0
callbinary select

TAG_numbers select 0;
//is
gvar TAG_numbers
push 0
callbinary select

[0,1,2,3] select 0; could be just

push [0,1,2,3]
push 0
callbinary select
surreal peak
#

Is there a way to alter Class of object without making a custom PBO? For example, adding a sensor to a vehicle

copper raven
#

nope

foggy hedge
#

Can someone help me with some basic remoteExec stuff? I have my regular hintSilent working, but I don't understand how to use it in remoteExec. Assuming I placed everything where it's supposed to go, the quotations marking the params interact weirdly with the hintSilent stuff.

//remoteexec, doesnt work
"format ["Time Left: \n %1", [((_time)/60)+.01,"HH:MM"] call BIS_fnc_timetostring];" remoteExec [hintSilent];

//old version, works (but only locally)
hintSilent format ["Time Left: \n %1", [((_time)/60)+.01,"HH:MM"] call BIS_fnc_timetostring];
foggy hedge
#

thx I'll take a look at that

little raptor
#

if not good let me know how to improve it

fair drum
#

i will say, remote exec, the concepts of setvariable/getvariable, variable locality, and MP locality are the top 4 things that mess up newer scripters.

winter rose
fair drum
#

seems like those are the things we answer the most often

spark turret
little raptor
meager epoch
#

Is it possible to have the intro text you set up from the Attributes tab pop up via a trigger?

#

Or smth else which would give me the same/similar result

meager epoch
#

Oh sick

#

Thanks

copper raven
#

if used as a unary like that yes, but in your case it's not invalid, it just doesn't make sense because you don't do anything in the code

slender beacon
#

is attachTo clientside?

little raptor
#

no

copper raven
#

notice the icons next to the game version

past wagon
copper raven
#

you don't do anything with it

past wagon
#

i can just do

if ( x == 5) then {
  x = x + 1;
};
#

or something like that?

copper raven
#

x = 5 is assignment, not comparison

past wagon
#

oh yeah

#

that was just an example but

#

yea

#

i didnt even realize that you could have an if then statement without an else

copper raven
#

why would that be a thing

past wagon
#

idk

#

didnt occur to me

#

can I use != to mean 'not equal to'?

#

for example:

if ( x != 5 ) then {
x = x + 1
};
copper raven
#

yes

solar chasm
#

Is it possible to use a script within a config to temporarily change the value of a variable in that config?
Specifically, I'm trying to add an ACE interaction to a mine to 'bury' it (move it -0.25m on the Z axis), and change it's mineInconspicuousness value - it's that second step I'm trying to parse.
Is it as simple as _this setVariable ["mineInconspicuousness", ("mineInconspicuousness"+50)]? I wasn't sure if setVariable is applicable to this case.
(I realize I also might need to define a local variable to store mineInconspicuousness if I'm changing it to a relative value)

solar chasm
#

As in "not possible"? OK. Thank you!

little raptor
#

delete the other and replace it with the "inconspicuous" one

rich frost
#

Hello everyone. I have been asked an very interesting question and i would like to ask you guys if you might have an awnser to that:

Is it possible to enable 3rd Person view (in vehicles or in general) for an individual player via Debug Console as an admin?

Background:
<22:45:38> "###": I have a question for you that I would rather ask with not having everyone else know regarding because it would cause a whole thing if people start thinking about it being possible. I have a friend who used to play Arma 3 with me on his servers, but gets motion sick from being in first person when in vehicles. Is there anyway that it could be done so he could have third person in vehicles when on the server and still go back to first person while walking?

If this is not the right channel, please accept my apologies and point me in the right direction. I'm already checking the wiki but havent found anything so far.

Also feel free to @ping me when you have an awnser for me, i would appreciate it!

winter rose
#

It exists as a difficulty setting, as well as a scripted solution

rich frost
#

I am aware of the difficulty setting, but ahvent found the scripted thingy yet

winter rose
#

switchCamera iirc

rich frost
#

thank you!

#

I see what i can figure out, i not really deep into code but i'll see how ican make this work

winter rose
rich frost
#

โค๏ธ

true frigate
#

@little raptor Hey ive got a problem, when i try the script in SP, it works fine, in multiplayer on my hosted server, it only works for me, no one else has the healing effect

little raptor
past wagon
#

Did I do the BIS_fnc_AAN correctly? Does it need to be remotely executed or will it execute globally for all players? did I do the structured text correctly? and did I do str player; correctly?
initServer.sqf:

penisSurgeon addAction ["Inquire about Penis Surgery", "penisSurgery.sqf", nil, 1.5, true, true, "", "true", 5, false, "", ""];

init.sqf:

largerOrSmaller = 69420;
waitUntil { largerOrSmaller != 69420 };
if ( largerOrSmaller == true ) then {
  str player;
  [parseText "<t size='2'>player has Recieved Penis Surgery!</t>",
  parseText "player chose to make his penis larger because it was too small!"] spawn BIS_fnc_AAN;
};
if ( largerOrSmaller == false ) then {
  str player;
  [parseText "<t size='2'>player has Recieved Penis Surgery!</t>",
   parseText "player chose to make his penis larger because it was too small!"] spawn BIS_fnc_AAN;
};

penisSurgery.sqf:

largerOrSmaller = ["You can get penis surgery to adjust the size of your penis! Would you like to make your penis smaller or larger?", "Penis Surgery", "Larger!", "Smaller!", displayNull, false, false] call BIS_fnc_guiMessage;
removeAllActions penisSurgeon;
#

this is a very important script that is crucial to the mission so I need to get it right

foggy hedge
#

AFAIK addAction has a local effect so it probably needs to be remoteExec'd if you want all players to have it, not sure about BIS_fnc_AAN and it looks like the wiki is outdated for it

past wagon
#

ok

past wagon
#

I get an error in penisSurgery.sqf that says "unable to create message box" with BIS_fnc_guiMessage

past wagon
#
waitUntil { largerOrSmaller == true };

why would this statement return nil?

#

can a variable be a number and then be changed to true/false?

fair drum
#

you can define 1 to mean true with #define, but that probably not what you want

past wagon
fair drum
past wagon
#

what did i do wrong?

fair drum
#

waitUntil { largerOrSmaller };

past wagon
#

ohhhhhh

fair drum
#

if larger or smaller is true, you just call the variable

past wagon
#

im retard

#

thnaks

#

@fair drum would the waitUntil statement work in this case:

waitUntil { largerOrSmaller != 69};
fair drum
#

if largerOrSmaller is a number, yes

past wagon
#

ok

#

one sec let me show you the whole script

#

init.sqf:

largerOrSmaller = 69;
penisSurgeon addAction ["Inquire about Penis Surgery", "penisSurgery.sqf", nil, 1.5, true, true, "", "true", 5, false, "", ""];
waitUntil { largerOrSmaller != 69};
if ( largerOrSmaller == true ) then {
  str player;
  [parseText "<t size='2'>player has Recieved Penis Surgery!</t>",
  parseText "player chose to make his penis larger because it was too small!"] spawn BIS_fnc_AAN;
};
if ( largerOrSmaller == false ) then {
  str player;
  [parseText "<t size='2'>player has Recieved Penis Surgery!</t>",
   parseText "player chose to make his penis larger because it was too small!"] spawn BIS_fnc_AAN;
};

penisSurgery.sqf:

largerOrSmaller = ["You can get penis surgery to adjust the size of your penis! Would you like to make your penis smaller or larger?", "Penis Surgery", "Larger!", "Smaller!", displayNull, false, false] call BIS_fnc_guiMessage;
removeAllActions penisSurgeon;
#

can a variable change from a number to true/false?

#

i basically want the waitUntil statement to wait until the variable equals either true or false

#

so I set the variable to a number at the beginning and said "wait until this variable isnt a number anymore"

fair drum
#

why are you just changing data types like that

#

stop it. make a new variable lol

past wagon
#

wait

#

but read penisSurgery.sqf

#

i need to get the return value of call BIS_fnc_guiMessage;