#arma3_scripting

1 messages ยท Page 3 of 1

cedar cape
#

alr

little raptor
#

it might break subsequent waypoints for that group

cedar cape
#

oh

#

im tryna have it so it flys to a waypoint and then rappels the player

#

but im activating the rappel script using a trigger

#

and the ai keeps flying not exactly on the waypoint so the trigger doesent activate

little raptor
#

well try that script for now and see how it works

cedar cape
#

alr

#

do i put it in on activation

#

oh no

#

it gave me an error

little raptor
cedar cape
#

alr

#

alr

#

it doesent really work

#

heli just spins around that area

little raptor
#

well vanilla pilots are terrible and they can't correctly fly exactly to a position

cedar cape
#

is there a mod that changes it

#

makes the pilots better

little raptor
#

not really

cedar cape
#

sad

little raptor
#

why not use unit capture?

cedar cape
#

whats that

little raptor
#

you fly the heli yourself and capture its movement

cedar cape
#

wait thats a thing???

#

how do i do this

little raptor
cedar cape
#

ok so

#

how do i start doing it

#

the wiki is confusing

hearty quiver
#

When this question is solved, I have one more myself

little raptor
# cedar cape the wiki is confusing

what part of it is confusing? you just use the command and put the variables you need:

[unit, duration, FPS, firing, startTime] spawn BIS_fnc_unitCapture
``` it even has an example
```sqf
[BIS_Vehicle, 50, 30, true, 10] spawn BIS_fnc_unitCapture;
#

then it starts recording

cedar cape
#

what are the numbers

little raptor
cedar cape
#

is that the length it records for

cedar cape
little raptor
cedar cape
#

ah

#

what does startTime do

#

is that the time it starts at or something

little raptor
#

it's like a counter before it starts recording after you've run the command

cedar cape
#

can i set it to record when i do something

#

nvm

#

alr

#

will it say when its recording

#

or not

little raptor
#

and start flying

#

increase the first 50 if your flight time is longer

cedar cape
#

can i set it higer than 50 and then stop it

#

because idk how long it will take

little raptor
#

yes

#

using Esc

cedar cape
#

how do i stop recording

#

ok

little raptor
#

just set it to 1000

cedar cape
#

alr

#

so

#

where do i put that code

little raptor
#
[blackHawk, 1000, 50] spawn BIS_fnc_unitCapture
cedar cape
#

is it in a trigger or something

little raptor
cedar cape
#

alr

#

so

little raptor
cedar cape
#

how do i play back

little raptor
#

paste the data to a file

cedar cape
#

yep

#

what do i do with the data

#

in the file

little raptor
cedar cape
#

alr

#

sorry if i sound really stupid lol

#

ive never done this before

hearty quiver
#

My second question is how to add actions/code to a spawned vehicle. I'm specifically looking to add an ACRE rack, the ability to change the waypoint (and associated loiter) and the ability to despawn the aircraft and teleport the player back to a specific spot

#

this addAction ["Create Covey",
{
_Covey = createvehicle ["uns_ov10_usaf", getMarkerPos "AO", [], 0, "FLY"];

_Pilot = [[0,0,0], WEST, ["vn_b_men_aircrew_25"],[],[],[],[],[],232] call BIS_fnc_spawnGroup;
((units _Pilot) select 0) moveInDriver _Covey;
player moveInGunner _Covey;

_wpCovey = _Pilot addWaypoint [getmarkerPos "AO", 800];
_wpCovey setWaypointType "LOITER";
_wpCovey setWaypointLoiterRadius 200;
_wpCovey setWaypointLoiterType "CIRCLE_L";
_Pilot setBehaviour "CARELESS";
}];

cedar cape
#

is it possible to disable the init.sqf

#

the intro sequence still hapens

little raptor
little raptor
#

on first line

cedar cape
#

what does that do

little raptor
#

skips it

cedar cape
#

ah

#

and then i remove when im ready correct?

little raptor
#

ye

cedar cape
#

wait

#

i have a problem

#

with capture

#

i want it so the heli waits until player gets in

#

then takes off

#

if im controlling the pilot

little raptor
#

you can do that with unit play

#

just do the capture

cedar cape
#

so like

#

ok

little raptor
#

get in the heli

#

start unit capture

cedar cape
#

ok

little raptor
#

start the engine and fly
once you're done hit Esc

cedar cape
little raptor
#

no

#

that's FPS

cedar cape
#

or does it start as soon as i excute it

#

ah

#

so it starts as soon as i execute the command

little raptor
#

yes

little raptor
#

also next time post your codes with syntax highlighting

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
hearty quiver
#

Oh, my apologies

little raptor
#
this addAction ["Create Covey",
{
_Covey = createvehicle ["uns_ov10_usaf", getMarkerPos "AO", [], 0, "FLY"];
_Covey addAction ["My action", ...];

_Pilot = [[0,0,0], WEST, ["vn_b_men_aircrew_25"],[],[],[],[],[],232] call BIS_fnc_spawnGroup;
((units _Pilot) select 0) moveInDriver _Covey;
player moveInGunner _Covey;

_wpCovey = _Pilot addWaypoint [getmarkerPos "AO", 800];
_wpCovey setWaypointType "LOITER";
_wpCovey setWaypointLoiterRadius 200;
_wpCovey setWaypointLoiterType "CIRCLE_L";
_Pilot setBehaviour "CARELESS";
}];
cedar cape
#

small problem

#

im shit at flying

little raptor
cedar cape
#

but like

#

its the hovering

#

it took me so long to get into hovering above the trees

#

the player would have rappeled already

#

in the time it took me to hover on the waypoint

little raptor
cedar cape
#

i did

#

but it took a while to get it in the right place

#

because its rappeling into trees

#

it needs to be exact

#

or the player breaks both thier legs

little raptor
#

no it has several errors

cedar cape
#

ok so

#

i have data

#

what do i do with it now

little raptor
#

as for the syntax highlighting:
you type 3 `
```
then type sqf
then hit enter (next line)
```sqf
hint

and then end with ```

```sqf
hint
```

hearty quiver
#
this addAction ["Create Covey",     
{     
_Covey = createvehicle ["uns_ov10_usaf", getMarkerPos "AO", [], 0, "FLY"];
_Covey add action ["Retask", {Action of interest};];
_Covey [_Covey ["ACRE_VRC64", "Upper Dash", "Dash", false, ["inside"], [], "ACRE_PRC77", [], ["intercom_1"]], false, {}] call acre_api_fnc_addRackToVehicle;   
}];```

So, theoretically, this would work? I've peered through the ACRE documentation a few times already and that add rack fnc is giving me a lot of trouble. I'm not sure what I'm doing wrong with it either
#

Aha

cedar cape
#

ok

little raptor
#

put the data in a file called data.txt in the mission folder

#

then put that code in a trigger

cedar cape
#

ok its all in data.txt

#

do i delete the ai waypoints i made

#

actually

little raptor
#

it doesn't matter

#

AI can't do anything during unit play

cedar cape
#

if this doesent work

#

or it goes wrong

#

are you any good at flying

#

because if the player gets killed

#

its down to my shit flying skills

little raptor
#

I am but I won't do it blobdoggoshruggoogly

#

just practice

cedar cape
#

sad

#

so i put [blackhawk, parseSimpleArray loadFile "data.txt"] spawn BIS_fnc_unitPlay into the trigger correct?

little raptor
#

it has nothing to do with ACRE

#

your SQF code was wrong (incorrect syntax)

cedar cape
#

alr

little raptor
#

the trigger that fires after the player gets in

#

or was it just init.sqf?

cedar cape
#

i put it in a trigger

#

i could put it in init.sqf

#

infact i might do that

#

so i have as little stuff in the mission as possible

little raptor
cedar cape
#

also

hearty quiver
cedar cape
#

can i enable interior light by default

#

like its already on

#

using a script

cedar cape
#

thats for a door isnt it

#

or does the same thing work with the light

little raptor
cedar cape
#

bruh

#

heli wont stay in the same place

#

this unit capture thing is annoying me

#

i swear i had hovered at this point

#

but it keeps hovering

#

flying up

#

hovering

#

flying up

little raptor
cedar cape
#

no

#

i press esc

#

oh wait

#

i stopped as soon as i hovered

little raptor
#

then how do you expect your hovering data to be there?

cedar cape
#

thats why

#

im so smart

#

HDWSADF

#

i will just ask one of my friends to fly it

#

who is much better at flying than i am

hearty quiver
#

Thanks for the help Leopard. It's been much appreciated, especially when I've been essentially just teaching myself SQF scripting

cedar cape
#

thanks aswell

#

the entire start of my mission wouldnt be in existance if you didnt help

pliant cradle
#

Good Evening, does somebody know if it is possible to use BIS_fnc_timeline_play on a dedicated Server? I tried so much fifferent ways to call. By Code direct in Script, as separate remoteExec Script, calling as Trigger, calling as Function and nothing worked. I also used the call BIS_fnc_timeline_init before and I am complete clueless, now. On SP and MP it works and so I expect it should work also on Dedicated. I am so thankful for any ideas ๐Ÿ™‚ Thanks a lot.

pliant cradle
#

Yeah, I know this page. Thanks. But it begins that I can't found out inside the Bohemia Wiki if this Modul is working from localisation like Triggers for example.

little raptor
#

but either way the solution is using remoteExec

hollow adder
#

Hello. I need a few commnds.

#

How do I make
Myself invincible
My friend invincible
Our vehicle invincivle
Our vehicle have infinite ammo

pliant cradle
open fractal
#

there's multiple ways to do infinite ammo, you can probably find some variation of that with a quick google

hollow adder
#

@open fractal

#

How do I make other players invincible

#

player allowdamage false; worked, but only on the player doing it

open fractal
#

it takes a local argument so it has to be executed on the player's machine

#
[_player, false] remoteExec ["allowDamage",_player];
``` `_player` being your variable for the player
hollow adder
#

