#arma3_scripting
1 messages · Page 783 of 1
nah its on the server
Just use initPlayerLocal
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;
};
};
};
};
```?
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?
got a CAS strike set to a trigger, however it always makes a radio call when triggered, anyway to avoid this?
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)
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?
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];
};
};```
Personally I would use a method with the time command since it's low-cost to check
ie get mission time and add your duration to it and then check for that time being exceeded
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 
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
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
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
it depends, but it likely doesn't make a difference if the mission is built efficiently
IIRC someone who knows stuff stated that long sleeps have higher scheduler priority, which would suggest that they're accurate.
well, I feel like calling sleep 10 540x in a waitUnitl is worse than calling one sleep 5400
epic
but wonderful, thanks for the info
no because you have mission time as a reference
I was just worried so my sleep does not go over 5500
in terms of precision, not so much performance cost
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
well, if use the function I wrote higher, it would call it 540x
with vehicles
540 times?
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
how would you write the timeout? I used waitUntil
like I said, the time command is low performance impact
if there's something else I don't know about, show me
I really am just a noob with SQF
yeah, but you're missing my point
why would I bother, if simple sleep achieves the same thing
because sleep is imprecise because of how the schedule works
is it imprecise in the matter of tens of seconds?
but John believes it to be good enough and I'd trust him
maybe! It depends on how many scripts you have running and exactly how the scheduler handles long sleeps
not that much, 70+ server fps... so, should be good
Like this
Just edit your message
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
My evidence is largely hearsay but it makes sense :P
Alright, I was wondering if we were both talking about something else.
didnt work
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?
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.
you need to end it with ``` too
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
The mission is played today, it's 4:45 and I am about to go to bed. Way too much hassle to test it now 
so if you have performance-heavy loops running concurrently your script will have to queue up
still, I am not looking at tens of seconds of longer sleep time
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
But if what I heard is correct, the longer sleeps get priority so they should be pretty accurate.
can someone help me with this command
wheres with waitUntil I am looking at 5 at average + what the scheduler adds, same as with one sleep
i just want it to be able to spawn vehicles with the skins
Even if the scheduler was just picking scripts round-robin it'd have to be pretty bad before the delay was a second off.
Accurate, I don't care about seconds, minutes is what bothers me
so I should be alright either way
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
killzone_kid
thank you, will ask him directly once I see him online then
My guess would be its more reliable timeout than sleep because it might end up being bit longer due to scheduler
Triggers are a way to do precise non-scheduled each frame execution, thus I guess they're also good for precise timeouts
👍
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"];
};
those remoteExec's are redundant
if you're calling the function on every machine what's the point
also have you verified your function is properly defined in cfgfunctions?
yes
man ngl to you it'd be a lot better if you remoteExec'd the whole function instead of using remoteExec for every line
ok
lemme do that then
but wait
I only want the notification to spawn for the killer
remoteExec/remoteExecCall can send a command only for a client, which is the killer this time, I guess
yeah, i know
I just dont get why this script isnt working
no notification, no systemchat message, nothing
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];
Also keep in mind event scripts are for missions, so this won't work if you're just doing it in a mod
yeah, I got that fixed
yep, its a mission
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?
Executed when player is killed in singleplayer or in multiplayer mission with "NONE" respawn type.
Which respawn type you use?
@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?
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?
Is there a way to stop the AI from going prone?
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.
What did you pack with?
Pbo viewer
...
PBO Manager* ?
Its worked before on new test projects
Then I'm not surprised
Well it works fine repacking it with the same name, but if the name is different it just dosent
I see, so its just some encoding bug with those tools?
Whats a pbo prefix?
pboPrefix, a data for each pbos that tells Arma 3 “where I am”
e.g if you set pboPrefix "scripts", it should work regardless the pbo name
Got it, will need to redo my stuff with this. Thank you for the help
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
I use that newer PBO Viewer from the A3 forums
But I assume the root issue is similar?
Yeah I mean, just found the post and never heard of it until now
Gotcha gotcha.
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.
Is there a way to tell if preloading screen is visible?
The one that triggers onPreloadFinished/onPreloadStarted ?
A certain display perhaps?
have you checked https://community.bistudio.com/wiki/Arma_3:_IDD_List ?
Is there any way to fire a vehicle weapon without an AI in it?
like, have an empty vehicle shoot
I think a gamelogic can fire something
I believe you can
:\
if you make it as a simple object you can fake the firing tho 
with animation and everything...
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
Im sorry to bother, but I cannot figure this out. Even building with Addon Builder, it just doesn't load the pbo, even in a new local mod. The only thing changed is pbo name, and prefix name. Could something in my arma setting be preventing something?
what does the pbo do?
And are you sure it is not loaded?
The only thing changed is pbo name, and prefix name.
you're not supposed to change the prefix if a path depends on it
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
im sure its not loading as the new ace self interactions do not appear.
or maybe your "changes" are incorrect
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
Got it, wasn't sure at first will move.
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?
this addAction ["Sanitater", "loadouts\Sanitater.sqf"];
In this function, how can I add action distance so that its not interactable from 50 meters away?
the actions are by default not interactable from 50 meters away. What is your desired behaviour against whats happening?
not interactable from 50 meters away.
they are
default action distance is 50
radius: Number - (Optional, default 50)
there are examples on the wiki
i have it open, i genuinely dont know what to look at 
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.
try it so you can learn
your computer won't explode 
I know, but then what the purpose of having this just above
If action is added to an object and not to player, the condition will only get evaluated if player is closer than ~50m to the object surface and is looking at the object.
Maybe i misunderstood that warning
it means it won't necessarily run the condition every frame
only when looking at the object
tried, nothing works
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.
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
this addAction ["Sanitater", "loadouts\Sanitater.sqf","50"];
like this?
no
You cannot skip anything between the arguments to condition
ok
here's another hint:
this addAction ["Sanitater", "loadouts\Sanitater.sqf","arguments","priority",....do i keep going?"50"];
and how do I know the default value?
I underlined it for you
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
btw new lines are optional
this addAction ["Sanitater", "loadouts\Sanitater.sqf",nil,1.5,true,true,,true,50];
like this?
You can't make everything quoted
Nope, as the example said
here's another hint:
the reason some things have "" is because they're strings
string means text
this addAction ["Sanitater", "loadouts\Sanitater.sqf", nil, 1.5, true, true, true, 50];
almost correct
yes, but your code still has issues
we didn't mean remove every ""
You can't skip everything before that, but after
this addAction ["Sanitater", "loadouts\Sanitater.sqf", "nil", 1.5, "true", "true", "true", 50];
right so text has ""
is "true" text?
i assume yes
it is a text (string) yes
this addAction ["Sanitater", "loadouts\Sanitater.sqf", "nil", 1.5, "true", "true", "true", 50];
read this again
i dont understand it
right true/false is a boolean so it doesnt need "-"
but anyway you could just copy the exact same things from the example
yep
this addAction ["Sanitater", "loadouts\Sanitater.sqf", "nil", 1.5, true, true, true, 50];
well no

depends what the argument is
i dont know what else to do with this
just look at the example again
it shows which ones have "" and which ones don't... 
this addAction ["Sanitater", "loadouts\Sanitater.sqf", nil, 1.5, true, true, "", "true", 5];
you skipped one
the ""?
yes
now?
yes
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
Programming without understanding syntax is hard
it works at least
you are goddamn right
yea i dont even know what syntax means
it sorta means the "grammar" of the programming language
^
Understanding syntax is what makes the usage of symbols like [ and { go from weird voodoo magic to an actual understandable ruleset
well you can start now:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting

it's not as hard as it looks
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.
And can always ask questions here, we generally don't bite
(though demonstrating effort is a prerequisite)
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.
apparently I am, but I didnt actually mean it that way. I just wanted to use "_player" instead of "_oldUnit".
no.... I don't think so. still dont understand how that works and what might cause it to be blocked....
@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
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
I would personally just "pave" the landing craft's floor area with walkable surfaces
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
yeah my onPlayerKilled.sqf is not firing when players are killed.
yeah thank you but sadly it's not mine 🙂 it is just the "[DISCONTINUED] LCAC Mod"
what I said can be done by scripting
doesn't have to be yours
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
oh ok but what do you mean "pave" ?
create a bunch of simple objects
and scale them
to cover the entire floor area with walkable surfaces
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 ?
you can make one in 10 seconds in object builder
oh you thought i put only one object and i resize it
yeah it's a good idea
it's a 1x1 square
Make sure you have script errors turned on in the launcher settings, and look out for any missing } in the file. Missing } have a bad habit of causing silent failures.
should I try using the Killed event handler instead of onPlayerKilled.sqf? Or does anybody know what might be causing the script to fail?
ok but after i do what exactly ? i attach this to the LCAC ?
because i need to freeze the LCAC
why?
the LCAC is a boat so i need to stop it
so just use setVelocity
yeah but the wave can be a problem
which is what those surfaces are for
I already told you in #arma3_scenario
make simple objects
Sad person
Thank you kind sir
@past wagon Can I see your current onPlayerKilled code
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
Is there a better alternative to a while loop? (that needs to always be looping.)
What purpose?
Ticking a radiation value on the player over time
no
Gotcha, thank you for the info.
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
damage _vehicle == 1 = ded
Thank you!
alive _vehicle is the shorter one. Also returns false for objNull which is handy.
…brain, why hast thou forsaken me
@storm arch ↑ what he said and I couldn't express! 😄 alive _vehicle it is
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.
Are getPosASL _plane and _planeStartPos identical here?
oh, there's a setPos at the top...
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
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.
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
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
yeah, pretty much
It's a little bit redundant
okay, lemme fix it
wat?
better?
Interval needs fixing I think.
I should change distance to _planeStartPos vectorDistance _planeEndPos?

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.
hmmm
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"]
with remoteExec you just need to have all the parameters in front; what you wrote is the equivalent of ```sqf
cursorObject sideChat "Test1"
```sqf
[[_side, _identity], _chatText] remoteExec ["sideChat"]
but nither of them are
[unit, text] sidechat.
that's not even valid in SQF
Aka for remoteExec the format is always ```sqf
[arg1, arg2, argN...] remoteExec [...]
regardless of the format of the function you're remoteExec'ing
commands have only 2 args (max)
Commands, yes, but remoteExec in general can pass more than 2 args
I know that you know that I know that we know that we agree 
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?
_interval = (time - _startTime) / (_dist / 100)
I wouldn't use frame times for this.
ok
(_dist / 100) here is just the total time it should take to cover start->end.
okay, so this should be the complete code?
nah planeStartPos and planeEndPos went walkabout and you just zero'd the updir, so I dunno what that does.
planeStartPos and planeEndPos are pre-defined
but this code wont work?
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.
well, I just want it to fly level. if I set the upDir to zeros, could that cause a problem?
because right now the plane is wobbly and starts tilting up randomly for players who arent the server host
wait, should I put [0,0,1]? wouldnt that not be level?
[0,0,1] should be pretty fucking level :P
It's a unit vector...
Well, if you want it to fly in a straight line then vectorUp won't change.
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.
probably.
ok
it's working! thanks
Does anyone know a good way to turn the screen monochrome for a bit as an intro?
yeah
ppEffects
there is a mission on the steam workshop that can help you edit them in game to get it the way you want it
What the hell how does that work better than just vectorUp
he probably meant [0,0,1] 
private _vectorUp = _vectorDir vectorCrossProduct [0,0,1] vectorCrossProduct _vectorDir;
yes
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?
Wouldn't that just result in [0, 0, 1] anyways though 
no
there are some fade to black and fade out stuff
dir cross [0,0,1] gives a right vector in the XY plane
Yes
which when crossed by dir gives a correct up
and again it only works as long as dir is not [0,0,1] itself
if you're still in doubt just use the right hand rule
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
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.
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]];
you could at least actually use the vectorUp
It does matter
If the plane has roll it'll carry over to the new up
oh, yeah :P
Can someone summarize how arguements for addActions work?
Thats what I looked at but there wasnt much to go off of
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
there is a scripted EH "curatorObjectRemoteControlled" 🙂
https://community.bistudio.com/wiki/Arma_3:_Scripted_Event_Handlers
you could add/remove the EH at that time?
I got really big damage handling script for preventing TK which is fully powered by “Hit” and “Killed” EHs and i want to exclude Zeus Controlled units from it
really big damage handling script
EH scripts should be small and fast
Nah i meant it’s a big amount of code, not like code that is hard to execute
preventing TK which is fully powered by “Hit” and “Killed” EHs
TK is prevented using handleDamage tho
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
oh crap lmfao I forgot that part
does that make a difference?
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.
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...
for "_i" from 1 to 2 + (round random 1) do {
// to
for "_i" from 1 to (2 + round random 1) do {
```also `_itemCount` is unused here
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
ohhhh yeah
yep, thanks
should be fixed now?
no
k...
what's wrong with it still?
the logic is wrong
and incorrect precedence as well
I dont see how
then test it
it works, just needed to add ()
what is the issue?
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
gui would be the hardest part
https://community.bistudio.com/wiki/forceAddUniform
https://community.bistudio.com/wiki/uniformItems
https://community.bistudio.com/wiki/addItemToUniform
these would be the backend commands for it
if you want a simplified version you can use addAction combined with the above commands https://community.bistudio.com/wiki/addAction
Can someone DM me and help me with a music script?
Anyone know if you can cancel out the radio call that appear after a trigger activates a ordinance module?
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.
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
It will be global
Yes
It's good to reference this page
All of the things with the JIP checkmark execute on every player join
@past wagon Use this with a looping interval https://community.bistudio.com/wiki/drawLine
I would not recommend each frame, though
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?


