#arma3_scripting

1 messages · Page 783 of 1

little raptor
#

No

past wagon
#

nah its on the server

little raptor
#

Just use initPlayerLocal

past wagon
#

ok...

#

so this should work in initPlayerLocal:

[] spawn {
    PP_wetD = ppEffectCreate ["WetDistortion", 300];
    PP_wetD ppEffectAdjust [3, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.05, 0.01, 0.05, 0.01, 0.1, 0.1, 0.2, 0.2];
    PP_wetD ppEffectCommit 0;
    PP_film = ppEffectCreate ["FilmGrain", 2000];
    PP_film ppEffectAdjust [0.5, 1, 1.5, 0.5, 0.5, true];
    PP_film ppEffectCommit 0;
    while { true } do {
        sleep 1;
        [] spawn {
            if !(player inArea "Zone") then {
                "Zone"= if (typeOf vehicle player in ["B_MRAP_01_F", "O_MRAP_02_F", "I_MRAP_03_F", "C_Plane_Civil_01_F", "C_Plane_Civil_01_racing_F"]) then {
                    3 / (getMarkerSize "Zone" select 0)
                } else {
                    5 / (getMarkerSize "Zone" select 0)
                };
                PP_wetD ppEffectEnable true;
                PP_film ppEffectEnable true;
                sleep 1;
                if !(player inArea "Zone") then {
                    player setDamage (damage player + _zoneDamage);
                };
            } else {
                PP_wetD ppEffectEnable false;
                PP_film ppEffectEnable false;
            };
        };
    };
};
```?
open fractal
#

why do you have a nested spawn?

#

why not just run the code in the while loop instead of adding it to the scheduler every second?

modern agate
#

got a CAS strike set to a trigger, however it always makes a radio call when triggered, anyway to avoid this?

leaden ibex
#

hey there, I am working on a TvT mission and they got their own mission framework. All of the things that require some timing, let's say a timeout of 150 seconds, they use a fucntion called KK_fnc_setTimeout (from http://killzonekid.com/arma-scripting-tutorials-triggers-v2/)

KK_fnc_setTimeout = {
    private "_tr";
    _tr = createTrigger [
        "EmptyDetector",
           [0,0,0]
       ];
       _tr setTriggerTimeout [
        _this select 2,
           _this select 2,
           _this select 2,
           false
       ];
       _tr setTriggerStatements [
        "true",
           format [
            "deleteVehicle thisTrigger; %2 call %1", 
               _this select 0,
               _this select 1
           ],
           ""
       ];
       _tr
};

And now I need a "timeout" of 5400 seconds. Is there any benefit to using the trigger way over simple

[] spawn {
  sleep 5400;
  // My code
};

will be run only on the server

#

(it does not need to be super precise, +- few seconds don't hurt me)

past wagon
#
private _supplyDropPos = [[[_zonePos2, 1500]], ["water"], {_this distance2D _zonePos1 < 1400}] call BIS_fnc_randomPos;

private _items = [
    "V_PlateCarrierSpec_blk", 2,
    "H_HelmetSpecO_blk", 2,
    "U_O_R_Gorka_01_F", 2,
    "FirstAidKit", 1,
    "Laserdesignator", 1,
    "HandGrenade", 1,
    "SatchelCharge_Remote_Mag", 1,
    "DemoCharge_Remote_Mag", 1
];

[_supplyDropPos, _items] spawn {
    params ["_supplyDropPos", "_items"];
    sleep selectRandom [860, 920, 980];
    private _crate = "B_supplyCrate_F" createVehicle _supplyDropPos;
    for "_i" from 1 to 2 + (round random 1) do {
        _item = selectRandomWeighted _items;
        _items = _items - [_item]; // <--------------------------------------- ERROR HERE
        _itemCount = if (_item == "FirstAidKit") then {
            2
        } else {
            1
        };
        _crate addItemCargoGlobal [_item, _itemCount];
    };
};

Does anyone know why I might be getting Error: undefined variable in expression: _item on the marked line?

pulsar bluff
#

you need to declare _item as a variable

#
[_supplyDropPos, _items] spawn {
    params ["_supplyDropPos", "_items"];
    sleep selectRandom [860, 920, 980];
    private _crate = "B_supplyCrate_F" createVehicle _supplyDropPos;
    private _item = '';
    for "_i" from 1 to 2 + (round random 1) do {
        _item = selectRandomWeighted _items;
        _items = _items - [_item]; // <--------------------------------------- ERROR HERE
        _itemCount = if (_item == "FirstAidKit") then {
            2
        } else {
            1
        };
        _crate addItemCargoGlobal [_item, _itemCount];
    };
};```
open fractal
#

ie get mission time and add your duration to it and then check for that time being exceeded

leaden ibex
#

Well, the think is that I need the timeout from a specified time, but I guess I could just add it to the 5400

#

Still, I would need a

private _myTime = time + 5400;
waitUntil {sleep 10; time > _myTime};
// My code
#

I don't know how the sleep work under the hood, but I would suspect it does not check it all the time if the timeout is that big

#

but yeah, engine older than I am so HAha

#

and shit, it's gonna be sleeping anyway most of the time, just calling it randomly, so I don't really see the difference here

open fractal
#

you could minimize the margin of error there though, since your scheduled code can be suspended by the scheduler

#

I'm not sure what the margin of error is with a long sleep but I understand it as a minimum and the engine takes liberties with how long exactly it is suspended

#

someone else could definitely explain it better but my understanding is the more scripts you have running the more your scripts have to compete for each frame

leaden ibex
#

well, if I let it sleep for 5400, it would not sleep for 8000 right?

#

like, I don't care about few seconds here and there, won't change a thing, either the mission end or not, but ten minutes is a long time

open fractal
#

it depends, but it likely doesn't make a difference if the mission is built efficiently

granite sky
#

IIRC someone who knows stuff stated that long sleeps have higher scheduler priority, which would suggest that they're accurate.

leaden ibex
#

well, I feel like calling sleep 10 540x in a waitUnitl is worse than calling one sleep 5400

open fractal
#

epic

leaden ibex
#

but wonderful, thanks for the info

open fractal
leaden ibex
#

I was just worried so my sleep does not go over 5500

open fractal
#

in terms of precision, not so much performance cost

tough abyss
#

can anyone help me with this

#

bis_fnc_garage_center = nil;
bis_fnc_arsenal_center = nil;
["Open", true] call BIS_fnc_garage;

if (missionNamespace getVariable ["my_garageEH", -1] != -1) exitWith {};

my_garageEH = [missionNamespace, "garageClosed", {
player hideObject false;
isNil {
_newObj = createVehicle [typeOf BIS_fnc_garage_center, [0,0,0]];
deleteVehicle BIS_fnc_garage_center;
BIS_fnc_garage_center = _newObj;
BIS_fnc_garage_center setVehiclePosition [player modelToWorld [0, sizeOf typeOf BIS_fnc_garage_center, 0], [], 0, "NONE"];
BIS_fnc_garage_center allowDamage true;
};
}] call BIS_fnc_addScriptedEventHandler;

[missionNamespace, "garageOpended", {
player hideObject true;
}] call BIS_fnc_addScriptedEventHandler

#

i want to make it so it lets you be able to use skins

leaden ibex
tough abyss
#

with vehicles

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
leaden ibex
open fractal
#

like I said, the time command is low performance impact

leaden ibex
#

if there's something else I don't know about, show me
I really am just a noob with SQF

open fractal
#

so 540 times in total is nbd

#

I've run much worse on every frame

leaden ibex
#

yeah, but you're missing my point
why would I bother, if simple sleep achieves the same thing

open fractal
#

because sleep is imprecise because of how the schedule works

leaden ibex
#

is it imprecise in the matter of tens of seconds?

open fractal
#

but John believes it to be good enough and I'd trust him

leaden ibex
#

How would you write it using time please?

#

if I am missing something

open fractal
#

maybe! It depends on how many scripts you have running and exactly how the scheduler handles long sleeps

leaden ibex
#

not that much, 70+ server fps... so, should be good

tough abyss
#

after i do the sqf

open fractal
tough abyss
#


bis_fnc_garage_center = nil; 
bis_fnc_arsenal_center = nil; 
["Open", true] call BIS_fnc_garage; 
 
if (missionNamespace getVariable ["my_garageEH", -1] != -1) exitWith {}; 
 
my_garageEH = [missionNamespace, "garageClosed", { 
  player hideObject false; 
  isNil { 
  _newObj = createVehicle [typeOf BIS_fnc_garage_center, [0,0,0]]; 
  deleteVehicle BIS_fnc_garage_center; 
  BIS_fnc_garage_center = _newObj; 
  BIS_fnc_garage_center setVehiclePosition [player modelToWorld [0, sizeOf typeOf BIS_fnc_garage_center, 0], [], 0, "NONE"]; 
  BIS_fnc_garage_center allowDamage true; 
  }; 
}] call BIS_fnc_addScriptedEventHandler; 
 
[missionNamespace, "garageOpended", { 
  player hideObject true; 
}] call BIS_fnc_addScriptedEventHandler```sqf
granite sky
#

My evidence is largely hearsay but it makes sense :P

leaden ibex
#

Alright, I was wondering if we were both talking about something else.

tough abyss
#

didnt work

leaden ibex
#

As, yes. Calling time every ten seconds will make no difference at all. But I still feel like it's a useless step, if simple sleep will get the job done.

Back to my original question, any idea why is KK using triggers? Just to be able to get the remaining time?

granite sky
#

You can test it anyway. Spam a lot of short sleeps to the point that it's struggling to run scripts and then time some longer sleeps.

leaden ibex
open fractal
#

sleep is not telling the game to wait precisely that amount of time and then execute, it's telling the game to hold off for at least that amount of time and then run the next line at the next available frame

leaden ibex
open fractal
#

so if you have performance-heavy loops running concurrently your script will have to queue up

leaden ibex
#

still, I am not looking at tens of seconds of longer sleep time

tough abyss
#
 bis_fnc_garage_center = nil; 
bis_fnc_arsenal_center = nil; 
["Open", true] call BIS_fnc_garage; 
 
if (missionNamespace getVariable ["my_garageEH", -1] != -1) exitWith {}; 
 
my_garageEH = [missionNamespace, "garageClosed", { 
  player hideObject false; 
  isNil { 
  _newObj = createVehicle [typeOf BIS_fnc_garage_center, [0,0,0]]; 
  deleteVehicle BIS_fnc_garage_center; 
  BIS_fnc_garage_center = _newObj; 
  BIS_fnc_garage_center setVehiclePosition [player modelToWorld [0, sizeOf typeOf BIS_fnc_garage_center, 0], [], 0, "NONE"]; 
  BIS_fnc_garage_center allowDamage true; 
  }; 
}] call BIS_fnc_addScriptedEventHandler; 
 
[missionNamespace, "garageOpended", { 
  player hideObject true; 
}] call BIS_fnc_addScriptedEventHandler ```sqf
granite sky
#

But if what I heard is correct, the longer sleeps get priority so they should be pretty accurate.

tough abyss
#

can someone help me with this command

leaden ibex
#

wheres with waitUntil I am looking at 5 at average + what the scheduler adds, same as with one sleep

tough abyss
#

i just want it to be able to spawn vehicles with the skins

granite sky
#

Even if the scheduler was just picking scripts round-robin it'd have to be pretty bad before the delay was a second off.

leaden ibex
open fractal
#

yes either way works

#

I just don't want to tell you it's the most precise way

#

but for your purpose I'd trust John that it's a-okay

leaden ibex
#

alright, wonderful

#

Now, any idea why KK is using triggers? rtzW

open fractal
#

nope

#

you can tag him when he's online

leaden ibex
#

he's.... here? pauseChamp

#

what's his @?

open fractal
#

killzone_kid

leaden ibex
#

peepoLove thank you, will ask him directly once I see him online then

meager granite
#

Triggers are a way to do precise non-scheduled each frame execution, thus I guess they're also good for precise timeouts

past wagon
#

I'm having some trouble with this script. It is supposed to give people a notification when they kill someone, but nothing is showing up, not even the systemChat message.
onPlayerKilled.sqf:

_this call TRI_fnc_killNotify;

TRI_fnc_killNotify:

params ["_player", "_killer"];

if (_killer in allPlayers) then {
    [format ["%1 was killed by %2!"], name _player, name _killer]] remoteExec ["systemChat"];
    [[
        parseText ("<t font='PuristaBold' size='1.3' color='#ff0000'>Enemy Killed:<br/><t font='PuristaBold' size='1.3' color='ffffff'>" + name _player),
        [1, 0.5, 1, 1],
        nil,
        7,
        0.7,
        0
    ]] remoteExec ["BIS_fnc_textTiles", _killer];
} else {
    [format ["%1 was killed!"], name _player]] remoteExec ["systemChat"];
};
open fractal
#

those remoteExec's are redundant

#

if you're calling the function on every machine what's the point

past wagon
#

riiiight

#

I think I meant to do call

open fractal
#

also have you verified your function is properly defined in cfgfunctions?

past wagon
#

yes

open fractal
#

thonk man ngl to you it'd be a lot better if you remoteExec'd the whole function instead of using remoteExec for every line

past wagon
#

ok

#

lemme do that then

#

but wait

#

I only want the notification to spawn for the killer

warm hedge
#

remoteExec/remoteExecCall can send a command only for a client, which is the killer this time, I guess

past wagon
#

yeah, i know

#

I just dont get why this script isnt working

#

no notification, no systemchat message, nothing

open fractal
#

have you verified your event script is in the right place and executing

#

weren't you having issues with initplayerlocal earlier?

#

also are you familiar with format?

#
systemChat format ["%1 was killed by %2!", name _player, name _killer];
tough abyss
#

Also keep in mind event scripts are for missions, so this won't work if you're just doing it in a mod

past wagon
past wagon
#

even this wont work:
onPlayerKilled.sqf:

params ["_player", "_killer"];
[format ["%1 was killed by %2!", name _player, name _killer]] remoteExec ["systemChat"];

Why isn't this working?

warm hedge
#

Executed when player is killed in singleplayer or in multiplayer mission with "NONE" respawn type.
Which respawn type you use?

past wagon
#

Oh

#

I don’t have respawn enabled…

#

Where does it say that?

open fractal
#

@past wagon wait, are you using the onPlayerKilled.sqs params for onPlayerKilled.sqf?

#

look at that page again

#

your params dont match

#

nevermind actually, shouldnt make a difference _oldUnit and _player are effectively the same

#

I assume you've run a systemchat or diag_log at the top of your onPlayerKilled file to verify that it's actually executing?

tough abyss
#

Yeah that note about the NONE respawn type is for SQS not SQF

#

@past wagon Do you have a cfgRemoteExec anywhere that could be blocking the remote execution?

coarse dragon
#

Is there a way to stop the AI from going prone?

open fractal
frigid oracle
#

Adding a new PBO to a local mod for testing and arma is not loading it. No clue whats up with that, any ideas what is could be?

EX.

Scripts.pbo works
moving it to back up the pbo and replacing it in the local mod with Scripts_Dev.pbo not working.
but renaming Dev to Scripts.pbo it starts working again.

little raptor
#

What did you pack with?

frigid oracle
#

Pbo viewer

little raptor
#

...

warm hedge
#

PBO Manager* ?

frigid oracle
#

Its worked before on new test projects

little raptor
#

Then I'm not surprised

frigid oracle
#

Well it works fine repacking it with the same name, but if the name is different it just dosent

little raptor
#

I know

#

It's because of pbo prefix

warm hedge
#

PBO Manager does such weird behavior, don't use it to pack

#

...Or, yeah what Leo said

