Search the Community
Showing results for '"code snippet"' in content posted in ARMA 3 - MISSION EDITING & SCRIPTING and posted by dreadedentity.
Found 12 results
-
Hello, I'm DreadedEntity pushing out another code snippet for everyone. This time it's a super-simple countdown timer. This script will count down from the amount of seconds you give it, and it will also display it in an optional debug parameter. Actually, all of the parameters are optional. So here's the script: DE_countdown.sqf: /* Usage: [60, "myOutput", true] spawn DE_countDown; (if using execVM: [60, "myOutput", true] execVM DE_countDown;) Parameters: P1: NUMBER - The number of seconds from which to count down from. (Default: 300, 5 minutes) P2: STRING - The string name for the global variable which you want to output. (Default: "DE_countdown") P3: BOOLEAN - Debug. True to display a hint with the current time, false to not. (Default: true) Returns: Script Handle, allows you to check if the countdown has finished -Second parameter also allows the content creator to use the timer in any way he/she desires (ie. within a dialog). Format of the output is [hours, minutes, seconds] and can be accessed using: _countdown = missionNamespace getVariable "DE_countdown"; */ DE_timer = { _seconds = [_this, 0, 300, [0]] call BIS_fnc_param;; _secondsTemp = 0; _minutes = 0; _hours = 0; _globalVar = [_this, 1, "DE_countdown", [""]] call BIS_fnc_param; _hint = [_this, 2, true, [false]] call BIS_fnc_param; while {_seconds > 0} do { _timer = [] spawn {uiSleep 1;}; _seconds = _seconds - 1; _hours = floor (_seconds / 3600); _minutes = floor((_seconds - (_hours * 3600)) / 60); _secondsTemp = floor (_seconds - (_hours * 3600) - (_minutes * 60)); if (_hours < 10) then { _hours = "0" + (str _hours); }; if (_minutes < 10) then { _minutes = "0" + (str _minutes); }; if (_secondsTemp < 10) then { _secondsTemp = "0" + (str _secondsTemp); }; waitUntil {scriptDone _timer}; missionNamespace setVariable [_globalVar, [_hours, _minutes, _secondsTemp]]; if (_hint) then { hint format ["%1:%2:%3", _hours, _minutes, _secondsTemp]; }; }; }; Enjoy!
-
[CODE SNIPPET] Throw magazines to your teammates
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello! I was watching videos of milsim clans playing the game, people were out of ammo, they were being overwhelmed by enemies. In the heat of battle, a guy dropped a magazine on the ground and his teammate had to look down at the ground to pick it up. This isn't realistic! (well in a real battle you probably wouldn't throw mags) "Never again", I said and I got to work. 2 or 3 hours later, here's what I made. Code:- 19 replies
-
- 12
-
[CODE SNIPPET] Pull dead bodies out of vehicles
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey guys, been a while since I did a code snippet, so here's a new one. There's a lot of room for improvement, to be honest, I couldn't find a lot of the answers that I've been looking for in the configs for the past few days. Anyway, here's a video and the code is below that: VERSION 2: this addAction ["Remove Dead (TESTING)", { _veh = _this select 0; _vehPos = getPos _veh; _posDriverExit = _veh selectionPosition ("pos driver"); _posCommanderExit = _veh selectionPosition ("pos codriver"); _posCargoExit = _veh selectionPosition ("pos driver"); _posDriver = (driver _veh) worldToModel _vehPos; _posCommander = (commander _veh) worldToModel _vehPos; _posCargo = ((crew _veh ) select 0) worldToModel _vehPos; _driverExitOffset = (_posDriverExit select 0) - (_posDriver select 0); { if !(alive _x) then { _deadPos = _x worldToModel _vehPos; if ((_deadPos select 0) > 0) then { _deadPos set [0, (_deadPos select 0) + (abs _driverExitOffset)]; }else { _deadPos set [0, (_deadPos select 0) + (_driverExitOffset)]; }; _deadExitPos = _x modelToWorld _deadPos; _deadExitPos set [1, (getPos _x) select 1]; _x setPos _deadExitPos; }; } forEach (crew _veh); }, nil, 6, true, true, "({!alive _x} count (crew _target) > 0)"]; The condition in the action is still not working as I intended but I am incapable of caring any less about that. -
[CODE SNIPPET] Using actionKeys && prevent players from reloading if magazine is full
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello fellow content creators, As all of us know, BI gives us pretty much complete freedom in how we can mod their game. Now, everyone that's been doing this for a while knows that as you allow more freedom, things become overall more complicated. The reason why is pretty simple, as you give more freedom, you have to have to add more commands to the game and the wiki. Eventually commands will get lost in the deep web and become extremely obscure. So, I'm here again with another code snippet, and maybe a much longer post. The reason I've embarked on this quest was because a few days ago someone was asking about how to disable players from accessing the map. I came up with 2 solutions but both were ugly, and barely working. So I dug deep into the wiki, and I'm back now and going to do a full write-up. Okay now, first, I'm going to show off some code and then go through it (possibly line-by-line), then finish off with some closing notes. Prevent players from reloading if they have a full magazine: _doNotReload = (findDisplay 46) displayAddEventHandler ["KeyDown", { _handled = false; if ((_this select 1) in (actionKeys "ReloadMagazine")) then { _magazine = []; { if ((_x select 2) && ((_x select 4) == currentMuzzle player)) then { _magazine = _x; }; }forEach (magazinesAmmoFull player); if (getNumber (configfile >> "CfgMagazines" >> (_magazine select 0) >> "count") == (_magazine select 1)) then { _handled = true; hint "Your magazine is full, don't reload"; }; }; if (_handled) then { []spawn { sleep 1; hintSilent ""; }; }; _handled }]; Okay, first off: _doNotReload = (findDisplay 46) displayAddEventHandler ["KeyDown", This adds a display event handler with the ID stored in a variable called _doNotReload, which is necessary if you ever want to remove the event handler. findDisplay will return the actual "display" value when you give the command a display IDD, using this you can add your event handler, 46 is the default, main game display. Seriously, click on that link and read it for yourself, it's hard to explain. "KeyDown" is the event handler we'd like to add, click on that link for a full list. DO NOTE: In my code I have "KeyDown" instead of "onKeyDown". I have tested "onKeyDown", "onKeyUp", "onMouseButtonDown", and "onMouseButtonUp" and none of them work unless you drop 'on' in front of them, suggesting that all of them on that list will work if you don't put 'on' in the beginning (but I only tested those 4). Actually, explaining all this sucks. Read over the code and if you have questions feel free to leave a comment and I'll answer to the best of my ability. A few reference pages from the wiki. actionKeys, DIK KeyCodes, A2 CfgDefaultKeysMapping Now, that last page is pretty much for just Arma 2, but while writing this post I found out how to get to the Arma 3 default keys. Go to the configViewer (cog symbol at the top of the editor), scroll to CfgDefaultKeysPresets -> Arma 3 -> Mappings. From there you can look at all of the actions in the game. By the way, here is that completed code that disables a player's map (and the GPS if they are bound to the same key, like the default keys are set up). disableMap = (findDisplay 46) displayAddEventHandler ["KeyDown", { _handled = false; if ((_this select 1) in (actionKeys "ShowMap")) then { hint "You cannot open the map"; _handled = true; }; if (_handled) then { []spawn //this spawn clears the hint after 1 second, in case anyone was wondering and couldn't figure it out { sleep 1; hintSilent ""; }; }; _handled }]; Hope that helps guys, enjoy. -
[CODE SNIPPET / RELEASE] Code for base builders
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello all, Earlier today someone was asking about building a base. Being the good guy that I am I started working on something that would make it easy to build bases. Rather than making ~30 edits to the code over the course of an hour like I usually do, I got it to a point where it works then posted it. Then I lazily beefed it up a little more over the course of the past few hours. This is the ultimate result. Working in the current release of Arma 3 at the time of this posting. Copy this and paste it into the Debug Console, then click "Local Exec" actionStatus = false; { removeAllActions _x; removeAllActions player; }forEach (allMissionObjects "ALL" - [player]); { _x addAction ["Pick Up", { if (!actionStatus) then { (_this select 0) attachTo [(_this select 1)]; (_this select 0) setUserActionText [(_this select 2), "Drop"]; heldObject = (_this select 0); heldObjectDir = (direction(_this select 0)); currentAction = _this select 2; rotateEvent = (findDisplay 46) displayAddEventHandler ["keyDown", " if (_this select 1 == 51) then { heldObjectDir = heldObjectDir - 1; heldObject setDir heldObjectDir; }; if (_this select 1 == 52) then { heldObjectDir = heldObjectDir + 1; heldObject setDir heldObjectDir; }; if (_this select 1 == 207) then { detach heldObject; actionStatus = false; heldObject setUserActionText [currentAction, ""Pick Up""]; player removeAllEventHandlers ""keyDown""; }; if (_this select 1 == 211) then { detach heldObject; deleteVehicle heldObject; actionStatus = false; }; if (_this select 1 == 210) then { createVehicle [typeOf heldObject, getPos heldObject, [], 0, ""CAN_COLLIDE""]; }; false;"]; }else { detach (_this select 0); (_this select 0) setUserActionText [(_this select 2), "Pick Up"]; player removeAllEventHandlers "keyDown"; }; actionStatus = !actionStatus; },[],6,true,true,"",""]; }forEach (allMissionObjects "ALL" - [player]); player addAction ["Save to clipboard", { clipboard = ""; { if (typeOf _x != "Logic" && {typeOf _x != "Snake_random_F"} && {typeOf _x != "FxWindPollen1"} && {typeOf _x != "FxWindGrass2"}) then { pos = getPos _x; pos set [2, round (pos select 2)]; clipboard = clipboard + format["_obj = createVehicle [""%1"", %2, [], 0, ""NONE""]:_obj setDir %3:", typeOf _x, pos, round direction _x]; }; }forEach (allMissionObjects "ALL" - [player]); copyToClipboard clipboard; }]; TO USE THIS: First you need to put some things down in the editor. Place more than you need. You can delete stuff you don't want by picking it up and pressing "delete". You can also rotate objects by picking them up and pressing either < or >. They are bound like you think they would be, < rotates counter-clockwise and > rotates clockwise (like arrows pointing). Note: For some reason infantry doesn't like to be rotated, they will turn back to where they started (from what I could tell, the output is unaffected by their stupid behavior). ADDED: 2 new buttons; "Insert" will create a duplicate of the currently held object but you need to go back to the Debug Console and click "Local Exec" again (or click it a few times, I've already sorted out the issues with this) or else there won't be options to pick up the duplicated objects. "End" is an emergency drop button, I realize that for some objects you will not be able to "drop" them because the option doesn't show up. Just press "End" and the object will be dropped right where it is (I have also already sorted out the issues with this). TO SAVE: Select the "Save to Clipboard" option, then open notepad and paste the result. Press "ctrl + h" and replace all colons ( : ) with semicolons ( ; ). After that point you can then copy it again and paste the code right into your script. Wham, bam, easy peasy. A NOTE ABOUT SAVING: There are many random objects that get picked up when you use "allMissionObjects" for some reason (like snakes), I did a quick test and made a filter for a few of these items. If you are using this piece of code and you notice some random classname in the output, comment back here and I'll add it to the filter. For other scripters: For some reason, if you put a unit down, you are still able to rotate it until you pick up another unit. This is a bug due to my lack of knowledge of removing a display event handler. There is a piece of code in there that needs to be replaced, but the code still runs and without problem so I left it in as a guide on what to replace. Enjoy -
[CODE SNIPPET] Extracting full classes from config
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello! It has been a long time since I have made a code snippet! I am going to start making a GUI tutorial soon (maybe a series) but I don't like several of the things I had to do when I started learning about GUI's in Arma. Like many, I read and followed Iceman77's guide (and even had the privilege of having him in my teamspeak server multiple times), and bangabob's video tutorial. However, these required you to download/copy some files that had been already created for you. For a long time while I was learning, I did not realize the freedom that was available to me. Of course, a fair amount of my misunderstanding was probably due to naivete with the engine. However, in my tutorial series I want to express how much freedom one has and teach people not to be scared of searching for information and trying new things, not just follow a guide. So to prevent having to provide some file(s) that won't teach the viewer anything, I wanted to write a function that will allow them to "export" a config straight from the game, using BIS's default values. Note: This function must be compiled using the functions library with the Tag "DREAD" and the name "copyConfigClass" to work properly. As it is a recursive function, if you want to compile it with a different name, you will have to edit the self-call within the function yourself. The easiest way to use this script is to compile it using the functions library, using the names I have listed previously. So without further delay, here's my script: fn_copyConfigClass.sqf /////////////////////////////////////// // Function file for Armed Assault 3 // // Created by: DreadedEntity // // // // MUST BE COMPILED WITH THE // // FUNCTIONS LIBRARY // //Tag = DREAD Name = copyConfigClass// /////////////////////////////////////// /* TO USE: _partialClass = [config] call DREAD_fnc_copyConfigClass; INPUT: config: TYPE - Config | Anything that is not a config class is rejected. OUTPUT: _partialClass: TYPE - STRING | USED BY THE FUNCTION TO CREATE OUTPUT, DO NOT OVERWRITE HOWEVER, it is possible to save the result outside of the function, to run it multiple times ex. _textBoxClass = [configFile >> "RscText"] call DREAD_fnc_copyConfigClass; _listBoxClass = [configFile >> "RscListBox"] call DREAD_fnc_copyConfigClass; _buttonClass = [configFile >> "RscButton"] call DREAD_fnc_copyConfigClass; TO CLIPBOARD: Outputs a full class definition, even returning subclasses and their attributes, and it's nicely formatted with tabs. I'm such a god. */ private ["_parents","_numTabs","_numParams","_param","_newConfig","_params"]; _MAKE_TABS = { _tabs = ""; for "_t" from 1 to _this do { _tabs = _tabs + (toString [9]); }; _tabs; }; if (!isClass (_this select 0)) exitWith {"Input Was Not A Class"}; _newLine = toString [13, 10]; _parents = [_this select 0] call BIS_fnc_returnParents; _numTabs = _this param [1, 0, [0]]; _output = _this param [2, "", [""]]; _output = _output + (_numTabs call _MAKE_TABS) + "class " + (configName (_this select 0)) + _newLine + (_numTabs call _MAKE_TABS) + "{" + _newline; _params = []; { _numParams = (count _x) - 1; for "_i" from 0 to _numParams do { _param = configName (_x select _i); _newConfig = (_this select 0) >> _param; if (isClass _newConfig) then { _output = [_newConfig, _numTabs + 1, _output] call DREAD_fnc_copyConfigClass; } else { _newParam = _param; _data = nil; switch (true) do { case (isNumber _newConfig): { _data = getNumber _newConfig; }; case (isText _newConfig): { _data = str(getText _newConfig); }; case (isArray _newConfig): { _newParam = _newParam + "[]"; _data = str(getArray _newConfig); _data = "{" + (_data select [1, (count _data) - 2]) + "}"; }; }; if (_params find _param == -1) then { _output = _output + ((_numTabs + 1) call _MAKE_TABS) + format["%1 = %2;%3", _newParam, _data, _newLine]; _params pushBack _param; }; }; }; } forEach _parents; _output = _output + (_numTabs call _MAKE_TABS) + "};" + _newline; copyToClipboard _output; _output; Lastly, I'd like to thank the person who wrote the code for the Splendid Config Viewer; whose code was so bloated and unreadable I experienced the greatest headache of my life from reading it, and probably got cancer. -
[CODE SNIPPET] Decimal to base any encoder and decoder && vehicle diagnostic tool
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello everyone! It's been some time since I've done a code snippet, I've been busy with other projects and life stuff. But I'm here today and I have something really cool things to show off (in my opinion). This code snippet will be a little more intense than my other ones, which were mostly just fun little arma things or short tutorials. So without further delay, here I go: Well, you did read the title correctly. One of my favorite things to do with code is loops. They're a bitch, but I love them. Today I've got 2 really neat functions, one is for converting a decimal number to ANY base (binary (base2), ternary(base3), base 10 (decimal, not sure why you'd convert from decimal to decimal though), hexadecimal, octodecimal) and the other is to convert that data back into decimal. I don't personally have a use for them, I was just having a little fun with the engine (somehow I've turned this game into a glorified calculator). It all started with my other little script that I wanted to show off. I played the DayZ mod for a great long time (a really long time), I played it for about a year before I even noticed that there was still another entire game that I hadn't played. Anyway, Rocket had vehicles in there that you had to fix up, and actions were shown in different colors depending on how damaged they were. Well guess who was able to reproduce this? That's right, see my video just below this. Now, I do realize that this isn't quite the same setup Rocket had, but I think it's a really good starting point. For some reason, however, I had to code in some error handling because some hitpoints were not showing up properly, despite being ripped off directly from the configfile, how strange! You can see that when I look at the hatchback and the light blue "NOT FOUND", I had to do that because otherwise it messed up my structured text and was just all around not very pretty. Alright, so in both of these scripts there are a few problems. For the Vehicle Diagnostic Tool I already talked about that, something's wrong with scraping the config info. Now in the encode/decode script, I'm not sure how many people know about Arma's rounding issues, but it's pretty bad. I've complained enough about it for one lifetime, though, so I won't say anything more. While writing those 2 functions, I was trying to get around the rounding so there ended up being a lot of strings and things dealing with them, the problem is there's always a failure point though. To make a long story short I'll get to the point, there is a maximum amount of characters that can be input before BOTH the encoder and decoder become unreliable. To circumvent this, I recommend splitting up larger numbers and saving them separately, you can then decode them with no problem and just stick 'em back together, like reattaching a loaf of bread that's been cut in half. Well, I guess I'll be off now. Keep up the good work, and please, don't forget to have fun along the way. Download: Vehicle Diagnostic Tool | BaseAnyEncoderDecoder (both are dropbox links) -
[CODE SNIPPET] The simplest loot system of all time
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello all, I didn't think I'd be writing another code snippet so soon! I just finished writing an extremely simple loot system for single player so I thought I'd show it off. Below is a video I just recorded, and below that will be the code. I will be privately improving this and re-writing some of the core code to be used in multiplayer missions. Enjoy! _distanceToSpawn = [_this, 0, 300, [0]] call BIS_fnc_param; _sleepTimer = [_this, 1, 10, [0]] call BIS_fnc_param; while {true} do { _positionArray = []; _buildingArray = nearestObjects [player, ["house"], _distanceToSpawn]; { _positionArray pushBack ([_x] call BIS_fnc_buildingPositions); }forEach _buildingArray; { _element = _forEachIndex; { if (({(typeOf _x) == "Sign_Arrow_Blue_F"} count (nearestObjects[player,["Sign_Arrow_Blue_F"], 1])) == 0) then { _newMarker = createMarker [format ["%1_%2", _element, _forEachIndex], _x]; _newMarker setMarkerShape "ICON"; _newMarker setMarkerType "mil_dot"; _loot = createVehicle ["Sign_Arrow_Blue_F", _x, [], 0, "CAN_COLLIDE"]; [_newMarker, _loot, _distanceToSpawn] spawn { waitUntil {player distance (_this select 1) > (_this select 2)}; deleteVehicle (_this select 1); deleteMarker (_this select 0); }; }; }forEach _x; }forEach _positionArray; sleep _sleepTimer; }; //Framework by DreadedEntity //I'll have to ask anybody that uses this code, or any parts of this code, to not delete these comments And, lastly, as always, I'll always do my best to answer any questions people might have. -
[CODE SNIPPET] Hopefully this blows your mind/Preprocessor Commands are fun
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I know that title is rather cryptic, but bear with me. If this works like I think it will, it will be awesome. First go into the editor, pick any map, put a player down, and save it with any name. Now download this script (Dropbox) and place it in your mission folder. Rename it all you want and then execVM it from your player's init line. (or even just rename it to init and let the game run it for you) Enjoy! For fun screenshot the hint and post it! (you can blot out your name of course, oops spoilers!) -
[CODE SNIPPET] Fun with scripting - Simple jump script
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello all, I got bored and decided that it would be fun to see if I can make a person jump. You can! my init.sqf player addAction ["Jump (for loop)", { for "_i" from 0 to 12 do { player setPos [getPos player select 0, getPos player select 1, (_i / 12)]; sleep 0.02; }; }]; player addAction ["Jump (setVelocity)", { _vel = velocity player; _dir = direction player; _speed = 1; player setVelocity [ (_vel select 0) + (sin _dir * _speed), (_vel select 1) + (cos _dir * _speed), (_vel select 2) + 5 ]; }]; [] spawn { while {true} do { _position = getPos player; if (_position select 2 < getPos player select 2) then { hintSilent format["%1", getPos player select 2]; }; }; }; I don't know how to bind code to keypresses so this is where I leave you. Have fun! -
[CODE SNIPPET] & Extremely important note regarding position accuracy (to some)
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello all, While working on another script I plan to release soon (debug is taking an extremely long time because of this issue), I have found out that accuracy is nearly impossible to achieve because of the way numbers are handled either in the game, in the engine, or within my operating system itself. Basically, the issue is that somewhere in the pipes, all numbers are rounded to 6 significant figures. I was in the middle of writing a huge essay explaining the situation but I deleted it because I realized a chart would be faster to understand/explain and you guys wouldn't want to commit suicide from boredom while reading it. Besides, most of you should know what significant figures are from school anyway. So here's the chart: 12983.5m 1928.93m 495.293m 93.0293m 5.20039m 0.102938m This basically sums up the issue in 6 numbers, versus the (almost) 3 paragraphs I had written up (and we are all about optimization here). So as you can see, larger numbers lose significant portions of their accuracy, because if you do getPos (or literally any of the other position-returning commands in the game at the moment) they all output the same way. And if you think this only applies to positions, you're wrong: myNumber = 57.293847 + 2.394807209; //Those numbers should equal 59.688654209, I did the math on paper and with a calculator. hint str myNumber; //Game shows myNumber equals 59.6887. Try it! I have made an issue in the feedback tracker regarding this, extra information is also available, if you think this is important CLICK HERE AND VOTE UP. Why is this important? It's probably not to most people, but it's pretty important to me so I wrote this little function that's able to keep all that "extraneous" information. DREAD_fnc_getAccuratePos = { /* USAGE: _output = [P1] call DREAD_fnc_getAccuratePos; P1: OBJECT - The object you want a more accurate position for. RETURNS: POSITION ARRAY (3 ELEMENTS) - [[X position rounded to nearest whole integer, variation], [Y position rounded to nearest whole integer, variation], [Z position rounded to nearest whole integer, variation]] EXAMPLE: _accuratePosition = [player] call DREAD_fnc_getAccuratePos; RETURNS: [[14630,0.833008],[16172,0.761719],[0,0.00143814]] ADD EACH SUB-ARRAY TOGETHER: [14630.833008, 16172.761719, 0.00143814] */ private ["_object","_output","_objPos1","_objPos2"]; _object = (_this select 0); _object enableSimulation false; _output = []; _objPos1 = getPos _object; _object setPos [(_objPos1 select 0)-(floor(getPos _object select 0)), (_objPos1 select 1)-(floor(getPos _object select 1)), (_objPos1 select 2)-(floor(getPos _object select 2))]; _objPos2 = getPos _object; { _output pushBack [floor (_objPos1 select _forEachIndex), _objPos2 select _forEachIndex]; }forEach [0, 1, 2]; _object setPos [((_output select 0) select 0) + ((_output select 0) select 1), ((_output select 1) select 0) + ((_output select 1) select 1), ((_output select 2) select 0) + ((_output select 2) select 1)]; _object enableSimulation true; _output }; Using this function can return numbers (with a little work) that have up to a maximum of 11 significant figures! Currently set up only for object positions, but could probably be easily modified to input/return pure numbers using the same theory. This theory is using the "significant figures rounding effect" (as I have dubbed it) against itself, by saving an object's position, rounding down the X, Y, and Z positions to the nearest whole number and subtracting the object's current X, Y, and Z positions by the rounded numbers. Thus you have numbers like 0.0023938 and 0.392829 which since they are at 0, which allows them to utilize the maximum number of significant figures available. You then simply save both the rounded-down number, and the "variation". I hope this helps...somebody. It helped me EDIT: Added some colors to the chart in case anybody doesn't get it. -
[CODE SNIPPET] Fun with scripting - Make a gun that shoots CARS
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello all, I got bored again tonight and decided to mess around with Event Handlers. Turns out making a gun that shoots strider's is easy! I wish my video didn't come out at 360p for some reason and is blurry as hell. add to your init.sqf player addEventHandler ["Fired", { _bullet = _this select 6; _dir = _this select 0; _velocity = velocity _bullet; [_bullet, _velocity, _dir] spawn { sleep 0.02; _newPos = getPos (_this select 0); deleteVehicle (_this select 0); _newBullet = createVehicle ["I_MRAP_03_F", _newPos, [], 0, "NONE"]; //_newBullet setDir (_this select 2); //breaks setVelocity for some reason. do not uncomment. _newBullet setVelocity (_this select 1); }; }];