#arma3_scripting

1 messages · Page 2 of 1

hardy orchid
#

Hello! Small problem i'm having:
I currently am creating an editor mission, and am just getting into scripting on arma3 (I have previous experience, however im not very experienced).
Following question:
I have a trigger, and an npc. The npc's init has the move ai disabled until a trigger is activated. This works fine, however, once it enters the car its supposed to, it starts driving although the cars init contains Introcar disableAI "MOVE";.

What am i doing wrong?

rough summit
#

one sec

winter rose
#

and use sleep, not uiSleep here 😂

little raptor
#

you have to disable the driver's AI

hardy orchid
rough summit
#

im always use uiSleep 😄

winter rose
little raptor
winter rose
warm hedge
#

sleep does sleep in simulation timescope, uiSleep does sleep in UI (realtime) timescope, aka even if the game's paused, or accTime == 0, it executes whenever the time ellapses

rough summit
#

_x action ["eject", _aircraft]; works, thanks

#

Why my script wont work. Bug?

hardy orchid
# little raptor and what do you have right now?

I think i just realised whats wrong, the init disableai is useless if i enable ai, i thought it would overwrite the old part as it has a higher importance as soon as the person enters.

What i'm basicaly trying to do is make the npc walk to the car, and wait for the player to get into the car, until it starts.

winter rose
hardy orchid
rough summit
#

This part of script

#

None of this works, although in theory it should

rough summit
warm hedge
#

It shouldn't, even though sleep does no guarantee that it continues after the exact time elapsed (which I mean, it could be longer than it should wait) but as long as the game is not hanging up, it should do the thing after the sleep time

cedar cape
#

does anyone know about cutscenes

#

how would i go about making a custom first person cutscene, i have seen a few videos but they dont really answer what im trying to do, i have a mission where the player gets into a heli and will then fly to the object and rappel out of a heli, at the start i want it so its the first person perspective walking towards the heli, then it snaps to the player getting in the heli, and then for rappeling. I could give the player rope and hope they know how to ace rappel but is it possible for them to ace rappel in a cutscene, like the ropes deploy and they slide down without having to do anything and then the mission starts when they hit the ground, if i could get the camera quite snappy like this section in the cod mw trailer https://youtu.be/bH1lHCirCGI?t=79 that would be great.

Prepare to go dark, Modern Warfare is back!

The stakes have never been higher as players take on the role of lethal Tier One operators in a heart-racing saga that will affect the global balance of power. Call of Duty: Modern Warfare engulfs fans in an incredibly raw, gritty, provocative narrative that brings unrivaled intensity and shines a li...

▶ Play video
#

ima tryna make it for a mission

#

but ive never done cutscenes before

tough abyss
#

Hello. Is it possible to implement target designation for the turret according to the co-pilot's view?
Let's say I turned my head to the right and the turret turned the same way.

#

You'd need a vector attached to a camera of your characters head

rough summit
granite sky
#

What's the pilot group ordered to do?

cedar cape
rough summit
#

Look. Im creating a plane and crew here

private _aircraft = createVehicle ["RHS_C130J", _aircraftSpawnPos, [], (_aircraftSpawnPos getDir _reinforcementsPositionOffset), "FLY"];
_aircraft setDir (_aircraftSpawnPos getDir _reinforcementsPositionOffset);
_aircraft setPosATL _aircraftSpawnPos;
private _airCrew = createVehicleCrew _aircraft;
_airCrew deleteGroupWhenEmpty true;

A little bit lower im creating new group and push units in this group

    private _landSoldiersGroup = createGroup [West, true];

    {

        private _soldier = _landSoldiersGroup createUnit [_x, _aircraftSpawnPos, [], 10, "NONE"];

        removeBackpack _soldier;

        _soldier addBackpack "B_Parachute";

        _soldier moveInCargo _aircraft;

        uiSleep 0.5;

    } forEach _landSoldiersClassesArray;
cedar cape
#

like i only know how to make it so its one view

#

how would i make it snap between multiple

#

like it starts of as the character walking towards the heli

#

and then it snaps to them getting in

rough summit
cedar cape
#

and then theres ace rappeling

#

is it possible to make the player ace rappel

#

in a cutscene

#

like without them doing the whole interaction menu

#

it does it for them

little raptor
cedar cape
#

wdym

#

i know how to ace rappel

#

but instead of the players doing it themselfs

little raptor
#

I mean actions have codes

#

they don't work on magic

cedar cape
#

yeah but where do i find it

rough summit
little raptor
#

idk. ask in ACE discord

cedar cape
#

good idea

tough abyss
#

@cedar cape Was responding to @tough abyss

cedar cape
#

oh my bad

tough abyss
#

KK did something similar with a UAV camera

tough abyss
#

Not sure.

hardy orchid
#

Short question. I have the following things set up in a trigger (in the condition tab)

this; SBackster in IntroCar;

The trigger is connected to multiple way points, allowing the car to continue driving.

Basically it waits for the player to get in until continuing. The car still continues, without the player having gotten in.

distant oyster
hardy orchid
#

Thanks!

tough abyss
#

@tough abyss it depends on how accurate you want it

#

Tethering the turret to your head movement.

hardy orchid
#

(with the npc in it)

cedar cape
#

i spoke on the ace discord

#

ive got some script to use

#

but idk where to put it

#

ive been given this code

#

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

#

which would disable interact until rappel is finished

#

and

#

[_vehicle] call ace_fastroping_fnc_deployAI

#

which would rappel the player

#

but where would i put this

#

since its not right at the start of my mission im not sure wether i put it into the init.sqf or a trigger

distant oyster
cold depot
hardy orchid
#

(Anyplayer and present) fires once only, and the trigger is located exactly on the seat

spiral zealot
#

hey) i have a question about scripting

``pole addAction ["spectate", {
[true, false] call ace_spectator_fnc_setSpectator;
}];

["telportPlayer", {
params ["_player", "_pos"];
if (ace_player == _player) then {
if (ace_spectator_isSet) then {
[false] call ace_spectator_fnc_setSpectator;
};
_player setPos _pos;
};
}] call CBA_fnc_addEventHandler;

["telportPlayer", [_target, [0,0,0]], _target] call cba_fnc_targetEvent; // hook to your system``

.

I have this script here, that allows people to interact with an object "pole" to enter ACE Spectator. It works great, but if player A goes unconscious, wakes up, and player B spectates him, he will see player A's last unconscious position rather then player A's perspective. So if all players die and respawn, all you can spectate is dead bodies. its a bit weird. Any ideas??

winter rose
#

fixed formatting

pole addAction ["spectate", {
  [true, false] call ace_spectator_fnc_setSpectator;
}];

["telportPlayer", {
  params ["_player", "_pos"];
  if (ace_player == _player) then {
    if (ace_spectator_isSet) then {
      [false] call ace_spectator_fnc_setSpectator;
    };
    _player setPos _pos;
  };
}] call CBA_fnc_addEventHandler;

["telportPlayer", [_target, [0,0,0]], _target] call cba_fnc_targetEvent; // hook to your system
little raptor
#

["telportPlayer", [_target, [0,0,0]], _target] call cba_fnc_targetEvent; // hook to your system
also what is _target?

#

it's not defined

little raptor
#

!quote 5

#

where is my favorite quote?! 🤣

cedar cape
#

i have question

#

how do i do cutscenes

#

i tried

#

using init.sqf

#

but when i played senario

#

nothing happened

#

and the init.sqf file disapeared out the folder

little raptor
#

you're using the wrong folder then

#

the game doesn't touch the scripts

cedar cape
#

which folder is it?

#

i put it in the mission folder

#

C:\Users\frazz\OneDrive\Documents\Arma 3 - Other Profiles\frazzle\missions\Ghost%20Sniper.Tanoa

little raptor
#

are you sure it's the same folder as the mission you're editing?

cedar cape
#

yeah

#

that is the correct folder right?

little raptor
#

if that's your profile maybe blobdoggoshruggoogly

cedar cape
#

yeah

#

i make a file

#

called init.sqf

little raptor
#

maybe oneDrive is messing with you blobdoggoshruggoogly
all I can tell you for sure is that the game never removes or edits your scripts

cedar cape
#

ill try it again

#

alr

#

ill give it another go

#

if not can i use triggers?

little raptor
#

you can use object inits

#

e.g. using a logic object

cedar cape
#

its just the video i was watching said there is a second when the game starts and you can see the mission before the cinema borders n shit come on

little raptor
#

what does your init.sqf contain? just to be sure it's correct

cedar cape
#

i copied it off a video but so far it says this: cutText ["", "BLACK FADED"];

[0,0,false] spawn BIS_fnc_cinemaBorder;

player1 playMove "Acts_B_M03_briefing";

little raptor
#

ok. have you turned on file extensions in Explorer?

cedar cape
#

it works now

little raptor
#

to make sure you're actually saving the script as .sqf and not as .txt

cedar cape
#

idk what happened

#

now for animations

#

if its first person perspective

#

how can i make it snap to a different angle

#

like it starts off as a walking animations

#

towards a heli

#

like halfway to the heli

little raptor
#

by making a camera

cedar cape
#

camera snaps to animation of player getting in heli

cedar cape
#

if im using init.sqf

#

so far all it does is enable cinema border and then add animations

little raptor
cedar cape
#

i have seen camera

#

but thats only third person right?

little raptor
#

what? no

cedar cape
#

sorry

little raptor
#

you can move cameras however you like

cedar cape
#

im pretty new to this

#

ive done missions before but never tried cutscenes or anything

#

alr im confused

#

cutText ["", "BLACK FADED"];

[0,0,false] spawn BIS_fnc_cinemaBorder;

player1 playMove "Acts_welcomeOnHUB01_PlayerWalk_1";

#

i put this in init

#

it enables cinema border

#

but no animation plays

little raptor
#

have you defined player1?

cedar cape
#

ye

#

i think atleast

little raptor
#

try this instead:

player1 switchMove "Acts_welcomeOnHUB01_PlayerWalk_1";
player1 playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
little raptor
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
cedar cape
#

yeah switch move works

#

thanks

#

now how do i snap

little raptor
#

snap what?

cedar cape
#

the camera

little raptor
#

to what?

cedar cape
#

wait leme do picture on ms paint

#

like this

worthy igloo
#

?

cedar cape
#

if thats possible

#

idk if i can snap camer

cedar cape
little raptor
# cedar cape https://imgur.com/a/KmqJqk1
cutText ["", "BLACK FADED"];

[0,0,false] spawn BIS_fnc_cinemaBorder;

player1 switchMove "Acts_welcomeOnHUB01_PlayerWalk_1";
player1 playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
while {player1 distance2D blackHawk >= 7} do {
    _dir = getPosWorld player1 vectorFromTo getPosWorld blackHawk;
    _dir set [2, 0];
    _dir = vectorNormalized _dir;
    player1 setVectorDirAndUp [_dir, [0,0,1]];
    player1 playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
    sleep 0.1;
};

_cam = "camera" camCreate (blackHawk modelToWorld [5, 5, 0]);
_cam setVectorDir (getPosWorld _cam vectorFromTo aimPos player1);
switchCamera _cam;
player1 action ["GetInCargo", blackHawk];
while {!(player1 in blackHawk)} do {
    _cam camSetTarget player1;
    _cam camCommit 1;
    sleep 0.5;
};

switchCamera player;
camDestroy _cam;
#

try that

#

oh wait not yet

cedar cape
#

do i use that?

cedar cape
little raptor
#

I meant wait for me to fix it...

#

try it now

cedar cape
#

oh ok

little raptor
#

I didn't test it

#

it's all written mentally

cedar cape
#

can you make it so it keeps the cinema borders during flight

little raptor
#

also change blackHawk to the variable name of your heli

cedar cape
#

im tryna make it so when the heli gets to the location it auto rappels the player in a cutscene

#

which i figured out how to do

#

thanks to ace discord

#

does that script u sent remove cinema border

little raptor
#

no

#

but it switches the camera back to player once he gets in

cedar cape
#

oh yeah thats fine

#

it doesent work

#

bruh

little raptor
#

did you even change blackhawk?

cedar cape
#

oh wait im so smart

little raptor
cedar cape
#

oh ok

#

the animation doesent play either

#

lemme try to fix

#

um

#

yeah its broken

#

when the player gets to the heli he starts sliding along the ground

#

wait lemee get video

little raptor
cedar cape
#

wait 1 se

#

sec

#

i put the code u said to put in]

#

[0,0,false] spawn BIS_fnc_cinemaBorder;

player1 switchMove "Acts_welcomeOnHUB01_PlayerWalk_1";
player1 playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
while {player1 distance2D blackHawk >= 7} do {
    _dir = getPosWorld player1 vectorFromTo getPosWorld blackHawk;
    _dir set [2, 0];
    _dir = vectorNormalized _dir;
    player1 setVectorDirAndUp [_dir, [0,0,1]];
    player1 playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
    sleep 0.1;
};

_cam = "camera" camCreate (blackHawk modelToWorld [5, 5, 0]);
_cam setVectorDir (getPosWorld _cam vectorFromTo aimPos player1);
switchCamera _cam;
player1 action ["GetInCargo", blackHawk];
while {!(player1 in blackHawk)} do {
    _cam camSetTarget player1;
    _cam camCommit 1;
    sleep 0.5;
};

switchCamera player;
camDestroy _cam;
little raptor
#

you didn't even change blackhawk in the code

cedar cape
#

its fine

#

i changed heli

#

to that name

#

thats what happens

little raptor
# cedar cape https://drive.google.com/file/d/1ePghTlcHLGwtYzCp1SrObB4QhQvYF_Kb/view?usp=shari...

try this:

cutText ["", "BLACK FADED"];

[0,0,false] spawn BIS_fnc_cinemaBorder;

player1 switchMove "Acts_welcomeOnHUB01_PlayerWalk_1";
player1 playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
_EH = player1 addEventHandler ["AnimStateChanged", {
    params ["_unit"];
    _unit switchMove "Acts_welcomeOnHUB01_PlayerWalk_1";
    _unit playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
}];
while {player1 distance2D blackHawk >= 5} do {
    _dir = getPosWorld player1 vectorFromTo getPosWorld blackHawk;
    _dir set [2, 0];
    _dir = vectorNormalized _dir;
    player1 setVectorDirAndUp [_dir, [0,0,1]];
    sleep 0.1;
};
player1 removeEventHandler ["AnimStateChanged", _EH];
_cam = "camera" camCreate (blackHawk modelToWorld [5, 5, 0]);
_cam camSetTarget player1;
_cam camCommit 0;
switchCamera _cam;
sleep 1;
player1 action ["GetInCargo", blackHawk];
while {!(player1 in blackHawk)} do {
    _cam camSetTarget player1;
    _cam camCommit 1;
    sleep 0.1;
};

switchCamera player;
camDestroy _cam;
cedar cape
#

