Search the Community
Showing results for tags '.sqf'.
Found 6 results
-
.sqf Scripting with Array + forEach + forEach into a forEach
thy_ posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I need some help: my code is stuck in my own (low) understanding around array and forEach when they need/should work together. Below, may you kindly point out the mistakes and show the fixes? I already read a lot of BIS wiki looking for how to code forEach inside forEach, even it doesn't look so clever, feeling... private _drivers = [driver01, driver02, driver03]; private _cars = [car01, car02, car03]; While {true} do { // DRIVERS { // forEach _drivers start... if (alive _x) then // if the driver is alive, so... { if ((_x distance _targetMarker) <= 30) then // DONT KNOW BUT IM NOT SURE THIS IS RIGHT. ISN't IT? { if (lifeState _x == "HEALTHY") then // if the driver is healthy, so... { _x directSay _sound1; // the driver screams. if (!isNull objectParent _x) then // if the driver is onboard a vehicle, so... { hint "driver has a veh"; // show text on screen. }; }; }; }; } forEach _drivers; // repeat that for each driver. // CARS { // forEach _cars start... if (alive _x) then // if the cars alive, then... { if ((_targetMarker distance _x) <= 30) then // DONT KNOW BUT IM NOT SURE THIS IS RIGHT. ISN't IT? { <HERE EACH DRIVER> directSay _sound2; // I DONT KNOW HOW TO CALL ANOTHER ARRAY+FOREACH HERE. sleep 0.3; _something createVehicle getPos _x; // DONT KNOW BUT IM NOT SURE THIS IS RIGHT. ISN't IT? }; if ((damage _x) >= 0.1) then // if the car get damage, then... { hint "car got damage!"; // show the text on screen. }; }; } forEach _cars; // repeat that for each car. sleep 1; // a looping breath. }; // while next looping. -
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:
-
A way for a script to pull all units name on a given side including mods
Joedapro posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I need a easier way to spawn random units instead of individually pulling all classes from the in game editor and pasting it while adding quotations and commas like this: ["B_mas_med_Army_ENG_F", "B_mas_med_Army_EXP_F", "B_mas_med_Army_GL_F",]. I want to use a script that when called it will pull a random unit from a given side of a given type (infantry, land, air) and spawn them in a group. The group will be filled with random units. I also want it to pull units from mods that I download. I dont want to have to keep updating the script every time I download another unit mod. The mod MMC sandbox has no problem in doing this but I dont know how they did it. -
Hello everybody! I am a research student working on his final thesis on a Helicopter Simulator implemented in VBS3. I would need to do some script in order to create a training field in VBS3, something like targets appearing that responde when you pass throught. I was used working with unity and there it´s easy to access the editor and code there. Here in VBS3 I think it´s different, I have seen that there is the possibility of writing and external function and name it with .sqf extension and then call it, but where do I call it in VBS3? Isn´t is possible to write some code directly inside VBS3? Are there any other ways of creating interaction between things without scripting? I wish a good day to all of you, Marco Gotelli
-
Hi poeple, I having trouble with a script that I know that have worked but i don't remember how it works By that script i want to be able to switch between two version of a weapon the M1903A1 from NIArms the scoped and unscoped version I know that it works because i tested it before but meanwhile i unistall arma 3 to free some space on my hard disk and some headhache with the editor here is the script _unit = _this select 1; if ("start" in _this) exitWith { Scope = true; _unit addAction ["Mount scope", "sight.sqf", [], 1, false, true, "", "_target == _this and !Scope"]; _unit addAction ["Dismount scope", "sight.sqf", [], 1, false, true, "", "_target == _this and !Scope"]; }; if (Scope) then { _unit removeWeapon "hlc_rifle_M1903A1_unertl"; _unit addWeapon "hlc_rifle_M1903A1"; _unit addmagazines ["hlc_5rnd_3006_1903",1]; Scope = false; } else { _unit removeWeapon "hlc_rifle_M1903A1"; _unit addweapon "hlc_rifle_M1903A1_unertl"; _unit addmagazines ["hlc_5rnd_3006_1903",1]; Scope = True; }; _unit selectWeapon (primaryWeapon _unit); i put this in the init of the playable unit : [_unit] execVm "sight.sqf" I give the name "scope" to the rifle that it will picked up to be used by player, but when i'm testing the mission it's saying me "error if : type Object expected bool" at line 8 of my script please help me, it's an important part for the beginning of my scenario
-
How to execute multiple .sqf's through custom GUI
SnakeDocc posted a topic in ARMA 3 - QUESTIONS & ANSWERS
So I'm trying to create a custom GUI I can open through an addAction on an object, and through that GUI be able to select different .sqf's via tick boxes and then execute multiple of them through a separate button, as well as having another button for executing an .sqf and one for closing the GUI (example GUI linked below), I've created the GUI and understand how to make it show up in game, but I can't work out how you then tie all the separate .sqf's to the separate buttons. Could anyone with experience explain what the next steps are or link me to a forum post I've missed, below I've linked my GUI EDITOR OUTPUT as Classes and exported Styles sheet below. GUI Editor Output https://pastebin.com/C2fHnjyu Styles Sheet https://pastebin.com/qFQrb3QX