Wait

#

but does he replace something with my name or whatever

hollow adder
#

Not sure why

#

he tried ["Hello"] remoteExec ["hint"]; and it worked

#

I saw hint

open fractal
#

how did you define _player?

hollow adder
#

I don't know

#

what is it supposed to be

#

He just did that command

open fractal
#

replace _player with the variable you set for the player unit

hollow adder
#

What variable did I set for that

#

what unit

#

we are in a mission

open fractal
#

um

#

your mission?

hollow adder
#

no we're in antistasi

open fractal
#
{[_x, false] remoteExec ["allowDamage",_x]} forEach allPlayers;
#

do this i guess

#

you should share more context to begin with if you want help in the future

smoky rune
#

is there any reliable way to get building real height?
i'm trying to use

private _buildingBoundingBox = 0 boundingBoxReal _building;
    private _p1 = _buildingBoundingBox select 0;
    private _p2 = _buildingBoundingBox select 1;
    private _maxHeight = abs ((_p2 select 2) - (_p1 select 2));

and it's still returns position 1-2-4 meters higher than it should

dreamy kestrel
#

hello, refreshing my VS Code bits, I seem to recall there was an updated LINT or something like that? anyone happy to have that reference handy? thanks...

dreamy kestrel
runic quest
#

hi friends

#

How drawIcon3D corresponds to the image texture in the task file?

dreamy kestrel
# little raptor wat?

IDK where you got that info from... this is from the Code extensions marketplace v2.0.3 ...

Released on 11/19/2015, 05:10:25
Last updated 3/14/2019, 16:00:47
Identifier armitxes.sqf

Versus v2.0.6

Released on 4/11/2022, 10:21:18
Last updated 4/14/2022, 17:24:27
Identifier blackfisch.sqf-language
#

Ah I see... LINT versus 'language' yessir...

#

although if that LINT is a fork, as forks go, 0.12 is 'more recent' in release date only, not a 0.13, in version number only, FWIW... how confusing is that. ๐Ÿคฃ

#

if I was the maintainer there, I might bump the version out beyond 0.13+ at least, to avoid confusion

storm arch
#
    a = 0;
    testDummie removeAction _myID;
    }];``` How do I get _myID not undefined in this
dreamy kestrel
storm arch
#

Is it not possible to pass it through params in this instance?

winter rose
#

and thou art correct ๐Ÿ™‚

winter rose
#

you can alternatively setVariable the action id

hollow adder
#

How do I heal all units?

#

more specifically players

#

I don't want to heal ai

winter rose
hollow adder
winter rose
#

no idea

tight cloak
#

if that doesnt work: try

{
_x call ACE_medical_treatment_fnc_fullHealLocal;
} forEach allPlayers;

only reason i give you two methods is because im not 100% certain on syntax for all players, ive only ever healed individuals via script

winter rose
#

fullHealLocal, doesn't it require remote execution?

tight cloak
#

good question, not 100% on that

#
"ACE_medical_treatment_fnc_fullHealLocal" remoteExec [call, -2]; 

would work, -2 being every client not the server

granite sky
#

You can't skip the parameter.

#

also syntax is pretty busted there

#

probably best to use fullHeal instead, and then you can just do this:

{
    [_x, _x] call ace_medical_treatment_fnc_fullHeal;
} forEach allPlayers;
frigid oracle
#

Is there a guide to optimizing while loop performance somewhere?

little raptor
#

nvm that page doesn't have what I wanted

#

anyway, a while loop has pretty much nothing to optimize. at least not the loop itself

granite sky
#

SQF optimisation is mostly about using as little of it as possible :P

frigid oracle
#

in my case a loop that creates a beep warning. while a condition is true. idk if there is a better practice for such a thing. lemme post what I got

little raptor
#

you can use sound sources instead

#

other than that there's nothing you can do for looping sounds

frigid oracle
#

so pretty much
say2d then sleep is all I got to work with?

granite sky
#

Well, sleep as long as possible, but that was probably obvious.

little raptor
frigid oracle
#

what does sound source mean in this case?

little raptor
#

you can also play it as music meowsweats

frigid oracle
#

is this faster than using say2d on the player?

little raptor
#

well sound sources are 3D

#

but the engine handles the looping so definitely faster

#

you just call the command and that's it

#

and when you want it to stop you delete the source

frigid oracle
#

another idea I thought in my head was having long sleeps but it "compiles" a sequence for sounds.

#

the case for this would be geiger ticks. I think playing the same audio track is kinda boring so im trying to spice it up with random ticking. But im realizing arma might hate this.

tough abyss
#

Pretty sure sound sources have support for random sound selection

#

Could just put different tick noises in as separate sounds and have it pick randomly as it plays

frigid oracle
#

Yeah its pretty much doing that already. From looking at the code optimization wiki page I think Lazy evaluation can help with the speed im worrying about.

tough abyss
#

Lazy evaluation definitely helps

#

Though as others said the best optimisation with sqf is generally just using as little as possible

frigid oracle
#

gotcha sounds about right. basically condensing it down right?

granite sky
#

Lazy evaluation does not always help, because it's extra SQF itself.

#

If you have two conditions that are both simple then you're better off without it.

tough abyss
#

^

frigid oracle
#

if more than 2 use it?

tough abyss
#

Mostly just use it if you have expensive checks

granite sky
#

Also depends how often you're hitting the no-evalution cases.

frigid oracle
#

gotcha I understand a bit better. Also is it better to have a waitUntil inside the while loop? or just have the condition on the while itself

tough abyss
#

That depends what you're doing, waitUntil and while are not equivalent

#

waitUntil is going to actually suspend your code until a condition is met, while is just going to continue until a condition isn't met or skip immediately if it isn't met initially

frigid oracle
#

in my case it sounds better to merge the waituntil with the while then given your example. As i dont really need the while to fire until all the conditions are met for my simple case.

tough abyss
#

It makes sense to wrap a waitUntil with a while only if you need to repeatedly wait for a condition to be met

frigid oracle
#

gotcha gotcha

copper raven
# frigid oracle Yeah its pretty much doing that already. From looking at the code optimization w...

"lazy eval" in sqf is usually only worth if you have something like cheapcond && expensivecond, in other cases it's actually slower than if you used no "lazy eval", fx., _a > 0 && _b > 0 both are cheap(ofc if you have multiple of them then it depends, also the likely/unlikely part), another case where it's useful is if the right operand requires left to be true, fx., !isNil "_a" && { _a blabla... even though it's cheap}

tough abyss
#

And a lot of the time you can simplify a conditional chain with logical laws of simplification.

#

associativity, Idempotence, Complementarity, Identity, Distributivty, etc.

winter panther
#

I have a script that runs when a player triggers an action on an object. The script does this:

  • creates a curator with some limited objects
  • assigns the curator to the triggering player
  • opens the zeus interface
  • waits for the interface to close
  • destroys the curator
    This works in a local MP server from the editor, but I assume it won't work in a dedicated server, since I need to execute things both on the server (creating the curator, assigning addons and limitations) and the client (open zeus interface, wait for it to close. How can I sync this to work in a dedicated server?
#

I'm still pretty new with locality stuff. I assume it works on a local MP server, because addAction runs locally, and I'm both a client and the server.

tough abyss
#

Everything that needs to be handled by the server should be handled by the server everything handled by the client handled by the client

#

And yes on a local MP server you are both client and the server

#

One way you can do it is wrap it in isServer

#

conditional check to execute only on the server

#

or for client if (hasInteface) then {}

#

The other way to do it is use the cfgFunctions.hpp file

#

and use cfgRemoteExec.hpp

winter panther
#

hmm yeah I thought about that. The problem is that the script has things that have to run on client and server in a specific order. I shouldn't open the zeus interface until the curator is created, and while I wait for the interface to close, I have a loop doing something else on the server

#

I guess I could somehow make both client and server do remoteExec on eachother

tough abyss
#

Curator things should be handled serverside

open fractal
tough abyss
#

Not client.

open fractal
#
if !isServer exitWith {};
tough abyss
#

^ Or you can use my technique of explicitly isolating subsystems by client and server

winter panther
tough abyss
#

Well that should run on the client

#

and that information passed to the server from the client

winter panther
#

hmm maybe I could use a broadcasted var on the player, so the server knows when he closed the interface? But I should also tell the client when the curator is created, so I can open the zeus interface

tough abyss
#

Yeah you could use that.

#

Bare in mind it will have to be local to the client

open fractal
tough abyss
#

If you have more than 1 player.

open fractal
#

since it's curator I think the only thing you need to run clientside is opening the interface

tough abyss
#

^

#

The server is where you should store all important things.

#

The client shouldn't handle anything that requires a singular reference point and copy.

#

Server is overlord and controller.

open fractal
#

curator assignment has to happen on the server or it won't happen at all

#

curator commands are server execution only

tough abyss
#

Use an EH on the client

#

and listen for the opening of the curator interface

#

Then pass that message to the server using setVariable

open fractal
#

?

#

you can force the interface open via script

winter panther
#

currently I'm using openCuratorInterface to force it open, and a waitUntil findDisplay is nil, to know when he closed it

#

that works, I just need to figure out how to synchronize it

#

I guess I could run the same script both on client and server, and use waitUntil to sync the order of execution, using broadcasted variables on the player

open fractal
#

you can define a function with both an "open" and "close" condition to create and destroy the curator object respectively

#

and remoteExec to the server

tough abyss
#

^

#

ID number 2

#

to send it to the server only

#
params remoteExec ["Function name or code",2,false]; 
open fractal
#
if !isServer exitWith {};
params ["_open","_caller"];
if _open then {
    //create curatorobj
    //make curator assignments
    remoteExec ["openCuratorInterface",_caller]; 
} else {
    //delete curator obj
};
#

pseudo code for how I would go about it

tough abyss
#

Is the exitWith really needed?

open fractal
#

not really but I put it there instead of commenting that it should only be run on the server

winter panther
#

I think I'm gonna try this:

addAction:

  • remoteExec script on SERVER

server:

  • create curator, customize it, assign to player
  • remoteExec script on CLIENT
  • wait for player broadcasted var
  • cleanup

client:

  • open zeus
  • wait for player to close it
  • broadcast var
#

so I'm gonna have two scripts, one for server and another one for client

tough abyss
#

Realistically yes you should

#

Putting client / server code in the same file is a nightmare to debug

open fractal
#

I doubt you need to remoteExec anything on client except the openCuratorInterface

tough abyss
#

^

#

The server is waiting for the message nothing more.

winter panther
#

yeah, the only code on client's side is opening the interface, and waiting until it's closed, to broadcast a var

open fractal
#

if you look at the example I sent above you just remoteExec that function from the client first with true to initiate the interface then with false upon closing

tough abyss
#

My missions / other projects use 3 folders.
client, server and common, common is for utility functions that are not used client or server side but are used everywhere.

open fractal
winter panther
#

yeah, I guess I could remoteExec twice instead

tough abyss
#

Yeah you don't even need a var.

winter panther
#

sounds better

tough abyss
#

I've used server side listeners to add TFAR radios to cars that don't have them.

open fractal
#

i.e. [true, _caller] remoteExec ["max_fnc_curator",2];

tough abyss
#

Basically a piece of EH code would listen for vehicles being placed then would setVariable and add a radio to them.

open fractal
#

then false upon closing it

winter panther
#

by the way, if I declare a private set of instructions, and use remoteExec on that, will it work on the server? I mean, the piece of code is local to the client, and the server has it too (it's on init), but I don't know if it will run

tough abyss
#

Put your client code in something like MAX_fnc_clientOpenedCurator

#

then call it on the client

open fractal
winter panther
#

yeah I wanted to avoide using CfgFunctions cuz it's a very small script ๐Ÿ˜›

tough abyss
#

_opened remoteExec ["MAX_fnc_clientOpenedCurator",2,false];

open fractal
#

it takes like 2 minutes to set up

tough abyss
#

@open fractal Or you could have something like I have that auto generates it ๐Ÿ˜›

open fractal
#

i also have that yes

tough abyss
#

Python?

open fractal
#

I wrote batch files for hpp files

tough abyss
#

Nah I use PowerShell

#

Much more powerful and less buggy

open fractal
#

have had no issue with batch

tough abyss
#

Didn't you get the memo microsoft only keeps batch around for backward compatibility PowerShell has basically set powershell to replace batch

#

PS is also OOP capable.

open fractal
#

batch is fine

tough abyss
#

Each to their own.

winter panther
#

btw thanks for the help ppl AoW

past wagon
#
[100, ["RscZoneTimer", "PLAIN"]] remoteExec ["cutRsc"];
for "_i" from _seconds to 0 step -1 do {
    private _timeString = ([_i, "MM:SS"] call BIS_fnc_secondsToString) select [1, 4]; //The problem is not here
    if (_i <= 10 && _i % 2 == 0) then {
        [_timeString, { (uiNamespace getVariable ["ZoneTimer", displayNull]) displayCtrl 1003 ctrlSetStructuredText parseText ("<t font='PuristaBold' size='2.3'color='#d41a0d'>" + _this + "</t>"); }] remoteExec ["call"];
    } else {
        [_timeString, { (uiNamespace getVariable ["ZoneTimer", displayNull]) displayCtrl 1003 ctrlSetStructuredText parseText ("<t font='PuristaBold' size='2.3'>" + _this + "</t>"); }] remoteExec ["call"];
    };
    if (_i == 0) then {
        ["FD_CP_Clear_F"] remoteExec ["playSound"];
    };
    sleep 1;
};
[100, ["", "PLAIN"]] remoteExec ["cutText"];
```I am having a weird issue with my structured text display here. I am trying to create an on-screen timer, and it *was* working perfectly. Now, it is only displaying the first 3 characters of the timer unless the last character is a 1. For example, with an 8-minute timer, it looks like this:

8:0
7:5
7:5
7:5
7:5
7:5
7:5
7:5
7:5
7:51
7:4
7:4
7:4
7:4
7:4
7:4
7:4
7:4
7:41

tough abyss
#

Interesting

#

Does it happen without the select [1,4] on the time string? I know the comment is there but it seems like the most obvious possible cause

past wagon
#

I'll test that

#

oh, btw, this is the display:

import RscText;
import RscStructuredText;
#include "\a3\ui_f\hpp\definecommongrids.inc"

class RscTitles {
    class RscZoneTimer {
        idd = -1;
        duration = 1e+6;
        fadeIn = 0;
        fadeOut = 0.5;
        onLoad = "uiNamespace setVariable ['ZoneTimer', _this#0]";
        onUnload = "";
        class Controls {
            class TimerText: RscStructuredText {
                idc = 1003;
                text = "";
                x = 0.912595 * safezoneW + safezoneX;
                y = 0.203 * safezoneH + safezoneY;
                w = 0.0515744 * safezoneW;
                h = 0.055 * safezoneH;
            };
        };
    };
};
past wagon
tough abyss
#