alr

#

it kinda works

#

could you make it so its first person

#

or it follows the players head

#

like this

open fractal
#

What's the difference between addItemCargo and addWeaponCargo?

cedar cape
#

so its a head cam almost

azure fern
#

how can i make ai drone keep altitude in the air

#

It's about the script but I don't know much

cedar cape
#

@little raptor if this is possible that is

cedar cape
#

how would i put that in the script?

cedar cape
little raptor
# cedar cape how can i put that in the script i have already
cutText ["", "BLACK FADED"];

[0,0,false] spawn BIS_fnc_cinemaBorder;

player1 switchMove "Acts_welcomeOnHUB01_PlayerWalk_1";
player1 playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
_EH = player1 addEventHandler ["AnimStateChanged", {
    params ["_unit"];
    _unit playMoveNow "Acts_welcomeOnHUB01_PlayerWalk_1";
}];
while {player1 distance2D blackHawk >= 5} do {
    _dir = getPosWorld player1 vectorFromTo getPosWorld blackHawk;
    _dir set [2, 0];
    _dir = vectorNormalized _dir;
    player1 setVectorDirAndUp [_dir, [0,0,1]];
    sleep 0.1;
};
player1 removeEventHandler ["AnimStateChanged", _EH];
_cam = "camera" camCreate (blackHawk modelToWorld [5, 5, 0]);
_cam attachTo [player1, [0.2, 0, 0.05], "head", true];
player1 action ["GetInCargo", blackHawk];
while {!(player1 in blackHawk)} do {
    sleep 0.1;
};

switchCamera player1;
camDestroy _cam;
cedar cape
#

it did the whole floor slidy thingy again

past wagon
#

I'm trying to create an on-screen timer, but my script is not successfully setting the display's text. The display is showing up on screen, because I can see the background, but no text is appearing.

params ["_seconds"];

100 cutRsc ["RscZoneTimer", "PLAIN"];
for "_i" from _seconds to 0 step -1 do {
    private _timeString = ([_i, "MM:SS"] call BIS_fnc_secondsToString) select [1, 4];
    [(uiNamespace getVariable ["ZoneTimer", displayNull]) displayCtrl 1003, _timeString] remoteExec ["ctrlSetText"];
    if (_i <= 10 && _i % 2 == 0) then {
        [(uiNamespace getVariable ["ZoneTimer", displayNull]) displayCtrl 1003, [0.8, 0, 0, 1]] remoteExec ["ctrlSetTextColor"];
    };
    if (_i == 0) then {
        ["FD_CP_Clear_F"] remoteExec ["playSound"];
    };
    sleep 1;
};
100 cutText ["", "PLAIN"];

Here is the GUI:

import RscText;
#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: RscText {
                idc = 1003;
                text = "";
                x = 0.912595 * safezoneW + safezoneX;
                y = 0.203 * safezoneH + safezoneY;
                w = 0.0515744 * safezoneW;
                h = 0.055 * safezoneH;
                colorText[] = {1,1,1,1};
                colorBackground[] = {0,0,0,0.5};
                sizeEx = 3 * GUI_GRID_H;
            };
        };
    };
};
cedar cape
#

with the sliding along the floor

copper raven
cedar cape
#

also

#

can i change the animation

#

from the default one to a different one

past wagon
copper raven
#

yeah but you can't remoteexec controls like that

cedar cape
#

@little raptor is this fixable?

copper raven
#

you need to remoteexec a function that gets the control handle on the client and does whatever you want it to do

past wagon
#

ok...

past wagon
copper raven
#

i guess, but function is better

past wagon
#

well

#

i dont really wanna make a new function just to set the text for this one timer

winter rose
past wagon
#

yeah...

#

I'll consider it

cedar cape
#

towards the end the player just slides along the floor

#

nvm i fixed it

#

also

#

is it possible to change the animation for getting in the heli to GetInHelicopterCargoRfl

#

instead of the default animation

#

or any other animation

atomic frigate
#

So I have a custom sound, It shows up on the list of sounds to play on a trigger. But when I click play, it doesn't.

#

No idea why

#

No errors, nothing

#

I tried it as music as well.

winter rose
past wagon
#

if I want to change the font of the text in my display, can I just use ctrlSetStructuredText in place of ctrlSetText?

little raptor
#

if it supports it yes

#

only structured text controls do

open fractal
little raptor
#

afaik no

open fractal
#

ty

compact maple
#

Thanks for answering 🙂
Is there a way to check that there is no player near by that position ?

jade acorn
#

how can I play an audio file when player opens a certain diary record in the briefing phase (and best if only there), other than making a link to playSound that player has to click? Speaker feature from animated briefing only works with the animated timeline, the old onbriefingsound or whatever doesn't work with Arma 3, and I've seen a code with detecting a layer/screen type but it is meant for briefing after the mission starts, the briefing phase "briefing" has a different display name and I have no idea how to detect the ones I'd need.

open fractal
#

user interface event handler?

#

you can definitely retrieve the diary display, maybe you can attach a handler to play the sound after clicking on the diary record

jade acorn
#

i have no idea where to start, especially that display for briefing phase and briefing during mission are different

past wagon
#
params ["_seconds"];

[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];
    if (_i <= 10 && _i % 2 == 0) then {
        [_timeString, { (uiNamespace getVariable ["ZoneTimer", displayNull]) displayCtrl 1003 ctrlSetStructuredText parseText ("<t font='PuristaBold' color='#d41a0d'" + _this); }] remoteExec ["call"];
    } else {
        [_timeString, { (uiNamespace getVariable ["ZoneTimer", displayNull]) displayCtrl 1003 ctrlSetStructuredText parseText ("<t font='PuristaBold'" + _this); }] remoteExec ["call"];
    };
    if (_i == 0) then {
        ["FD_CP_Clear_F"] remoteExec ["playSound"];
    };
    sleep 1;
};
[100, ["", "PLAIN"]] remoteExec ["cutText"];
``````hpp
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;
                colorBackground[] = {0,0,0,0.25};
            };
        };
    };
};
```I am using this script to open this display and set its text, but no text is showing up...
little raptor
#

for the other, have you even tried your code locally?

#

to make sure it works before throwing all those remoteExecs into it?

jaunty ravine
#

Is there some kind of hidden restriction on who can equip ghillie suits? Trying to make a mod where you use a context menu to switch between uniforms but it doesn't want to work with the ghillie suits, everything else works just fine.

past wagon
little raptor
#

yes

little raptor
#

technically you also need </t> but Arma doesn't care about that afaik

jaunty ravine
winter rose
#

overloaded unit?

jaunty ravine
#

Don't think so, let me double check.

#

Nope

little raptor
#

are you sure the classname is correct?

jaunty ravine
#

Yeah, it takes the classname from config. One sec and I'll get you a snippet of code.

#
params ["_unit", "_item"];

// Get all items in player inventory
private _itemsInInventory = items _unit;

// Check if any type of uniform is in there
private _hasUniformInInventory = _itemsInInventory findIf {_x isKindOf ["Uniform_Base", configFile >> "CfgWeapons"]};

// If player has more than zero uniforms in their inventory
if (_hasUniformInInventory > 0) then {

    // Get total mass of all items in the old uniform
    private _itemsInUniformMass = loadAbs (uniformContainer _unit);

    // If the total mass in old uniform exceeds capacity of new uniform, exit with false.
    if(_itemsInUniformMass > getContainerMaxLoad _item) exitWith {false};

    // Check current uniform mass and if it can fit in backpack.
    private _currentUniformMass = getNumber (configFile >> "CfgWeapons" >> uniform _unit >> "ItemInfo" >> "mass");
    private _canSwapUniform = _unit canAddItemToBackpack (uniform _unit);
    
    _canSwapUniform; // Return or something idfk
};```
little raptor
#

