Jump to content

Gekkibi

Member
  • Content Count

    372
  • Joined

  • Last visited

  • Medals

Everything posted by Gekkibi

  1. It seems it's this time again... The release of new Arma means I have to update my old scripts once more. Because I had a request for this old script, I decided to publish it after tweaking it a little bit & making sure it works in Arma 3. Ladies and gentlemen, I give you GKB_fnc_randomAAFire. The same one rexehuk praised so much many years ago. Old video from Arma 2 version (go to 0:18, this video contains other projects I created as well). Here's an Arma 2 version in action. An actual mission, not just a showcase. Thanks goes to Havoc Company for using it. /* ---------------------------------------------------------------------------------------------------- Function: GKB_fnc_randomAAFire Author: Gekkibi Terms for copying, distribution and modification: Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) http://creativecommons.org/licenses/by-nc-sa/3.0/ Description: Defined AA-batteries shoot coherently to a randomly selected position, simulating anti-air fire without creating any in-game aircraft. Script will make sure they will not run out of ammunition. AA-batteries can be stationary or mobile. Batteries will stop firing at the fake target if they spot a real one, and continues normally afterwards. Parameters: 1st Objects in Array AA-units 2nd Arrays in array Target is created between these coordinates [[x1, x2], [y1, y2], [z1, z2]] 3rd Number Delay between targets 4th Number Secondary weapon chance (from 0 to 1). Use 0 if no such weapon 5th Code When true new targets are calculated Returns: Nil Example: [ [GKB_aa1, GKB_aa2, GKB_aa3], [[0, 4500], [7000, 8000], [1000, 500]], 20 + random 100, 0.1, {alive GKB_radar} ] spawn GKB_fnc_randomAAFire.sqf; ---------------------------------------------------------------------------------------------------- */ if (isServer) then { private ["_positionArray", "_runCondition", "_secondaryChance", "_sleepTime", "_unitArray"]; _unitArray = _this select 0; _positionArray = _this select 1; _sleepTime = _this select 2; _secondaryChance = _this select 3; _runCondition = _this select 4; { _x lock 3; } forEach _unitArray; while _runCondition do { private ["_direction", "_weapon"]; { if (! alive gunner _x) then { _unitArray = _unitArray - [_x]; }; } forEach _unitArray; if (count _unitArray == 0) exitWith {}; _direction = [ (_positionArray select 0 select 0) - random ((_positionArray select 0 select 0) - (_positionArray select 0 select 1)), (_positionArray select 1 select 0) - random ((_positionArray select 1 select 0) - (_positionArray select 1 select 1)), (_positionArray select 2 select 0) - random ((_positionArray select 2 select 0) - (_positionArray select 2 select 1)) ]; if (random 1 > _secondaryChance) then { _weapon = "cannon"; } else { _weapon = "missile"; }; { if (alive gunner _x && isNull assignedTarget _x) then { [_x, _direction, _weapon] spawn { private ["_direction", "_unit", "_weapon"]; _unit = _this select 0; _direction = _this select 1; _weapon = _this select 2; _unit doWatch _direction; sleep 2; switch (_weapon) do { case "cannon": { for "_x" from 1 to 1 + ceil random 5 do { sleep random 2; for "_x" from 1 to 10 do { if (! isNull assignedTarget _unit) exitWith {}; _unit fire (_unit weaponsTurret [0] select 0); sleep 0.05; }; if (! isNull assignedTarget _unit) exitWith {}; _unit doWatch _direction; }; }; case "missile": { sleep (2 + random 5); _unit fire (_unit weaponsTurret [0] select 1); }; }; if (isNull assignedTarget _unit) then { _unit doWatch objNull; } else { _unit doWatch assignedTarget _unit; }; _unit setVehicleAmmo 1; }; }; } forEach _unitArray; sleep _sleepTime; }; }; You can download an example mission by clicking here. As always, feedback, suggestions, questions, bug reports and outright insults are welcome. Feel free to use in your missions (CC BY-NC-SA 3.0).
  2. Don't like marker texts we have in Arma? Do they tend to clutter the map screen when you zoom out? Worry not, now you can write all the necessary map texts with a function! You can quickly draw lines too (paths, borders, you name it), or even arrows! Everything is done locally, so it won't cause problems in MP. With your own creativity you can even make it so that some markers are only created for certain side, unit type and so on. This way you can have intel, objectives, bp's, op's, etc for those who need them (private Johnson from 2nd platoon, 3rd squad don't have to know where tank platoon's BP 4 is located). Supported symbols: 0-9, A-Z, ".", ",", "!", "?", "'" and "-". More are naturally coming later. You can give me feedback and tell me which symbols you would like to have. Improvements over normal marker texts: - the text won't scale up when you zoom the map. This way the map is not a wall of text - you can rotate the text! (see example picture) - you can create extremely large text, or ridiculously small, whatever you need Improvements over normal marker lines: - faster to create. The end of the lines will automatically snap together Improvements over normal marker arrows: - ...did you even watch the example picture?!?! Here's a larger picture. It demonstrates nicely that this is much better method than using normal marker texts (or arrow symbols). The rest of the map is black because of GKB_bordersToMap (it's part of the example mission), a small script I created after I found out that you can create non-transparent markers... And after creating it I read a thread about A2 ACR DLC script that does pretty much the same thing! ...I just re-invented more gun powder... ;) Example mission can be downloaded by clicking here. As always, comments, feedback, bug reports and insults are welcome. ---------- How to use: 1) Download the example mission. 2) Delete GKB_mapTool folder, mission.sqm, description.ext and init.sqf (it's recommended you preview the mission first and familiarize yourself how to use this). 3) copy the remaining files to another mission folder where you want to use this. 4) incude the following line to your init.sqf #include "libraries\GKB.sqf"; I used GKB_clickToClipboard -script to get the coordinates. Every map click is added to your clipboard. I put it to the example mission folder. Have fun with it, and I hope it will make things easier. If you'd like to use it somewhere else than in the example mission, just create a radio trigger with this in the initialization field: nul = [] execVM "scripts\GKB_clickToClipboard.sqf"; ---------- Recent update: - Improved the font. Here's a comparison (old on top). Still not satisfied with the font. I'm going to do an alternative font you can use when text is not transparent (otherwise it looks "fugly"). here's a preview (0 is the future font). - Please note that previous patch made huge changes to the arguments, and you will have to replace the call arguments in your mission. Just copying new functions to the mission folder is not enough. I did this because of the feedback I got. Now it should be easier to find the right parameter. All markers use "SolidFull" brush now too. This doesn't mean you can't have transparent text, lines or arrows. It means that now alpha 1 is not transparent at all. You might have to tweak alpha parameters because default brush alpha != SolidFull brush alpha. - Automatic offset with the arrow text! You can define where you want the text to be ("front", "rear" or "center"). No more try & error with offset-value. - Separate color & alpha selection for arrows (text can be different color than the arrow)! - Some minor tweaks... - I included early WIP version of the in-game UI. It kind of works in MP, but it has some problems with indexing the markers. I do not recommend you use it in your missions. If you do, don't blame me when it's not working like you wanted it to work... ;) ).You can't change the text, color, transparency or width. Here's a picture. And here's a picture what it's going to be. Every slider and button is working: Here's how to use the WIP UI in the example mission (tools are located in custom UI that opens up every time you open the map. Yes, it's pain in the donkey, but it's what it is: WIP): Cancel: Removes on-map-click. Line: Shift-click - Set line end position. If you click close to your previous end position, it will finalize the line. Alt-click - Remove the last line end position. If no end positions left, it will cancel the tool. Arrow: Shift-click - Set the arrow's head position. If you click near the same location when both the head and tail has been set, it will finalize the arrow. Alt-click - Set the arrow's tail position. If you click near the same location when both the head and tail has been set, it will finalize the arrow. Text: Shift-click - Set the start position. If you click near the same location when both the start and end has been set, it will finalize the text. Start and end positions will be swapped if needed. Alt-click - Set the end position. If you click near the same location when both the start and end has been set, it will finalize the text. Start and end positions will be swapped if needed. Erase: Shift/alt-click - Erases the closest line, arrow or text drawn earlier. Must be relatively close to the line. Feedback is required! If you have any comments, please feel free to share them! Only with feedback I can make it more user-friendly. Here's the code if you want to see what and how it does this. ---------- Files: These are included in the example mission. If you only need certain files and know what you're doing, feel free to dig further.
  3. Sorry for a late reply, I've been engaged elsewhere for some time now. There's probably going to be a mod version as well, but only after I have made the UI working properly.
  4. Gekkibi

    Script Reference For All

    ...But there is... Right there, just look up couple of cm... :P http://forums.bistudio.com/showthread.php?147502-SIX-Config-Browser-Editing-resource-ARMA-3-Alpha-available
  5. You can also try using CAN_COLLIDE when using the One And Only createVehicle command. Dump the old obsolete command.
  6. New version: First version of the graphical UI released (see the 1st post): No more action menu crap.
  7. fix'd, I was tired yesterday, and I didn't test what I wrote. The addAction condition had !isNil instead of isNil. I made it so that you don't need lightsOff.sqf at all. All you need is a object "generator" and init.sqf, that is all. No other sqf's or markers on the map... ...And this time I tested it in Arma 3, works like a charm. ;)
  8. Yes, with cutText. However, extra steps must be made if you want others than just the one who activated the action see the text... Use this... init.sqf: if (!isNull player) then { [] spawn { nul = player addAction ["Switch Lights Off ", {lightsOut = true; publicVariable "lightsOut";}, [], 0, false, true, "", "_this distance generator < 5 && isNil 'lightsOutVariable'"]; waitUntil {!isNil "lightsOut"}; hint "plop"; sleep 10; hint "bang"; }; }; if (isServer) then { waitUntil {!isNil "lightsOut"}; sleep 10; { _x setDamage 1; sleep 0.01; } forEach (getPos generator nearObjects ["Lamps_Base_F", 500]) + (getPos generator nearObjects ["PowerLines_base_F", 500]); }; Now it should be MP compatible... Edit: And yes, you can remove the trigger completely. Also, delete the addAction from the player init field. All you need is init.sqf, plus the marker (and the generator, of course).
  9. That also has the locality issue in MP.
  10. MAJOR EDIT: forgot this was for MP... Didn't take locality into concideration... In case of power generator, edit the action. Because the object is always in the right place, you can clean the addAction as well. Name the generator "generator". lightsoff.sqf player sidechat "LightsOff in 10 seconds!"; sleep 10; lightsOutVariable = true; publicVariable "lightsOutVariable"; Create init.sqf where is this text: nul = player addAction ["Switch Lights Off ", "lightsoff.sqf", [], 0, false, true, "", "_this distance generator < 5"]; if (isServer) then { waitUntil {!isNil "lightsOutVariable"}; { _x setDamage 1; sleep 0.01; } forEach (getMarkerPos "lightMarkerTest" nearObjects ["Lamps_Base_F", 500]) + (getMarkerPos "lightMarkerTest" nearObjects ["PowerLines_base_F", 500]); };
  11. Put this to your player unit, you can completely remove the trigger. nul = this addAction ["Switch Lights Off ", "lightsoff.sqf", [], 0, false, true, "", "_this distance markerPos 'lightMarkerTest' < 100"]; Cleaned it up for you. player sidechat "LightsOff in 10 seconds!"; sleep 10; { _x setDamage 1; } forEach (getMarkerPos "lightMarkerTest" nearObjects ["Lamps_Base_F", 500]) + (getMarkerPos "lightMarkerTest" nearObjects ["PowerLines_base_F", 500]); player sidechat "Lights are OFF now! Gogogo!"; PS. Don't forget these: ;
  12. Oh dear, I didn't realize how and where you added the action to your action menu... ;) Ya, you only need to create it once. Could you post the current version of the sqf?
  13. Ya, it takes time to learn SQF. The magic trick is: practice - practice - practice. I started with SQS back in the OFP days, and switched to SQF when Arma 2 was released (I was too stubborn to learn new tricks when I played Arma 1, and sticked with SQS). It sure was pain in the donkey at first... Protip: keep this page in one of your browser tab, at all times. But back to topic: "_this distance centerPoint < 100" Create an empty invisible helipad, name it centerPoint and place it where you want. The action is visible when the player is closer than 100 meters from this object. When he gets closer than 100 meters he will see the action in his action menu. After he gets further it will suddenly disappear, and appear again when he's closer. This way you don't have to constantly create and remove the action (assuming you want to do that, that is).
  14. One easy way to do it is to set a condition for the action: nul = player addAction ["Switch Lights Off ", "lightsoff.sqf", [], 0, false, true, "", "_this distance someRelevantCoordinates/object < 100"];
  15. Not quite sure what you want to do, but if I understood you right, with an addAction. I'm curious, why do you publicVariable the variables? I guess these controls animate? According to BIKI, both the effect and argument of animate is global.
  16. Gekkibi

    Battlefeild Style Conquest?

    Use commands like setFlagTexture. As for marker color, use setMarkerColor...
  17. New version: The WIP UI kind of works in MP now. Relatively safe to use in coop missions, especially without JIP. If there are more than one faction then the indexing falls apart and starts to eat old markers from other factions... Feedback required. ...And yes, I know action menu sucks. This is (hopefully) only a temporary solution.
  18. _obj = _This select 0; _light1Pos = _this select 1; _light2Pos = _this select 2; _light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"]; _light lightAttachObject [_obj, _light1Pos]; _light setLightBrightness 0.2; _light setLightAmbient [1.0, 0.0, 0.0]; _light setLightColor [1.0, 0.0, 0.0]; waitUntil {!isNil "yourVariableNameHere"}; deleteVehicle _light; _light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"]; _light lightAttachObject [_obj, _light2Pos]; _light setLightBrightness 0.2; _light setLightAmbient [0.0, 1.0, 0.0]; _light setLightColor [0.0, 1.0, 0.0]; nul = [Heli1, [1, 0, 0], [-1, 0, 0]] execVM "lights.sqf"; Create a trigger, add desired condition and put yourVariableName = true to the on-activation field. Didn't test, might contain typos.
  19. nul = [Heli1, 1, [1, 0, 0], [-1, 0, 0]] execVM "lights.sqf";
  20. Wouldn't that create one building per player..? @OP Have you tried using "test setPos [getPos test select 0, getPos test select 1, altitudeYouWantToHave];"?
  21. Gekkibi

    Start Jet at a height

    No need to do that in A3 any longer. You can set the elevation in edit unit screen, lower left corner.
  22. Gekkibi

    Start Jet at a height

    Just change the elevation in edit unit screen...
  23. Create lights.sqf: _obj = _This select 0; _rate = _This select 1; _light1Pos = _this select 2; _light2Pos = _this select 3; while {true} do { _light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"]; _light lightAttachObject [_obj, _light1Pos]; _light setLightBrightness 0.2; _light setLightAmbient [1.0, 0.0, 0.0]; _light setLightColor [1.0, 0.0, 0.0]; sleep _rate; deleteVehicle _light; _light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"]; _light lightAttachObject [_obj, _light2Pos]; _light setLightBrightness 0.2; _light setLightAmbient [0.0, 1.0, 0.0]; _light setLightColor [0.0, 1.0, 0.0]; sleep _rate; deleteVehicle _light; }; Put this to your trigger activation: nul = [object, 1, [pos1], [pos2] execVM "light.sqf"; Tweak it before you're satisfied.
  24. Use the chemlights under empty -> mines. You can attach them by using attachTo command.
  25. ...Well, the question is: "can you hear crew irl if you're outside the tank and hatches are closed"?
×