Hmm well worth making sure I guess

past wagon
#

oh wait I was gonna try something and then I got sidetracked

#

I think it might be out of the gui box

#

lemme check

tough abyss
#

Interesting that it would only do so for numbers other than 1, but possible

past wagon
#

hmm

#

well 1 is a small number?

#

very skinny

#

it's still on the right tho lol

tough abyss
#

Not sure if structured text uses normalized font sizing or not

#

If it does then all of the characters should be uniform width anyways

past wagon
#

well yeah that's what it was

cedar cape
#

["cutscene", true] call ace_common_fnc_setDisableUserInputStatus; 
[{ (getPosATL player)#2 < 1 }, { 
    showCinemaBorder false; 
    ["cutscene", false] call ace_common_fnc_setDisableUserInputStatus; 
}] call CBA_fnc_waitUntilAndExecute;```
#

this is script

#

im using

#

for some reason it works

#

like

tough abyss
#

Why wouldn't it work?

cedar cape
#

wait

#

its supposed to

#

first half works fine

#

but when its finished rappeling the player

#

the cinema borders dont disable

#

and i cant move

#

like its supposed to disable ace interact whilst the player is rappeling, enable it when they are on the ground and remove the cinema borders

#

but none of that happens

#

it disables it but doesent remove cinema borders or renable ace interact

tough abyss
#

Hm

#

Perhaps just do the waitUntil yourself instead of using the CBA function and see if it works

#

Or use isTouchingGround instead of the ATL z pos check

cedar cape
#

so how would i change that script

#

to use those

#

also how do i change altitude of heli using a waypoint

#

instead of using unit capture i went back to ai pilots and it works fine with going to the waypoint but its flying to high atm

#

so the rappels ropes are too short and the player dies

#

is there like a script i could use that makes it so the heli flys like idk

#

20m above the ground

tough abyss
#

I don't do mission making so I don't know the best way to do it

#

Unlikely that forcing it via script is the best way to do it though

cedar cape
#

i belive there is a script that does im not sure tho

#

like setHeight

#

not sure how it works tho

#

ill figure that out on my own

#

but i do need help with the other one, the rappel script

tough abyss
#

Instead of the getPosATL condition you'd change it to just

#

isTouchingGround player

cedar cape
#

i belive this might work for my heli problem _helicopter flyInHeight 40;

#

where would i put that in the script i have already

tough abyss
#

Could put it in the heli init or just before you tell it to move

#

Seems like a good way to do it

cedar cape
#

im confused

#

[blackHawk] call ace_fastroping_fnc_deployAI;

["cutscene", true] call ace_common_fnc_setDisableUserInputStatus;
[{ (getPosATL player)#2 < 1 }, {
showCinemaBorder false;
["cutscene", false] call ace_common_fnc_setDisableUserInputStatus;
}] call CBA_fnc_waitUntilAndExecute;

#

where do i put it in there

#

im executing that script with a trigger

tough abyss
#

Oh you mean the other thing

cedar cape
#

yeah

#

ive figured out the heli height

#

i think

tough abyss
#

I'm on mobile otherwise I'd just write it for you

cedar cape
#

i think i can put it in a waypoint

cedar cape
#

can you try to or not

#

as im horrible with scripting

tough abyss
#

See the code that says getPosATL player etc.

cedar cape
#

yea

tough abyss
#

Just replace that with { isTouchingGround player }

cedar cape
#

["cutscene", true] call ace_common_fnc_setDisableUserInputStatus; 
[{ ({ isTouchingGround player })#2 < 1 }, { 
    showCinemaBorder false; 
    ["cutscene", false] call ace_common_fnc_setDisableUserInputStatus; 
}] call CBA_fnc_waitUntilAndExecute;```
#

so that?

#

it doesent look right

tough abyss
#

Nope the entire thing needs to be replaced

cedar cape
#

ohhhhh

tough abyss
#

Everything in the {}

cedar cape
#