what does this snippet have to do with not being able to equip ghillie suits?

#

also it's missing a second return (not all control paths return something)

jaunty ravine
#

This is the condition for being able to swap uniform

little raptor
#

so does it return false?

#

are you sure that snippet is the problem?

jaunty ravine
#

Only for ghillie suit though, that's what's fucky.

#

Okay, that's interesting. Having an item in the inventory of the ghillie suit makes it possible to swap.

#

I've missed something for sure.

little raptor
jaunty ravine
#

What the fuck, now it works.

#

I changed literally nothing.

little raptor
jaunty ravine
#

And on mission restart, it stops working.

jaunty ravine
little raptor
#

that could be the problem

jaunty ravine
#

That is a very good point.

little raptor
#
params ["_unit", "_item"];

// Get all items in player inventory
private _itemsInInventory = items _unit;

// Check if any type of uniform is in there
private _hasUniformInInventory = _itemsInInventory findIf {_x isKindOf ["Uniform_Base", configFile >> "CfgWeapons"]};

// If player has more than zero uniforms in their inventory
(_hasUniformInInventory < 0) || {

    // Get total mass of all items in the old uniform
    private _itemsInUniformMass = loadAbs (uniformContainer _unit);

    // If the total mass in old uniform exceeds capacity of new uniform, exit with false.
    if(_itemsInUniformMass > getContainerMaxLoad _item) exitWith {false};

    // Check current uniform mass and if it can fit in backpack.
    private _currentUniformMass = getNumber (configFile >> "CfgWeapons" >> uniform _unit >> "ItemInfo" >> "mass");
    private _canSwapUniform = _unit canAddItemToBackpack (uniform _unit);
    
    _canSwapUniform; // Return or something idfk
};
#

try that

#

or maybe

params ["_unit", "_item"];

// Get all items in player inventory
private _itemsInInventory = items _unit;

// Check if any type of uniform is in there
private _hasUniformInInventory = _itemsInInventory findIf {_x isKindOf ["Uniform_Base", configFile >> "CfgWeapons"]};

// If player has more than zero uniforms in their inventory
(_hasUniformInInventory >= 0) && {

    // Get total mass of all items in the old uniform
    private _itemsInUniformMass = loadAbs (uniformContainer _unit);

    // If the total mass in old uniform exceeds capacity of new uniform, exit with false.
    if(_itemsInUniformMass > getContainerMaxLoad _item) exitWith {false};

    // Check current uniform mass and if it can fit in backpack.
    private _currentUniformMass = getNumber (configFile >> "CfgWeapons" >> uniform _unit >> "ItemInfo" >> "mass");
    private _canSwapUniform = _unit canAddItemToBackpack (uniform _unit);
    
    _canSwapUniform; // Return or something idfk
};
#

not sure which one you want

#

I guess the second one

jaunty ravine
#

Gonna try those, thank you.

#

Neither one seemed to do the trick, though I have stumbled upon the issue, as Lou mentioned it (seems to be) due to the load on the unit.

#

Guess I didn't wait long enough for it to register before.

little raptor
#

And always return something

jaunty ravine
#

Yeah, I'm gonna keep that in mind in the future for sure.

little raptor
#

also another error in your code is that you use _hasUniformInInventory > 0

#

it should be >=

#

index can be 0 too

jaunty ravine
#

Ah, right

#

Alright, thanks for the assistance, @little raptor and @winter rose.

tough abyss
#

I wonder if ArmA 3's script scheduler would benefit from more sophistication apart from LRU policy.

tough abyss
#

I tend to find that it's less the case that the scheduler is lacking and moreso the case that the netcode and people's script optimization is

#

Yeah but on say a standard operating system the scheduler is a lot smarter.

#

Often using RR scheduling

#

Apples to oranges really, OS scheduler is able to leverage hardware and kernel level access meanwhile the arma scheduler is constrained to an old engine managing high-level scripts

#

Wonder if much changed in Enfusions scheduler

#

And you can't exactly blame peoples optimisations when a lot scripting commands are kind of inefficient by default.

#

Eh I'll blame them when most of the built-in commands run in 0.001ms and people write up an unoptimized onEachFrame handler that demolishes performance

#

Yeah but most people who write scripts are not computer scientists.

#

They are not going to know about O(n) or (Omega)(n) situations.

#

Don't have to be just to learn good programming conventions, there's an entire wiki page dedicated to optimization techniques put in simple non-CS language

#

Yeah but a lot of data structures that can improve things are not in that wiki.

#

Queues and dequeues are pretty simple implemenations in A3

#

Stacks as well can be defined using nothing more than arrays

#

Yes but most people's mods aren't suffering performance-wise just because they don't know how to implement queues and stacks, as those usually aren't that relevant to begin with

#

I used to queue for my heads up display.

#

most people it comes down to not knowing simple things like using sleep and not looping execVM every 0.01 seconds

#

Executing functions in the queue on each frame within the scheduled environemnt.

#

Circular queue to be exact.

#

It made the most sense in terms of updating each HUD element.

#

Not saying they don't have any applications in Arma, but I've never seen a situation where a queue was strictly necessary especially seeing as there's usually built-in commands that handle that sort of object management

#

Invade & Annex used queues a fair bit.

#

Used them to store AI spawn types.

#

Another point about A3 being inefficient is having to query buildings "positions"

#

Yes there's lots of inefficiencies

#

One of the ways around that is to just store flat data structures containing the buildings you care most about.

#

That way you don't have to constantly lookup the buildings positions again and again

little raptor
#

Here we go again... people who think they have the answer to all of Arma's problems without even having seen the source code...

tough abyss
#

the C++ source code or the scripting source code?

little raptor
#

C++ ofc

tough abyss
#

Not a developer am I?

little raptor
#

Then why do you think you know how the game works?

tough abyss
#

All I know from the surface is there a things going on that are not efficient.

#

Honestly the constantly added scripting commands feels like there might be hundreds of adaptor objects in the C++ code.

#

Thats a "guess" though.

#

I think lots of the inefficiencies that show up on the surface level are far more of a symptom of other core issues than issues themselves

#

one main core issue being that ArmA 3 is, like I said before, using a very old engine

#

which has its own caveats when it comes to what can and cannot be done efficiently

#

but overall nobody will be able to delve into details as to why anything was done a certain way other than the devs

#

The one thing that confuses me the most the main menu is literally SQF and .hpp files

#

All the GUI is pretty much running on SQF

granite sky
#

I was in an open-source project where that was considered a great thing to aim for :P

tough abyss
#

I mean benefit of that is that it can be interfaced with via the scripting language directly

granite sky
#

It's not unreasonable if your game is supposed to be heavily modded, and GUIs generally don't have to be fast.

#

What mostly bugs me is that they didn't make the AI more open to modding.

#

but then there are routes that I haven't explored there.

tough abyss
#

True but many other languages use their own mark-up specification language like AXML or Javas FXML

#

Which is effectively industry standard now.

#

Using hybridised C++ header files is just plain yuck

#

Even ArmA's test GUIs are broken like. CreateDialog "RscTestControlTypes";

#

and createDialog "RscTestControlStyles";

#

Game has a literal meltdown when you try to use them.

#

