Search the Community
Showing results for tags 'allplayers'.
Found 3 results
-
Getting the total OPFOR/BluFor Players
JarrodsC posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi I have been trying to create a Attack and Defend so far I things have been moving along nicely but I have been having issues with spawning Ifirts for the Attackers. When I am just testing the script by myself it will only spawn one ifirt because there is only one Opfor player. But if someone else is playing with me it will spawn two Ifirts. Even though there will still only be one Opfor Player. TL;DR Trying to use allPlayers select {side _x == east}; to count the number of players on OPFOR to then spawn Ifirts for them. For some reason it always spawns one extra then what it actually needs? TeleportArea.Sqf This at the moment is mostly pointless but in the future will hold all the different areas for spawning. TeleportArea = "TeleportArea\TestArea.sqf"; NatoUnits = allPlayers select {side _x == west}; OpforUnits = allPlayers select {side _x == east}; execVM "RoundStartTimer.sqf"; TestArea.Sqf player removeAction weaponSafety; NatoUnits = allPlayers select {side _x == west}; OpforUnits = allPlayers select {side _x == east}; _Pos = [11362,11442]; { _x setpos [11682 + random [-5,0,5],11917 + random [-5,0,5],1] } forEach NatoUnits; { _x setpos [11362 + 10,11442 + 10,1]; GetinVechicle = VechicleSpawn createVehicle [11362 + 10, 11442 +10]; _x MoveInDriver GetinVechicle; } forEach OpforUnits; [300] execVM "GameTimer.sqf"; The highlighted areas in TestArea is what I belive is causing the issue. But I don't know why. I am fairly new to Arma 3 mission File scripting... Infact this is my first Mission file. So I do apologize if this may seem trival. Thanks, JarrodsC- 11 replies
-
- scripting
- createvehicle
-
(and 2 more)
Tagged with:
-
[Solved] Run SQF when role is not taken in server
NunesSergio posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello there! I'm struggling to find the solution to my problem. Already googled a lot to no use. My friends and I have a dedicated server running a mission which has a HALO Jump SQF script. This script is tied to a whiteboard object. Basically we want the HALO Jump to be available only when there are no pilot roles taken. I can only think it must be something along the lines of filling an array with "typeOf allPlayers" and run "typeOf" through it to know if there's "B_Helipilot_F" in there, but I really can't wrap my mind around the syntaxes. Can anyone help? Thanks in advance! -
Trouble looping through allPlayers array
Vostok7798 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey, all. Just wrote this event handler script the other day, and I hope to eventually implement it into a multiplayer mission. Now, I want the event handler to assign to all players on the server, so I thought I'd just create a forEach loop with the allPlayers array. The problem is, when I make reference to the _z variable within the loop it seems to mess with the commands and produce all kinds of compiling errors. As a bit of a run down, the event handler activates when the player fires their weapon. If there is a civilian in a vehicle, within 20 meters, who possesses a detonator, as well as an explosive device attached to his car, there will be a 75% chance they will detonate it. In addition, if there is a civilian driver within 50 meters, who merely carries a gun, he will be assigned to an enemy side and made enemy to the player. Now, the obvious issue is, throughout the code, the variable "player" is used, and from what I understand, it is no recommended to use it in multiplayer, hence the "forEach allPlayers" loop. Now, I thought it was merely a matter of substituting the player variable with _z, which represents a player from the allPlayers array. However, like mentioned above, it seems to cause quite a long list of errors. To be clear, the code as depicted below works flawlessly in the editor environment. Here is the code: { // All Players _z = _x; _z addEventHandler["Fired",{ _obTemp = nearestObjects [player, ["Car"], 50]; _manTemp = nearestObjects [player, ["Man"], 50]; { // All vehicles in a 50 meter radius of the player _y = _x; _hasWeap = false; if (! isnull (driver _y)) then { if ("ACE_M26_Clacker" in items driver _y && count (attachedObjects _y) > 0) then { if ((random 100) > 25 && (player distance _y < 20)) then { [(attachedObjects _y select 0), 1] call ace_explosives_fnc_scriptedExplosive; }; }; }; { // The occupants of the aforementioned vehicles _w = _x; { // The weapons of the aforementioned occupants if (_x != "" && side (driver _y) == civilian) then {_hasWeap = true}; [east, "HQ"] sideChat format ["%1", _x != ""]; } forEach weapons _w; } forEach crew _y; if (_hasWeap) then { _agGroup = createGroup (selectRandom [WEST, INDEPENDENT]); crew _y joinSilent _agGroup; { // Members of the new hostile group _x enableAI "ALL"; } forEach units _agGroup; _agGroup leaveVehicle _y; }; } forEach _ObTemp; { // All AI units in a 50 meter radius of the player _y = _x; _hasWeap = false; _unitAr = []; { // The weapons of the aforementioned AI if (side _y == civilian && _x != "") then {_hasWeap = true}; } forEach weapons _y; if (_hasWeap) then { _x enableAI "ALL"; _unitAr = _unitAr + [_y] }; } forEach _manTemp; _agGroup = createGroup (selectRandom [WEST, INDEPENDENT]); _unitAr joinSilent _agGroup; }]; } forEach allPlayers; Fair warning: I know nearly nothing about all of the multiplayer scripting quirks (and am only a beginner at programming in general), and have very little knowledge on what should be executed on solely the server, or what should be executed globally, or what should be executed by the clients, etc.. So, and pointers are more than welcome. at this point, I just need to know if I am barking up the right or wrong tree with how I am doing things.- 2 replies
-
- loop
- allplayers
-
(and 2 more)
Tagged with: