#arma3_scripting
1 messages ยท Page 660 of 1
yeah just tested. the eventhandler just goes ballistic when crashing
hmmm it kind of works just with a little bit delay
damaging the main rotor will destroy it but it will regenerate quickly
or not. weird
sometimes it can handle the damage and sometimes not
I'll just ping dedmen for now so he can take a look at it later @still forum
tried getting the selection name of the rotating diorama piece with
selectionNames GalleryDioramaUnit_01_F;
but it didn't work;
did I use it wrong?
did I use it wrong?
Yes
SelectionNames takes an object
oh got it
Is there anyway to get Container Object of the last added Container to a box/vehicle? I'm trying to create a container with specific items inside with a script but i have not been able to find a way to get the CO so i can add items to it. I did see someone getting the last object that returns from everyContainer which made me think last added object would be the last element in that array but that is not the case.
I know if statements only run once but I have it in a function that I'm calling but it still won't run. Should I be using something else?
Nvm
What command are you using to create the container?
setObjectScale works in sp but not on a dedicated server
the object just stops existing at all
If it's createVehicle (as I would expect) the first syntax here https://community.bistudio.com/wiki/createVehicle returns the created object e.g.
_createdObject = "classnamehere" createVehicle [getPos player];
_createdObject addItemCargo ["optic_ARCO",2];```
It does work on DS (source: watched someone do it a few hours ago) but there are specific conditions under which the command works at all.
Also, there can be culling issues. For example, when someone made a giant Miller, he would disappear if you looked at his top half, because some part of his normal model was still somewhere at his feet, no longer in your field of view, and the game therefore assumed he was out of sight.
maybe putting it in the init field doesn't work?
im not quite sure what the problem is with my set up for it
It's not, I'm not talking about objects, I'm talking about Cargo Container Objects (Backpack/Vest/Uniform https://community.bistudio.com/wiki/Category:Command_Group:_Containers)
For example, I already have a box object that was created with createVehicle, i want to use addBackpackCargoGlobal to add a backpack and get the added backpack object so i can use more add commands on that container (backpack) to add items into the backpack.
Although it looks like create"Vehicle" is able to create a backpack object, i could maybe manipulate this, i will try somethings. Thanks.
Okay maybe not, I was not able to find a function to move an object into a container. Does such a thing exist?
Every function I see creates an object with the classname.
Well I figured it out. Last answer on that topic, I wonder why I never thought of substituting new-old
. I was already doing a count check but I was doing it on total.
Okay a question you know the screens and stuff we can place custom images on, is it possible to change them mid mission via script
cool thanks
haha ha my first custom texture
good good the main op center is 90% completed including animations and props
sounds like bug. But no time for that
what are you working on rn?! ๐
battleye timeout
I'll just make a ticket then
I have some code running where I'm trying to count the number of players for bluefor and allow to code to repeat itself until turned off keeping the exact number of blufor players until turned off. But I can't find the right code to keep the current number of players. I have this so far
while {readyActive == true} do {
{
if (isPlayer _x && playerSide == west) then {
//Idk what to put here
};
} forEach (playableUnits);
hint format ["players %1",westPlayers]; //testing purposes
};```
readyActive == true that nonsense. Comparing a boolean to true does nothing
readyActive == true == true == true == true == true == true == true == true is literally the same as readyActive
you want the number of players in blufor?
or number of playableUnits in blufor (different things)
westPlayers = west countSide playableUnits
I'm looking to count west players that are even just slotted.
Yep that works. Thanks
sigh combat animations are so nice they allow you to keep a squad grouped together while allowing you to place them naturally around an area instead of standing in a wedge formation like idiots
Yeah, sure. My image is .jpg, the A3 image converter doesn't work and crashes each time i use it. I'll post my codes on Pastebin
onload = "[] spawn {execVM 'rangeScript.sqf';};";
execVm spawns already
@clever radish
action = "closeDialog 0;";
You can use IDC = 1 instead
oh okay. Thanks, could that fix the problem with the image not spawning?
Terra is helping me with GUI not spawning my image. Everything runs as it should, but the image is not showing. No script error will show either
sure
if I set player locations in init.sqf, will that be a problem if AI is disabled? will it only set the locations of units who have already been occupied by a player in the role selection screen?
@ me
what i mean is, do those objects exist in the mission before they are selected by a player
Allplayers only catched players, not unoccupied slots afaik
player0 setPos selectRandom [[, , ], [, , ], [, , ]];
player1 setPos selectRandom [[, , ], [, , ], [, , ]];
player2 setPos selectRandom [[, , ], [, , ], [, , ]];
player3 setPos selectRandom [[, , ], [, , ], [, , ]];
player4 setPos selectRandom [[, , ], [, , ], [, , ]];
player5 setPos selectRandom [[, , ], [, , ], [, , ]];
player6 setPos selectRandom [[, , ], [, , ], [, , ]];
player7 setPos selectRandom [[, , ], [, , ], [, , ]];
player8 setPos selectRandom [[, , ], [, , ], [, , ]];
player9 setPos selectRandom [[, , ], [, , ], [, , ]];
This is what I have in init.sqf. I have not added in the values yet
this is for multiplayer, and AI is disabled. will it still set the position of these objects if they have not been selected by a player?
@past wagon If AI is enabled for playable units, the unit can obviously exist before the player joins.
Independent of that, init.sqf runs on every client that connects, so if you change the player object position there, already existing objects get teleported.
wait
If that is in init.sqf it's bad
so every time a player connects it runs the script again?
Yes
should it be in initPlayerLocal instead?
That's why one should be using initServer.sqf for server stuff and initPlayerLocal.sqf for client stuff.
okay, im gonna put it in initServer.sqf because i was having problems with it in initPlayerLocal.sqf
Not that particular code, because initPlayerLocal.sqf runs for every connecting client too, so every time a player joins everybody who's already playing gets teleported.
the code would run again after the mission started, and teleport players in the middle of the mission when someone connected
yea
would it be fine in initServer.sqf?
It's not going to do much good in initServer.sqf as the units probably don't (all) exist when that runs.
okay
initPlayerLocal.sqf runs for every client that connects, so you can just place player setPos selectRandom [...]; there.
No, it only teleports the player on the client that is running initPlayerLocal.sqf (= the client that is joining).
In fact the problem was that you teleported every player from that file.
i can just have it say player instead of listing player1, player2, player3.....
because the units are named player1, player2, player3.....
Exactly, because you only want to teleport one player - the one that is joining.
ok
thank you
but there is one problem with this
the way I had it, each unit had one of 3 possible unique spawn locations
now everyone will have the same spawn locations, so it is possible that two players will spawn in the same place
Do your players have different role descriptions?
im not sure
That would be the easiest way to get something going.
i can make them have different role descriptions
Then one way to get it working is this:
private _spawnLocations = [[0, 0, 0]]; //Can't hurt to have a failsafe / fallback
switch (roleDescription player) do {
case "Player 1": { _spawnLocations = [...]; };
case "Player 2": { _spawnLocations = [...]; };
...
};
player setPos selectRandom _spawnLocations;
okay
so how do i make this work?
i need each player to have different role descriptions?
is that what "Player 1", "Player 2" are?
Yes
That switch-statement is basically the same as:
if (roleDescription player == "Player 1") then { _spawnLocations = [...]; };
if (roleDescription player == "Player 2") then { _spawnLocations = [...]; };
ok
It is indeed intended to work in initPlayerLocal.sqf.
Well it could in theory somehow happen (somebody messes something up while editing the code, a bug comes along, ...) that roleDescription player does not end up matching any of the options we compare it to ("Player 1", "Player 2", ...), and then player setPos selectRandom _spawnLocations; would throw an error. To avoid that we set a default value for _spawnLocations (ideally not in water, so [0, 0, 0] might not be the best choice), so in case the role description doesn't match any of the role descriptions provided, initPlayerLocal.sqf doesn't get interrupted by an error.
If the role description matches "Player 1", then that default value gets overwritten with the correct values for Player 1.
okay
if (roleDescription player == "Player 0") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 1") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 2") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 3") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 4") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 5") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 6") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 7") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 8") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
if (roleDescription player == "Player 9") then { _spawnLocations = [[, , ], [, , ], [, , ]]; };
player setPos selectRandom _spawnLocations;
I havent added in the values yet, but should this work correctly?
I also havent put in the fallback line of code at the beginning yet just for simplicity
Looks right to me.
hi guys i'm currently trying to make a scripted function where ai units and both empty and destroyed vehicles are deleted after 2 minutes, they would be inside a trigger area. I wrote this with some help from others, however i don't currently have access to a server to test it on; does this look satisfactory?
scopeName = main;
_counter = 0;
_counterLimit = 120;
while{true} do
{
_counter = _counter + 1;
if (_counter == _counterLimit && ((aiUnits inArea Trig1) || (landVehicles inArea Trig1)) then
{
{ (landVehicles inArea Trig1) deleteVehicleCrew _x } forEach crew inArea Trig1;
deleteVehicle aiUnits;
deleteVehicle landVehicles inArea Trig1;
killAi = allUnits inAreaArray Trig1;
{deleteVehicle _x} forEach killAi;
killVeh = vehicles inAreaArray Trig1;
{deleteVehicle _x} forEach killVeh;
canibal = allDead inAreaArray Trig1;
{deleteVehicle _x} forEach canibal;
breakTo main;
};
else
{
} exitWith {};
sleep 1;
};
thank you!
there are quite a lot of errors.
scopeNamesyntax is:scopeName "main": https://community.bistudio.com/wiki/scopeNameaiUnits inArea Trig1: ifaiUnitsis an array then this command will not work (same forlandVehicles) https://community.bistudio.com/wiki/inAreadeleteVehicleCrewsyntax:vehicle deleteVehicleCrew unit. vehicle is an object, not an array (landVehicles) https://community.bistudio.com/wiki/deleteVehicleCrewcrew inArea Trig1that is an illegal combination. again, crew only works on objectsdeleteVehicle aiUnits;assumingaiUnitsis an array this is also wrongdeleteVehicle landVehicles inArea Trig1;see (4) and (5)killAi = allUnits inAreaArray Trig1;allUnitsallUnits returns an array and does not take in any arguments, inAreaArray is similar to inArea (2): https://community.bistudio.com/wiki/inAreacanibal = allDead inAreaArray Trig1;see (7), same goes for allDead: https://community.bistudio.com/wiki/allDeadbreakTorequires a string as right argument:breakTo "main";: https://community.bistudio.com/wiki/breakToelse { } exitWith {};is not possible. it's eitherif (condition) then {} else {};orif (condition) exitWith {};
soo, uuhh nothing of your script will work
hey guys, im new to script code, so forgive me if this is a little handholdy
how would you write a script where you add a crew to an empty vehicle on init?
ive tried customizing vehicle crews from the config.cpp route, and its an insane hassle just to get more than 3 into a vehicle, i was wondering if its any easier using scripts.
@willow hound I added in some placeholder values to test it and I am getting an error on line 11. it says undefined variable
if (roleDescription player == "Player 0") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 1") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 2") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 3") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 4") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 5") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 6") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 7") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 8") then { _spawnLocations = [0, 500, 0]; };
if (roleDescription player == "Player 9") then { _spawnLocations = [0, 500, 0]; };
player setPos selectRandom _spawnLocations; //ERROR HERE
because it's not
_spawnLocations is only defiend inside the scope
๐
idk
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[0, 500, 0];};
....
};
but better to use arrays
or hashmaps
okay
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
};
player setPos selectRandom _spawnLocations;
does that look better?
@little raptor
missing ;
oh
also it won't work
why not
selectRandom _spawnLocations
returns a number
and its supposed to be an array?
have you ever seen a position as a number?! (hey go to grid 1
)
you have an array of numbers [0, 500, 0] ๐
yes
ok
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
};
player setPos selectRandom _spawnLocations;
now it works
Now it's an array of one position, selectRandom will always return the same position.
yay
ok
so...
well yea they are all the same coords
oh and i only put in one set of coordinates per player
just for testing
As long as you're aware of that, we're good ๐
did you exit the mission or just restart it?
well it says line 13
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
};
player setPos selectRandom _spawnLocations;
and variable _spawnLocations
there is nothing wrong with that
couldnt that be condensed with a forLoop with
roleDescription player == format["Player %1",_x]
The end goal is different _spawnLocations for each player.
ah
have you tried putting selectRandom _spawnLocations; in brackets like (selectRandom _spawnLocations); I know some languages are finiky like that
https://community.bistudio.com/wiki/setPos the comments all do that
it's perfectly fine
read the rules of precedence
What if we are in the case I described earlier?
if you guys cant find the error, then I certainly cant ๐คทโโ๏ธ
there is no error
im just gonna restart arma
post the rest of your code if it still doesnt work
What if roleDescription player matches none of provided ones?
WAIT
am i a fucking retard
nope
for a second i thought i might have pasted it into the wrong mission file
then this is your problem
#arma3_scripting message
oh
provide a default pos
wait
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
[[0, 500, 0]];
};
player setPos selectRandom _spawnLocations;
that just adds a default pos?
Where is the money indent Lebowski Leopard?
i dont understand what the array at the bottom does
that is a default return value
If the role description is not Player 0 to 9 like Player 10 he still needs a spawnLocation and this is the default value
okay
I'm not what that script should do
wait
That is a very bad coding style
oof
what is mr genious?
by any chance do the role descriptions actually have to have quotations?
or are they just strings?
In the Editor?
Don't need quotes there
ok
I mean why do u call it and not just taking a normal switch case
well all the role descriptions match up with the ones in the code
so i dont know what the problem is
faster
Isn't there a break statement now?
but the fastest solution is hashmaps here
And to call a script is faster then just execute the script?
which I'm not in the mood to explain to a newbie
Its a one time check for 9 players. Performance dont mattee
That code looks shite
Needs a foreach loop or switch case
Modify the end of the script like this and tell me what Arma gives you when you try with that:
systemChat str _spawnLocations;
player setPos selectRandom _spawnLocations;
ok
Ah nevermind, it gives you undefined variable lol
Elegance in coding is the opposite of performance. And when performance doesnt matter, i pick elegance
I'm not a newbie. Hashmaps would the best solution. But I agree with the faster execution against a switch but why call that function
ok
switch balala do {}
is still calling a code
so is if (blabla) then {}
plus call has a very minor performance penalty (<0.0004ms)
_spawnLocations = call {
// why do it here
};
and not here
_spawnLocations = [0,0,0];
if (blabla) exitWith{};
because it exits the entire script
Just put it in a if( true) then