Truthfully speaking I think the GUI system and the weird psuedo-C++ used for configs are some of the worst parts involved in modding this game, but they work and I doubt they'll change

#

can at least look forward to the cleaner system Enfusion's using

#

Object oriented language I look forward to it.

#

Also the other problem with modding is there is no "standardisation" about how to do things.

#

Some mods are like spaghetti, some are not.

#

ACE3 and CBA_A3 are probably two non-spaghetti mods.

#

I mean that applies in real world dev too, the only standards are the ones you (or your superiors) hold you to, and even then standards can vary depending on what your application is

#

What about Java and Python?

#

And C# they actually have a specification rule set you must follow.

#

Pythons PEP8 for example.

#

Those are style guides

#

but expecting amateur mod devs to follow a strict style guide is unrealistic

warm hedge
#

Imagine making something based on messy 20 yo game engine

tough abyss
#

I mean I love ArmA 3 it just falls flat in some places.

#

Current got a problem with a script and am not sure how to approach it.

#

But I don't want a script I want it to be a mod.

#

Still working on the IVAS mod.

#

Any idea how to convert the 3D compass into a 2D strip?

#

There is a mod already out there called the Voyager compass.

#

Two versions exist one using a nested array with position offsets which updates all the offsets with a nested for loop

#

and the other which uses a continuous texture and moves it in relation to the players direction.

#

any ideas @warm hedge or @tough abyss

#

?

#

I don't do much GUI stuff so I'm not going to suggest one way or another, though the second approach sounds cleaner to me

#

Yeah and faster the first eats a whooping 20 frames

#

Doing research on it, a game engine such a Unity does the same thing.

#

I kind of wish the BI Arma 3 Toolset would automatically setup all the mod files etc automatically for you.

#

CBA_A3 does do that sort of.

little raptor
tough abyss
#

Wiki page on that?

#

I thought about normalising it into vector space which would then allow me to represent it into a value between 0 and 1

little raptor
#

ct_controls_group

tough abyss
#

Original credits will be added

#

The original is performance hog though.

#

Thats the less resource hungry version

#

I need to add pips to the display as well

#

Which indicate objects.

#

Alright

cedar cape
#

for some reason my init.sqf file dissapeared

#

i made it in the right folder yesterday and i wanted to change some stuff today and its gone

#

there is only the mission.sqm

#

the stuff that i put in the init.sqf however

#

still work

#

even though its not there

meager granite
#

You're probably looking into wrong directory

cedar cape
#

i pu tit here

#

C:\Users\frazz\OneDrive\Documents\Arma 3 - Other Profiles\frazzle\missions~Ghost%20Sniper.Tanoa

#

which is my profile

#

and where the missions are stored

#

and yesterday it worked fine

#

it still works fine today

#

like all the script i put in there works

#

its just the actual file is gone

meager granite
#

execute copyToClipboard loadFile "init.sqf" in debug console and see what it pastes into clipboard

cedar cape
#

ok

meager granite
#

Actually

#

getMissionPath "init.sqf"

#

Will show you where the file is

cedar cape
#

it doesent

#

it just gives me whats in the init file

#

or what i put in it yesterday before it dissapeared

#

cutText ["", "BLACK FADED"];

[0,0,false] spawn BIS_fnc_cinemaBorder;

player1 switchMove "Acts_welcomeOnHUB01_PlayerWalk_1";
_EH = player1 addEventHandler ["AnimStateChanged", {
params ["_unit"];
_unit switchMove "Acts_welcomeOnHUB01_PlayerWalk_1";
}];
while {player1 distance2D blackHawk >= 5} do {
_dir = getPosWorld player1 vectorFromTo getPosWorld blackHawk;
_dir set [2, 0];
_dir = vectorNormalized _dir;
player1 setVectorDirAndUp [_dir, [0,0,1]];
sleep 0.1;
};
player1 removeEventHandler ["AnimStateChanged", _EH];
_cam = "camera" camCreate (blackHawk modelToWorld [5, 5, 0]);
_cam attachTo [player1, [0.2, 0, 0.05], "head", true];
player1 switchMove "GetInHelicopterCargoRfl";
player1 action ["GetInCargo", blackHawk];
while {!(player1 in blackHawk)} do {
sleep 0.1;
};

switchCamera player1;
camDestroy _cam;

#

which is this

meager granite
#

means the file is there

#

and you're just looking in the wrong place

cedar cape
#

yeah but problem is its not where i put it

meager granite
#

in debug console

cedar cape
#

i did

#

thats what it gave me

#

what is in the init

#

nvm

meager granite
#

the output, not the clipboard

#

copyToClipboard getMissionPath "init.sqf" if you want output in the clipboard

cedar cape
#

"C:\Users\frazz\OneDrive\Documents\Arma 3 - Other Profiles\frazzle\missions\Ghost%20Sniper.Tanoa\init.sqf"

#

yes

#

thats where im looking

#

im looking here, C:\Users\frazz\OneDrive\Documents\Arma 3 - Other Profiles\frazzle\missions~Ghost%20Sniper.Tanoa

meager granite
#

"OneDrive" 🤔

cedar cape
#

yeah

#

it made the folder

#

in my documents

#

by default

#

when i installed the game

warm hedge
#

OneDrive is one of the best way to break anything in Arma 3

cedar cape
#

it might by one drive fucking with it

cedar cape
#

but like

#

the game put the folder in the documents folder

#

which is managed by one drive on my pc

#

but if i move it

#

how do i tell the game that its moved

#

oh wait

#

im so smart

#

i was looking in the wrong folder XD

#

there are 2 folders with the same name

#

one has a ~ at the start

#

also

#

in a cutscene

#

how do i black the screen

#

for like

#

15 seconds

#

and then fade it back in after

meager granite
#
"MyBlackoutLayer" cutText ["", "BLACK", 1e-6];
sleep 15;
"MyBlackoutLayer" cutFadeOut 0;
#

Change 1e-6 and 0 to needed fade times

cedar cape
#

wdym fade times

meager granite
#

how quickly it turns black and back

#

play around with numbers and you'll figure it out

#

And read wiki articles on these commands to know what's going on

cedar cape
#

its working

#

but not working

#

what im tryna get is

#

mission starts black

#

fades in

#

player starts walking towards a heli

#

as they get near it

#

it fades to black

#

heli takes off in black

#

and then it fades back in with them in the air

cedar cape
meager granite
#

of course

cedar cape
#

how can i do it?

meager granite
#

I gave you the code

#

init.sqf might be running too early for cutText to work though

cedar cape
#

ah

#

ill try it in a trigger

#

for the init tho

#

how can i make it

open fractal
#

you can suspend the script until a variable is broadcast by the server so everyone sees it at once

cedar cape
#

so it starts black

open fractal
#

unless it's SP

cedar cape
#

its a singleplayer mission

meager granite
#

What would be the condition to know when cutText can be run?

open fractal
#

dude you're chilling just add a waitUntil

meager granite
#

Personally I use first onPreloadFinished but there might be a better way

cedar cape
#

because i want it so the player rappels in a cutscene so i cant do mp

cedar cape
#

waituntil

#

or preloadfinished

cedar cape
open fractal
#

you can do cutscenes in MP but yeah it's easier to manage in SP

cedar cape
#

but the rappeling wont work in mp

#

i spoke to ppl on the ace discord

#

and they said that i can make the players rappel with script

#

but it would be much more complicated in mp

meager granite
#

waitUntil {!isNull findDisplay 46} perhaps?

cedar cape
#

would that make the mission start as a black screen

#

and then slowly fade in

