#arma3_scripting

1 messages · Page 773 of 1

drifting portal
#

:(

winter rose
#

because actions are local

#

UI is local
so UI is client-side, logic is server-side - that's always a good way to think

drifting portal
#

I know but, in the code there is

[_target ,[_actionId, "Turn on screen"]] remoteExec ["setUserActionText",0];

shouldn't that be enough?

winter rose
#

no, because again, action IDs are local, so it would be expecting action ID on server to be the same as on client (which can technically differ)

#

you're just taking the risk it could work 😄

drifting portal
#

hmm

#

what adds to my confusion is that its a single action, so index should always be 0

little raptor
#

you're forgetting about mods

winter rose
#

it should work :D

#

really, make the UI client-side, you will never regret it

drifting portal
#

so not to worry

drifting portal
#

obviously it will work but I thought I could make it more elegant and such

#

but functionality over looks they say

granite sky
#

Multiple actions with different conditions works out a lot cleaner tbh.

drifting portal
#

Yep

spark turret
#

im playing with cruisemissiles, is there a way to make them ignore damage and collision during "starting"?
if they collide with anything, they explode right after spawning, very annoying.

allowDamage and disableCollision didnt do anything

little raptor
#

you can create a simple object and fake the flight

valid abyss
#

does anybody know how to use this function?
BIS_fnc_moduleCuratorAddPoints

#

I want to be able to deduct resources upon placing ai but the one set costs module appears broken with modded units

drifting portal
#

what is the best way to spawn a light source underneath the water?

drifting portal
#

fixed it

exotic flame
#

Hello,
I'm trying to create a DLL able to communicate with a distant server using c# ssl stream socket SSLStream. Everything goes fine with SSLStream.Write but every time i try to read data from the stream the game freezes for 3 seconds and crashes giving me this error:
Exit code: 0xE0434F4D - STATUS_CLR_EXCEPTION
I tried to set a read timeout to 1 second on the SSLStream but it doesn't change anything. Anyone has a workaround ?

acoustic abyss
#

I've a seemingly contradictory question:
I am trying to play a sound file (using playSound) at the start of my mission. In order to remove noises, I use fadeSound. However, fadeSound also affects my playSound. Is there a way around this?

little raptor
exotic flame
hallow mortar
drifting portal
#

light works in night time but not in day time

opal zephyr
#

Hello, I need some help with Regex, this is my string : ""2",":","28"".
Im trying to to make it look like 2:28
The furthest I've gotten is making it look like this ""3":"22"", essentially just removing the commas and one set of quotations.
I used this regex to get that: ","""

Any help is greatly appreciated!

still forum
#

splitstring by " and ,
then joinString by ""
removes all quotes and commas, without regex

opal zephyr
still forum
#

wat?

#

splitString '"'

opal zephyr
#

Trying to use ' on either end gives me Error Invalid Expression on the next commented line after it

#

This is the code chunk

_tst = str _timeArray;    
_tst = _tst splitString '",';
_tst = _tst joinString """";
little raptor
#

what is the exact string?

opal zephyr
#

Im turning an array into a string, so it shows up in game with a systemchat as ["2",":","28"]

little raptor
#

then just do joinString

#

["2",":","28"] joinString ""

opal zephyr
#

Jeez scripting continues to make me feel stupid on the stuff that should be easy. Thankyou so much both of you :) That works great Leopard

wind hedge
#
 waitUntil {!(isNull (findDisplay 46))};
    (findDisplay 46) displayAddEventHandler ["KeyDown", {
        params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
        _handled = false;
        switch (_key) do {
            case (actionKeys "MoveForward") :{
                systemChat "Standing!";
                [player] spawn vFNC_standFromChair;
            }; // Key assigned to the Forward Movement (W)
        };
        _handled
    }]; ```
#

☝️ Is there a way to remove this displayAddEventHandler after the player is no longer sitting and just add it back again when the players sits?

#

I mean, I know how to add it but not how to remove it... something like BIS_fnc_holdActionRemove but for displayAddEventHandler

little raptor
#

switch (_key) do {
case (actionKeys "MoveForward") :{
use addUserActionEventHandler instead

wind hedge
little raptor
#

no

#

_standEhId is not defined in the EH code

#

just use the magic var _thisEventHandler

wind hedge
little raptor
#

yes

#

all event handlers

#

(not sure about scripted ones)

wind hedge
#

addUserActionEventHandler is very new, very few scripts and mods using it

little raptor
#

unless you need to override a key

wind hedge
wind hedge
#

I can now make units sit on a chair even if the chair is high on a building... the only weird thing is that getDir gets a wrong dir for chairs that are not at ground level...

little raptor
#

it needs permission to access

winter rose
wind hedge
#

If you try it, sit on the chairs on top of the building and then the chairs downstairs

little raptor
little raptor
#

but you use several inconsistent commands

#

and you also use setPos.... meowsweats

#

the only weird thing is that getDir gets a wrong dir for chairs that are not at ground level...
it has nothing to do with getDir. it's related to your own code:

if (_pos select 2 > 1) then {
        _agentCamera attachTo [_chair,[0,0,-1]];
        [player] spawn vFNC_CheckForFORWARDkeyPress;
    };
wind hedge
#

When the chair is up in the air I must use the attachTo command but since that removes the "stand up" holdaction I had to do it with the addUserActionEventHandler

#

Gonna optimise and test the script some more 😉

wind hedge
little raptor
#

you can do that with a simple per frame loop and setVelocityTransformation

#

which roughly has the same performance cost as attachTo

wind hedge
little raptor
#

but you also get to keep the free look

little raptor
#

well unless it's MP

#

not sure about MP

wind hedge
#

To be honest I made this script because no other script out there offers these functionalities. Most lock you in place, do not allow you to move your camera like doing a Freelook or use the attachTo command on all chairs regardless it is needed or not and also most do not work on ALL arma 3 chairs, this one does.

#

And now it is working perfectly except for that setDir issue

pulsar bluff
#

i just let them spin 😂

pulsar bluff
#

also to add, making things is relatively easy. making things work as intended under all circumstances, is very complicated

#

for instance, what happens if someone puts a quad bike beside the chair, and the seated person uses the “get in” action?

#

or if a second person tries to get into the same chair. or if the seated person gets incapacitated and then revived

#

or if a physx collision/explosion pushes the not-attached-to person away from the chair

#

or pushes the chair away

#

or player disconnects while seated

#

etc etc etc 😂

tough abyss
#

How to change the vectorUp of an object via angle?

#

Tried:

findDisplay 46 displayAddEventHandler ["KeyDown", {
    params ["", "_key"];
    private _vectorUp  = vectorUpVisual object;

    switch (_key) do {
        case 17: {
            angleUp = (angleUp + 1) min 360;

            _vectorUp = [_vectorUp, angleUp, 2] call BIS_fnc_rotateVector3D;

            systemChat "vectoring";
        };
    };

    object setVectorUp _vectorUp;
}];

angleUp = 0;

But it didn't work

little raptor
#

which obviously is impossible and won't work (it returns the same vector)

#

also you're incrementing the rotation angle each time, which is wrong

#

plus, your code is extremely inefficient. it changes the vectorUp of the object when ANY key is pressed.

drifting portal
sage heath
#

this is uhhh in a friends of mines script document (read the comments)

setFriend

resistance setFriend [east, 1];
east setFriend [resistance, 1]; // they're fwiends UwU

resistance setFriend [east, 0];
east setFriend [resistance, 0]; // they're not fwiends anymore /w\```
#

help

hallow mortar
#

This appears to be largely valid. What's the problem?

granite sky
#

He's probably just worried that his friend is a furry :P

sage heath
hallow mortar
#

That seems to be an accurate description of what the code does.
Unfortunately, being scared of the word "fwiends" is a you problem, not a scripting problem, so I can't help with that.

hallow mortar
#

Yes, I got that, I just didn't think it was funny

sage heath
#

ok mr humor police, anyways im off

wind hedge
#

Do you guys think that turning each destroyed vehicle into simple objects at the time they are destroyed will help to ease the performance impact they cause on the server? Because right now each destroyed vehicle on my scene takes from 5-10 FPS toll on my overall FPS... so if I have 60 FPS and then 3 or more vehicles are destroyed and burning nearby I hover between 30-35 FPS and that is too noticeable... Don't know if it is the particle effects or what

sage heath
open fractal
#

it's a significant difference

wind hedge
open fractal
#

I believe the engine still processes a crispy car as a car

wind hedge
sage heath
#

and also, its the smoke

open fractal
#

You may be right about it being the particles maybe your pc doesn't like them

sage heath
#

not the models

wind hedge
#

I am thinking about doing a "KilledEH" for vehicles that turns them into simple objects as soon as destroyed, and also add a custom smoke and fire effect not so demanding...

#

Don't know why we have to "hack" our way into stable FPSs but heck, at least there is a way...

sage heath
#

honestly dont bother, its the particles that kills it (if its destroyed), and theres nothing you can do about that except deleting them entirely

open fractal
#

Definitely doable but you'll have to deal with the occupants

open fractal
sage heath
#

rephrased, slightly

wind hedge
open fractal
#

yeah that'll do

sage heath
#

honestly a good thing you can do is: just delete the stuff the players have already seen and done, so it keeps lag down

#

and have garbage collection so bodies gets auto deleted, and maybe if you have any, tune down the decor

#

but at this point this isnt about scripting its more #arma3_scenario territory but you get me

#

scripting isnt gonna help much when its only gonna fix 1 out of the 10 things thats lagging your ops (which is everything, its doing a little but it adds up)

wind hedge
little raptor
granite sky
#

It'll be the particles that cost, so not much point unless you're removing those.

open fractal
#

wouldn't deleting the original vehicle remove the particle source anyway?

wind hedge
sage heath
granite sky
#

Yes, but the suggestion was to put the particles back on a simple object.

open fractal
#

yeah but it can still make a difference if he only puts back, say, one resource-light particle effect instead of the multiple originally present

granite sky
#

Maybe if the original burning effect was particularly bad and you could arrange a cheaper one, but I can't say I noticed...

little raptor
wind hedge
sage heath
#

again, we’re basically building a script that will only solve 1 of the problems out of the possible 10-20, i dont think this is an efficient way to use your time, when really its about how you make your mission, and sacrificing certain aspects for mission stability

but thats about it from one zeus to another, if you guys wanna continue knock yourself out

wind hedge
# little raptor yes

Well, in my testings I found out that is not the case. Because if I attach a unit to a chair that is facing north the direction of the character (unit) in relation to north is XX while if I attach the unit on the same chair (but this time the chair pointing south) the direction of the unit in relation to that chair is YY which is not the same correlation to the behaviour seen on the chair pointing north... ergo the ticket

sage heath
#

use attachtoRelative

wind hedge
#

Gonna try it!

sage heath
#

yes and it doesnt turn the same way as the thing you’re attaching it to

little raptor
little raptor
#

as I said the dir of attached objects should be relative

sage heath
little raptor
#

it should be _unit setDir 180

wind hedge
wind hedge
#

If you check the ticked, I don't even need to use the _unit setDir... just by attaching the unit to the same chair facing different directions will already exhibit the wrong behaviour... because in the chair facing XX the unit is attached sitting straight and on the chair facing YY the unit is attached sitting sideways... where if the direction was trully relative to the chair the unit would always be attached straight no matter the direction of the chair

little raptor
#

because in the chair facing XX the unit is attached sitting straight and on the chair facing YY the unit is attached sitting sideways...
that's not possible at all

#

you're doing something wrong

granite sky
#

Just tested blowing up vehicles in the editor, no mods. I had to go above eight visible burning vehicles to drop fps below 60 on my trash hardware, and after that it's maybe cutting it by 1-2fps each.

#

So you may have a mod or display setting problem there.

little raptor
#
_unit = player;
_chair = createVehicle ["Land_ChairPlastic_F", screenToWorld [0.5, 0.5]];
_unit attachTo [_chair,[0,0,-0.5]];

call {
if (typeOf _chair in ["Land_ChairWood_F","Land_CampingChair_V2_F","Land_CampingChair_V2_white_F"]) exitWith {_unit setdir 180;};
if (typeOf _chair in ["Land_ChairPlastic_F"]) exitWith {_unit setDir 90};
};
#

there. fixed

#

well your own code is wrong in the first place. the dirs are wrong

wind hedge
sage heath
little raptor
sage heath
# wind hedge You are probably right...

if its that fps intensive mission, and theres nothing in the mission you can afford to change && you can change the mods in the modset, consider removing those + dependencies, or atleast try it

but if you’re like my unit, and you cant remove those cause they’re core mods, you just gotta start deleting stuff behind players

wind hedge
#

But it wasn't working of course

sage heath
#

something something, the sp forces certain higher quality graphics settings to be always on vs in mp. for example: grass

wind hedge
#

Going back to MP

#

Thanks!

wind hedge
wind hedge
spark turret
#
        if !(_shapeParams isEqualTypeArray [5] && (_shapeParams#0 > 0)) then {
            ["invalid circle parameters"] call BIS_fnc_error;
            _legal = false;
        }

this code thorows a "unexpected type error on the second condition when _shapeParams = ["hello"].
why?
lazy eval should abort the checking if the first condition fails. does arma not have lazy eval ?

#
19:04:53 Error in expression <isEqualTypeArray [5] && (_shapeParams#0 > 0)) then { 
   ["invalid circle parame>
19:04:53   Error position: <> 0)) then { 
   ["invalid circle parame>
19:04:53   Error >: Type String, expected Number,Not a Number
hallow mortar
#

Lazy eval is done with {}, e.g. if ((condition1) && {condition2})

spark turret
#

wtf

#

why in the world would it not be default

hallow mortar
#

It didn't exist at all until halfway through A2OA

spark turret
#

lol sqf truly is from a darker time

#

thanks for the help 👍

still forum
#

If you knew how SQF syntax worked you'd know that it cannot be by default with ()

spark turret
#

i didnt know at all that lazy eval was optional. i thought every language uses it by default

still forum
#

SQF needs to evaluate arguments before being able to execute a command.
It has to evaluate your conditions and the && before it can possibly call the if command

drifting portal
#

This has been asked many times by other people so sorry for not focusing,
Best way to find a gun's muzzle position?

#

Player's gun muzzle position

opal zephyr
#

@drifting portal Did you try currentMuzzle?

drifting portal
#

let me edit the question

#

yes sir?

little raptor
#

@drifting portal

little raptor
drifting portal
little raptor
#

there is no other way

#

unless you want a less accurate solution

drifting portal
#

so its just the muzzlePos?

#

in the config?

little raptor
#

muzzlePos is the mem point of the muzzle in weapon coords

#

it has nothing to do with player

drifting portal
#

isn't there a way to get the weapon object of the player?

little raptor
#

no

drifting portal
#

damn

#

if you use cursorobject on a unit's weapon it returns the object

#

but yeah alas

little raptor
#

it's a proxy

#

it's completely useless

#

you can't even get its position (getPosXXX _wpn returns [0,0,0])

drifting portal
little raptor
#

it's not a bug

drifting portal
little raptor
#

it's been asked many times before and the devs said it's not gonna happen

drifting portal
#

well, thanks a lot

#

just have to create a model on every frame I guess

little raptor
drifting portal
#

misread the if statement my bad

little raptor
#

and the onEachFrame is (was) just for drawing (I removed the draw part)

#

using drawLine3D between _p1 and _p2
I put it back again

drifting portal
#

oh ok

opal zephyr
#

The or statement in this is busted and I cant for the life of me figure out why, I know its the or statement because deleting everything after the or statement makes it work. I use or statements elsewhere with no problem... Anyone have any suggestions?

if (_playerRole select 0 == "driver" || (_playerRole select 0 == "turret" && ((_playerRole select 1) select 0 == 0))) then
#

^if the or statement is true then this calls just fine

little raptor
#

turret with turret path [0]?

opal zephyr
#

ya, it gets the co-pilot seat

#

Heli's seem to class that role as a turret role, but its only difference to other turret roles is that its turretpath is 0, so I was getting it like that

little raptor
#

if your _playerRole array has only 1 element or the second element is not an array or it's an empty array it can fail

#

the question is how do you generate it

opal zephyr
#

Oh interesting... I get it with assignedVehicleRole, which if its anything but the turret, only outputs an array with one value

#

So it can't find the second part of the array and gets upset and just... fails?

little raptor
#

well you can simply do this then:

if (_playerRole in [["driver"], ["turret", [0]]]) then
#

or if you want to keep yours, use lazy eval

#
if (_playerRole select 0 == "driver" || {_playerRole select 0 == "turret" && {(_playerRole select 1) select 0 == 0}}) then
#

also turret path [0] doesn't necessarily mean copilot

opal zephyr
#

The first one is much cleaner, I wasnt aware of the "in" option, will definitely be using that more often

opal zephyr
little raptor
#

the consistent way is thru the turret config

opal zephyr
#

This script doesn't run anything important enough for it to be that consistent, I will note that for future things though

little raptor
#

it's not that complicated. all you need is:

_cfg = configOf _veh >> "Turrets";
{_cfg = _cfg select _x} forEach _turretPath;
getNumber(_cfg >> "isCopilot") == 1
opal zephyr
#

Does that last line give me the turretpath of the co-pilot?

little raptor
#

no

#

it checks if the turret path you provided is copilot

#

if you want to get the copilot path(s) you can do:

_copilotPaths = allTurrets _veh select {
  _cfg = configOf _veh >> "Turrets";
  {_cfg = _cfg select _x} forEach _x;
  getNumber(_cfg >> "isCopilot") == 1
} 
opal zephyr
#

Second one works brilliantly! Thanks for the help Leopard, you continue to come through the fast and reliable solutions

little raptor
#

you need to define _veh ofc

opal zephyr
#

And that if statement you did there would run through every option in _copilotPaths? If for some reason there were more than 1 copilot?

little raptor
#

yeah

opal zephyr
#

Im not understanding this section

(_playerRole select 1) in _copilotPaths

Just like in a technical sense

#

Its selecting the turretpath part of the array from my _playerRole, but then how does using "in" in this sense make it check for every value in _copilotPaths?

little raptor
#

read the wiki page for in

opal zephyr
#

Syntax 4? the haystack stuff?

little raptor
#

_playerRole select 1 is a turret path
_copilotPaths is an array of turret paths
in searches the _copilotPaths array to see if _playerRole select 1 is in it

little raptor
opal zephyr
#

Ohhhh

#

Since _playerRole select 1 is a parent array with the actual values being stored in nested arrays

little raptor
#

no, copilotPaths is the "parent array"

#

see example 1 on wiki:

1 in [0, 1, 2]; // true
opal zephyr
#

yes, but I was lost at how _playerRole select 1 was getting each possible turretpath available in the heli, I was missing that it wasnt actually selecting the individual turretPath, but all of them

little raptor
opal zephyr
little raptor
#

since you have an array of paths now the second one is already clean

opal zephyr
little raptor
opal zephyr
#

haha, ill pass

low birch
#

Is toLower implemented to Cyrillic?

warm venture
#
        class sand {
            amount = 2;
            zones[] = { "sand_mine","sand_mine_2" };
            item = "pickaxe";
            mined[] = { "sand" };
            zoneSize = 30;
        };

How could I loop through items in "zones[]" and see if the player is near any of them?

granite sky
#
  1. Where is sand in the config tree?
  2. What are the entries in zones[]?
warm venture
#

either setting a variable on the player when they enter a trigger zone, or adding the action then instead of on start

#

I had it adding the action just fine but it was finicky about removing it once the player left

open cape
#

so for example this vehicle cwr3_b_a10

granite sky
#

How are you spawning the vehicle?

open cape
#

It spawns through a build menu

#

kp liberation

#

to be exact

granite sky
#

You'd need to edit the code where KP Liberation spawns the vehicle then.

#

If it's multiplayer you'll need to broadcast the whitelists, like this:
_vehicle setVariable ["ace_pylons_magazineWhitelist", _arrayOfMags, true];

open cape
#

I was assuming I could use the kp_objectinits.sqf

granite sky
#

This isn't necessary in an editor init statement because those run globally.

#

yeah, looks possible.

open cape
#

My main problem so far is getting the vehicle as a variable

#

I tried something like this
["cwr3_b_a10",{ params ["_veh"]; _veh setVariable ["ace_pylons_magazineWhitelist", ["PylonRack_3Rnd_Missile_AGM_02_F"]]; }, true];

granite sky
#

You can do it directly, I think:
[["cwr3_b_a10"], {_this setVariable ["ace_pylons_magazineWhitelist", _arrayOfMags, true]}],

#

But the params method should also work.

#

You have the true in the wrong array there.

#

Make sure you have the correct case on the classname too. Might matter.

open cape
#

copied it from the editor with right click

open cape
#

Any way for me to see what its putting _this as like hint it out?

granite sky
#

From the other examples it's clearly the object created.

open cape
#

Cause its still not working and not sure why

granite sky
#

Have you successfully changed anything else in the mission?

open cape
#

would this work in a init.sqf on a test vr world

#

and I haven't changed anything script wise no

granite sky
#

Usually people trip up on trying to edit steam missions in-place

#

and then steam just repairs them

open cape
#

I copied the mission file from our server to my pc

granite sky
#

Run KPLIB_objectInits in the debug console to check that your edits are actually being applied.

#

otherwise hint typename _this;

#

To check that it's actually installing the whitelist you can also look at the vehicle and run cursorObject getVariable "ace_pylons_magazineWhitelist"

open cape
#

No idea still doesnt want to work
_arrayofMags = ["PylonRack_3Rnd_Missile_AGM_02_F","PylonRack_1Rnd_Missile_AGM_02_F"]; ["cwr3_b_a10", { params ["_veh"]; _veh setVariable ["ace_pylons_magazineWhitelist", _arrayofMags, true]; } ];

granite sky
#

_arrayOfMags likely needs to go in that code.

#

At least, I don't know what KPLib is actually doing with the code.

#

Did you run either of those debug console checks?

open cape
#

How do I actually do that just put kp_objectinits into console?

granite sky
#

KPLIB_objectInits, yes

open cape
#

atm Im testing on a vr test world using a init.sqf just to see if I can get it to work

winter rose
open cape
#

Atm this is all I have in init.sqf

    ["cwr3_b_a10",
        {
            params ["_veh"];
            _arrayofMags = ["PylonRack_3Rnd_Missile_AGM_02_F"];
            _veh setVariable ["ace_pylons_magazineWhitelist", _arrayofMags, true];
        }
    ];
granite sky
#

Yeah, that's a misunderstanding. kp_objectInits.sqf doesn't do anything itself. It's just data that the rest of KPLib is using somewhere.

open cape
#

should this work in a init.sqf?

granite sky
#

No.

#

And because there's no general object init event, you can't make a general version without polling.

open cape
#

would something like this help me acheive what I want to do?

granite sky
#

Potentially, yes.

#

That's what CBA does, it polls the object list every frame looking for new objects.

open cape
#

But yeah I thought that kp_objectinit might work cause it can change camo of vehicles when you first build them according to the kp lib discord

granite sky
#

It might well work, but you haven't even done anything to check that your edits are actually sticking yet.

open cape
#

I did try that cursorobject and it returned nothing

granite sky
#

what about the KPLIB_objectInits?

open cape
#

Testing now

#

nothing happens when I put kp_objectInits

#

in debug

granite sky
#

Right, so the edits are sticking but you broke the syntax :P

#

I think all your examples had a semicolon on the end of the array you added, which is incorrect.

#

Should be either a comma if it's the last element of the parent array, or nothing if it's the last element.

open cape
#

so this isnt correct? _arrayofMags = ["PylonRack_3Rnd_Missile_AGM_02_F","PylonRack_1Rnd_Missile_AGM_02_F"];

warm venture
#

Anyone know why I can't use this function at all?

#

I can copy paste the example and get no notification in my mission. If I make a different mission file it works fine.

#

Idk how a built in function is possible corrupted on my server

drifting portal
warm venture
#

["TaskSucceeded", ["", "Disable the nuke"]] call BIS_fnc_showNotification;

#

works in editor, works in a different mission on my server

#

does not work in my main mission.

drifting portal
#

How are you executing it

#

Because the function has a local effect

warm venture
#

local, global, server, all but server

#

doesnt work for any

bleak thicket
#

Hi guys, I have a question how to make a bot shoot while playing an animation, here is an example of the animation "Acts_CrouchingFiringLeftRifle03" how to implement it, someone can make a script as an example and show me.

warm hedge
bleak thicket
#

I apologize for this, but I really want to solve this issue with these animations, I can't

#

If there is an opportunity to throw off the script to test to understand what's what.

drifting portal
#

Not sure if it works

warm hedge
#

Again that's because the config prevents it, you can't do anything only with scripts but with #arma3_config

drifting portal
#

I'm probably wrong

bleak thicket
#

[] spawn {
s1 switchmove "AadjPknlMstpSrasWrflDright_Hgun_enablefiring";
sleep 5;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 8;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 5;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 8;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 5;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 8;

};

drifting portal
#

What happened?

#

Fired or not

bleak thicket
#

I did this in the sqs script, but the bot does not come out, does not play the animation and shoots single

drifting portal
#

Well idk is the animation name correct

#

Enlighten us POLOX

#

Please

warm hedge
#

Again again again, it won't work. Because of the config

drifting portal
#

Did the fire action just override the animation or something?

bleak thicket
#

Yes..... the campaign I'm not destined to comprehend it all, it's a pity, of course.

warm hedge
#

Because the animation doesn't exist?

bleak thicket
#

If anyone has seen the youtuber's nicknames Flawless Warhammer in his videos, animations are played with shooting, I want to do about the same in the introductory video for the mission.

warm hedge
#

Make a Mod

bleak thicket
#

that's why I'm asking for a ready-made script, I just don't really understand these scripts, I'm just learning.

warm hedge
#

Once, Again, you need a Mod for it, script isn't a concern

bleak thicket
#

you mean the RHS mod I use it bots and weapons from there

warm hedge
#

Whaaat

#

I am saying that, you need a Mod that tweaks the animations' config, not anything else, not even RHS

bleak thicket
#

that is, it is necessary to talk about this topic with the developers of this mod, do I understand correctly or not?

warm hedge
#

I don't know what this means, but most unlikely you understand it correctly

bleak thicket
#

understand that it's hard for a beginner for me, no offense

warm hedge
#

It's not beginner or veteran thing, it's just impossible in vanilla environment, you need a Mod that edit the animations' config so the animations can fire something

bleak thicket
#

Okay, I understand you, thank you for listening, I will look for such a person.

little raptor
warm hedge
#

Assumed it was just a typo of sqf

little raptor
#

There was another guy a few days ago who also wrote sqs and he actually meant sqs (he was testing a script on OFP meowfacepalm )

velvet merlin
#

if ((true) || (condition)) then

#

will condition be evaluated in sqf and if so why?

little raptor
#

unless they're codes, which only execute with a "caller" command e.g. call, then, do, etc.

#

if you don't want condition to be evaluated use lazy eval

#
if (true || {condition}) then 
#

condition will never be evaluated

velvet merlin
#

so you should to apply lazy eval even for OR conditions (if the nth conditions are more complex) ?

little raptor
#

yes

#
if (c1 || {c2 || {c3}})
#

this is also possible:

if (c1 || {c2} || {c3})
#

the 1st one is faster

still forum
#

the 1st one is faster
depends on which conditions are true 👀

#

runs away

little raptor
#

you sure? I'm pretty sure the 1st one is always faster (or same)

little raptor
granite sky
#

The code brackets themselves have a cost, so with simple conditions it's usually faster without the lazy eval.

velvet merlin
#

@little raptor thanks a lot 👍

brazen lagoon
#

like, is there an explanation on how to use this somewhere lol

#

i'm trying to do it in script instead of having to place them

#

oh right this wont work for me anyway rip

velvet merlin
#

_map ctrlAddEventHandler ["draw"

#

how to not draw temporarily best

#

to remove the draw event altogether [annoying would be to re-add without events] or just to resize the map control/move off screen?

little raptor
#
if (_map getVariable ["Don't Draw", false]) exitWith {};
velvet merlin
#

this will keep the cutRsc tho

#

just not update it

#

(this is BI's group indicator)

little raptor
#

I don't get it. What are you trying not to draw?

tough abyss
#

is it possible to set setVectorDirAndUp on attached objects?

little raptor
#

yes

tough abyss
# little raptor yes

But how? I attached first object to second, and tried to set the pitchBank to the attached object.

b1 attachTo [b2, [0, 0, 0.5]];
[b1, 45, 0] call BIS_fnc_setPitchBank; 

As a result, the attached object absolutely does not react to this

little raptor
#

it looks like you're trying to pitch the object at 45 degrees

#

you can just use this then:

#
b1 attachTo [b2, [0, 0, 0.5]];
_dir = [0, cos 45, sin 45];
_up = [0,-sin 45, cos 45];
b1 setVectorDirAndUp [_dir, _up];
rich frost
#

Hi - I'm work on porting a Helicopter Landing Practice Mission to the different CDLC Terrains (and more), i talked with the author and he is cool with it, but busy.

The Mission uses a "Virtual Vehicle Spawner" script from 2015 to register and spawn the desired helicopter via an ingame menu.

Sadly it doesnt detect the GlobalMobilisation Vehicles, because GM uses a different VehicleClass or sth?

Here is the link to the file where i think i need to add the right config name but im just not familiar with that kind of stuff.
https://github.com/1337zorn/A3_HeliLandingPractice/blob/main/%23copy this inside the mission folder/VVS/functions/fn_buildCfg.sqf

i know the basics of sqf but never had a chance to dive into configs and classes n stuff, so im not very familiar with that, so any help here would be appreciated.

Alternatively, if people can point me towards an alternative script/module/solution to spawn a vehicle/helicopter by choice via a menu or sth, that would be great as well.

If i understand right, the GM Vehicles are already children of Air and Helicopter , but it still doesnt show up.
["gm_ge_army_bo105p1m_vbh_swooper_base","gm_bo105p1m_vbh_swooper_base","gm_bo105p1m_vbh_base","gm_bo105p1m_base","gm_bo105p_base","gm_bo105_base","gm_helicopter_base","Helicopter_Base_H","Helicopter_Base_F","Helicopter","Air","AllVehicles","All"]

GitHub

Arma 3 - Helicopter Landing Practice Mission, original by KiloSwiss - Ports to more Maps + minor Adaptations - A3_HeliLandingPractice/fn_buildCfg.sqf at main · 1337zorn/A3_HeliLandingPractice

little raptor
rich frost
#

ahm in this case yes

little raptor
#

it does the job thats needed for that scenario ^^
really? then you're good to go then

rich frost
#

well

#

Well it spawns everything as much as i could see, it works with vanilla, RHS, CUP, CSLA, SOG:PF, WS c.dlc's but only Glob Mob helicopters wont be shown in the list.

velvet merlin
#

this is the group indicator

#

but you dont want that visible during cutscenes, subtitles, black out etc

#

option 1) create and destroy all the time

#

option 2) just "hide" when not desired

little raptor
#

I personally prefer not to remove/destroy something temporarily

#

plus how are you gonna check if cutscenes, etc. are visible?

#

you still need a loop that runs every frame

velvet merlin
#
            exitWith
            {
                missionNamespace setVariable ["LIB_GroupIndicatorPosition",ctrlMapPosition _map];
                _map ctrlMapSetPosition [0,0,0,0];
            };

            if ((missionNamespace getVariable ["LIB_GroupIndicatorPosition",[]] isNotEqualTo []) then
            {
                _map ctrlMapSetPosition (missionNamespace getVariable "LIB_GroupIndicatorPosition");
            };```
#

this is what i want to try now

#
            if
            (
                (missionNamespace getVariable ["LIB_CDA_isCutscene",false])
                ||
                ((count _allActiveTitleEffects) > 0)
                ||
                (visibleMap)
                ||
                (cameraOn != (vehicle player))
                ||
                (!(isNull (findDisplay 602)))
                ||
                (!isNil "LIB_fnc_showSubtitle_Subtitle" && {!isNull LIB_fnc_showSubtitle_Subtitle})
                ||
                ("arsenal" in (toLower missionName))
            )```
little raptor
#

well yeah you have to do that in a loop

#

they don't have event handlers

velvet merlin
little raptor
#

what I mean is they don't have event handlers

#

so you still need a loop

velvet merlin
#

_map ctrlAddEventHandler ["draw","with uiNamespace do {['Draw',_this] call LIB_MissionUtilityFunctions_fnc_GroupIndicator;};"];

#

yep

little raptor
#

you might as well not remove anything and do the check in the draw EH

velvet merlin
#

thats why i want to try to reposition or hide the control by other means

#

above is inside the EH

little raptor
#

well if your ctrls are in a controls group you can just setFade it and the entire "group indicator" will hide

velvet merlin
#

RscMapControl seems special. havent tested yet what works and doesnt with it

little raptor
#

afaik setFade works with everything

#

RscMapControl
I don't recommend drawing a whole map just for some group icons... meowsweats

velvet merlin
#

its BI's system 😛

#

i guess its a prototype they wanted to merge into engine later, but then scrapped it

#

how do mods do it instead?

little raptor
#

idk how mods do it, but I'd personally just draw some ctrls on the screen instead blobdoggoshruggoogly
that circle can be drawn in Photoshop or something similar
and the unit icons can just be RscPictures

drifting portal
#

is there something homologous to saveProfileNamespace but for server variables?

#

basically a file save operation on a dedicated server so I can store variables after restart?

velvet merlin
#

need to do more legwork yourself that way tho

drifting portal
#

for example profile variables are stored in a file in the profile folder

#

which file has these variables stored in it?

#

it says its stored on the client's pc?

#

burden me but kinda confused

open fractal
#

can't you just set profileNamespace variables on only the dedicated server?

drifting portal
#

Do you have an example?

#

I basically don't want them stored on client PC

open fractal
#
profileNamespace setVariable ["myVariable",_myValue];
#

just run this on the server, by default it won't be broadcasted

#

the dedicated server will create a file just like the clients do

drifting portal
#

Like where will it be saved

open fractal
#

your dedicated server has a profile folder

#

i dont remember where

drifting portal
open fractal
#

but it stores difficulty settigns

#

and variables

drifting portal
#

Well what does missionprofilenamespace do then

open fractal
#

I think it just makes a separate file to store variables for a specific mission or group of missions

drifting portal
#

Remoteexec ["servariable", 2]?

open fractal
#

you dont need to remoteExec setVariable

#
profileNamespace setVariable ["myVariable",_myValue,2];
drifting portal
#

Thanks

open fractal
#

yw

little raptor
open fractal
#

am I misunderstanding this?

little raptor
#

I don't think you can do that with profile namespace

#

I've never tried it tho

open fractal
#

I haven't found any notes on the profileNamespace or setVariable page on that though

haughty bone
#

Greetings. i am trying to make some new tasks via scripts via BIS_fnc_taskCreate however it keeps throwing my newly made task into the debug corner. my code is[west, "Check the location", ["Move to the given location and if there are indeed soldiers. Steal the weapon cache","Check the location", getMarkerPos "mission_02"], [0,0,0]] call BIS_fnc_taskCreate; So basically i have a preplaced marker that i have called mission_02 but it doesnt seem to recognize it. Am i overlooking as to how it works? I have also tried it without the getMarkerPos since that's how the example is showing it. From what i understand from the wiki. it is asking for an xyz position which getMarkerPos gets from the location as far as i know.

#

edit: typo error

brazen lagoon
#

is there a way to put HUD elements behind other HUD elements?

#

do I just have to create them first?

drifting portal
#

create them first

#

some will still be displayed above anything else like RscPicture

opal zephyr
#

Is it possible to pass a local variable into a function?
Example:

_test = 5;
call Function;

Function =
{
    _thing = _test +2;
};
opal zephyr
#

Hmm, ive used params before, didnt know it was possible to be used when calling an entirely different function though... Ill give it a try I guess, despite the examples not being super suggestive

drifting portal
opal zephyr
#

thanks

drifting portal
opal zephyr
#

ik lol, it was purely as an example

little raptor
opal zephyr
#

I supposed it would work for the example I posted, but it wouldn't for this example would it?
Example:

_test = 0;
call Function1;

Function1 =
{
  _test = 7;
  call Function2;
};

Function2 = 
{
  "_test would equal 0 here because its definition in Function1 would be local to that Function Right?"
};
opal zephyr
#

oh really eh

#

I believe my understanding of it has been very flawed up until this point then....

little raptor
#

in that case then is executing the code (subject to the if condition ofc). and all codes still see _var. no matter how deep you nest them

opal zephyr
#

Hmm, switching my global variables broke the script... hold on while I find out exactly where

little raptor
#

your code either branches off (due to if for example) or it's executing elsewhere (e.g. due to spawn or EH code or ...)

opal zephyr
#

I do have EH in the code, whats the rules like for setting variables inside of it? Do they gotta be global for that?

little raptor
#

depends on the type of EH

opal zephyr
#

GetInMan

little raptor
#

but in any case they can't be from the script that adds the EH

little raptor
opal zephyr
#

That EH adds to the player

little raptor
#

or global var

#

but that's bad

little raptor
#

it can change at any minute

opal zephyr
#

If only globals weren't bad smh

little raptor
#

by bad I mean they're not suitable for that case

#

since an EH can be added to thousands of objs

#

each with the same code

#

how are you gonna be able to use global vars without having a new global var for each object?

#

which is messy ofc

opal zephyr
#

gotcha

#

ya I learned passing them into functions and stuff a little bit ago because of that reason

#

Is passing them to the object different or pretty much the same as passing it into a function?

little raptor
#

instead you just store the var in the obj:

_obj setVariable ["myVar", _bla];
_obj addEventHandler ["GetInMan", {
  params ["_obj"];
  _bla = _obj getVariable ["myVar", -1];
}
opal zephyr
#

interesting

#

GetInMan has params of its own that im using, so does "_obj" for example go to the end of the line automatically?

little raptor
#

wat? _obj is just the first of GetInMan params

granite sky
#

err, that's the first param of GetInMan. Called "_unit" in the wiki but you can call it what you like.

little raptor
#

I just skipped the rest

granite sky
#

You don't have to define all the params.

opal zephyr
#

Oh I see what you did there, it worked out that I was assigning the variable to the player, and it already gets the player as part of the GetInMan thing. I get it I get it

#

Can I assign multiple variables in the same setVariable?

#

Like just nest it? [[],[],]

granite sky
#

Well, you can set a variable to an array.

#

Or you can set multiple variables with different names.

opal zephyr
#
player setVariable [["var1", var1],["var2",var2]];

Is this ok? Could I still get the variable like Leopard did?

granite sky
#

No.

#

You can do either:

player setVariable ["var1", _var1];
player setVariable ["var2", _var2];

or:

player setVariable ["vars", [_var1, _var2]];
opal zephyr
#

To get say var2 in the second example, could I do this?

getVariable ["vars" select 1, -1];
#

Or is it impossible to select the individuals

granite sky
#

No, player getVariable ["vars", [-1, -1]] select 1

#

SQF isn't a fancy language. You gotta break things up into steps.

opal zephyr
#

Ah ok, thankyou! I think ill stick to the first example you gave in this case, one more line of code for the sake of comprehension is better I think. Its super handy to know the second example though

#

Thanks for the help again tonight Leopard and John :)

little raptor
#

it's bad practice

#

the player may have changed

opal zephyr
#

Is it bad to use the player in general, or just for getVariable out of a player?

#

Ok so I have 2 roadblocks implementing all this stuff, the first being that the local variable defined as 0 at the start is then being increased in a function, however when I try and systemchat it, it comes out as ScalarNAN or any. The value doesnt save... (Ill mention the second issue after)

#

Here is an example showing the structure:

_myVar = 0;

Function =
{
"_myVar returns any here"
};

onEachFrame {
call Function
};
little raptor
little raptor
#

You don't pay any attention to where a code executes

#

First of all remember that a code never captures variables

#

It's the caller that defines variables for the code

#

In your code, the EH is executing "somewhere else"
What does it see?
A global variable called Function
And in function you're referencing a var called _myVar

#

But it was never defined

#

If your EH code was like this it would work:

_myVar = 0;
call Function 

Now the caller (call command in this case) defines _myVar for Function

opal zephyr
#

I think im following, since both onEachFrame and EH's are seperate "environments" than the rest of my code, I have to define the variable in that environment as well?

little raptor
#

Yes

granite sky
#

onEachFrame doesn't have a good way to get non-global vars into it. However, there's a better version (addMissionEventHandler with "EachFrame") which does.

opal zephyr
#

I was about to ask that haha

granite sky
#

addEventHandler is always applied to an object (well, or group with 2.10), so setVariable on that object is the natural method.

opal zephyr
#

Would the only way to get local vars into that mission event handler be to set them to an object?

granite sky
#

addMissionEventHandler has a third parameter for vars that are passed into the EH.

#

But note that in SQF, most variables are passed by value, not reference.

little raptor
#

But you can't modify most of them by reference

granite sky
#

Not sure I see the distinction :P

little raptor
#

The distinction is in mem usage

#

E.g. you can't modify a string by ref, but when you do _newStr = _oldStr you're not copying the string

#

It's the exact same string. You simply don't have any commands that can modify strings by ref (e.g. like pushBack for arrays)

opal zephyr
#
_myVar = 5;

addMissionEventHandler ["EachFrame", {
    "_myVar returns as 5 here and is referenced by _myVar"
},[_myVar]];

The wiki for addMissionEventHandler implies that this would work, is that correct?

granite sky
#

Oh right, because you build an array when creating the parameters, and that gets passed by reference.

little raptor
#

You still have to define it

opal zephyr
#

oh right, sorry, it would be with [_thisArgs, _myVar]

little raptor
#

No, it would be with

_thisArgs params ["_myVar"]
opal zephyr
#

How does this example get it then?

_id = addMissionEventHandler ["EachFrame", { systemChat str [_thisArgs, time] }, [time]];
little raptor
#

It's just printing both the current time and _thisArgs variable

#

time is a command

#

Not a variable

opal zephyr
#

oh ok

#

Ok, now that second issue was getting a local variable that's being set in a standard eventHandler out of it and into this missionEventHandler. I know it works by using setVariable, but as you said Leopard, I dont want to be using that with Player. Would the other option be to either use a global variable or create a dummy object to attach that variable to?

granite sky
#

Well, you have to attach the EHs to objects anyway, so setting variables on those same objects is fine. You just have to consider that your mission hangs together with whatever player object switches you allow.

#

Obviously inside the EH you should use the unit parameter rather than player.

opal zephyr
#

I see that mentioned a lot, but the wiki says very little on it apart from cutscenes. When could/does the player object actually change?

granite sky
#

Respawns, although those actually transfer setVariables at some point, and some EHs.

#

And selectPlayer.

opal zephyr
#

Do you know of anywhere I could read up on how it affects it for respawns?

granite sky
#

(Most of?) the ones that are persistent say so there.

opal zephyr
#

Ah so thats what that meant under GetInMan

#

ok

#

It looks like im going to have to use setVariable for all the variables I want to pass into the missionEventHandler. Since its EachFrame, its setting the value in that environment to what it is outside, so that aint gonna work and brings me back to where I was before this bit

#

Ah nope, that wont work either. Since the variable is being used in a timer. Guess that will just have to be a global variable

meager granite
#
    RscNoise_color = [1,1,1,0.5];
    123 cutRsc ["RscNoise", "PLAIN", 1e-6];
```Sometimes when I `call` above script from editor's vehicle init field (my mission scripts origin), `RscNoise_color` is not initialized and `nil`. I can't figure out why this might happen, I never nil it anywhere myself, I searched through all game scripts and nothing nils it either. My assumption was that game clears mission namespace variables on mission start and I somehow set the variable before that, but I *think* my other variables are fine? (Didn't test them last time this issue happened, it happens very rarely) Any ideas what might happen here?
pulsar bluff
#

why not just use pre init function for mission script origin

little raptor
#

You say it's nil, but where?

#

If in another object's init, or at pre-init ofc it can be

#

But if neither of those two, then your script is not executing (e.g. you're not calling it as you said, but it's spawn which might take some time to execute if scheduler is busy, or you're calling a non-existing function)

meager granite
#

Both lines are right next to each other, I see standard noise but it uses default [1,1,1,1] color (white static) and when I ran isNil"RscNoise_color" it returned true. Sadly I can't reproduce this issue, but I had it happen several times out of hundred runs.

meager granite
#

Welp, I guess at this point I need to see it happen again to do proper testing to see what's up.

modern meteor
#

Hi, is there a way to stop playing a sound which was started with playSound?

modern meteor
#

And another question, is there a way to increase the volume of a sound which is defined in CfgSounds?

pearl glen
#
          if ( !isPlayer _x ) then {
                _x setdamage 1;
            } foreach units delete1;```
what the problem? Error...
little raptor
#

incorrect brackets

#
{
  if ( !isPlayer _x ) then {
    _x setdamage 1;
  }
} forEach units delete1;
drifting portal
little raptor
#

_Code = str ...
_Code = _Code trim ["{}", 0];
wat? use toString

pearl glen
#

How to correct add multiple groups (delete1, delete2...) for this? Doesnt work, tried many ways

{
  if ( !isPlayer _x ) then {
    _x setdamage 1;
  }
} forEach units [delete1, delete2, delete3];```
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
little raptor
#

second of all, you can do either of these:

{
  {
    if ( !isPlayer _x ) then {
      _x setdamage 1;
    }
  } forEach units _x;
} forEach [delete1, delete2, delete3];
{
  if ( !isPlayer _x ) then {
    _x setdamage 1;
  }
} forEach (units delete1 + units delete2 + units delete3);
drifting portal
#

Is this possibly what causing the user input disable?

drowsy geyser
#

is there a way to place a progressBar vertical?
im using this but it is horizontal by default (wiki example)

    with uiNamespace do {
        bar = findDisplay 46 ctrlCreate ["RscProgress", -1];
        bar ctrlSetPosition [0,0,1,0.01];
        bar ctrlCommit 0;
        bar progressSetPosition 0.75;
    };
little raptor
#

you're trimming all {}s

#

which can happen if you had something like }}

#

if not that make sure you return false at the end of the code

#

your false is currently in the if

little raptor
#

not sure if there's a default vanilla one

drifting portal
#

So that's why

little raptor
#

yes

#

params returns true

#

but your if is after it thonk

#

I don't see why it would override anything

drifting portal
drifting portal
#

Like I can't escape etc, have to alt +f4

little raptor
#

try the stuff I said first

drifting portal
#

Yes sir

drifting portal
drowsy geyser
#

what do you mean by increase its height?

little raptor
#

nvm that

drowsy geyser
#

thank you!

drifting portal
drifting portal
little raptor
#

there shouldn't be any problem anymore blobdoggoshruggoogly

drifting portal
little raptor
#

unless there's a problem in that code you spawn thonk

#

remove that spawn, see what happens

drifting portal
#

but why would the spawn disable input is what is confusing me

little raptor
#

well try an empty spawn first

#

[] spawn {};

drifting portal
#

alright

little raptor
#

but I'm pretty sure that works fine too

modern meteor
drifting portal
little raptor
modern meteor
#

Is there a way to increase the volume of a sound which is defined in CfgSounds?

#

Or do I have to manipulate it with a sound editor?

little raptor
little raptor
#

no, I mean moveIn/out

#

try long sleeps between different parts to see where input is bugging out

drifting portal
pearl glen
#

what am I suppose to add in waitUntil condition, to execute after briefing ends and game starts?

little raptor
drifting portal
little raptor
#

maybe add a moveOut after that in 3 secs

#

see what happens

drifting portal
little raptor
#

I've never run into any issues moving units out then in

drifting portal
little raptor
#

¯_(ツ)_/¯

drifting portal
little raptor
#

try isNil

drifting portal
#

The eject seat?

#

How is it nil tho

little raptor
#

wat? I mean run it unschd:

isNil {
  moveOut _bla;
  _bla moveInAny _blabla
}
drifting portal
#

Oh alright

acoustic abyss
#

I'm aiming to play an introduction sound, without background noise. However, fadeSound interferes with playSound. Is there another way of playing a custom sound?

drifting portal
acoustic abyss
drifting portal
little raptor
velvet merlin
#
20:08:45 Wrong color format #000ÿ
20:08:45 XML parsing error in 't', code: <t ><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>B</t><t colo...
20:08:45  ➥ Context:     [] L189 (A3\functions_f\GUI\fn_typeText2.sqf)
    [] L187 (A3\functions_f\GUI\fn_typeText2.sqf)```
#

tried to add some logging, but the string gets too long that BI function constructs for diag_log (would need to log char by char)

#

does index out of bound access exist in RV engine?

#

20:08:45 ["_frameMerged","<t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>B</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>r</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>a</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>v</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>e</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'> </t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>m</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>n</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>a</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>r</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#00000000' sha 20:08:45 ["_frames",[Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol]] 20:08:45 ["_rootFormat","<t >%1</t>"]

#

thats my logging

#

happens here the first time

#
20:08:44 ["_frameMerged - _x","<t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>l</t>"]
20:08:44 ["_frameMerged","<t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>B</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>r</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>a</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>v</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>m</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>n</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>a</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>r</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#000
20:08:44 ["_frames",[Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol]]
20:08:44 ["_rootFormat","<t >%1</t>"]
20:08:44 Unknown attribute col
20:08:44  ➥ Context:     [] L189 (A3\functions_f\GUI\fn_typeText2.sqf)
    [] L187 (A3\functions_f\GUI\fn_typeText2.sqf)

20:08:44 XML parsing error in 't', code: <t ><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>B</t><t colo...
20:08:44  ➥ Context:     [] L189 (A3\functions_f\GUI\fn_typeText2.sqf)
    [] L187 (A3\functions_f\GUI\fn_typeText2.sqf)```
little raptor
#

I have no idea what I'm looking at... 😅

#

but you have 2 errors in the rpt

velvet merlin
#

its the quote feed into fn_typeText2.sqf

#

the function adds the structured text formatting automatically to it

drifting portal
velvet merlin
#
//pre-process the frames
private["_frame","_frames","_frameId","_charId","_frameMerged"];

_frames = [];

{
    _frame   = [];
    _frameId = _forEachIndex;

//diag_log ["_frameId",_frameId];
//diag_log ["_charsShown 2",_charsShown];
    //combine the characters into frames
    {
        _charId = _forEachIndex;

        if (_charId <= _frameId) then
        {
            _frame set [count _frame,_x];
        }
        else
        {
            _frame set [count _frame,_charsHidden select _charId];
        };
//diag_log ["_charsShown 3",_charId,_x,_charsHidden select _charId];
    }
    forEach _charsShown;

    //merge frame characters into a string
    _frameMerged = "";

//diag_log ["_frame",_frame];
    {
//diag_log ["_frameMerged - _x",_x];
//diag_log ["_frameMerged",_frameMerged];
        _frameMerged = _frameMerged + _x;
    }
    forEach _frame;

//diag_log ["_frames",_frames];
//diag_log ["_rootFormat",_rootFormat];
    _frames set [count _frames, parseText format[_rootFormat,_frameMerged]];
}
forEach _charsShown;```
#

forEach _charsShown twice stacked doesnt look right

little raptor
#

as far as I see it's just constructing each "frame" of the text (one frame per character)

#

the algorithm is extremely inefficient but looks fine

#

the problem appears to be due to using format

#

it can't handle strings longer than 8 KB

#

(total size after format)

velvet merlin
#

ok so its index out of bound essentially

#

probably cuts the remaining bits which leads to a different character

#

which then the xml parser doesnt like

little raptor
#

format could be breaking the text tho

#

making it incomplete (e.g. the ending could be <t>blabla<" which is wrong ofc)

modern meteor
#

I have three different sound files. Is there a way to pick one randomly with the say3D command?

#

They are all defined in description.ext

modern meteor
#

Works. Thank you Leopard.

modern meteor
#
loop = true;
while {loop} do {
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];

sleep (5 + random 10);

};

player addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
    deleteVehicle object;
}];```
#

This is producing an error

#

Seems it is related to the sleep?

#

But how can I add a random delay to a loop?

hallow mortar
#

It would help to know what the error actually says.

Also, this loop is creating a new bucket every time it runs and not removing the existing one. Over time this will add up to quite a lot of buckets.

opal zephyr
#

You could try something like this

loop = true;
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;

while {loop} do {
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];

sleep (5 + random 10);

};

player addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
    deleteVehicle object;
}];
#

^Doing this might affect the script elsewhere though since it will never be created again once its deleted

hallow mortar
#

The reference to "seems it is related to the sleep" - which I wish they would elaborate on by posting the actual error - leads me to suspect this is being done in a context where sleep is not allowed, such as an init field

opal zephyr
#

^your probably right

#

@modern meteor Use "canSuspend" to check if you can use sleep

modern meteor
opal zephyr
#

what if they never reload..?

modern meteor
#

I do!

#

If I want to stop the radio transmission

opal zephyr
#

Yes, but before you reload a bucket is created every cycle, there could be thousands

modern meteor
#

Ah, i see what you mean

hallow mortar
#

Only the last-created bucket is referenced by the object variable. Every previously created bucket is still out there and does not get deleted.

opal zephyr
#

@modern meteor What is the actual error that is displaying?

modern meteor
#

Error suspending not allowed in this context

#

Referring to sleep

opal zephyr
#

Where are you calling this code?

velvet merlin
#

it produces non standard characters

modern meteor
#

I tried

loop = true;
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;

while {loop} do {
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];

sleep (5 + random 10);

deleteVehicle object;

};

player addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
    deleteVehicle object;
}];```
opal zephyr
#

Is that just for testing, or will you be calling it somewhere else in the future?

modern meteor
#

for testing

#

want to loop it in an sqf which

#

starts from init

spark turret
#

hello, i have a bunch of VR arrows outlining an area. i would like the arrows to dissapear when ZEUS presses backspace, like if they are HUD overlays.
Is there an easy way to do that or is it not worth the trouble?

opal zephyr
#

ok, your gonna have to use spawn in your code then itraxx

#

one sec

#
loop = true;
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;

spawn {
    while {loop} do {
    object say3D selectRandom           ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];

    sleep (5 + random 10);

    deleteVehicle object;

    };
};

player addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
    deleteVehicle object;
}];
#

@modern meteor Try that, it incorporates "spawn" which is an environment you can call sleep in

modern meteor
#

trying

#

1 sec pls

#

this gives me an error on spawn

#

in the console

opal zephyr
#

whats the error....

modern meteor
#

Error missing ;

opal zephyr
#

what line

#

oh sorry, add this infront of spawn []

#

I just tried it locally and it seems to run fine

modern meteor
#

Still testing

#

Would this script play one of each file on repeat during a mission with random sleep?

opal zephyr
#

It looks like it would only do it once because you are deleting the object after it does it

#

Is this the whole script or is there more?

modern meteor
#

This is the whole script

opal zephyr
#

And what is it exactly that you want to be happening?

modern meteor
#

For me it's not repeating

#

I guess because the object got deleted

opal zephyr
#

yup

modern meteor
#

because we spawn the object outside the loop

opal zephyr
#

Do you want audio files to play and then stop when you reload?

modern meteor
#

yes exactly

opal zephyr
#

When do you want them to start playing again?

modern meteor
#

or delte the object after the random sleep

modern meteor
#

like evey 4-7 min

opal zephyr
#

ok, you have no code setup to be doing that bit

modern meteor
#

the sound files are 1 min each

#

no, i don't have any other code for this

#

This is all i have so far

opal zephyr
#

Do you know what you should be doing for it to have the audio file play ever 4-7 minutes?

#

Another thing, the way the code is ordered, im not sure your event handler is coming into effect until after the object has alredy been deleted following the sleep

modern meteor
#

Unfortunately i don't know a better solution. The idea is to play 1 out of 3 files every 4-7 minutes with the option to stop the transmission manually but not deleting the loop (i use reload for that)

opal zephyr
#

In testing are your audio files finishing? It looks like the code would force them to end after 5 to 15 seconds

#

despite them being a minute lol

spark turret
#

your loop deletes the object/bucket on the first run

#

is that intended?

modern meteor
#

to see if it stops and loops to the next one

#

once it works i will extend the loop

modern meteor
spark turret
#

so you want to randomly play a sound every couple seconds for the player, until some outside event happens?

opal zephyr
#

mm I dont think its a problem, since deleting it is the only way to play a new sound. The issue is that its not being created again

spark turret
#

how about this?

spawn {
    while {!isNull object} do {
    object say3D selectRandom           ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];

    sleep (5 + random 10);
    };
};
#

are you sure you need to tdelete the object to play a new sound? sounds sketchy

modern meteor
#
loop = true;

[] spawn{
    while {loop} do {
    object = "Land_Bucket_F" createvehicle (getpos player);
    object attachTo [player,[0,0,0],"head"];
    hideObject object;
    object say3D selectRandom           ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];

    sleep (5 + random 10);

    deleteVehicle object;
    hint "deleted";

    };
};

player addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
    deleteVehicle object;
}];```
#

this seems to be working

#

is there any disadvantage to it

#

should only have one bucket attaached at time

opal zephyr
#

well itraxx really shouldnt be using the attachobject as the sound source, however the wiki says that only one sound can be played at a time, and the only way to stop the sound is to delete the vehicle

modern meteor
#

delete it before attaching new one

modern meteor
#

cannot stop the sound otherwise

opal zephyr
#

I know, one sec

spark turret
#

can always teleport the object on a loop instead of attaching it, if thats an issue

#

0.1 setPosWorld getPosWorld

opal zephyr
modern meteor
#

yes

opal zephyr
#
[]spawn {
    _loop = true;

    player addEventHandler ["Reloaded", {        
        deleteVehicle sound;
    }];

        while {_loop} do {
        
        sleep (240 + random 180);    
        sound = player say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];

        sleep 62;
        deleteVehicle sound;
        };
};

This is how I would write it, I believe it should work. This way your just deleting the sound "object" and not the actual object that you were using to attach to the player. Ive subbed that object out with the player itself

#

The way thats written, every 4-7 minutes a sound file is played, after 62 seconds the sound is deleted. If at any point during that time you press reload then it deletes the sound

brazen lagoon
#

any suggestions on how to place a flag on top of a building via script?

opal zephyr
#

How do you want to determine the building? By its type, location, or something else?

brazen lagoon
#

object

#

i want to pass in a building object and put a flag on top

granite sky
#

Completely arbitrary buildings possible, or can you make a list?

opal zephyr
#

I would just createVehicle with your flag, and then move it up to the top of the building

#

assuming its the same building each time

#

If its any type of building being entered, you could maybe use boundingBoxReal in combo with boundingCenter to get the vertical height of the building, and then use that to put the flag on top

granite sky
#

Except that the highest point of the building isn't necessarily a suitable surface, and isn't necessarily in the center.

brazen lagoon
#

got it its actually simpler than I thought

#

I thought i'd have to do attachto

#

yeah, but that's fine. if it doesn't work perfectly on all building w/e

#
_flag = "Flag_VZ_F";
_house = cursorObject;

_obj = _flag createVehicle position _house;

_newpos = (position _house) select [0, 2];
_newpos pushBack (_house call alive_fnc_getrelativetop);

_obj setpos _newpos``` this works fine
#

well enough anyway. going to test it more on more houses

#

alive_fnc_getrelativetop is ```sqf
ALiVE_fnc_getRelativeTop = {

_object = _this;

_bbr = boundingBoxReal _object;
_p1 = _bbr select 0; _p2 = _bbr select 1;
_height = abs((_p2 select 2)-(_p1 select 2));
_height/2;

};```

modern meteor
hallow mortar
#

I have a system where the player can type in a grid reference and get artillery dropped on the centre of that grid square. Thus:

if ((count ((toLower _text) regexFind ["\d{6}"])) > 0) then {
            _fsGrid = (((_text regexFind ["\d{6}"]) select 0) select 0);
            _fsGridPos = (_fsGrid call BIS_fnc_gridToPos) select 0;
            _fsGridCentre = _fsGridPos vectorAdd [50,50];
            _responseText = "Roger, message received. Stand by for fire support.";
            _newEvent = "SUPPORT";
            
            // gm_shell_155mm_he_m795
            // sh_155mm_amos
            // gm_shell_155mm_he_dm111
            missionNamespace setVariable ["njt_story_support_cooldown",true,true];
            [_fsGridCentre] spawn {
                sleep 20;
                [_this select 0,"sh_155mm_amos",100,6,3,{false},0,350,1] spawn BIS_fnc_fireSupportVirtual;
                sleep 200;
                missionNamespace setVariable ["njt_story_support_cooldown",false,true];
            };
        } else {```
(there is a proper else case but it doesn't matter here)
The problem: in local MP, everything works as expected. Plug in your own grid ref and get shells on your face. However, on DS, the artillery never arrives. Everything up to that works - the "stand by for fire support" message is sent. But, no explosions.
This script is executed on the server.
A valid grid ref must be received since it checks that in order to accept the request. Everything after that is fairly simple and I can't see anything that would be different between local and DS. And the bis_fnc_firesupportvirtual spawn does work when server executed in the debug console with a dummy position.
little raptor
hallow mortar
#

The content of a chat message from a handleChatMessage EH (string)

little raptor
#

is that code being executed on the server?

hallow mortar
#

The handleChatMessage EH is not (custom channels aren't detected by EHs on the server for some reason). That EH does this:

[_text,_person] remoteExec ["njt_fnc_storyResponse",2];```
and the code above is in njt_fnc_storyResponse.
#

The if check at the top ensures the string contains a valid 6 digit grid reference (or, well, a 6 digit number, but I definitely typed in a valid reference). If it doesn't, it would never get to the _responseText part. That's tested. So...the only thing I can think of is maybe BIS_fnc_gridToPos not working on DS. But that doesn't make any sense to me.

little raptor
#
ctrlMap = finddisplay 12 displayctrl 51;
_mapPos1 = _ctrlMap ctrlmapscreentoworld [0,0];
_mapPos2 = _ctrlMap ctrlmapscreentoworld [1,0];
_mapPos1 set [2,0];
_mapPos2 set [2,0];
_mapSize = round ((_mapPos1 vectordistance _mapPos2) / ctrlmapscale _ctrlMap);
hallow mortar
#

oh for f...

#

thanks BI

#

Okay, I guess I have to move the grid reference check into the local EH. What a pain.

granite sky
#

Anyone know a way to get AI squads a bit keener about following move waypoints without completely ignoring enemies?

little raptor
granite sky
#

Nope. I'll give it a shot.

granite sky
#

Still weird but probably an improvement, thx.

granite sky
#

Hmm. Until one squad turned around and walked 700m back towards me despite knowsAbout 0.

hallow mortar
#

Welcome to the hell that every Zeus player faces every game

#

If you use LAMBS Danger, that might have some waypoints or functions that might be useful. Rush or Assault or something IIRC

wanton swallow
#

I have a trouble with CfgFunctions for compiled scripts. Maybe here can't help?
There my message #arma3_config message

drifting portal
granite sky
#

I think I may have actually bugged out waypoints such that the ones shown on Zeus and returned by waypoint commands are not the ones they're actually following.

drifting portal
granite sky
#

Yeah, but I'm deleting all the previous ones first with:
while {count waypoints _group > 0} do { deleteWaypoint [_group, 0] };

#

And I suspect that's desyncing them.

drifting portal
#

maybe, why don't you dynamically create them?

#

createUnit, createVehicle, etc

granite sky
#

This is all dynamically created.

#

But I figured it's cleaner to clear out obsolete waypoints.

drifting portal
#

well yeah I can see the zeus units still wonder around despite being given waypoints

#

they usually like to be like 100m away from the waypoint actual location

granite sky
#

Thing is, one of the waypoints is clearly marked in the wrong place but the units are going the right way :P

drifting portal
#

hmmm

#

well I hope you don't get the [0,0,0] waypoint glitch in zeus

#

where units decided to seek out [0,0,0] for sake of being AI

granite sky
#

That's partly why I delete the things. Sometimes units spawn with a [0,0,0] for some reason.

drifting portal
#

I don't think deleting them matters

#

even added waypoints sometimes get overridden by [0,0,0]

#

well if you are stuck you can always use lambs

granite sky
#

No, I really can't :P

drifting portal
pulsar bluff
#

is there any way to force a static turret to fire without a gunner?

granite sky
#

Right, this works far better without the waypoint clearout.

#

I wonder if I can replicate this well enough for someone to actually bother poking the AI code :P

#

Depending on the turret you could maybe fake it by spawning ammo...

hallow mortar
granite sky
#

Do the UAV AIs work?

drifting portal
drifting portal
#

you mean as fake turrets?

granite sky
#

Like can you put the AI crew from UAVs into other vehicles.

#

Simpler way is probably to just use normal crew and hide them, but I'm curious.

drifting portal
#

idk try doing
moveout gunner (vls)

#

see what happens

#

obviously spawn a VLS

drifting portal
granite sky
#

Wasn't my question in the first place. I have no personal interest in invisible gunners :P

drifting portal
#

kinda reminded me of something with the hidden units since somebody in pub zeus kept trolling me by attaching a brick to my player model and hiding the player model.
couldn't play against enemies since my hitbox was nonexistent

warm venture
#

not even a placeholder box, the function just does like nothing

drifting portal
warm venture
#

correct...

#

i dont get why its broken on mine.

#

theres no reason for it to be

drifting portal
#

well Leopard is far better than me on such an issue

#

hope he hops on soon

warm venture
#

@little raptor any idea...?

warm venture
#

my server

#

I tried in debug console too its something with my mission but I dont know how.

#

works with different missions

little raptor
#

Also I assume you mean the vanilla debug console right?

warm venture
#

infistar

little raptor
warm venture
#

admin tool

#

none of these work

little raptor
warm venture
#

Yes

#

just not that function

#

in sqf files, debug console, nothing.

little raptor
#

Have you put its description.ext in your mission folder?

#

I mean that framework's description.ext

warm venture
#

it is

drifting portal
warm venture
#

nope

#

it does if i put in a different mission..

drifting portal
little raptor
drifting portal
#

Yep

little raptor
#

My guess was busy scheduler but you said other scripts work, so... blobdoggoshruggoogly

warm venture
#

exactly makes no sense.

drifting portal
#

The arma3server at it again

warm venture
#

yep...

#

buggiest game ever made

little raptor
#

It has nothing to do with the game

warm venture
#

lol

#

it has everything to do with the game.

little raptor
#

Functions are not part of the game to begin with

#

They're just scripts
Plus you said yourself that it doesn't work in only one of your missions. It's pretty obvious its your own mission's fault

drifting portal
#

Alright nvm I was addressing the wrong message

#

8am and its consequences

drifting portal
warm venture
#

Cant

#

its a builtin function

little raptor
#

You can break things in many ways

#

I can't look at the function rn to tell what could be wrong

drifting portal
drifting portal
#

Or something else not running due to something

little raptor
#

No, I mean like breaking a display or cutRsc or sth

drifting portal
#

Yep

#

That's very sound

warm venture
#

Cant break the built in ones

drifting portal
#

Not the function itself

#

You might be breaking something which the function relies on

simple pendant
#

Has anyone ever used SandStorm script on Mulitplayer?

#

this script

#

ROS Sandstorm

versed widget
#

does anyone knows the parent class for wheels ?
there is wheel_1_1, wheel_1_2 ...etc and goes endlessly especially for 8x8 APCs

versed widget
#

.. nvm i will use getText

little raptor
drifting portal
#

is there a way to prevent a shell from exploding?

little raptor
#

you can enableSimulation false it

#

but it won't move either

drifting portal
#

prevent it from exploding upon hitting something

#

I'm basically using a rocket to lift an object, and I don't want something unexpected to make the rocket explode during gameplay

little raptor
#

do you have to use a rocket?

drifting portal
#

yes