in which case you check the if multiple times
you wanna copy paste code? be my guest
Thanks for just answering the question. I mean that is ugly as hell, not sure if (<0.0004ms) is worth it
I meant to keep avoid exiting the whole script with exitWith, yoi make an obsolete if statement.
It was a joke
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 1") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 2") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 3") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 4") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 5") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 6") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 7") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 8") exitWith {[[0, 500, 0]];};
if (roleDescription player == "Player 9") exitWith {[[0, 500, 0]];};
};
player setPos selectRandom _spawnLocations;
any news about wth is wrong with this script?
is my arma broken?
yea but why do i need a default
i know but that wont work when i add in actual arrays with a bunch of coords
right?
if ur roleDescription does not match one of the above u will run into a error
okay then lets fix the error instead of making a default coordinate
You said all the role descriptions align, so you shouldn't need a default, which makes this very interesting.
Is it vanilla Arma @past wagon?
yes
and these coordinate arrays are completely for testing purposes
i am going to add in 10 different sets of coords for each player
Just paste your added coords one
So it works with default, but not without?
no no no
Just go into your mission
im so fucking confused
type "roleDescription player" in debug console and see what comes out
You say its correct, but did you actually check?
the default is basically just "if the script doesnt work then just put them here". right?
the role descriptions are Player 1, Player 2, Player 3, etc.
Did you check yes?
not just "player"
Or do you think they should be?
I am confused
Please just go and check
in the mission
do you see the problem now?
not at all
Did u try in multiplayer?
not yet
๐
Does not work in single player.
bruh
idk
It's more complicated to check player == Player1 because you have to pay attention with isNil "Player1" and fun stuff like that
"Does not work in single player." that shouldn't be a problem here
vehicleVarName
the script is obviously checking multiple players
so its obviously intended to be multiplayer
wait if I host a LAN server will it work
But if the is execute that stuff in single player
even if I am the only one on the server
did you test in editor preview?
There is singleplayer and multiplayer Eden editor
yes. Multiplayer editor is local hosted LAN
but who cares if this is a multiplayer mission
Scrolling up I see so many people making bad recommendations and steering in the wrong direction 
He is just testing that stuff in singleplayer and not multiplayer. He should switch to multiplayer editor
That's why it isn't working
Yes. I just wrote that above
Yeah me too with my comment, u just misunderstood that
Smart; I didn't think of that. Only read about the existence of those commands a few days ago in fact.
Either way, I originally proposed using roleDescription, and here we are 
okay it does work in multiplayer
Yeah
anyone one what that error means?
22:52:51 Trying to add inventory item with empty name to object [Sharpshooter]
22:52:51 Trying to add inventory item with empty name to object [Heavy Gunner]
22:52:57 [ACRE] (sys_io) INFO: Pipe error: Read CreateFileA WinErrCode: 2
22:53:13 [CBA] (optics) INFO: Scripted camera restarted.
22:53:13 [ACRE] (sys_io) INFO: Pipe error: Read CreateFileA WinErrCode: 2
22:53:22 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
22:53:22 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
22:53:22 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
22:53:22 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
it goes on for another 200 lines
you're probably passing a local object to a remote target
hm that sounds like an equipement script could cause it ?
add local magazine to server owned unit, like that
Isn't 'bis_fnc_objectvar' the function that remoteExec tried to execute? does it make sense to call that via remoteExec? as its basically a getter?
also I think that stuff is done by vanilla
No 5 @little raptor
Trying to add inventory item with empty name to object
[ACRE] (sys_io) INFO: Pipe error:
[CBA] (optics) INFO: Scripted camera restarted.
A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
๐
I'm just messing around tho ๐
[Sharpshooter]
but it's the same kind of error ๐
i got a script that re-equips units into terrorist style, called through cba spawn eventhandler on class "man"
maybe that causes it. not really improtant bc some other poop auto disconnects me on serverjoin with no error message
Eh arma reboot fixed it. Probably some battleeye crap
Does it matter if I use netid array or object array using remoteExec? (network bytes wise)
sleep 60;
while { true } do {
waitUntil { sleep 1; alive player };
if !(player inArea "EndZone") then
{
player setDamage 0.05;
};
};
while true bad
i want to give players 60 seconds to get to a specific zone before they start taking damage
whats bad about it?
Whenever I have had a script with one, it just ends really poorly for performance. You really need an exit condition
use triggers
Hey everyone, quick question can you check to see if a door will open inwards or outwards?
okay
what if I want the exit condition to be until there is one player left
how would I go about that?
Does emptyPositions include in its count seats which have a dead body in them?
sleep 60;
while { true } do {
waitUntil { sleep 1; alive player };
if !(player inArea "EndZone") then
{
player setDamage 0.05;
};
};
``` this script doesnt seem to be doing 0.05 damage to players who are not in the zone after 60 seconds. what could be the problem?
it seems to be able to do 1 damage and instantly kill the player, but cant do smaller increments of damage
Well, it is setDamage, not addDamage.
i changed it and it still doesnt seem to be applying any damage
There is no addDamage command ๐
You have to get the current value, add the amount of damage you want to add to that value and then use setDamage with the result.
_currentDamage = damage player;
_newDamage = (_currentDamage + 0.05);
player setDamage _newDamage;```
because you don't put a sleep in it
no
I don't think so, but not sure either.
You can try killing the vehicle crew see what it returns
Is there a way in which I can create an option to enable or disable the alarm part of my script before the mission starts? ```sqf
soundAlarm = {
if (isNil "AlarmHasGoneOff") then {
AlarmHasGoneOff = true;
deleteWaypoint [grp4, 1];
wp1 = grp4 addWaypoint [getMarkerPos "marker_0", 0];
[grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
// Comment or Delete waitUntil {} Field if an Alarm is Not Needed or Desirable
waitUntil {
_alarm = createSoundSource ["Sound_Alarm", getMarkerPos "marker_0", [], 0];
(EAST knowsAbout player) == 0;
};
};
};
{
_x addEventHandler ["firedMan", {
_x removeEventHandler ["firedMan", _thisEventHander];
[] spawn soundAlarm;
}];
} forEach (units grp0 + units grp1 + units grp2 + units grp3);
Yes, parameters (secondary params in the article)
https://community.bistudio.com/wiki/Mission_Parameters
waitUntil {
_alarm = createSoundSource ["Sound_Alarm", getMarkerPos "marker_0", [], 0];
(EAST knowsAbout player) == 0;
};
will spawn many alarms
disable the alarm part of my script before the mission starts?
not sure what you mean
Is there a script command to order a medic to heal a unit?
no
it has to be scripted
there is an action for healing
but again it won't "order" the unit to do it
@little raptor how would I fix the spawning of many alarms? For the Disable or Enable the Alarm, I'm looking at like creating a mission param that can be selected before mission start while in the lobby.
alright, so i'll have the medic move to the person who needs healing first
Yes, mission params are exactly what you need. https://community.bistudio.com/wiki/Mission_Parameters
is there a generic move to (a person whom may be moving)
so that they will follow that person until they reach them?
no
fucking hell
you have to put it in a loop
doMove and moveTo (moveTo requires doStop in A3, not sure about A2)
create the alarm soundSource
waitUntil {sleep 1; condition}
delete sound source
(EAST knowsAbout player) == 0;
probably will never happen
or at least it'll take forever
What should I use as a condition?
Would something along the lines of once the reinforcements, or enemies in the area have been eliminated work?
plz help ```sqf
_selection = allGroups select {side _x isEqualTo west};
player hcSetGroup [_selection,""];
help with what?
player hcSetGroup (allGroups select {side _x isEqualTo west} apply {[_x, ""]})
thx @little raptor
I want to create random sounds around the player but I don't want other players to hear these sounds (local to the client only), I should use Say3D right? Because playSound3D says is only local while say3D is marked as both Global and Local on the wiki and so it got me confused...
plz halp again ๐ ```sqf
player addAction [([getPos player select 0, getpos player select 1, 500]), (random 360), "O_Heli_Attack_02_F", EAST] call BIS_fnc_spawnVehicle;
i some how have to wrap
well i even dont have a menu item title lol
i can do it with a sqf, but i don't wan't too
are module functions executed in scheduled or unscheduled?
Scheduled. You can always check by logging output of canSuspend
thank you!
i got it. player addAction ["a useless action that does nothing", {[([getPos player select 0, getpos player select 1, 500]), (random 360), "O_Heli_Attack_02_F", EAST] call BIS_fnc_spawnVehicle;}];
Question, is it possible to save a loadout to profileNamespace and have a script that can load it up later?
Looking into making a script for my guys that would preserve loadouts between missions
Nvm, got it, thanks!
Is there a smarter way to detect dense jungle areas or positions in Tanoa?
Trying to hide some IEDs/traps amongst the foliage.
count nearestTerrainObjects [position player, ["FOREST","FOREST BORDER", "FOREST TRIANGLE", "FOREST SQUARE"], 20000, false, true]
```returns 0
```sqf
count nearestLocations [position player, ["VegetationBroadleaf", "VegetationFir", "VegetationPalm", "VegetationVineyard"], 20000]
```returns 0
```sqf
isLush = (count nearestTerrainObjects [position player, ["TREE","SMALL TREE","BUSH"], 15, false, true]) > 14
```Gives me fairly acceptable results. Better alternatives?
hmm so maybe selectBestPlaces?
hello! can i give you guys two trigger requirements and you can string them together for me so it only goes off when both are met?
selectBestPlaces
say3D is marked as both Global and Local
One is for effect , the other is for arguments
say3D has local effect
@tough abyss what are you trying to do
Wanting to set up a trigger that stops firing the tracer module once a target has been shot.
shot or dead
using the pop up targets, so when they get shot and go down, i would like the tracer module to stop
is there a way to respawn as enemy? So I start blufor, die, and respawn as opfor without leaving to lobby ?
onPlayerRespawn.sqf and then set to a different position, new loadout, new side
i need some advise, how can i damage a unit (ace medical) without killing it, but still making it unconsious?
(using a script)
I tried to pass a vehicle to a script, using [vehiclenamehere] execVM "Script", but the first task is a getpos _this and it's complaining that _this is an array, not an object... but shouldn't it be the vehicle? o.0
nope!
._.
you are passing [vehicle], this is the argument itself (you could pass player, "", etc)
use params to name inner array values!
// e.g
player execVM "file.sqf"; // _this = player
[player] execVM "file.sqf"; // _this = [player]
``````sqf
// and in file.sqf
params ["_unit"];
_unit setDamage 1; // player is killed
the good thing is that params works for both player and [player]
it happens, this is called the rubber duck method ๐ when explaining to someone, the solution reveals itself
This is true.
I'm writing a scene, actually a bonus for exploration, where the player can call in supporting fire after destroying a jamming device, but the subsequent chaotic mess of communications and the desperate situation means that everything available gets used - read, randomly select three types of fire support per target, from VLS to mortars to a cluster bomb.
So wrapping my head around creating and calling functions.
But I couldn't get spawn to work for the life of me, and call doesn't allow for sleep, so it's not useful for mortar or arty, where I want multiple, spaced hits.
But I think Spawn may have been failing for the same reason I couldn't get Exec to work 
Yup, just so T_T I thought the [] was required to pass anything to a function
So Calls can't suspend, but Spawns can... do Spawns stop the thread they're running on until theyre complete?
For instance, if I had each of my functions generated in the same .sqf that they're called in, and ended with:
target spawn fnc_mortar;
target spawn fnc_bomb;
target spawn fnc_arty;
would fnc_mortar have to finish before fnc_bomb could begin?
Think I figured it out, nvm
And my random call idea works out :3 This is going to be such a hot mess
public variables yes, otherwise no
Ugh... spent all this time making my target jump around randomly, then remembered that BIS_fnc_randomPos exists T_T
On the plus side tho, the heli-rocket attack is ๐ฅ
Now i just gotta make it look good, since I'm spawning in the rockets instead of relying on the heli to take the shot
will this work: SQF _result = surfaceIsWater (getPosWorld player); _result
I am asking because I know it works with (getPos player)
but getPosWorld is faster so...
โ so basically yes ^^
Similar question;
pickle = getpos player;
[pickle select 0,pickle select 1,(pickle select 2)+15]
is spawning the thing that follows on the ground :/ I've checked each value, and it should be 15 meters above me.
how do you position the object? try maybe getPosASL/setPosASL?
ASL seems to have done it. Ugh T_T
Do I need a script to get the AI to use a searchlight in a side to side sweep?
The item is from CUP
BIS_fnc_holdActionAdd has some built in occlusion property, so the action doesn't show up if there's something blocking your view . Is there a way to turn this off?
nope, but add the action on the unit itself
it's probably part of the addAction command
Oh, that's brilliant actually. Thanks.
note that then you do not have to aim at the object itselfโฆ which may defeat the purpose?
kewl! you can even add that proximity thing as action display condition ๐
Anyway to remove the players ability to move but allow them to use the map and scroll wheel options while then being able to give them back control? I'm thinking enableSimulation but I can't seem to get it to work for a group of players in MP.
yes, by using the key pressed event handler on display 46 (main display) iirc
Yeah no clue what that means. Still fairly new to scripts
oh ok! sorry for the deep dive :p
i have an EH that fires on inventory openend, and i check if the container is a dead man unit, if so i want to close the inv.
closeDialog 602 didnt work, any suggestions?
Return true to override inventory opening
as a return value in the eventhandler?
yes
coolio it works now
Inb4 Lou says to look at the wiki
Anyone know how to go about getting the pos of a playable unit in multiplayer, before it's initialized? As in, the position of exactly where it was placed in the 3den editor
Looking to make a script where players who are loading in have a choice of either spawning in at their unit's default location on base, or spawning at other locations elsewhere on the map
save a getPosASL somewhere ๐
But I mean, before it's initialized on first spawn
So like, player's just loaded in, gone through role screen, and is at the first respawn screen to load in at the 3den placed pos or somewhere else
grab it as soon as the unit is created?
Potentially before the unit is created, like grabbing the data on where the unit was placed in 3den
but that ^ can be a simple add Respawn position function call, no?
Yeah, but the trick is the position- I'm looking to make a script that can get that position locally, on each player client, so that every playable unit has a respawn unique to that unit on the exact position it was placed in the editor
I just don't know how to get the position, or if it's possible
You can access the SQM by adding to your description.ext (Credit: KillzoneKid)
class MissionSQM
{
#include "mission.sqm"
};
So you can find all units pos
You have to do conversions
as they are stored in a different format
Don't know
Sounds good, I'll do some testing
Darn
Anyway to remove the players ability to move but allow them to use the map and scroll wheel options while then being able to give them back control?
hmmm would sqf while{goggles _x != "G_Respirator_white_F";} forEach units group player; do { _x setdamage (damage _x + 0.05);} forEach units group player; sleep 1;
work or am i messing up my magic variable placment again
Hey, any way to get the variable name of a certain object? E.g. if I want to get the variable name of the local player's unit
@still forum since you here can you havce a look at that code i just wrote
sorry to bother
I already left
I only join for a few seconds to read things, and then move on
Eh I mean..
You've reached Dedmens mailbox, please leave your message after the beep. beeeep
k sorry man have a good one
Alright, more dumb questions ๐ Trying to figure out what the best way would be to have the function search through the mission.sqm to find the entry for the local player's unit, so that it can pull the pos from that entry
What would be the best way to go about searching through a mission.sqm's mission entry for that entity?
That reaction doesn't give me a warm fuzzy feeling 