open fractal
#

if you use cutText to make the screen black on init it should start with a black screen

cedar cape
#

i do have it already but it doesent start as black

meager granite
#

Experiment and see what works

cedar cape
#

[0,0,false] spawn BIS_fnc_cinemaBorder;

player1 playMove "Acts_welcomeOnHUB03_PlayerWalk_5";

_EH = player1 addEventHandler ["AnimStateChanged", {
    params ["_unit"];
    _unit switchMove "Acts_welcomeOnHUB01_PlayerWalk_5";
}];
while {player1 distance2D blackHawk >= 5} do {
    _dir = getPosWorld player1 vectorFromTo getPosWorld blackHawk;
    _dir set [2, 0];
    _dir = vectorNormalized _dir;
    player1 setVectorDirAndUp [_dir, [0,0,1]];
    sleep 0.1;
};
player1 removeEventHandler ["AnimStateChanged", _EH];
_cam = "camera" camCreate (blackHawk modelToWorld [5, 5, 0]);
_cam attachTo [player1, [0.2, 0, 0.05], "head", true];
player1 switchMove "GetInHelicopterCargoRfl";
player1 action ["GetInCargo", blackHawk];
while {!(player1 in blackHawk)} do {
    sleep 0.1;
};

switchCamera player1;
camDestroy _cam;```
#

i have that already

meager granite
#

Add that waitUntil before the cutText

cedar cape
#

but it doesent start as black

#

at the start?

meager granite
#

Yes, at the start

cedar cape
#

i did

#

doesent work

#

it still just startsd

#

no black screen

meager granite
#

Try the line I gave you above

cedar cape
#
cutText ["", "BLACK FADED"];

[0,0,false] spawn BIS_fnc_cinemaBorder;

a1 playMove "Acts_B_M03_briefing";

sleep 5;

titleCut ["", "BLACK IN", 10];
meager granite
#

for the cutText

cedar cape
#

the video i was watching said that

#

would that work

meager granite
#

Actually yours should work too

cedar cape
#

ill give it a go

#

idk why it doesent work

#

i tried it

#

but the walk animation doesent even play

open fractal
#

you're sure the script is running?

cedar cape
#

it doesent start as black

cedar cape
#

bc cinema borders spawn

#

but nothing else works

open fractal
#

does bis_fnc_cinemaborder override the cutText?

cedar cape
#

it might do actually

#

i dont think it does

meager granite
#

When uncertain add if something runs or not, add diag_log markers

cedar cape
#

the video i was watching used that it worked

#

as soon as i remove that script i sent its fine

meager granite
#

Something like:

diag_log [diag_frameno, diag_tickTime, "My marker something should happen here"];
#

Then check RPT to see what runs and what doesn't

cedar cape
#

ok

#

i put it back to what it was before

#

without the script i sent

#

and it works fine

#

so i have no idea how i can get it to start black

meager granite
#

Have nothing but cutText and see if it turns it black at all

cedar cape
#

nothing in the init?

#

but cutText

meager granite
#

Just cutText, then waitUntil and cutText, then another piece

#

See what happens and what breaks what

cedar cape
#

wait

#

so what do i actually put

#

in the init

#

would it be like

open fractal
#

where are you putting all this?

cedar cape
#

cutText;

waitUntil;

cutText;

open fractal
#

init.sqf?

cedar cape
#

init.sqf

#

its right at the start of my mission

open fractal
#

yeah that should work assuming you write all the syntax correctly

meager granite
cedar cape
#

maybe

#

im not very good at scripting lol

cedar cape
#

ok i just wont do any fades

#

since its to complicated

#

and my smooth brain doesent understand it

open fractal
#

no it's easy you just need to look at the wiki

#

go to that page and ctrl+f cutText

#
cutText ["","BLACK FADED"];

waitUntil {!isNull findDisplay 46};

cutText ["","BLACK IN"];
#

as an example

cedar cape
#

i tried it and nothing happened

open fractal
#

cutText ["","BLACK FADED"];

#

try this in the file

#

nothing else

cedar cape
#

i put in cutText ["","BLACK FADED"];

#

nothing happened

meager granite
#

waitUntil is needed there before any cutText stuff, it waits until main display is loaded, I assume that should be the condition to make sure you can start using cutText

#
waitUntil {!isNull findDisplay 46};
cutText ["","BLACK FADED"];
sleep 5;
cutText ["","BLACK IN", 10];
open fractal
cedar cape
#

still nothing

cedar cape
#

where

open fractal
#

after sleep 5

meager granite
#

Yeah, fixed

open fractal
#

but if you put it there and it still doesnt work there's something on your end

cedar cape
#

nope

#

still nothing

open fractal
#

out of curiosity, are you using notepad?

cedar cape
#

yeah

#

is that why?

meager granite
#

@cedar cape Make sure you have "Show Script Errors" checkbox in Arma 3 Launcher parameters

open fractal
#

do you have file extensions turned on in windows explorer?

cedar cape
#

i belive so

#

yeah

cedar cape
#

when u start

#

if so

#

yeah thats happened before

#

showing the error

#

but with that script

#

no error

#

just nothing happened

meager granite
open fractal
meager granite
#

waitUntil is not even needed

open fractal
#

yeah this

meager granite
#

Maybe its your OneDrive messing things up

cedar cape
#

yeah

meager granite
#

Feeding the game cached outdated files or something

cedar cape
#

where can i move it

#

the game auto put it in there

#

when i installed

open fractal
#

can you try something real quick

meager granite
#

Never dealt with OneDrive

open fractal
#

you can see what the game thinks is in your init.sqf if you open the debug console and type loadFile "init.sqf";

cedar cape
#

alr

#

"waitUntil {!isNull findDisplay 46};
cutText ["""",""BLACK FADED""];
sleep 5;
cutText ["""",""BLACK IN"",10];"

#

thats what it sees

open fractal
#

what's with all the "

cedar cape
#

idk

meager granite
#

Maybe you have modules that do titles in the mission or something, that mess it up

cedar cape
#

i put this

#

waitUntil {!isNull findDisplay 46};
cutText ["","BLACK FADED"];
sleep 5;
cutText ["","BLACK IN",10];

open fractal
#

oh it's part of the string nevermind

#

it should be like that

meager granite
#

As an experiment, do a blank mission with that init.sqf in there

cedar cape
#

alr

meager granite
#

with just a soldier placed and init.sqf

open fractal
#

what's your preferred blank testing map sa-matra?

#

i'm a stratis fan myself

cedar cape
#

i use tanoa

#

or altis

meager granite
#

Been using Stratis for years, switched to VR recently

cedar cape
#

i tried what you said

#

blank mission

#

waitUntil {!isNull findDisplay 46};
cutText ["","BLACK FADED"];
sleep 5;
cutText ["","BLACK IN", 10];

#

still nothing

meager granite
#

mods?

cedar cape
#

yes

#

quite a few

meager granite
#

Try without mods

cedar cape
#

nothing that should do anything tho

#

its like a gear mod

#

a few gun mods

#

a bullet cam mod

open fractal
#

try launching with no mods

cedar cape
#

cup mods

#

rhs

#

yeah alr

#

ok so

#

with no mods

#

it works fine

#

but i cant tell which mods are causing it

tough abyss
#

Running anything else that displays GUI on mission init?

meager granite
#

He said he tried blank mission so I assume no

cedar cape
#

i can send the mods im using

meager granite
#

Just try having a blank mission with that init.sqf without any mods

cedar cape
#

i have

#

and it worked

meager granite
#

Well enable them back one by one to figure out which one breaks it for you

open fractal
#

cup and rhs are safe

tough abyss
#

I know he's using a blank mission, was asking if any of the mods he runs do anything with the GUI

cedar cape
#

no

#

nothing

open fractal
#

bullet cam?

cedar cape
#

yeah

#

that just tracks the bullet tho

#

nothing else

meager granite
#

My bet would be on bullet cam mod

cedar cape
#

ill try

#

i hope i dont

#

since its a sniper mission

meager granite
#

Enable them back one by one, find which one breaks UI titles, then angrily complain on workshop page

open fractal
cedar cape
#

thats why i used it

#

yeah

#

is there a bullet cam script

#

like sniper elite

#

ingame without the mod

open fractal
#

you can attach a camera to a bullet but it won't show a bullet model unless you add one in

#

but you can still get a slow down effect and stuff, I'd wait for 2.10 since projectile scripts will have more functionality

tough abyss
#

You could also see if using titleText instead of cutText works

open fractal
#

upcoming arma update, adds projectile event handlers

meager granite
#

Arma is really acting up recently, went into blank VR mission to test, then joined my own server to continue what I was doing, mission downloaded, files not found errors, world is VR instead of Altis and I'm in-game somehow thronking

open fractal
#

attaching a camera to a bullet isn't hard, the other sniper elite effects of the bullet hitting the dude would require more handling

meager granite
#

I think titleText is just an alias to cutText

tough abyss
#

They're handled separately

cedar cape
#

so like

#

ill disable bullet cam and find ou

open fractal
#

right now there isn't really a way to figure out if a bullet hit something besides looping and checking for velocity changes

#

unless someone else knows a trick

#

you can use a handler to find out if the bullet killed them though

meager granite
#

Actually, nevermind, titleCut is the same as cutText

open fractal
tough abyss
#

alas hitpart doesn't work for everything

#

and you'd need to attach it to everything

meager granite
#

Yeah, limited by entity types

open fractal
# meager granite HitPart?

hm yeah that does pass the shooter, but can you determine if it was that projectile hitting the person?

meager granite
#

As for which bullet, you can somehow index your fired bullets, then index HitPart registrations and compare them against HandleDamage for example?

open fractal
#

oh wow _projectile

meager granite
#

Just guessing

#

Would be a pain to have that in MP too

#

Throwing stuff around back and forth

open fractal
#

I never knew hitPart was that advanced

meager granite
#

Was dreaming about making damage handling server side as an experiment to stop lag switchers once, and had that HitPart compared against HandleDamage idea in mind.

open fractal
#

hey ferb i know what we're gonna do today

meager granite
#

🤔

open fractal
#

the hard part to me is determining if the bullet is going to hit before it is fired

south swan
#

raytracing powah?

#

how quick is lineIntersectsObjs?

cedar cape
#

nope i disabled it

#

didnt work

#

bullet cam wasnt the problem

meager granite
#

Keep disabling until you find out

cedar cape
#

alr

meager granite
#

Or rather enable it back one by one

#

As combo of two mods might be the issue

cedar cape
#

ima do something else

#

this is pain

#

i will do later

meager granite
#

Welcome to Arma

cedar cape
#

lol

#

despite how janky this game is

#

its still amazing

#

oh yeah

#

also

#

are credits possible

#

at the end of the mission

#

so i can name all the people here who have helped me out with scripting

meager granite
#

A lot of stuff is possible, you just have to script it

cedar cape
#

how do i make heli start

#

like without waiting for it to start

#

its already running when the mission starts

open fractal
#

getRelPos always returns 2D position for a projectile object. Any ideas why?

#

[x,y,0]

#

neither getPosASL nor getPosATL return 0 as the z value

meager granite
#

what about visual variants?

south swan
#

maybe worldToModel/modelToWorld or something would fit better?

tough abyss
#

It's 2d because getRelPos operates with a heading which requires an azimuth plane

#

Anyways doing raycasts for collision pre-detection will not always be sufficient, especially at long distance since you won't be taking drop and other deflection into account

#

Best you could probably do is continuous raycasting a short distance ahead of the projectile as it moves but there's always a chance fast projectiles will have their hits go undetected

open fractal
#

I don't think it's possible to detect whether a bullet will hit upon firing though, which is what prompts the sniper elite effect.

tough abyss
#

Yeah you'd have to settle with detecting right before hit or finding sufficient data for pre-calculating the trajectory

#

Both of which have problems

#

On the one hand if you detect only right before hit you're going to have a fun time actually seeing the projectile hit

#

And accurately determining the trajectory upon firing sounds like a nightmare if it's even possible with how many variables there are

open fractal
#

I think I'll just settle for making a staged shot and posting a gif of it somewhere and refusing to elaborate

tough abyss
#

Working with projectiles in real time in this game is, bluntly, a massive pain in the ass

#

Hopefully it'll be improved in the future

open fractal
#

right now I'm malding over the utter lack of bullet models, unless there's some hidden somewhere

south swan
#

well, raycast is enough for "slow time when camera is already attached to the bullet"

open fractal
#

currently shrinking an artillery shell

tough abyss
#

Indeed but with how fast some projectiles move in this game (because we absolutely MUST stimulate realistic ballistic velocities) there's a good chance the projectile hits faster than your raycast can even detect it being within proximity

south swan
#

well, raycast to, say, 0.1 seconds worth of projectile velocity would be enough if we raycast every frame. It seems to work okay with MX at 400 meters, at least

tough abyss
#

Yeah, doable but much messier than it should be

south swan
#

not gonna argue with "messy" part

tough abyss
#

I love having object detection fail for bullets because they need to move at 3000fps and I refuse to spam nearObjects every frame

#

And then it still misses some even if it runs every frame

#

Then don't even get me started on MP

south swan
#
private _intersects = lineIntersectsSurfaces [ 
    getPosASLVisual _missile,  
    (getPosASLVisual _missile) vectorAdd ((velocity _missile) vectorMultiply 0.1),  
    _missile,  
    objNull,  
    true,  
    -1,  
    "FIRE",  
    "VIEW",  
    true 
    ] apply {_x#3};
_intersects = _intersects arrayIntersect allUnits;``` on every frame, yeah
tough abyss
#