["cutscene", true] call ace_common_fnc_setDisableUserInputStatus; 
[{isTouchingGround player}, { 
    showCinemaBorder false; 
    ["cutscene", false] call ace_common_fnc_setDisableUserInputStatus; 
}] call CBA_fnc_waitUntilAndExecute;```
#

so that?

tough abyss
#

Yup

cedar cape
#

so would that remove cinema border and reanble ace interact when the player hits the ground

tough abyss
#

Yes if that function is actually working properly

cedar cape
#

i assume it is

#

it disables ace interract

tough abyss
#

If it still doesn't work we can try without the CBA function

cedar cape
#

and its the piece of code ppl on the ace discord told me to use

cedar cape
#

idk if this is the problem

#

but

#

the original piece of code had showcinemaborder true at the start

winter rose
#

group your messages please

cedar cape
#

ok

winter rose
#

or I'll spam in-between huehuehue

cedar cape
#

and i removed it because it have it in the init.sqf and left the disable cinema border

tough abyss
#

Won't matter

cedar cape
#

alr

#

ill give this a shot and find out

#

question, whats the difference between flyInHeight and flyInHeightASL

#

oh wait nvm its different altitudes for different behaviours

tough abyss
#

First based on ATL pos second based on ASL pos

cedar cape
#

an

#

ah*

#

bruh, it works kinda but i cant test it properly because the heli flys way to high so i just die because the ropes are too short and i hit the ground

tough abyss
#

Dunno what to tell you there

cedar cape
#

oh wait

#

i think i know why

#

_helicopter flyInHeight 40;

#

im supposed to replace _helicopter with variable name

#

i think

tough abyss
#

Yes lol

cedar cape
#

am so smart

tough abyss
#

Replace it with the variable representing the helicopter

cedar cape
#

yeah

#

ill give it another go and let you know if the height works and if the script works

tough abyss
#

๐Ÿ‘

cedar cape
#

yeah same problem

#

it flies to heigh, rappel rope too short player go big splat on the ground

tough abyss
#

Perhaps that ace rappel function lets you adjust rope length

cedar cape
#

it doesent

tough abyss
#

Could also just temporarily make the player invincible

cedar cape
#

its way too high

#

i could but it would look so unrealistic

tough abyss
#

Not sure why your heli is still flying so high

cedar cape
#

because the player would fall for like 20+m before hitting the ground and not dieing

#

yeah

#

idk why

tough abyss
#

Does it have waypoints?

cedar cape
#

yes

#

i put the code in the waypoint and told it to fly 20m above the ground

tough abyss
#

Hm interesting

cedar cape
#

the way ace rappel works is you use ace interact to prep the FRIES system and then use the rope you brought in the aresenal to rappel

#

and it has different lengths of rope in the loadout

#

but thats without the script, the script auto does all of that

#

i belive

tough abyss
#

Must be a reason your heli isn't flying low enough

cedar cape
#

yeah

tough abyss
#

@cedar cape FligtInHeightASL is Above Seal Level

#

Meaning the 0 point on the z axis is at the ocean level

#

Not the terrain level

cedar cape
#

will that make the ai fly low

#

how can i force the ai to ignore the trees

#

like its bc there are trees

#

and the ai are terrified of going near it

tough abyss
#

Disable their path finding

#

Sorry

#
aiUnitName disableAI "FSM";
winter rose
smoky rune
#

is there any reliable way to get building real height?
i'm trying to use

private _buildingBoundingBox = 0 boundingBoxReal _building;
    private _p1 = _buildingBoundingBox select 0;
    private _p2 = _buildingBoundingBox select 1;
    private _maxHeight = abs ((_p2 select 2) - (_p1 select 2));

and it's still returns position 1-2-4 meters higher than it should for the majority of buildings

winter rose
smoky rune
#

something like

private _realHeight = _maxHeight;
while {!lineIntersects [_maxHeight, _realHeight]} do {
  _realHeight = _realHeight - 0.5;
};

this?

#

function description requires positionASL though, and it seems that boundingBoxReal returns ATL height

winter rose
#

you have ATLtoASL commands

smoky rune
#

so, do I need to ATLToASL the height?

#

oh ok

#

looks like there will be some quirks and gotchas, but at least it's something
thanks for suggestion!

winter rose
#

draw from the top of the bounding box to the bottom, stop at first result, check distance from intersection to bottom ๐Ÿ™‚

smoky rune
#

hmmm
it has much more arguments though
i guess it should be something like
lineIntersectsSurfaces [_buildingHeightAsl, _buildingHeightRealAsl, ???, ???, true, 1, "GEOM" or "VIEW", probably don't needed, true]

winter rose
smoky rune
#

yeah, seems that default parameters are good enough
thanks for help!

austere nymph
winter rose
stable dune
winter rose
cedar cape
cedar cape
#

is it the init of the object

#

oh wait

#

nvm

tight cloak
#
            _loadoutClass = getPylonMagazines _vehicle;
            {
                _indexString = str _forEachIndex;
                _loadoutMark = ["_loadoutMark", _indexString] joinString "";
                _loadout = ["_loadout", _indexString] joinString "";
                _indexMod = _forEachIndex + 1;
                _incr = (-100 * _indexMod);
                _loadoutDisplay = getText (configFile >> "CfgMagazines" >> _x >> "displayName");
                systemChat format ["%1", _loadoutDisplay];
                _loadoutMarkPos = (getMarkerPos _markername) vectorAdd [0,_incr,0];
                _loadout = createMarker [_loadoutMark, _loadoutMarkPos, 1]; // put it just under the Asset 
                _loadoutMark setMarkerColor "ColorBlue";
                _loadoutMark setMarkerShape "ICON";
                _loadoutMark setMarkerType "hd_dot";
                _loadoutMark setMarkerText _loadoutDisplay;
                systemChat format ["%1", _loadout];
                _markerCount append [_loadout];
                publicVariable "_markerCount";
            } forEach _loadoutClass;
        };
        case false: {
            deleteMarker _markername;
            {
                deleteMarker _x;
            } forEach _markerCount;
            systemChat format ["%1", _markerCount];
        };

for some reason, it fetches all in _markerCount, will delete them but not the marker? so post "deletemarker" the array is empty but the markers remain

winter rose
tight cloak
#

create it as a GlobalVariable then?

winter rose
#

that would be ugly

cedar cape
#

i tried it

open fractal
cedar cape
#

blackhawk disableAI "FSM";

tight cloak
#

so i cant delete the markers, seems its scope stuff

#

and still new to sqf so im not sure the best approach

winter rose
winter rose
cedar cape
#

would blackhawkD disableAI "FSM"; work

winter rose
#

perhaps yeah

tight cloak
# winter rose can you make a simplified version of your code issue?

EH for engine on
engine on: makes a series of markers via foreach loop using the pylons (posts their loadouts on the map)
engine off: delete all markers
^ intended functionality
currently in the loop i have each marker being added to an array, so i can call upon it later to delete them. and in the output of systemchat it has entries for each pylon, 0-3 (4 pylons)
but on engine off, i try to delete the markers, and the array "deletes" them using delete marker, except all it does is empty the array and not delete the markers

winter rose
tight cloak
#

everyone

winter rose
#

I take that it's a function that is called with "is engine on" argument, and in the case of false:
_markername is undefined
_markerCount is undefined

cedar cape
tight cloak
#

i think ill just rewrite it to rely on waituntil (engine off)

open fractal
cedar cape
#

so i can get it to fly back to base without blowing up

cedar cape
#

ok i can neat

winter rose
#

sooo public variable it would be, or (better) setVariable on the vehicle

tight cloak
#

alright ill give that a go

austere nymph
austere nymph
winter rose
austere nymph
#

Oh indeed. The community thinks of stuff BI staff never even imagined.

winter rose
#

ooooooh yeah. ๐Ÿ˜Ž

cedar cape
#

ahdhsdeherdwh

#

or atleast i dont think it did, im tryna make it so the ai ignores the trees and hovers at the fly height i set but instead it keeps flying 50+m above the ground

faint oasis
#

Hi, i'm trying this command to get a "flight plan" straight but i don't know why the plane always point to the heading : 207

plane enableAIFeature ["PATH", false];

Is there a way to change the default dir ?

cedar cape
#

wait are you tryna disable it

#

shouldnt it be disableAI ["PATH"]

#

i might be wrong

#

im just guessing there

#

it might be disableAI "path";

faint oasis
cedar cape
#

why should that mean you cant use disableAI

faint oasis
cedar cape
#

ah

tight cloak
#
{
    _x addEventHandler ["Engine", {
    params ["_vehicle", "_engineState"];
    _crew = crew _vehicle;
    _names = [(name (driver _vehicle))], + [(name (gunner _vehicle))];
    _markername = str(_vehicle);
    PRIVATE _markers = [];
        if (_engineState) then {
            _className = getDescription _vehicle;
            _className = _className select 0;
            _displayName = getText (configFile >> "CfgVehicles" >> _className >> "displayName");
            _listing = createMarker [_markername, [5700,7600], 1];
            _markername setMarkerColor "ColorBlue";
            _markername setMarkerShape "ICON";
            _markername setMarkerType "RedCrystal";
            _markername setMarkerText _displayName + "//" + str _names;
            _loadoutClass = getPylonMagazines _vehicle;
            {
                _indexString = str _forEachIndex;
                _loadoutMark = ["_loadoutMark", _indexString] joinString "";
                _loadout = ["_loadout", _indexString] joinString "";
                _indexMod = _forEachIndex + 1;
                _incr = (-100 * _indexMod);
                _loadoutDisplay = getText (configFile >> "CfgMagazines" >> _x >> "displayName");
                _loadoutMarkPos = (getMarkerPos _markername) vectorAdd [0,_incr,0];
                _loadout = createMarker [_loadoutMark, _loadoutMarkPos, 1];
                _loadoutMark setMarkerColor "ColorBlue";
                _loadoutMark setMarkerShape "ICON";
                _loadoutMark setMarkerType "hd_dot";
                _loadoutMark setMarkerText _loadoutDisplay;
                systemChat format ["%1", _loadout];
                _markerCount append [_loadout];
            } forEach _loadoutClass;
        }
        else {
            deleteMarker _markername;
            systemChat format ["%1", _markerCount];
            {
                deleteMarker _x;
            } forEach _markerCount;
        };
}];
} forEach vehicles;
#

the marker called "marker name" gets removed

#

but not the array of markers made in _loadout

winter rose
#

normal

#

1/ _markername is defined before the if-else, _markerCount not
2/ use pushBack instead of append []
3/ rename _markerCount to e.g _loadoutMarkers

winter rose
tight cloak
tight cloak
winter rose
tight cloak
#

because i removed it after syntax errors and the same effect of it not being deleted, so i took a few steps back for reproach rather than clutter it up

winter rose
#

the code flow as I see it:

  • if the engine is on, create the markers and store them in the vehicle with setVariable
  • if the engine is off get the markers from the vehicle with getVariable

that's it

tight cloak
winter rose
#

good luck, soldier!

#

well, Captain

true frigate
#

I feel like an idiot for asking this because its so simple but I haven't done it in so long.
I'm trying to make a tank shoot at a target, which is an empty vehicle with the var name t1.

Right now, I've tried following a tutorial online I couldn't get working, and the doTarget and doFire commands, on both the gunner of the tank, and the tank itself. I'm still not getting anything from it, so I figured I'd ask here. I know its trivial, sorry ๐Ÿ˜…

winter rose
#

'not knowing' is not a crime, persevering in it is

#

so, welcome! ๐Ÿ˜„

true frigate
#

Haha I suppose, I've been trying this for around 15-20 minutes now as well as tweaking the rest of the mission, its just kind of annoying at this point because I've done it before but can't remember how ๐Ÿ˜„

winter rose
#

add an invisible enemy and call it a day? :D

true frigate
#

That's possible, I'd rather have it controlled on a trigger though

open fractal
#

you can have a crewman with ai disabled and use a trigger with setcaptive

true frigate
#

That's true, I will give that a go. Thanks! ๐Ÿ™‚

true frigate
#

I would have to specify the main gun then wouldn't I?

little raptor
#

it does

#

tho I think you should use it on the gunner

true frigate
#

Yeah I just looked at the config and saw it haha, I'm going to try both of these solutions and see if I get it ๐Ÿ™‚

#

Ah thats interesting, currentWeapon is returning the MG for the tank, I might have to find the string for the main gun and try it again

open fractal
true frigate
#

Sorry, do I need to run doTarget first or would it run that automatically with fireAtTarget?

tnk2G fireAtTarget [t1,"CUP_Vcannon_2A46_Txx"];``` I'm using this right now, but it doesn't seem to be firing, or even moving the turret. I could very well have messed it up though haha
#