No clue where to even start, but I'm looking into using select to search config in missionNameSpace, then description.ext, then the missionSQM class and all the way down the tree to entities
Just need to figure out how it's structured, any tips would be welcome ๐
To be fully honest I have no clue how to implement a keydown event handler to keep the player from moving. Anyone mind give me some tips?
Okay, what's the function to pull a variable from a config entry? getVariable right?
getMissionConfigValue ("MissionSQM" >> "Mission" >> "Entities" >> "Item0" >> "Entities" >> "Item0" >> "Attributes" >> "name");
Anyone know what's wrong with my syntax?
Read the examples?
about everything is wrong
>> doesn't take string
getMissionConfigValue doesn't take config
thats not at all how that command works
See wiki
Okay, so then it'd look more like getMissionConfigValue ("MissionSQM >> Mission >> Entities[etc]")?
Or would I be using /'s?
What are you even trying to do?
What
Where on tha wiki page does it say anything about "MissionSQM" or using getMissionConfigValue with >>
Cuz I don't see it
The command takes a string.
No, okay, so from earlier, someone gave me some code that adds the mission.sqm into the description.ext as a class
And as I said >> still doesn't take a string on the left side
This post
I know it takes a string
But I don't know how that string needs to be formatted
still doesn't take a string
That command is useless for what you're trying to do
Would help if people wouldn't only credit a name (and the wrong name at that) but instead link the source so that people can read up on it by themselves.
Stupid question from a noob. Is there a mod/way to add triggers(F3 in editor) to zeus? I want to add repair/healing areas on a dedicated vps playing Overthrow Plus. I can get it working in the editor but can't figure out how to recreate it in our current game. I've thought about how I could do it manually in the .pbo(private group -- no key check) but I feel like I'm over complicating this. I'd appreciate any guidance to get me back on track.
you can edit missions while having their savefiles intact
ive done it with liberation
no idea how savefiles work tho
Is Event Handler code (re-) compiled every time the EH fires?
//PLAYER SPAWN RANDOMIZATION
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 1") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 2") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 3") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 4") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 5") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 6") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 7") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 8") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
if (roleDescription player == "Player 9") exitWith {[[, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500], [, , 500]]; };
};
player setPos selectRandom _spawnLocations;
I am getting an error on line 2: missing ;
where do I put the ; ?
can't have empty elements in your arrays
you can also use a switch statement instead of the call return
yea im not done putting in the values
but why does it say there is a missing ; on line 2? will that be fixed when I finish putting in the values?
yes
okay, thanks
private _spawnLocations = switch (roleDescription player) do {
case "Player 0": {
[[0, 0, 0], [100, 100, 0]]
};
case "Player 1": {
[[10, 10, 0], [110, 110, 0]]
};
default {
[[0, 0, 0], [100, 100, 0]]
};
};
player setPosATL selectRandom _spawnLocations;
is that more efficient than the current script i have?
true
And yes a Call is faster that a Switch but you are calling roleDescription a lot so the performance gain is probably canceled out.
i really dont believe that a call is faster in the end. its stated sometimes but it makes zero sense for a compiler to have abstraction be slower.
yes
use vectorAdd instead of [pickle select 0,pickle select 1,(pickle select 2)+15] 
maybe a simple _unit setVariable ["ACE_isUnconscious", true, true] will do it? (I've forgotten how it worked)
use animStateChanged instead
_unit addEventHandler ["AnimStateChanged", {
params ["_unit", "_anim"];
if (_anim select [0,4] != "amov" || _anim select [9,3] != "stp") then {
_unit playMoveNow format ["amovp%1mstpsrasw%2dnon", _anim select [5,3], _anim select [17,3]];
};
}];
remove the EH to restore the ability to move
it used to. I think Dedmen fixed it, but not sure
no
It can be 25% to 50% faster
in sqf every {} that is executed is a call.
if () then {};
switch () do {};
while {} do {};
call simply executes the code ( {} )
for a compiler
sqf is never compiled to machine code or something
it is interpreted I believe
does initPlayerLocal.sqf execute when a player connects to the server or selects a role and joins the mission?
The latter
little help plz sqf while {{goggles _x != "G_Respirator_white_F"} forEach units group player;} do { {_x setdamage (damage _x + 0.1)} forEach units group player }; sleep 10;
this is killing the player outright when it triggers instead of damaging over time
your sleep is outside the loop
while {{goggles _x != "G_Respirator_white_F"} forEach units group player;}
do {
{_x setdamage (damage _x + 0.1)} forEach units group player; sleep 10;
};```
better
That condition looks to me like only the last element of units group player actually has an impact.
well it damages the unit so thats a win considiering i cam up with this code off the top of my head at 4am
yeah im stumped a little help on how to get it to only damage the one not wearing the mask
while {true} do {
{
if (goggles _x != "G_Respirator_white_F") then {
_x setdamage (damage _x + 0.1);
};
} forEach units player;
sleep 10;
};
the loop goes on forever, so if someone takes their mask off later they'll take damage
still i was pretty close considering my rather lacking scripting knowledge
do you wish to trigger this in a specific area only? Asking as a HAZMAT professional and if a trigger will be used in combination with this.
hi im trying to get the classnames of some vehicle weapons to use with the addweaponturret command
@glass bridge im hoping to use it interchangably in triggers and for entire map
probs have to modify for triggers
and no i cant use the arma wiki because they are from a mod
I'm not sure what kind of weapons you want
I think vehicle weapons are of type 65536
but I don't think you can modify those
("getNumber (_x >> 'scope') >= 1 && {getNumber (_x >> 'type') == 65536}" configClasses (configFile >> "CfgWeapons")) apply {configName _x}
gives you all weapons defined in the config and of type 65536
//PLAYER SPAWN RANDOMIZATION
_spawnLocations = call {
if (roleDescription player == "Player 0") exitWith {[[12294, 19176, 500], [15415, 22406, 500], [3203, 20058, 500], [10218, 17779, 500], [4071, 20452, 500], [11914, 21564, 500], [4587, 22501, 500], [4207, 17277, 500], [9634, 18172, 500], [3081, 19081, 500]]; };
if (roleDescription player == "Player 1") exitWith {[[4587, 19665, 500], [8522, 19217, 500], [11941, 22596, 500], [6649, 22229, 500], [3990, 21117, 500], [14601, 23179, 500], [6310, 17372, 500], [5102, 20262, 500], [16554, 21863, 500], [7111, 17738, 500]]; };
if (roleDescription player == "Player 2") exitWith {[[7993, 22772, 500], [7002, 19597, 500], [3230, 21008, 500], [7328, 21442, 500], [11018, 17901, 500], [9227, 19692, 500], [6201, 19000, 500], [9974, 21632, 500], [4777, 21374, 500], [8603, 21809, 500]]; };
if (roleDescription player == "Player 3") exitWith {[[7572, 22080, 500], [6595, 20696, 500], [8481, 18457, 500], [11643, 20506, 500], [10353, 21035, 500], [, , 500], [4424, 18606, 500], [6215, 20262, 500], [14424, 20628, 500], [14343, 22283, 500]]; };
if (roleDescription player == "Player 4") exitWith {[[7450, 18715, 500], [5632, 20750, 500], [5591, 18661, 500], [8780, 20397, 500], [9458, 17317, 500], [10109, 19923, 500], [5102, 17969, 500], [12999, 21184, 500], [15089, 21686, 500], [12823, 22392, 500]]; };
if (roleDescription player == "Player 5") exitWith {[[6215, 21836, 500], [5998, 19461, 500], [10109, 20547, 500], [15835, 21320, 500], [2972, 21741, 500], [5442, 19855, 500], [8698, 23464, 500], [8291, 20886, 500], [7680, 19258, 500], [12131, 19828, 500]]; };
if (roleDescription player == "Player 6") exitWith {[[5496, 22121, 500], [13596, 22134, 500], [3990, 17982, 500], [9051, 21252, 500], [10245, 19149, 500], [6649, 21347, 500], [6717, 18552, 500], [12606, 20560, 500], [4763, 21904, 500], [8183, 17331, 500]]; };
if (roleDescription player == "Player 7") exitWith {[[3433, 18647, 500], [7911, 20180, 500], [8033, 21564, 500], [12524, 21564, 500], [14044, 19963, 500], [3963, 19543, 500], [11290, 19583, 500], [11168, 21917, 500], [10638, 18620, 500], [3976, 22053, 500]]; };
if (roleDescription player == "Player 8") exitWith {[[13569, 22867, 500], [8793, 17819, 500], [13637, 20615, 500], [5116, 19217, 500], [11208, 21239, 500], [14994, 20913, 500], [7287, 20615, 500], [9567, 22229, 500], [16093, 22039, 500], [5265, 17290, 500]]; };
if (roleDescription player == "Player 9") exitWith {[[9485, 20574, 500], [4641, 20723, 500], [8712, 22772, 500], [9349, 18796, 500], [10856, 20262, 500], [5971, 21171, 500], [7599, 18091, 500], [14112, 21429, 500], [5944, 18091, 500], [11358, 18593, 500]]; };
};
player setPos selectRandom _spawnLocations;
this script is not working and i dont know why
not even giving me an error message
where are you even executing that?
@past wagon you have an array with empty elements still
player 3
[, , 500]
ik this is a basic script but can sombody make me a jet deletion script its name is jet1 and everything i look at dosent make any sense to me cause i dont know shit about coding
wdym jet deletion?
so like once it reaches a trigger it deletes the jet for extra cpu space
so i can put more ai if need be
You can do that inside the waypoint
CPU space
?!
anyway, you can define an area and use deleteVehicle if the jet runs outside the area
deleteVehicle <someWPVariableThatIDontRemember>
so just deleteVehicle jet1?
im talking about about the classnames like they use in addweaponurret like as an example to add a 6.5mm rcws turret for the driver you would put "this addweaponturret ["lmg_rcws",[-1]]; its the lmg rcws part that im looking for
No, I need to check
mk
and what I showed you gives you ALL vehicle weapons
waypoint magic var would return the pilot so
deleteVehicle vehicle this
in your waypoint onAct
just that?
@tough abyss I'm working on a solution, just give me a moment :)
do i put that in the init field of the vehicle or the .sqf of the mission
it's literally just:
[thisTrigger] spawn {
params ["_trigger"];
while {triggerActivated _trigger} do {
{
if (goggles _x != "G_Respirator_white_F") then {
_x setdamage (damage _x + 0.1);
};
} forEach units player;
sleep 10;
};
};
oh heh, you'd probably also want to delete the pilot 
yes
Does spawn work with sleep?
deleteVehicle vehicle this;
crew vehicle this apply {deleteVehicle _x};
this didint even work
deleteVehicleCrew?
is there a command ? ๐ฎ
yeah, right. I used that one before 
wait, deleteVehicleCrew can also only delete one crew member at a time. So not so useful afterall
Again, it returns all class names in the config as an array.
There's no guarantee any of them would work on your vehicle
{deleteVehicle _x} forEach ([vehicle this] + crew vehicle this);

Yeah, why not
wow no apply
unused _foreachIndex ๐ฅ

for "i"
but tbh, isn't it weird deleteVehicleCrew has no alt syntax to just get rid of the entire crew of a vehicle?
quite strange
They work. I tested it
then what am i doing wrong
It's probably the waypoint field
yes
im putting it in as {deleteVehicle _x} forEach ([vehicle this] + crew vehicle this);
under act and it dosent wanna work
ticket time ๐
Then your waypoint isn't completed
heh
Increase the completion radius under "Transformation" to 50m for testing
it's a jet so can probably leave it large
are you using a waypoint or a trigger?
cause its 250 by 250 by -1
trigger
ah okay
haha
i dont even see that
_area = [_pos1, _pos2, _pos3, _pos4]; //define a polygon
while {true} do {
{
if (!isPlayer _x && {!(_x inPolygon _area)}) then {
{deleteVehicle _x} forEach ([vehicle _x ] + crew vehicle _x );
};
} forEach allUnits;
sleep 10;
}

all i see under transformation is position rotation size
that gave me a error
you can always use something like this:
#arma3_scripting message
deletes any unit that leaves the area ๐
you have to use it in the right place
heh
that still dosent make sense to me
you can get those positions in eden ๐
you could have used just ! inArea with an invisible marker
regardless
a move waypoint with that onAct would work fine
example
_pos1 = [1000,2000,0];
_pos2 = [-1000,2000,0];
_pos3 = [-1000,-2000,0];
_pos4 = [1000,2000,0];
_area = [_pos1, _pos2, _pos3, _pos4];
@noble heart or this
just define an area
like i said i know nothing about coding/scripting
or an empty trigger
triggerArea someTrigger
none of this makes sense i just want a script that i can put into said trigger that deletes the jet that is named jet1
you can't do it with just a trigger
I just went a way for making a ticket and now I see you are drawing polygons. Waypoint isn't fancy enough anymore ? ๐
then how do i even do it
I dont think the waypoint was ever utilized
xD
You know what Eden Editor is missing? Away to export unit layout and attributes, to share with others so we can quickly exchange a setup with beginners
Hmm yes it's almost like it needs some sort of extension
wait do i have to have the trigger and waypoint synced or something
Well it needs to be vanilla so new comers can easily access it
@noble heart does your jet even have a waypoint?
is it just one jet?
do you want to delete more units?
one jet and it has a waypoint to said trigger
then in the onActivation field of the waypoint put the aforementioned script
now you got me messed up haha
which one there are like 50 now
I think this is referring to the group tho
there is some weirdness going on if crew is deleted via deleteVehicle
group leader = pilot
ok (makes no sense tho)
yup
vehicle is deleted first
this also dosent even work
it doesent
are you putting that in the waypoint or trigger?
now im putting that on a waypoint
For my mission i need the contents of storage crates to be random. I want half of the crates to be equipment crates (with random equipment) and the other half to be weapon crates (with random weapons). The problem is that I want both of these types of crates to be the same mission object. How can I make it so that it only adds weapons to half of the crates and adds equipment to the other half?
it should work then
its not
what is your waypoint type?
move
did you set the waypoint completion radius?
yeah its 100
these are the scripts I currently have:
//WEAPON CRATE CONTENTS RANDOMIZATION
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];
_crates = allMissionObjects "Box_EAF_Wps_F";
{
_weapon_and_mag = selectRandom _weaponArray;
_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 3];
} forEach _crates;
//EQUIPMENT CRATE CONTENTS RANDOMIZATION
private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
_crates = allMissionObjects "Box_EAF_Equip_F";
{
_item = selectRandom _itemArray;
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
}
} forEach _crates;
I literally just tried it and it works (as R3vo said already) 
the way it currently works is that there are separate mission objects for the respective types of crates, but i want to have the same crate types everywhere.
here go into the vc it dosent even wanna work not sure what your on about
Send a screenshot of your waypoint setup
cant
Upload it to imgur or so
Looks fine ๐คทโโ๏ธ
and the jet has a variable name its jet1 if that means anything
AAAAAAA
B?
delete the waypoint and put it again then
don't mess with the completion radius or anything
just paste that code
@noble heart also the waypoint must not be offmap
//WEAPON CRATE CONTENTS RANDOMIZATION
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];
_crates = allMissionObjects "Box_EAF_Wps_F";
{
_weapon_and_mag = selectRandom _weaponArray;
_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 3];
} forEach _crates;
//EQUIPMENT CRATE CONTENTS RANDOMIZATION
private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
_crates = allMissionObjects "Box_EAF_Equip_F";
{
_item = selectRandom _itemArray;
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
}
} forEach _crates;
I would like to get it so that I can have 50% of crates contain weapons and 50% of crates contain equipment, but I want them to be the same type of crate/mission object.
still not working and its not
for each crate, could I make it flip a coin, and if it comes up as equipment, it adds random items from the equipment array, and if it comes up as weapons, it adds random weapons from the weapon array?
yea
divide by 2 (integer only 0,1,2,3,4,5,6..)
and fill half of them with weapons, other half with other stuff
well yeah but wouldnt it be easier to just have each crate have a 50% chance of being either?
I don't understand
you want each crate to be half filled with weapon and half filled with ammo?
no
or half of the crates to be weapons and the other ammo?
if (random 1 > 0.5) then {
i want each crate to either contain weapons + ammo or equipment.
but that could make you end up with 100% weapons
i know but there are a fuck ton of crates so odds are that wont happen
I want each crate to have a 50% chance of having weapons added to it, and a 50% chance of having equipment added
Odds were bad for that guy who won 700 million in the lottery, but still
use arsenal and blacklist some stuff
well if the luck comes out that way then it isnt the end of the world
itl take time but better than rng
no i am making a battle royale game
so its gotta be rng
_rng = random 1
if (_rnd <= .33) then {weapons}
if (_rnd > 0.33 && < 0.66) then {equipment}
if (_rnd >= 0.66) then {mags}
or you do
_rng = selectRandom [0, 1, 2];
okay is call BIN_fnc_CBRNHoseInit a contact only function cause it aint working son
how did everyone begin to learn/understand arma coding? little to no prior experience in scripting or coding. did you just trial and error? or is there a website for basics?
No programmer here as well. I just started with a video tutorial (German though)
PAIN. PAIN and suffering. And I still suck.
Mostly Youtube tutorials
pain apain and hours of trying code combinations till it sticks
@past wagon a really simple (but unoptimized solution) is this:
_crates = allMissionObjects "Box_EAF_Wps_F";
_cratesWithWpn = [];
for "_i" from 1 to count _crates /2 do {
_rand = selectRandom _crates;
_cratesWithWpn pushBack _rand;
_crates = _crates - [_rand];
};
_cratesWithItems = _crates;
@austere seal https://community.bistudio.com/wiki/Category:Scripting_Topics start here and read some
now use each for what you want
seriously tho that function isnt working for me to link the gas mask to the pack
@tough abyss
params["_thisTrg", ["_goggles", ["G_Respirator_white_F"]], ["_eVehicles", []], ["_addTime", 10], ["_addDamage", 0.1]];
while {true} do {
{
if (_x isKindOf "CAManBase" && !(goggles _x in _goggles)) then {
_x setdamage (damage _x + _addDamage);
};
if (_x isKindOf "LandVehicle" && !(_x in _eVehicles)) then
{
{
if !(goggles _x in _goggles) then
{
_x setDamage (damage _x + _addDamage);
};
}forEach crew _x;
};
} forEach list _thisTrg;
sleep _addTime;
};```
Le script. Save it as sqf and execVM it in the on activation filed. Activation "Anybody" Type "Present".
how do i get the syntax highlights working?
@cosmic lichen thank you
@tough abyss You can give it all the goggles you want that should work, excepted Vehicles (CBRN resistant ones you can define as you like), the time inverval and the damage that should be added each interval
[thisTrigger, ["G_AirPurifyingRespirator_02_black_F", "G_Respirator_white_F"], [cbrnTruck1, cbrnTruck2]] execVM "poisonScript.sqf";
if (_x isKindOf "Man" &&
Change that to "CAManBase" please
_crates = allMissionObjects "Box_EAF_Wps_F";
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];
private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
_weapon_and_mag = selectRandom _weaponArray;
_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;
_item = selectRandom _itemArray;
if (_rnd <= .5) then {
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 2];
} forEach _crates;
if (_rnd >= .5) then {
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
}
} forEach _crates;
yup okay sqf [unit] call BIN_fnc_CBRNHoseInit; isnt working for me
i highly doubt that will work but is it a start? @little raptor
this will
ah screw it i dont need to hose link to work gasmask is fin by its self
yeah but i wanna use code that im somewhat familiar with
it won't produce the result you want
i dont at all understand the code you wrote
@glass bridge if (_x isKindOf "Man" &&
Change that to "CAManBase" please
otherwise it will trigger for snakes and stuff as well
Alright. But why?
Animals inherit from Man as well
and you don't wanna put a gas mask on a snake or goat
that's true :D
really makes you think
It selects a crate
adds it to an array called _cratesWithWpn
then removes it from the pool
it does that for half the total crates
what remains is your _cratesWithItems
Nah, better don't ask "why" ๐
shorter variable names = faster
not that short
scripts with 50 variables named like this
upsmon
Was fun reading it...not
wait how much faster?
very little
negligible
but at least easier to type!
ima just call it "Weapon" so i dont get confused
what does _cratesWithWpn pushBack _rand; do?
_crates = allMissionObjects "Box_EAF_Wps_F";
_cratesWithWeapons = [];
for "_i" from 1 to count _crates /2 do {
_rand = selectRandom _crates;
_cratesWithWeapons pushBack _rand;
_crates = _crates - [_rand];
};
{
...
} forEach _cratesWithWeapons;
_cratesWithItems = _crates;
{
...
} forEach _cratesWithItems;
of course you didn't need to create a separate array for _cratesWithWeapons (you could just do it in the for loop)
but if that confuses you too...
adds _rand to array _cratesWithWpn
what is _rand? is it half of all _crates?
a single random crate
how many times?
ohhhhhh
its how many crates there are divided by two
okay
_cratesWithWeapons = []; what does this line of code do?
creates an empty array
am I supposed to put stuff in that array?
before all that 
ok
_crates = allMissionObjects "Box_EAF_Wps_F";
_cratesWithWeapons = [];
for "_i" from 1 to count _crates /2 do {
_rand = selectRandom _crates;
_cratesWithWeapons pushBack _rand;
_crates = _crates - [_rand];
};
_cratesWithItems = _crates;
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];
private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
{
_weapon_and_mag = selectRandom _weaponArray;
_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 2];
} forEach _cratesWithWeapons;
{
_item = selectRandom _itemArray;
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
}
} forEach _cratesWithItems;
that's your whole script
private _weaponArray = [["", ""]];
private _itemArray = [""];
_crates = allMissionObjects "Box_EAF_Wps_F";
_cratesWithWeapons = [];
for "_i" from 1 to count _crates /2 do {
_rand = selectRandom _crates;
_cratesWithWeapons pushBack _rand;
_crates = _crates - [_rand];
};
{
...
} forEach _cratesWithWeapons;
_cratesWithItems = _crates;
{
...
} forEach _cratesWithItems;
and where do I put the code that actually adds the weapons into the crates? just at the end?
that's your whole script
just use what I posted above
thanks
but just out of curiosity, can you tell me what would have gone wrong with this script?
_crates = allMissionObjects "Box_EAF_Wps_F";
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];
private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
_weapon_and_mag = selectRandom _weaponArray;
_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;
_item = selectRandom _itemArray;
if (_rnd <= .5) then {
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 2];
} forEach _crates;
if (_rnd >= .5) then {
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
}
} forEach _crates;
well
misses {
ok
@past wagon and if not that, since you're selecting a random number your crates wouldn't necessarily be divided in 2
you could even end up having all crates with either items or wpns
that would be astronomically unlikely
there are hundreds of crates
it would be pretty even
still, they wouldn't necessarily be divided by 2
yeah but thats not even a problem
something like 70% 30% was absolutely likely
not with hundreds of crates
it might be off by a couple
randomness is good
its for a battle royale
do you even know probability?
yes
if there are 200 crates, then there would be a 50% chance for it to be off by 1 crate, a 25% chance for it to be off by 2, and a 12.5% chance to be off by 3
well regardless of the amount of crates
but it would almost always be within 97 - 103 crates of one type
at least I think thats how probability works
idk
You could put it in a loop, run a bunch of trials, and see what happens.
yea
@past wagon ```sqf
_a = [];
for "_i" from 1 to 100 do {
if (random 1 >= 0.5) then {_a pushBack _i};
};
count _a
may give you as low as 27-30
an even better test:
_b = [];
for "_j" from 1 to 1000 do {
_a = [];
for "_i" from 1 to 100 do {
if (random 1 >= 0.5) then {_a pushBack _i};
};
_b pushBack count _a
};
_b sort true;
_b#0
gives you the minimum after 1000 tests
_crates = allMissionObjects "Box_EAF_Wps_F";
_cratesWithWeapons = [];
for "_i" from 1 to count _crates /2 do {
_rand = selectRandom _crates;
_cratesWithWeapons pushBack _rand;
_crates = _crates - [_rand];
};
_cratesWithItems = _crates;
private _weaponArray = [["hgun_ACPC2_F", "9Rnd_45ACP_Mag"], ["hgun_P07_F", "16Rnd_9x21_Mag"], ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], ["hgun_Rook40_F", "30Rnd_9x21_Mag"], ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"], ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"], ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"]];
private _itemArray = ["Binocular", "FirstAidKit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];
{
_weapon_and_mag = selectRandom _weaponArray;
_weapon = _weapon_and_mag select 0;
_mag = _weapon_and_mag select 1;
_item = selectRandom _itemArray;
_x addWeaponCargoGlobal [_weapon, 1];
_x addMagazineCargoGlobal [_mag, 2];
_x addItemCargoGlobal [_item, 1]
} forEach _cratesWithWeapons;
{
_item = selectRandom _itemArray;
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
};
{
_item = selectRandom _itemArray;
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
};
} forEach _cratesWithItems;
@little raptor would the repeated code at the bottom add multiple random items to the item crates?
it's wrong
misses ;
one extra {
plus it only adds two random items
(if it was corrected, that is)
if isClass (configFile >> "cfgVehicles" >> _item) then
{
_x addBackpackCargoGlobal [_item, 1];
}
else
{
_x addItemCargoGlobal [_item, 1];
} ; <- here
just what I said
and you didn't remove the extra {
got it
question for you guys, trying to add { #include "RifleTargets\cfgfunctions.hpp"};
to an existing class CfgFunctions, however when i do add it, i get an error code saying something to the effect of encountered "}" instead of "=" Any ideas?
Q: is there a call stack?
!(player in list triggerVariable)
can i get some help with this sqf if !(player in list shelter1 or shelter2); then { _x setdamage (damage _x + 0.1); } forEach units player;
no
you can call a recursive code virtually infinitely
- you need two
ins - remove the
;beforethen - missing
{}
@little raptor can you show me what you mean by two ins
!(player in list shelter1) && !(player in list shelter2)
or
!(player in list shelter1 || player in list shelter2)
second 1 is the one
both do the same thing
yes
the player can only be in one of the triggers
not if they overlap
they dont
plus that's not the same thing
it means player is in neither trigger
I simply corrected what you were doing 
!(player in list shelter1 or shelter2)
no i want it to kill the player if there not in one of the shelters
Anyone who knows how to remove the minigun magazines from the Ghost Hawk? and/or how to add an other turret type to the helicopter?
_veh = "B_CTRG_Heli_Transport_01_tropic_F"createVehicle (player modelToWorld [8,0,0]);
_veh setUnloadInCombat [true, false];
_veh removeMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Green", [0]];
_veh removeMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Green", [0]];
_veh addMagazineTurret ["2000Rnd_20mm_shells", [2]];
_veh addWeaponTurret ["gatling_20mm", [2]];
_veh addMagazineTurret ["2000Rnd_20mm_shells", [0]];
_veh addWeaponTurret ["gatling_20mm", [0]];
_dirP = getDir player;
_veh setDir _dirP
but wont && kill the player even if he is in one of the shelters
well it was correct in the first place
thanks it works i think i get it now
_unit gives off an error, its a MP mission. I have it running in
//initServer.sqf
//All inside if (isServer) then { ...
while {readyActive} do {
{
if (isPlayer _x && playerSide == west) then {
westPlayers = west countSide playableUnits;
_unit addEventHandler ["AnimStateChanged", {
params ["_unit", "_anim"];
if (_anim select [0,4] != "amov" || _anim select [9,3] != "stp") then {
_unit playMoveNow format ["amovp%1mstpsrasw%2dnon", _anim select [5,3], _anim select [17,3]];
};
}];
};
} forEach (playableUnits);
};
Would player work instead of _unit if in a remoteExec?
finaly got my emissions script done and my gas mask script
New Question. (A2OA)... I have ai units that sometimes go prone and then sit there forever. I can detect these situations. But I don't know how to unstick them. Is there a foolproof way? Perhaps a way to reset the ai for that unit entirely?
unit setCombatMode "GREEN";```
bc you are doing it wrong
Sounds about right
[_unit] joinSilent group _unit
should i try both those things?
๐คท
I honestly think resetting the group should do it but it wouldn't hurt to try both methods separate and together.
she may be rough ```sqf
while {alive player} do
{
sleep (selectRandom [5,10,15]);
b1 sideChat "ALL forces be advised, emission detected! Seek shelter immediately!";
sleep 1;
[1] spawn BIS_fnc_earthquake;
sleep 30;
b1 sideChat "Emission will hit in thirty seconds!";
sleep 1;
[2] spawn BIS_fnc_earthquake;
sleep 15;
b1 sideChat "Emission in fifteen seconds!";
sleep 1;
[3] spawn BIS_fnc_earthquake;
sleep 10;
b1 sideChat "FIVE SECONDS! GOD HELP YOU IF YOU ARNT INSIDE YET!";
sleep 1;
[4] spawn BIS_fnc_earthquake;
b1 sideChat " EMISSION INCOMING";
sleep 3;
[4] spawn BIS_fnc_earthquake;
shelter = execVM "shelter.sqf";
[4] spawn BIS_fnc_earthquake;
shelter = execVM "shelter.sqf";
sleep 10;
b1 sideChat "The emission has passed";
};```
im proud of my little script.
also is there a limit on sleep times
let me ask you a question. do you even know what an event handler is?
Somewhat. But I'm going to say no
no
sweet
it's a code that triggers every time that something happens
you just add it once
Oh I have to call it. Right?
no
something like this will trigger (get called) every time the unit changes its animation
_unit addEventHandler ["AnimStateChanged", {
params ["_unit", "_anim"];
if (_anim select [0,4] != "amov" || _anim select [9,3] != "stp") then {
_unit playMoveNow format ["amovp%1mstpsrasw%2dnon", _anim select [5,3], _anim select [17,3]];
};
}];
ohhhh
And this keeps the player from changing stance?
_unit playMoveNow format ["amovp%1mstpsrasw%2dnon", _anim select [5,3], _anim select [17,3]];
as for issues in your code:
- you're adding multiple event handlers

- no sleep

it forces the unit to play a certain animation
in this case I'm using a stop animation
Keeping them from moving
Yeah my code is very beginner-ish/sucks. Definitely going to need someone to point out all the mistakes when I finish it.
However I have learned a lot while making it
I have a marker on the map that gives information on amount of players. Should I used a PlayerConnected event handler to update this every time a player connects to the server?
_num1 = worldName; _num2 = serverName; _num3 = playersNumber west; _num4 = playableSlotsNumber blufor; _markerinfo = createMarker ["Info.", [12245.8,18606.6,-3.05176e-005]]; _markerinfo setMarkerShape "ICON"; _markerinfo setMarkerColor "Default"; _markerinfo setMarkerType "lop_flag_Afghan"; _markerinfo setMarkerText format ["Map %1. Server name: %2. Players %3 of %4", _num1, _num2, _num3, _num4];
This is the code. But I am unsure on how to have it automatically update to show the correct amount of players.
update it using setMarkerText
Thanks.
This should work.
onPlayerConnected { _num1 = worldName; _num2 = serverName; _num3 = playersNumber west; _num4 = playableSlotsNumber blufor; markerinfo setMarkerText format ["Map %1. Server name: %2. Players %3 of %4", _num1, _num2, _num3, _num4]; };
Adding _num1 and _num2 in onPlayerConnected seems redundant. (Unless they change throughout the mission)
I guess so , but it works. I can trim it down. It works running from eden. Should work on my server.
if (isServer) then
{
while {true} do
{
{
if (goggles _x != "G_AirPurifyingRespirator_01_F") then
{
_x setdamage (damage _x + 0.1);
};
} forEach units player;
sleep 10;
};
};
else
{
exitWith {};
};```
does this look right for use on a multiplayer server
No