Yuuup

south swan
#

although, apply and arrayIntersect are way slower than any lineIntersect* or nearObjects anyways XD

tough abyss
#

Meh iteration is expensive but necessary

#

I have to detect projectiles for my portals so that they can be teleported through them, I've had my fair share of contempt for this system

#

Rockets and such go through fine but so help me god if I want to fire a 9mm round from within 30ft of the portal without it going undetected before it collides with a wall

south swan
#

sqf-wise it collides the same frame it's shot at, no?

tough abyss
#

Hm?

#

Not sure what you mean

south swan
#

if sqf is run every frame and the bullet is created and deleted in the same frame - there is no time for sqf to do its thing

tough abyss
#

Well yeah that's part of the issue but generally the bullet is around for longer than a frame

south swan
#

that was meant to comment on the "help me god if I want to fire a 9mm round from within 30ft" part, sorry for being unclear

tough abyss
#

Ah yeah

#

It's an unfortunate issue

#

And I can't rely on detecting the bullets hitting the portal because I don't want to actually let projectiles collide

south swan
#

sounds like "check weaponDirection at each shot, run extra raytrace and move/recreate a projectile" kind of problem, but that sounds like increasing the mess by 150%

cedar cape
#

ok i found the problem

#

with my mission

#

it was melee mod

tough abyss
#