Not sure if this would affect it, but the units are around 1.1km away, probably should have mentioned that at first :/

little raptor
#

do I need to run doTarget first
iirc no

true frigate
#

Still not having any effect, it is returning True when I put it in extended debug console though ๐Ÿค”

open fractal
#
_veh doWatch _target;
waitUntil { _veh aimedAtTarget [_target] > 0 };
_veh fireAtTarget [_target];
``` maybe try this template, see if it actually aims at the target?
little raptor
true frigate
#

I had just noticed that on the wiki haha, but yep it looks promising ๐Ÿ˜„

open fractal
#

maybe try reveal if the target isn't being detected? Odd that true was returned though

true frigate
#

Ayy it worked

#

Thanks guys! I don't remember it being that complex though haha

#

When I did it last time I mean ^, but that must have been 7+ months back now

sullen sigil
#

Hello my fellows how does one go about scripting low gravity to a3

#

I have tried setting the gravityfactor for everything to 0.5 through a config however that seems to have had no effect

little raptor
sullen sigil
#

i want it on every object which has physx

little raptor
tough abyss
#

could theoretically accomplish it by applying a fractional setMass to all PhysX objects

#

not sure if the game uses actual physx forces for gravity though

#

if not, then that won't work

sullen sigil
#

how would i go about doing that for the sake of it

tough abyss
#

truthfully I'm not sure the best way to grab all physX objects in a mission, as not all of them have uniform inheritance or anything AFAIK

#

I know many but not all inherit from ThingX

sullen sigil
#

would changing the mass for all objects not work anyway

#

seeing as the ones without physx arent moving regardless

little raptor
tough abyss
#

^

little raptor
#

even players are not PhysX

sullen sigil
#

oh

#

i mean things that fall in that case

tough abyss
#

Well they can be affected by physX things but any sort of force just causes them to ragdoll

sullen sigil
#

so things that fall instead of just physx

tough abyss
#

"things that fall" are physX generally

#

emphasis on generally

#

you can try the setMass thing but I'm not sure the internals of how the game simulates gravity

sullen sigil
#

can i not just change the mass of every object or will that cause some funky monkey behaviour

tough abyss
#

changing the mass would only work for simulating low grav if the game actually simulates gravitational force based on mass

tough abyss
#

well there we go then

little raptor
#

it simply makes them bouncier... meowsweats

sullen sigil
#

can i turn a grenade into a bouncy ball :o

#

throw it at a wall and it pings off every wall in the room

sullen sigil
#

but i have no idea how it does it myself seeing as theres no simple mass slider in eden attributes ๐Ÿ’€

tough abyss
#

If it were using newtonian gravity changing the mass would work

little raptor
#

they act weird

tough abyss
#

Fg = G*m*M/r^2

#

making either of the masses a fraction of their original mass would result in fractional gravitational force

sullen sigil
#

oh yeah i forgot theres another m

#

i doubt BI is quite on the level of being able to simulate gravity according to einstein just yet tbh

tough abyss
#

newtonian gravity isn't hard to simulate but they probably didn't want to need to apply actual grav force calcs to everything

#

as that would be horrendous for performance I'm sure

sullen sigil
#

according to the wiki doing setMass only changes it for PhysX objects

tough abyss
#

Then again...

#

I suppose even if that worked you'd end up with the same acceleration since the mass would be smaller

#

so you'd need to somehow only adjust the mass for the grav force calc without actually dropping the mass of the object for the applied force

#

RIP

little raptor
little raptor
tough abyss
#

I just don't think they actually simulate gravity with forces

#

or at least not mass-based

sullen sigil
#

wait how do flaps work then in that case

#

does that just reduce the maxspeed of a vehicle or something

little raptor
#

maybe you can change gravity in CfgWorlds thonk

tough abyss
#

Yeah I had a physics brainfart when I was pondering the mass change

#

good ol' feather and hammer test

sullen sigil
#

cant find any matches on cfgworlds wiki page for acceleration, gravity or freefall

tough abyss
#

Although...

#

you might be able to do an onEachFrame handler or similar that constantly adjusts the Z-axis velocity to a set fraction of its current value

#

as that would simulate fractional acceleration

sullen sigil
sullen sigil
tough abyss
#

...perhaps

little raptor
#

it does

tough abyss
#

cant think of a better way to do it though tbh

sullen sigil
#

how would i go about doing it for the sake of testing if its possible

#

just fetch every objects z-axis velocity every frame and halve or w/e then set that as a new z-axis velocity?

little raptor
#

it changes the trajectory

#

e.g. a plane can't nose dive anymore

tough abyss
#

Indeed not technically correct as you're affecting non-gravitational movement

#

but not sure how you'd avoid that thonk

little raptor
#

e.g. a ball thrown up

sullen sigil
#

wouldnt it just have half as much 'force' downwards?

tough abyss
#

yeah you'd have to handle some things differently

sullen sigil
#

tbh it doesnt need to be exact just needs to somewhat simulate low gravity

little raptor
#

well if you measure the acceleration you could somewhat do it

tough abyss
#

problem being that gravity operates on acceleration which we can't work with directly

#

yeah you'd need to measure it

little raptor
#

well if the FPS is high enough you can just subtract two subsequent velocities and multiply by FPS

#

for each object...

#

each frame... meowsweats

tough abyss
#

yuuup

sullen sigil
#

i dont think arma will ever have high enough fps for that

tough abyss
#

I mean there's setAccTime but that will affect everything, not just gravity

little raptor
#

anything above 20 FPS will do

#

it's an approximation after all

sullen sigil
tough abyss
#

yeah I figured not

sullen sigil
#

setAccTime would also just make everything look slow wouldn't it

#

rather than for instance if i throw a grenade up it'd go twice the height or whatever

tough abyss
#

yes which is what I meant by everything

sullen sigil
#

is also disabled for multiplayer according to the wiki anyway

little raptor
#
onEachFrame {
  _accDiff = 9.807 - 5;
    _dt = accTime * diag_deltaTime;
    {
        if (isTouchingGround _x) then {continue};
        _v2 = velocity _x;
        _w2 = _v2#2;
        _w1 = _x getVariable ["lastAcc", 0];
        if (_w2 > 0 || {_w1 - _w2 > 9.807 * _dt}) then {
            _w2 = _w2 + _accDiff * _dt;
        };
        _v2 set [2, _w2];
        _x setVelocity _v2;
        _x setVariable ["lastAcc", _w2];
    } forEach vehicles;
};

meowsweats

frigid oracle
#

If a client is waiting for data to update from a target, is there some method more robust than a sleep or using CBA_fnc_waitAndExecute as a sleep. Like idk remotexec'ing back a confrimation of a change or something?

little raptor
#

let me fix one thing

sullen sigil
#

i'll test it for the sake of testing but i expect that wouldnt work well enough in MP for an op or something

little raptor
#

I know

#

...

#

still trying to fix

sullen sigil
#

no it works

#

somewhat

tough abyss
#

lol not yet

sullen sigil
#

its funny with helicopters

little raptor
sullen sigil
#

oh lol

#

oh yeah i see now

tough abyss
#

another issue this is going to run into is that terminal velocity won't really be a thing anymore

sullen sigil
#

perfect

tough abyss
#

unless you do the acceleration measuring method

sullen sigil
#

allow people to a c c e l e r a t e to their demise

#

(i dont intend on anyone really freefalling too much so probably wont be noticeable)

tough abyss
#
onEachFrame {
  _accDiff = 9.807 - 5;
  {
    if (isTouchingGround _x) then {continue};
    _v = velocity _x;
    _v set [2, (_v#2) - _accDiff * diag_deltaTime * accTime];
    _x setVelocity _v;
  } forEach vehicles;
};

pretty sure this would be sufficient as long as you don't care about terminal velocity, no?

#

given gravitational acceleration should always be negative on the Z axis

sullen sigil
#

that doesnt seem to do anything i dont think

tough abyss
#

might be better like this

#
addMissionEventHandler ["EachFrame", {
    _accDiff = 9.807 - 5;
    {
      if (isTouchingGround _x) then {continue};
      _v = velocity _x;
      _v set [2, (_v#2) - _accDiff * diag_deltaTime * accTime];
      _x setVelocity _v;
    } forEach vehicles;
}];
#

as onEachFrame is a bit gross

sullen sigil
#

oh golly

#

i'll try both one second

sullen sigil
# little raptor try this

interestingness happens with this one, helicopter out of fuel and otherwise normally "falling" goes upwards whereas a car goes downwards

#

the car does go downwards at a lower speed though

sullen sigil
#

yeah i hit localexec a load of times and it accelerates downwards faster

tough abyss
#

hm yeah I suppose it's just adding to the existing gravity

sullen sigil
smoky rune
#

How to apply animation on dead unit?
Iโ€™m using Acts_Death-series animation on alive unit, everything is fine but heโ€™s rolling his eyes and moving his head thus completely ruining the idea of the scene, and it seems that simple โ€œswitchMoveโ€ call is not working on dead unit

little raptor
#

apply animation on dead unit?
not for that. that's not possible

#

tho iirc doing switchMove does give them a jolt (reminds me of a funny bug in one of my mods...) meowsweats

sullen sigil
#

@little raptor is it possible to do a similar thing with units on this

little raptor
#

use allUnits + vehicles meowsweats

sullen sigil
#

muahahaha

little raptor
#

what a huge mess notlikemeow

sullen sigil
#

it mostly grounds helis btw but that should be no issue

#

should be

#

so i want forEach allUnits + vehicles at the bottom right

little raptor
#

@sullen sigil

onEachFrame {
    _dt = accTime * diag_deltaTime;
    {
        if (isTouchingGround _x) then {continue};
        _v2 = velocity _x;
        _w2 = _v2#2;
        _w1 = _x getVariable ["lastAcc", 0];
        if (_w1 - _w2 > 4 * _dt) then {
            _w2 = _w2 - 5 * _dt;
            systemChat str _W2;
        };
        _v2 set [2, _w2];
        _x setVelocity _v2;
        _x setVariable ["lastAcc", _w2];
    } forEach allUnits + vehicles;
};
#

this should be clearner

#

and work correctly meowsweats

sullen sigil
#

roger i shall use that one moment

#

im not noticing a hit on performance tbh

#

will that change in MP or

tough abyss
#

quite frankly MP will be a nightmare with this

sullen sigil
sullen sigil
#

i can tolerate a nightmare in behaviour

tough abyss
#

potentially both depending on how you go about it

#

I'd distribute the workload to the server and clients and only have them work on things that are local to them

little raptor
#

setVelocityTransformation might be better thonk

#

because it's local thonk

tough abyss
#

indeed

sullen sigil
#

i think players will always be odd with it because initially falling has a high velocity i believe?

#

i'll try from higher up

#

yeah same ting

little raptor
#
onEachFrame {
    _dt = accTime * diag_deltaTime;
    {
        if (isTouchingGround _x) then {continue};
        _v2 = velocity _x;
        _w2 = _v2#2;
        _w1 = _x getVariable ["lastAcc", 0];
        
        if (_w1 - _w2 > 5 * _dt) then {
            _w2 = _w1 - 5 * _dt;
            _v2 set [2, _w2];
            _x setVelocity _v2;
        };
        
        _x setVariable ["lastAcc", _w2];
        
        
    } forEach allUnits + vehicles;
};
#

what about that one meowsweats

sullen sigil
#

player is definitely falling slower but vehicles are falling super slow

#

think player might need to be multiplied by a different value tbh

tough abyss
#

I'm currently cooking up a potential method as well

little raptor
sullen sigil
#

that'd make sense to me tbh

#

its not suuppeerr noticeably slower but ACE is only giving me bruises when falling with that and breaks bones when falling without so

#

helicopter seems to be falling the wrong way again

#

except its so slow i cant tell ๐Ÿ’€

#

ok no nvm it just takes a while to start falling

#

which is fine

little raptor
frigid oracle
sullen sigil
#

roger will try

#

it does indeed seem to have worked

sullen sigil
#

which did hit fps, just not super badly

little raptor
#

that's not the thing here tho

sullen sigil
#

o

little raptor
#

when I was doing setVelocity every frame it seems that the engine was not updating the velocity

#

so it was falling with almost constant speed

#

so now I only change it when it needs to

#

but because the sync rate of PhysX objects is weird it gets laggy

little raptor
frigid oracle
#

Whats that?

sullen sigil
tough abyss
#

Isn't this current gravity system still going to hard-limit Z-axis acceleration to the gravitational acceleration

little raptor
# frigid oracle Whats that?

it's a name I've heard people call it. it comes from other languages like C++, JS. I personally just prefer calling it callback
anyway, the client that does the remoteExec stores some ID
then the remoteExec target does another remoteExec on the caller using that ID
you don't need an ID tho
it can just be a callback function

#

here's an example:

#

fn_remoteExec.sqf

params ["_params", "_function", "_callbackParams", "_callback"];
_result = _params call (missionNamespace getVariable [_function, {}]);
[_callbackParams + [_result]] remoteExec [_callback, remoteExecutedOwner];

usage:

[[_var1, _var2], "my_fnc_remote", [_var3], "my_fnc_local"] remoteExec ["my_fnc_remoteExec", _target];

what happens is:

  1. your local machine remoteExecs the my_fnc_remoteExec on the target machine
  2. when that function executes, it runs the my_fnc_remote on the target machine, using the [_var1, _var2] args you passed
  3. then it appends the result to the parameters of the function that needs to be called on the local machine (my_fnc_local) and remoteExecs it.
  4. now the local machine can access the result by doing: params ["_var3", "_result"] in my_fnc_local
little raptor
#

(negative acc)

tough abyss
#

yeah that's what I mean

frigid oracle
#

i see, ill see what I can do with that example

tough abyss
#

so still limits the acceleration of nosediving planes etc.

sullen sigil
#

to test this theory i shall try and nosedive a plane

tough abyss
#

though I'm not sure there's any way around that so

#

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

little raptor
sullen sigil
#

oh wow

little raptor
#

you could put an upper limit on the acceleration

sullen sigil
#

thats cool

#

i literally cannot go downwards

#

i cannot nosedive

tough abyss
#

I tried with an A-10 and it didn't seem too noticeably different w/ a value of 5 for the new grav

#

but with a low value it might have... bad consequences

sullen sigil
#

I mean I don't intend on nose diving with anything anyway

#

We probably won't have air support

#

@tough abyss @little raptor surely there's an internal value seeing as all objects seem to be falling at the same speed?

#

ive just tested it with a shit ton of them and all are hitting the ground at the same time

little raptor
#

basically any object that willingly accelerates downwards will be affected

tough abyss
#

^

#

though it's probably the best you're gonna get

little raptor
#

well you could ignore planes and helis with their engines on meowsweats

sullen sigil
#

I don't think we're going to touch the skies tbh seeing as the op'll likely be set on a moon so

#

No atmosphere and tings

#

oh bruh thats interesting

#

hang on let me check im not seeing things

#

i think the MATV just hit the ground a second or two after a few others

#

yeah im definitely not seeing things

little raptor
#
onEachFrame {
    _dt = accTime * diag_deltaTime;
    {
        if (isTouchingGround _x || {
          isEngineOn _x && {
          toLower getText (configOf _x >> "simulation") in ["airplanex", "helicopterrtd", "helicopter"]
        }}) then {continue};
        _v2 = velocity _x;
        _w2 = _v2#2;
        _w1 = _x getVariable ["lastAcc", 0];
        
        if (_w1 - _w2 > 5 * _dt) then {
            _w2 = _w1 - 5 * _dt;
            _v2 set [2, _w2];
            _x setVelocity _v2;
        };
        
        _x setVariable ["lastAcc", _w2];
        
        
    } forEach allUnits + vehicles;
};
sullen sigil
#

DAGOR is hitting the ground before MATV and quad bike so either theres something I don't understand in your code or something I don't understand in how BI did 'gravity'

little raptor
sullen sigil
#

air vehicles with engines on dont need to be ignored for me though heh

#

likely wont be used

#

thats after ive put the script on

#

all start from same altitude

little raptor
#

or is that with the "low gravity" code?

sullen sigil
#

with the low gravity one

#

just tried dropping from 1k+ meters and theyre remaining at the same height without so

#

idk whats going on there

sullen sigil
#

even though they shouldnt be impacted??

little raptor
#

any PhysX object and units should be affected now

sullen sigil
#

im still using the old code lol

#

i'll try with the new one

#

ah yeah thats cool -- dagr is still falling faster than matv & quad for some reason though

#

surely there's just got to be some constant somewhere to change ๐Ÿ˜‚

tough abyss
#

I don't think so unfortunately

sullen sigil
#

i want to find out what gravityFactor does now

tough abyss
#

keep in mind even with this code drag can still make objects fall slower than the cap

sullen sigil
#

can you not change the drag

frigid oracle
little raptor
#

also one thing I forgot to say is that that code is meant for 1 remoteExec target

frigid oracle
#

So what is my_fnc_local exactly?

little raptor
#

a function meowsweats
that will be called on the PC that does the remoteExec

frigid oracle
#

sorry for asking just this setup seems a bit more advanced than what im used too atm.

#

Ok I understand better now

little raptor
#

basically the whole purpose of that code is to avoid waiting, as you wanted

#

let's say you're in function A right now (on the client)

#

you execute function B on the server. function A exits without waiting

#

once function B is executed, the server gives the result back to the client, by executing function C

frigid oracle
#

I see, does that example always pass to the server?

little raptor
#

no

#

another client

#

but it has to be 1 client

#

you can change it to support multiple

frigid oracle
#

Ok thank you for the extended explanation.

little raptor
#

but it gets more complex

sullen sigil
little raptor
#

this is more descriptive I guess...
fn_remoteExec links A and B
fn_remoteExecCallback links B to C

tough abyss
#

the joys of remoteExec

sullen sigil
#

uhhhh

#

uhhhhhh

#

@little raptor @tough abyss did you guys actually test setting the mass

#

while its not working for players its definitely having an impact on vehicles

tough abyss
#

but is it actually simulating low grav

sullen sigil
#

using {_x setMass (getMass _x * 0.1)} forEach (allMissionObjects "All"); inside of a trigger with radio alpha (just so i can compare) and it does alter the 'gravity'

winter rose
#

yep
for PhysX objects

#

humans are not exactly that

sullen sigil
#

in the real world its different

tough abyss
#

force is halved but so is the mass so acceleration should still be the same

#

which is the problem leopard and I mentioned

sullen sigil
#

should be though

#

but its not

tough abyss
#

interesting

#

could just be falling slower since drag + lower mass

little raptor
#

but when it landed it started to bounce around

sullen sigil
#

I'm using VR with a MATV and messing with it's mass driving it off a ramp

#

It's definitely going further

#

Setting its mass to 0.1 has funny results but I don't want it as 0.1 so ๐Ÿคท

little raptor
#

so? it falls the same

tough abyss
#

is it going further because it's falling slower or going further because it's able to accelerate to a higher speed

#

yeah ^^

sullen sigil
#

this is a valid point

#

I suppose I can record them both and time it?

tough abyss
#

I suspect it's still falling at the same speed

winter rose
#

set a negative mass? ๐Ÿ˜„

#

wheeeeee

sullen sigil
tough abyss
#

but that's not low grav

#

true low grav would have it fall slower

sullen sigil
#

yeah but the people in the op will think its low grav if i tell them it is

#

i dont exactly think theyre going to bother to calculate it

tough abyss
sullen sigil
#

im timing it either way

tough abyss
#

why not just use the low grav script provided earlier

sullen sigil
#

mp + fps

tough abyss
#

fair

sullen sigil
#

if it was a single player scenario i would

#

ok yeah @tough abyss I think you're right, both are ~2 seconds of freefall so

#

Though I suppose I could try it higher up to reduce any uncertainty ๐Ÿค”

#

fuck it imma do that

#

Yeah +/- 0.4 seconds in my second test at ~8.5 seconds average so I think you're right

#

Either way it still has the effect of simulating low gravity

#

As for how I'm going to explain off players seeming normal ๐Ÿค”

tough abyss
#

you could potentially get the gravity script provided earlier to be performant in MP

#

but it'd take some remote execution and locality checks and etc.

#

and even then it would maybe run horribly

#

not to mention desync between clients

sullen sigil
#

Yeah, unless BI let us just change the constant I don't think it'll be worth it beyond the "poor mans" route imo

#

Thanks for the help though both of you ๐Ÿ™‚

tough abyss
#

๐Ÿ‘

frigid oracle
#

Oh noob moment, but today I learned say2d is much slower than playsound

winter rose
#

ah yes
say2D relates to the 3D world, playSound to UI only I believe, some "more straightforward process" in a way

sullen sigil
#

People aren't propelling themselves off ramps to notice lower gravity, they're hitting bumps and stuff which isn't noticeable if it's only horizontal distance further

#

I'll experiment with trying to get your script somewhat working in MP but I doubt I'll be able to tbh

stiff isle
#

How can I put different squads' variables into a group?

open fractal
past wagon
#

I'm trying to create a "repair vehicle" script that will have the caller continuously do a repair animation while they are repairing the vehicle. I have tried several methods, and none of them have worked. This is one of them. The player gets stuck on the animation. What would be the best way to do this?

params ["_vehicle", "_caller", "_actionID"];
_vehicle removeAction _actionID;

_caller setVariable ["repairing", true];

private _repairTime = if ("ToolKit" in flatten getUnitLoadout _caller) then {
    20
} else {
    100
};

private _repairDistance = _caller distance _vehicle;

[_vehicle, _caller, _repairDistance] spawn {
    params ["_vehicle", "_caller", "_repairDistance"];
    waitUntil { !(_caller getVariable "repairing") || { _caller distance _vehicle > (_repairDistance + 2) || { _caller distance _vehicle > 3.5 || { !(alive _caller) } } } };
    _caller setVariable ["repairing", false];
};

[_caller] spawn {
    params ["_caller"];
    while { _caller getVariable "repairing" } do {
        if (animationState _caller != "ainvpknlmstpsnonwnondnon_medic_1") then {
            _caller playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
        };
    };
    
};

for "_i" from 1 to 100 do {
    if !(_caller getVariable "repairing") exitWith {
        hintSilent "Repair Failed";
        _caller switchMove (switch (currentWeapon _caller) do {
            case "": {"AmovPknlMstpSnonWnonDnon"};
            case primaryWeapon _caller: {"AmovPknlMstpSrasWrflDnon"};
            case secondaryWeapon _caller: {"AmovPknlMstpSrasWlnrDnon"};
            case handgunWeapon _caller: {"AmovPknlMstpSrasWpstDnon"};
            case binocular _caller: {"AmovPknlMstpSoptWbinDnon"};
        });
    };
    hintSilent ("Repairing: " + str _i + "%");
    sleep (_repairTime / 100);
#
    if (_i == 100) exitWith {
        _vehicle setDamage 0;
        hintSilent "Repair Finished";
        _caller switchMove (switch (currentWeapon _caller) do {
            case "": {"AmovPknlMstpSnonWnonDnon"};
            case primaryWeapon _caller: {"AmovPknlMstpSrasWrflDnon"};
            case secondaryWeapon _caller: {"AmovPknlMstpSrasWlnrDnon"};
            case handgunWeapon _caller: {"AmovPknlMstpSrasWpstDnon"};
            case binocular _caller: {"AmovPknlMstpSoptWbinDnon"};
        });
    };
    if (animationState _caller != "ainvpknlmstpsnonwnondnon_medic_1") then {
        _caller playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
    };
};

_caller setVariable ["repairing", false];

_vehicle addAction ["Repair Vehicle", "jump.sqf", nil, 1, false, true, "", "vehicle _this == _this", 3.5];
past wagon
#

I've just tried so many different ways of "after the player finishes the animation, make them do it again until they are done repairing the vehicle", and none of them work...

open fractal
#

have you tried the event handler

#

"AnimDone" I think

#

something like that