frigid oracle
#

I see, so its just some encoding bug with those tools?

little raptor
#

No

#

You need to set the pbo prefix

frigid oracle
#

Whats a pbo prefix?

warm hedge
#

pboPrefix, a data for each pbos that tells Arma 3 “where I am”

warm hedge
#

e.g if you set pboPrefix "scripts", it should work regardless the pbo name

frigid oracle
#

Got it, will need to redo my stuff with this. Thank you for the help

warm hedge
#

And, if you use the software PBO Manager, don't don't don't and don't, to pack a pbo. Use at least Addon Builder from Arma 3 Tools

frigid oracle
#

I use that newer PBO Viewer from the A3 forums

#

But I assume the root issue is similar?

warm hedge
#

It's not an issue, feature

#

Hmm never heard of PBO Viewer

warm hedge
#

Yeah I mean, just found the post and never heard of it until now

frigid oracle
#

Gotcha gotcha.

frigid oracle
#

Built the mod with Addon Builder.
Darn at this point I have no clue, but I don't think the issue is with the mod loading anymore as it shows the changed name on the eden selection. Im trying to use Livonian Lighting on one cup map, but it just wont swap the changes.

I tested it with another mod, yeah it still doesn't work. It's like adding something new is not registered at all. This really sucks.

meager granite
#

Is there a way to tell if preloading screen is visible?

#

The one that triggers onPreloadFinished/onPreloadStarted ?

#

A certain display perhaps?

pulsar bluff
#

Is there any way to fire a vehicle weapon without an AI in it?

#

like, have an empty vehicle shoot

warm hedge
#

I think a gamelogic can fire something

winter rose
#

drone AI pilots are invisible too

#

it has to be "manned" afaik

pulsar bluff
#

iirc the drone AI cant be moved into other assets

#

"B_uav_AI" or however its called

warm hedge
#

I believe you can

pulsar bluff
#

:\

little raptor
#

if you make it as a simple object you can fake the firing tho meowsweats

#

with animation and everything...

hallow mortar
#

Even if the drone AI can't be used, you could still create a regular AI and hit it with hideObject and disableAI so it's safe to use as a dummy

frigid oracle
little raptor
#

what does the pbo do?

warm hedge
#

And are you sure it is not loaded?

little raptor
#

The only thing changed is pbo name, and prefix name.
you're not supposed to change the prefix if a path depends on it

frigid oracle
#

Polpox, im sure its not loading as the new ace self interactions do not appear. and what I mean changed is addon builder auto gening a new name.
pretty much all im trying to do is have a new pbo called Radiation_DEV.pbo to keep stable and in progress different when passing it to friends for testing. But this simple name change just like doesn't work. Im just lost at this point

little raptor
#

im sure its not loading as the new ace self interactions do not appear.
or maybe your "changes" are incorrect

warm hedge
#

We actually can't say anything specific unless you show the actual code

#

...And this is not really a suited channel for it, #arma3_config instead

frigid oracle
#

Got it, wasn't sure at first will move.

storm arch
#

I currently have an array with three things in them. I have an if statement that works for the one item in the array, but errors out for the other two. I only want one of the three in the array to work at once so it works properly. Is there a way to stop the error from appearing on the other two variables in the array?

little raptor
#

idk what you mean

#

show us the code

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf"];

In this function, how can I add action distance so that its not interactable from 50 meters away?

kindred zephyr
little raptor
#

not interactable from 50 meters away.
they are

#

default action distance is 50

radius: Number - (Optional, default 50)

little raptor
spiral zealot
little raptor
#

it literally has comments in front of it

spiral zealot
#

yes i see but i dont know how to incorporate it into my "this addAction ["Sanitater", "loadouts\Sanitater.sqf"];"

#

this addAction ["<t color='#f71505'>Gruppe</t>", "loadouts\none.sqf"];
this addAction ["GruppenFuhrer", "loadouts\Squadleadermp40.sqf"];
this addAction ["MG Schutze 1", "loadouts\mg1.sqf"];
this addAction ["MG Schutze 2", "loadouts\mg2.sqf"];
this addAction ["MG Schutze 3", "loadouts\mg3.sqf"];
this addAction ["Rifleman Kit", "loadouts\Rifleman98k.sqf"];
this addAction ["<t color='#f71505'>Zugtrupp</t>", "loadouts\none.sqf"];
this addAction ["Zugfuhrer", "loadouts\Zugfuhrer.sqf"];
this addAction ["Sanitater", "loadouts\Sanitater.sqf"];

#

this is my current ini for my box

#

i dont know how to put this