The way the projectile teleportation currently works is a bit like that

#

Find projectile near portal with a trajectory pointing into the portal, save projectile info and delete original projectile, create new projectile with transformed data at exit portal

#

As I said it works fine for slower projectiles but there doesn't seem to be a way to get high velocity projectiles to work at close range

#

They're just too fast

south swan
#

yeah. Running the second copy of the same logic in "Fired" EH is +100% mess. Making the two behave together is another 50%

tough abyss
#

Yeah luckily I don't have to link to fired events at least

#

I can get high speed projectiles to go through if I'm backed up at least 10-15ft from the portal though so whatever

#

It's at least still fun to send rockets and tank shells through

#

@cedar cape glad you figured it out, that mod breaks a lot of things from what I've seen

cedar cape
#

yeah

#

its annoying

#

since i was tryna make a sniper/stealth mission where you can sneak up on people and take them out without anyone knowing

#

oh well

#

lets hope it gets fixed

south swan
#

silenced pistol and hiding the copses it is then 😛

cedar cape
#

yep

#

wait

#

is there a mod

#

for hiding corpses

#

like you could carry them and hide em in a bush

tough abyss
#

Pretty sure ACE lets you

cedar cape
#

it does

#

but doesent

#

like

#

only if they are alive

#

you cant drag/carry them if they are dead

#

like if you do a non lethal and knock them unconcious

#

you can drag

#

but if you headshot you cant drag/carry them

#

or kill them

tough abyss
#

Then again 90% of my time in this game is moddding and not actually playing so unsurprising that I don't know

#

Ah that's unfortunate

cedar cape
#

lol

#

yeah

#

oooooo

#

ill try this

#

works with ace so u can drag dead bodies

tough abyss
#

Nice

cedar cape
#

how would i make it black out

#

when you get near to the heli

#

so i have it so the player is walking towards the heli

#

nvm

#

how do i play music

#

in zeus

#

there is a module

#

but i cant find it in eden

#

also

#

how do i make the heli start

#

like

#

when you press play mission

#

heli is already running

#

with lights on and stuff

winter rose
cedar cape
#

no but like seriously

#

how do i do it

#

nvm i figured it out

open fractal
#

does uh anyone know a bullet model that can work for this

warm hedge
#

It doesn't change the bullet model but attachTo most likely

open fractal
#

yeah I did that with the plane but I don't know if there's a bullet model in the game

warm hedge
#

Ah that's what you mean

#

I don't think I'm aware such bullet mode ingame. It's not that hard to make one IMO, tho

meager granite
#

Use a shark model

cedar cape
#

there is a mod

#

that does it

open fractal
#

that adds a bullet model?

cedar cape
#

yeah

#

lemme get video

#

here

#

the video doesent show latest version

#

but in latest

#

there is data when u kill

#

it will say distance and type of shot

#

like

#

58m headshot

warm hedge
#

That's not what he asked for, in the first place

cedar cape
#

yeah

#

he was making script

#

for bullet cam

#

and i said there is a mod that does that

#

with a bullet model

warm hedge
#

I don't see a model in the video, is it just because too small?

open fractal
#

looks like they whipped up a model in blender

#

i might do the same

#

though the plane is kind of funny

cedar cape
#

yeah

cedar cape
#

lol

#

question

#

how would i play music

#

i put it in a trigger saying playMusic "LeadTrack02_F_Mark";

#

but nothing happens

#

is there anything else that needs doing

warm hedge
#

Apparently you need to increase the music volume than 0

cedar cape
#

so would it be playMusic 5 "LeadTrack02_F_Mark";

warm hedge
#

No

#

In Audio options

cedar cape
#

settings?

warm hedge
#

Yes

cedar cape
#

it was already up a bit

warm hedge
#

Then the trigger might didn't fired at all

cedar cape
#

yeah figured it out

#

is it possible to make a trigger that is always active

#

instead of it being like a player inside the radius

#

can you make it so it activates on mission start

#

or not

warm hedge
#

Yes but what purpose

cedar cape
#

playing music

#

i have a cutscene of a player walking towards a heli and i want music playing as soon as the mission begins

warm hedge
#

If you want to start a music whenever the mission starts, just write in init.sqf?

cedar cape
#

oh yeah

#

am so smart

#

can you make a trigger when someone dies

#

so like

#

you kill a certian person

#

and music plays

warm hedge
#

Use !alive thePersonWhoNeedsToBeDead as condition

cedar cape
#

alr

#

thanks

#

so like

#

if i called it

#

hvt

#

it would be

#

!alive hvt

warm hedge
#

Yes

#

...And this is an informal warning for you from a moderator, please don't spam Enter to write a long sentence

cedar cape
#

ok

cedar cape
#

another question, how do i make the heli start on mission start so like the heli is already running when you press play and as soon as the player gets in it takes off

open fractal
#

engineOn

cedar cape
#

thanks

#

can i make it so the heli only goes to the waypoint when the player is in it?

#

like is there a script that says like when player is in x vehicle

proven charm
stiff isle
#

If I wanna enable an a group of units’ simulation through trigger, can I just activate through the group’s variable name?

#

Like
AIGroup enableSimulation true;

proven charm
stiff isle
south swan
#

{_x enableSimulation true} forEach units AIGroup; or something like this

stiff isle
#

I see thx

cedar cape
winter rose
cedar cape
#

ah ok

#

its not an mp mission anyway

#

ill replace it anyway tho

winter rose
hearty quiver
#

Thank you kindly

cyan dust
#

Good day. How can I get all the tasks existing at the moment? I've tried

_tasks = [];
{
    {
        _tasks pushBackUnique _x;
    } forEach (_x call BIS_fnc_tasksUnit);
} forEach allPlayers;

But somehow it misses some of them 🤔

hearty quiver
#

I'm working on a basic script to spawn a plane and then have it orbit a specific marker location. I've got that down, but there are some flaws in it. When I click on the map to set the working area, it won't automatically clear out of the map (which isn't really a problem), but I'd like to know what I'm doing wrong with that. Additionally, I'm having trouble figuring out how to add additional functions to the spawned in plane. I'm happy to post the script itself; could I get some pointers/help on how to figure this out?

#

this addAction ["Set Working Area",

{
openMap true;
mapclick = false;
onMapSingleClick "'AO' setMarkerPos _pos; mapclick = true; true";
waitUntil{!visibleMap};
onMapSingleClick "";
}];

little raptor
little raptor
#

if it clears after click then how are you supposed to see it? thonk

hearty quiver
#

Sorry, I may have been less precise. I want it to close the map after you click

cyan dust
hearty quiver
little raptor
cyan dust
little raptor
#

well yeah they no longer exist

#

how do you expect to get the tasks of a non-existing unit? blobdoggoshruggoogly

cyan dust
little raptor
#

so?

#

do all online players have all the tasks?

cyan dust
#

I'm just trying to delete all the existing tasks, is there a way to do that?

little raptor
#

can't 2 players have tasks with the exact same name?

cyan dust
#

So in other words, I need something like that?

{
    private _player = _x;
    private _tasks = _player call BIS_fnc_tasksUnit;
    //do
    {
        [_x,[true,_player],true] call BIS_fnc_deleteTask;
    } forEach _tasks;
} forEach _allPlayers;
little raptor
#

yes

#

if those args are correct

#

I didn't check the wiki

cedar cape
#

is there a script that makes the ai fly straight to the waypoint

#

so lke

#

like*

#

it flys directly on it

#

instead of like a 50m radius

cyan dust
little raptor