this addAction
[
"title", // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
50, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
into it.

little raptor
#

your computer won't explode blobdoggoshruggoogly

kindred zephyr
little raptor
#

it means it won't necessarily run the condition every frame

#

only when looking at the object

spiral zealot
#

would you mind giving me a hint?

#

do I just have to give a "50," somewhere?

#

this addAction 50, ["Sanitater", "loadouts\Sanitater.sqf"];

#

like this?

#

and ofc replace 50 with my desired number.

little raptor
#

well you have to add a radius yes, but not there

#

here's the hint:

#

it tells you the order of arguments

#

e.g. in what you have:
this addAction ["MG Schutze 1", "loadouts\mg1.sqf"];
this is the object
"MG Schutze 1" is title
"loadouts\mg1.sqf" is script

#

now keep going until you reach radius

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf","50"];
like this?

winter rose
#

no

little raptor
#

I said keep going

#

we are trying to teach here

warm hedge
#

You cannot skip anything between the arguments to condition

kindred zephyr
little raptor
#

here's another hint:

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf","arguments","priority",....do i keep going?"50"];

little raptor
#

don't just skip over stuff

#

just put the default values

spiral zealot
#

and how do I know the default value?

little raptor
#

I underlined it for you

spiral zealot
#

oh i see

#

this addAction
[
"title",
{
params ["_target", "_caller", "_actionId", "_arguments"];
},
nil,
1.5,
true,
true,
"",
"true", // _target, _this, _originalTarget
50,
false,
"",
""

#

from this

#

ahh

#

i think im starting to understand now

#

from the example in the wiki

#

one moment

little raptor
#

btw new lines are optional

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf",nil,1.5,true,true,,true,50];

#

like this?

little raptor
#

kinda

#

but you shouldn't wrap everything in ""

warm hedge
#

You can't make everything quoted

spiral zealot
#

well the previous ones were

#

so i assumed

warm hedge
#

Nope, as the example said

little raptor
#

here's another hint:

#

the reason some things have "" is because they're strings

#

string means text

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf", nil, 1.5, true, true, true, 50];

little raptor
#

almost correct

spiral zealot
#

i dont think i need stuff after the 50

#

since default is fine

little raptor
#

yes, but your code still has issues

little raptor
warm hedge
#

You can't skip everything before that, but after

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf", "nil", 1.5, "true", "true", "true", 50];

#

right so text has ""

#

is "true" text?

#

i assume yes

little raptor
#

it is a text (string) yes

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf", "nil", 1.5, "true", "true", "true", 50];

little raptor
spiral zealot
#

i dont understand it

little raptor
#

some things need "", some don't

#

those that say String do

spiral zealot
#

right true/false is a boolean so it doesnt need "-"

little raptor
#

but anyway you could just copy the exact same things from the example

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf", "nil", 1.5, true, true, true, 50];

little raptor
#

well no

spiral zealot
little raptor
#

depends what the argument is

spiral zealot
#

i dont know what else to do with this

little raptor
#

just look at the example again

#

it shows which ones have "" and which ones don't... meowsweats

spiral zealot
#

this addAction ["Sanitater", "loadouts\Sanitater.sqf", nil, 1.5, true, true, "", "true", 5];

little raptor
#

you skipped one

spiral zealot
#

the ""?

little raptor
#

yes

spiral zealot
#

now?

little raptor
#

yes

spiral zealot
#

amen

#

you have godly patience 🙏

#

works, perfect

#

this addAction ["<t color='#f71505'>Gruppe</t>", "loadouts\none.sqf", nil, 1.5, true, true, "", "true", 5];this addAction ["GruppenFuhrer", "loadouts\Squadleadermp40.sqf", nil, 1.5, true, true, "", "true", 5];
this addAction ["MG Schutze 1", "loadouts\mg1.sqf", nil, 1.5, true, true, "", "true", 5];
this addAction ["MG Schutze 2", "loadouts\mg2.sqf", nil, 1.5, true, true, "", "true", 5];
this addAction ["MG Schutze 3", "loadouts\mg3.sqf", nil, 1.5, true, true, "", "true", 5];
this addAction ["Rifleman Kit", "loadouts\Rifleman98k.sqf", nil, 1.5, true, true, "", "true", 5];
this addAction ["<t color='#f71505'>Zugtrupp</t>", "loadouts\none.sqf", nil, 1.5, true, true, "", "true", 5];
this addAction ["Zugfuhrer", "loadouts\Zugfuhrer.sqf", nil, 1.5, true, true, "", "true", 5];this addAction ["Sanitater", "loadouts\Sanitater.sqf", nil, 1.5, true, true, "", "true", 5];

#

such a mess

tough abyss
#

Programming without understanding syntax is hard

spiral zealot
#

it works at least

kindred zephyr
spiral zealot
#

yea i dont even know what syntax means

little raptor
#

it sorta means the "grammar" of the programming language

tough abyss
#

^

spiral zealot
#

fair enough

#

dont meowsweats me i dont program cri

tough abyss
#

Understanding syntax is what makes the usage of symbols like [ and { go from weird voodoo magic to an actual understandable ruleset

spiral zealot
little raptor
#

it's not as hard as it looks

kindred zephyr
#

it just looks hard, but once you get the core of it you can kind of understand what you are suppose to be doing. Planning ahead helps too (making an algorithm), as having in consideration the whole scope of what you want to do alleviates branching issues.

tough abyss
#

And can always ask questions here, we generally don't bite

#

(though demonstrating effort is a prerequisite)

faint oasis
#

Hi, i have a question about the simulation disabled. Actually i making a script for a "Landing Craft Air Cushion" to be able to attach a vehicle to it but i have a problem. To avoid some collisions problem the LCAC need to have the simulation disabled while loading and while unloading but when the vehicle is attached the vehicle rotation doesn't work because the LCAC has the simulation disabled. Is there a way to solve that ? I tried to attach the LCAC to a gamelogic but sadly there is the collisions only for the player and not for the vehicle i want to put on.

past wagon
past wagon
tough abyss
#

@past wagon I would suggest trying Artisan's advice regarding putting a systemChat in the onPlayerKilled to make sure it's running to begin with

past wagon
#

yeah

#

doing that now

tough abyss
#

Chances are if you're not familiar with cfgRemoteExec you don't need to worry about it

#

Unless you're using someone else's mission or files

little raptor
#

instead of disabling simulation

#

that should allow you to load and unload the vehicles

#

if you've made the landing craft yourself, it's easier

#

just add a roadway LOD to the model

past wagon
#

yeah my onPlayerKilled.sqf is not firing when players are killed.

faint oasis
little raptor
#

doesn't have to be yours

hallow mortar
#

You need access to the model to modify its inherent walkability, but by "paving" it they mean adding a bunch of walkable objects, e.g. concrete slabs, rather than changing the model

faint oasis
#

oh ok but what do you mean "pave" ?

little raptor
#

create a bunch of simple objects

#

and scale them

#

to cover the entire floor area with walkable surfaces

faint oasis
#

oh

#

i thought something like t his but i need to find a good object. Maybe a concrete slab as said "Nikko"

#

so thank you i will check. And i need to create the "pave" everytime ?

little raptor
#

you can make one in 10 seconds in object builder

faint oasis
#

yeah it's a good idea

little raptor
#

it's a 1x1 square

hallow mortar
past wagon
faint oasis
#

because i need to freeze the LCAC

little raptor
#

why?

faint oasis
#

the LCAC is a boat so i need to stop it

little raptor
#

so just use setVelocity

faint oasis
#

yeah but the wave can be a problem

little raptor
#

which is what those surfaces are for

brisk lagoon
#

anyway to resize props in a dedicated server?

#

@ me please

little raptor
#

make simple objects

brisk lagoon
#

I lost it

#

lol

warm hedge
#

Ctrl+F is always your friend

#

Also no lol required

brisk lagoon
#

Sad person

little raptor
#

that's the script

brisk lagoon
#

Thank you kind sir

little raptor
#

it replaces all objects in a layer with simple objects

#

and scales them

tough abyss
#

@past wagon Can I see your current onPlayerKilled code

past wagon
#

yes

#

onPlayerKilled.sqf:```sqf
_this call TRI_fnc_killNotify;

`TRI_fnc_killNotify`:
```sqf
params ["_player", "_killer"];

if (_killer in allPlayers) then {
    [format ["%1 was killed by %2!", name _player, name _killer]] remoteExec ["systemChat"];
    [
        parseText ("<t font='PuristaBold' size='1.3' color='#ff0000'>Enemy Killed:<br/><t font='PuristaBold' size='1.3' color='ffffff'>" + name _player),
        [1, 0.5, 1, 1],
        nil,
        7,
        0.7,
        0
    ] remoteExec ["BIS_fnc_textTiles", _killer];
} else {
    [format ["%1 was killed!", name _player]] remoteExec ["systemChat"];
};
#

I move the code from onPlayerKilled.sqf to a "Killed" EH on every player, and it works fine

#

onPlayerKilled just wasnt firing for some reason

tough abyss
#

Interesting

#

At least it's working now

frigid oracle
#

Is there a better alternative to a while loop? (that needs to always be looping.)

warm hedge
#

What purpose?

frigid oracle
#

Ticking a radiation value on the player over time

little raptor
#

no

frigid oracle
#

Gotcha, thank you for the info.

storm arch
#

Is there a command to see if a vehicle is not blown up vs blown up? I've tried isNull but couldn't get it to work

storm arch
#

Thank you!

granite sky
#

alive _vehicle is the shorter one. Also returns false for objNull which is handy.

winter rose
past wagon
#
private _plane = createVehicle ["B_T_VTOL_01_infantry_blue_F", _planeStartPos, [], 0, "FLY"];

//START FLIGHT
addMissionEventHandler ["EachFrame", {
    _thisArgs params ["_plane", "_planeStartPos", "_planeEndPos"];
    private _vectorDir = _planeStartPos vectorFromTo _planeEndPos;
    if (_vectorDir vectorCos (_planeStartPos vectorFromTo _planeEndPos) <= 0) exitWith {
        removeMissionEventHandler ["EachFrame", _thisEventHandler];
    };
    private _velocity = _vectorDir vectorMultiply 100;
    private _distance = getPosASL _plane vectorDistance _planeEndPos;
    _plane setVelocityTransformation [
        _planeStartPos,
        _planeEndPos,
        _velocity,
        _velocity,
        _vectorDir,
        _vectorDir,
        [0, 0, 1],
        [0, 0, 1],
        100 * diag_deltaTime / _distance
    ];
}, [_plane, _planeStartPos, _planeEndPos]];

I am using setVelocityTransformation for a plane flight, but the plane is very wobbly and buggy for all players except the server host. Is this an issue of locality or is it just a lag issue that cant be fixed? This code is executed on the server.

granite sky
#

Are getPosASL _plane and _planeStartPos identical here?

#

oh, there's a setPos at the top...

winter rose
#

!quote 5

lyric schoonerBOT
granite sky
#

That one should definitely be setPosASL.

#

setVelocityTransformation makes way more sense if it's from start->end rather than current->end.

#

Like you can do that, but it's probably wrong :P

#

Also the updir is bogus here, not sure if that matters.

meager granite
#

Doesn't setVelocityTransformation send network set position messages for remote entities?

#

Not sure if its a good idea to execute it on a remote entity each frame

little raptor
#

it shouldn't even work for a remote entity

#

it requires local arg

meager granite
#

I think other setPos commands set it locally on remote entity and also send position update network message

#

not sure if this one is different

past wagon
#

It's a little bit redundant

little raptor
granite sky
#

Interval needs fixing I think.

past wagon
little raptor
granite sky
#

Probably best to pass in the start time.

#

You can do it without but the calc gets messy

#

Like remove all dependencies on the plane's current position within the EH.

past wagon
#

hmmm

marsh trench
#

how does this work?
sideChat has 2 syntax :

[side, identity] sideChat chatText;
unit sideChat chatText;

but nither of them are [unit, text] sidechat.
so how does remote exec work? does it know how an specific commands syntax work?

[cursorObject, "Test1"] remoteExec ["sideChat"]
open fractal
little raptor
tough abyss
#

Aka for remoteExec the format is always ```sqf
[arg1, arg2, argN...] remoteExec [...]

regardless of the format of the function you're remoteExec'ing
little raptor
#

commands have only 2 args (max)

tough abyss
#

Commands, yes, but remoteExec in general can pass more than 2 args

little raptor
#

I know

#

just saying

tough abyss
#

I know that you know that I know that we know that we agree blobdoggoshruggoogly

past wagon
#
private _plane = createVehicle ["B_T_VTOL_01_infantry_blue_F", [0, 0, 1000], [], 0, "FLY"];
private _startTime = time;
addMissionEventHandler ["EachFrame" {
        params ["_plane", "_planeStartPos", "_planeEndPos", "_startTime"];
        private _vectorDir = _planeStartPos vectorFromTo _planeEndPos;
        private _vectorUp = _vectorDir vectorCrossProduct (vectorUp _plane) vectorCrossProduct _vectorDir;
        private _velocity = _vectorDir vectorMultiply 100;
        private _distance = _planeStartPos vectorDistance _planeEndPos
        private _interval = (time - _startTime) / (_distance / 100);
        _plane setVelocityTransformation [
            _planeStartPos,
            _planeEndPos,
            _velocity,
            _velocity,
            _vectorDir,
            _vectorDir,
            [0, 0, 1],
            [0, 0, 1],
            _interval
        ];
}, [_plane, _planeStartPos, _planeEndPos, _startTime]];
#

alright, so how would I deal with interval?

granite sky
#

_interval = (time - _startTime) / (_dist / 100)

past wagon
#

ok

#

not 100 * diag_deltaTime / _distance?

granite sky
#

I wouldn't use frame times for this.

past wagon
#

ok

granite sky
#

(_dist / 100) here is just the total time it should take to cover start->end.

past wagon
granite sky
#

nah planeStartPos and planeEndPos went walkabout and you just zero'd the updir, so I dunno what that does.

past wagon
#

but this code wont work?

granite sky
#

oh, you don't define distance either. Should be private _distance = _planeStartPos vectorDistance _planeEndPos or similar.

#

I don't know. I always defined the updir.

past wagon
#

oh yeah

#

I think I just forgot to include that, I have it in my other code

past wagon
#

because right now the plane is wobbly and starts tilting up randomly for players who arent the server host

granite sky
#

uh, [0,0,1] at worst.

#

start pos and end pos have the same Z value?

past wagon
#

ohh

#

upDir is supposed to be an array

past wagon
granite sky
#

[0,0,1] should be pretty fucking level :P

past wagon
#

ok

#

its just a 1 meter difference?

granite sky
#

It's a unit vector...

past wagon
#

oh

#

right

#

so wait

#

should I set both the current and next vectorUp to [0,0,1]?

granite sky
#

Well, if you want it to fly in a straight line then vectorUp won't change.

past wagon
#

yeah

#

ok

granite sky
#

Generally you're better off using something like this though: private _vectorUp = _vectorDir vectorCrossProduct (vectorUp _plane) vectorCrossProduct _vectorDir;

#

which will work correctly even if it's not a level path.

past wagon
#

okay

#

should I just do that then?

granite sky
#

probably.

past wagon
#

ok

past wagon
#

it's working! thanks

fluid wolf
#

Does anyone know a good way to turn the screen monochrome for a bit as an intro?

past wagon
#

yeah

past wagon
#

there is a mission on the steam workshop that can help you edit them in game to get it the way you want it

fluid wolf
#

Hmm... ok

#

thank you

#

would that be... color corrections?

tough abyss
little raptor
#
private _vectorUp = _vectorDir vectorCrossProduct [0,0,1] vectorCrossProduct _vectorDir;
little raptor
fluid wolf
#

Gotcha

#

Thank you

#

Is there a way to like, fade it out at all? EG Fade from Black and White to Normal Color? Or do I have to make it more abrupt?

tough abyss
little raptor
#

no

little raptor
little raptor
tough abyss
#

Yes

little raptor
#

which when crossed by dir gives a correct up

#

and again it only works as long as dir is not [0,0,1] itself

little raptor
tough abyss
#

Ah I see now, the example I was envisioning in my head was a case where it didn't change from [0, 0, 1]

#

My brain's a bit fried on vectors after how heavily I've been needing to use them as of late

#

Preserving momentum, direction, and relative positioning whilst teleporting requires a not fun amount of vector math

granite sky
#

Using the current vectorUp of the plane or [0,0,1] doesn't matter here because you're aiming for an upright path. The vectorUp is handy if you're doing weirder shit and chaining segments together, but in general you just use a vector that's in approximately the right direction and it outputs a vector that's in exactly the right direction.

past wagon
#

I'm now using this script to fly the plane, and it works, but for all players other than the server host the plane is constantly wobbling up and down... is it an issue of locality? how can I fix this?

private _startTime = time;
addMissionEventHandler ["EachFrame", {
        _thisArgs params ["_plane", "_planeStartPos", "_planeEndPos", "_startTime"];
        private _vectorDir = _planeStartPos vectorFromTo _planeEndPos;
        if (_vectorDir vectorCos (getPosASL _plane vectorFromTo _planeEndPos) <= 0) exitWith {
            removeMissionEventHandler ["EachFrame", _thisEventHandler];
        };
        private _vectorUp = _vectorDir vectorCrossProduct [0, 0, 1] vectorCrossProduct _vectorDir;
        private _velocity = _vectorDir vectorMultiply 100;
        private _distance = _planeStartPos vectorDistance _planeEndPos;
        private _interval = (time - _startTime) / (_distance / 100);
        _plane setVelocityTransformation [
            _planeStartPos,
            _planeEndPos,
            _velocity,
            _velocity,
            _vectorDir,
            _vectorDir,
            [0, 0, 1],
            [0, 0, 1],
            _interval
        ];
}, [_plane, _planeStartPos, _planeEndPos, _startTime]];
granite sky
#

you could at least actually use the vectorUp

little raptor
#

If the plane has roll it'll carry over to the new up

granite sky
#

oh, yeah :P

storm arch
#

Can someone summarize how arguements for addActions work?

winter rose
#

@storm arch ↑

storm arch
#

Thats what I looked at but there wasnt much to go off of

wide stream
#

Is there a way to execute code in EH (which have instigator parameter) only for units remotely controlled by Zeus?

#

I don’t want to fire this code for UAV operators, i need it to be fired only for remotely controlled units

winter rose
wide stream
little raptor
#

really big damage handling script
EH scripts should be small and fast thonk

wide stream
little raptor
#

preventing TK which is fully powered by “Hit” and “Killed” EHs
TK is prevented using handleDamage tho thonk

wide stream
#

I have like 3 or 4 different EH’s related to this system added so i’m trying to figure out how to filter out instigator’s that are remote controlling units through zeus

past wagon
#

does that make a difference?

granite sky
#

I don't know, I never passed garbage into the function before.

#

Otherwise I don't know why it wouldn't work. We have more complex setVelocityTransformation stuff and it looks fine on clients.

past wagon
#
private _items = [
    "V_PlateCarrierSpec_blk", 2,
    "H_HelmetSpecO_blk", 2,
    "U_O_R_Gorka_01_F", 2,
    "FirstAidKit", 1,
    "Laserdesignator", 1,
    "HandGrenade", 1,
    "SatchelCharge_Remote_Mag", 1,
    "DemoCharge_Remote_Mag", 1
];
_item = "";
for "_i" from 1 to (2 + round random 1) do {
    _item = selectRandomWeighted _items;
    _items deleteAt ((_items find _item) + 1);
    _items deleteAt (_items find _item);
    _itemCount = if (_item == "FirstAidKit") then {
        2
    } else {
        1
    };
};
```I am getting `Error: Generic error in expression` on the marked line and I don't know why...
winter rose
little raptor
#

the real problem is breaking the weighted array

#

selectRandomWeighted will give a string the first time

#

and that string is removed

#

leaving an unbalanced (odd) array

little raptor
#

no

past wagon
#

k...

past wagon
little raptor
#

the logic is wrong
and incorrect precedence as well

past wagon
little raptor
#

then test it

past wagon
winter rose
neat shadow
#

Question been trying to figure it out for awhile, but using ace I was in a ranger unit that had all of their uniforms

#

Coded into one single uniform aka,
Ranger uniform once you click on it it had a list or so that was winter uniform, arid, jungle etc
Anyone seen anyone videos made on how to do this or is it self made code

open fractal
#

gui would be the hardest part

mild mortar
#

Can someone DM me and help me with a music script?

modern agate
#

Anyone know if you can cancel out the radio call that appear after a trigger activates a ordinance module?

past wagon
#

how can I draw a line on the map that connects a player to a location? I want one end to always be connected to the player, and the other end connected to the position.

marsh trench
#

if i have a script file that gets excuted by execVM, if i create a variable in it like this :

misson_special_variable = 0;

will this be a global variable?

#

or do i need to set the variable in missionNamespace

tough abyss
#

It will be global

marsh trench
#

thanks

#

and does init.sqf excute per player connecting?

tough abyss
#

Yes

marsh trench
#

or once on map loading

#

oh thanks

tough abyss
#

It's good to reference this page

#

All of the things with the JIP checkmark execute on every player join

#

I would not recommend each frame, though

marsh trench
#

does BIS_fnc_arsenal with "Preload" argument preload the arsenal on the server hence the arsenal loads faster for everyone, or does it preload the arsenal on clients machine? and do i need to call it every time a player joins in multiplayer if i want to keep the arsenal preloaded?