Jump to content

Search the Community

Showing results for tags 'functions'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • BOHEMIA INTERACTIVE
    • BOHEMIA INTERACTIVE - NEWS
    • BOHEMIA INTERACTIVE - JOBS
    • BOHEMIA INTERACTIVE - GENERAL
  • FEATURED GAMES
    • Arma Reforger
    • Vigor
    • DAYZ
    • ARMA 3
    • ARMA 2
    • YLANDS
  • MOBILE GAMES
    • ARMA MOBILE OPS
    • MINIDAYZ
    • ARMA TACTICS
    • ARMA 2 FIRING RANGE
  • BI MILITARY GAMES FORUMS
  • BOHEMIA INCUBATOR
    • PROJECT LUCIE
  • OTHER BOHEMIA GAMES
    • ARGO
    • TAKE ON MARS
    • TAKE ON HELICOPTERS
    • CARRIER COMMAND: GAEA MISSION
    • ARMA: ARMED ASSAULT / COMBAT OPERATIONS
    • ARMA: COLD WAR ASSAULT / OPERATION FLASHPOINT
    • IRON FRONT: LIBERATION 1944
    • BACK CATALOGUE
  • OFFTOPIC
    • OFFTOPIC
  • Die Hard OFP Lovers' Club's Topics
  • ArmA Toolmakers's Releases
  • ArmA Toolmakers's General
  • Japan in Arma's Topics
  • Arma 3 Photography Club's Discussions
  • The Order Of the Wolfs- Unit's Topics
  • 4th Infantry Brigade's Recruitment
  • 11th Marine Expeditionary Unit OFFICIAL | 11th MEU(SOC)'s 11th MEU(SOC) Recruitment Status - OPEN
  • Legion latina semper fi's New Server Legion latina next wick
  • Legion latina semper fi's https://www.facebook.com/groups/legionlatinasemperfidelis/
  • Legion latina semper fi's Server VPN LEGION LATINA SEMPER FI
  • Team Nederland's Welkom bij ons club
  • Team Nederland's Facebook
  • [H.S.O.] Hellenic Special Operations's Infos
  • BI Forum Ravage Club's Forum Topics
  • Exilemod (Unofficial)'s General Discussion
  • Exilemod (Unofficial)'s Scripts
  • Exilemod (Unofficial)'s Addons
  • Exilemod (Unofficial)'s Problems & Bugs
  • Exilemod (Unofficial)'s Exilemod Tweaks
  • Exilemod (Unofficial)'s Promotion
  • Exilemod (Unofficial)'s Maps - Mission Files
  • TKO's Weferlingen
  • TKO's Green Sea
  • TKO's Rules
  • TKO's Changelog
  • TKO's Help
  • TKO's What we Need
  • TKO's Cam Lao Nam
  • MSOF A3 Wasteland's Server Game Play Features
  • MSOF A3 Wasteland's Problems & Bugs
  • MSOF A3 Wasteland's Maps in Rotation
  • SOS GAMING's Server
  • SOS GAMING's News on Server
  • SOS GAMING's Regeln / Rules
  • SOS GAMING's Ghost-Town-Team
  • SOS GAMING's Steuerung / Keys
  • SOS GAMING's Div. Infos
  • SOS GAMING's Small Talk
  • NAMC's Topics
  • NTC's New Members
  • NTC's Enlisted Members
  • The STATE's Topics
  • CREATEANDGENERATION's Intoduction
  • CREATEANDGENERATION's HAVEN EMPIRE (NEW CREATORS COMMUNITY)
  • HavenEmpire Gaming community's HavenEmpire Gaming community
  • Polska_Rodzina's Polska_Rodzina-ARGO
  • Carrier command tips and tricks's Tips and tricks
  • Carrier command tips and tricks's Talk about carrier command
  • ItzChaos's Community's Socials
  • Photography club of Arma 3's Epic photos
  • Photography club of Arma 3's Team pics
  • Photography club of Arma 3's Vehicle pics
  • Photography club of Arma 3's Other
  • Spartan Gamers DayZ's Baneados del Servidor
  • Warriors Waging War's Vigor
  • Tales of the Republic's Republic News
  • Operazioni Arma Italia's CHI SIAMO
  • [GER] HUSKY-GAMING.CC / Roleplay at its best!'s Starte deine Reise noch heute!
  • empire brotherhood occult +2349082603448's empire money +2349082603448
  • NET88's Twitter
  • DayZ Italia's Lista Server
  • DayZ Italia's Forum Generale

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Yahoo


Jabber (xmpp)


Skype


Biography


Twitter


Google+


Youtube


Vimeo


Xfire


Steam url id


Raptr


MySpace


Linkedin


Tumblr


Flickr


XBOX Live


PlayStation PSN


Origin


PlayFire


SoundCloud


Pinterest


Reddit


Twitch.Tv


Ustream.Tv


Duxter


Instagram


Location


Interests


Interests


Occupation

Found 22 results

  1. Hi, I am spawning some motorized reinforcements as functions. They work fine but I have the feeling that performance gets worse then if I just execVM them ... //initServer.sqf _handle = 0 spawn { sleep 3600; call KIB_fnc_mehSqus; sleep 1800; call KIB_fnc_mehSqru; sleep 1800; call KIB_fnc_mehSqus;}; // fn_mehSqus.sqf // troops are doing exactly what I want - they use the BTR to hunt down players // then get out from the vehicle shoot and if no player is alive they get it and continue to hunt down other players reinfGRP = createGroup [independent,true]; _reinfGRP allowFleeing 0; private _spos = [battle_flg, 0, 500, 5, 0, 0.25] call BIS_fnc_findSafePos; private _reinfVeh = [_spos, 0, "rhsgref_cdf_btr80", _reinfGRP] call BIS_fnc_spawnVehicle; private _u1 = _reinfGRP createUnit ["rhsgref_cdf_para_squadleader", _reinfGRP, [], 0, "CARGO"]; private _u2 = _reinfGRP createUnit ["rhsgref_cdf_para_machinegunner", _reinfGRP, [], 0, "CARGO"]; private _u3 = _reinfGRP createUnit ["rhsgref_cdf_para_grenadier_rpg", _reinfGRP, [], 0, "CARGO"]; private _u4 = _reinfGRP createUnit ["rhsgref_cdf_para_rifleman", _reinfGRP, [], 0, "CARGO"]; private _u5 = _reinfGRP createUnit ["rhsgref_cdf_para_rifleman", _reinfGRP, [], 0, "CARGO"]; private _u6 = _reinfGRP createUnit ["rhsgref_cdf_para_machinegunner", _reinfGRP, [], 0, "CARGO"]; private _u7 = _reinfGRP createUnit ["rhsgref_cdf_para_grenadier_rpg", _reinfGRP, [], 0, "CARGO"]; private _u8 = _reinfGRP createUnit ["rhsgref_cdf_para_rifleman", _reinfGRP, [], 0, "CARGO"]; private _u9 = _reinfGRP createUnit ["rhsgref_cdf_para_rifleman", _reinfGRP, [], 0, "CARGO"]; private _u10 = _reinfGRP createUnit ["rhsgref_cdf_para_rifleman", _reinfGRP, [], 0, "CARGO"]; private _u11 = _reinfGRP createUnit ["rhsgref_cdf_para_rifleman", _reinfGRP, [], 0, "CARGO"]; private _u12 = _reinfGRP createUnit ["rhsgref_cdf_para_rifleman", _reinfGRP, [], 0, "CARGO"]; private _u13 = _reinfGRP createUnit ["rhsgref_cdf_para_rifleman", _reinfGRP, [], 0, "CARGO"]; private _u14 = _reinfGRP createUnit ["rhsgref_cdf_para_medic", _reinfGRP, [], 0, "CARGO"]; _reinfGRP addEventHandler ["EnemyDetected", { commandGetOut _u1; commandGetOut _u2; commandGetOut _u3; commandGetOut _u4; commandGetOut _u5; commandGetOut _u6; commandGetOut _u7; commandGetOut _u8; commandGetOut _u9; commandGetOut _u10; commandGetOut _u11; commandGetOut _u12; commandGetOut _u13; commandGetOut _u14; }]; private _stalking = [_reinfGRP, alpha, 10, 20] spawn BIS_fnc_stalk; Or maybe the cause is the event handler?
  2. Guys, folks, dudes, What: Here is where I make my day: I built a function where a specific group finds out a building, goes there and, after a while, they find a new building and go there too, over and over again. If a member of this group stays behind, this member is removed from the group. After being removed, that lone wolf will be allowed to find out their own buildings and go there too. Issue: The lone wolf unit, after being transferred to a new empty group (so they're the leader) the unit stands still, facing their newest waypoint over a building (so the step_one function ran), but is not allowed to move there, just sometimes shaking head and weapon but completely stuck. If I drop a enemy around, the lone wolf will engage, but never change their position. No clue what's happening here. No mods on. Only Arma 3. Unit (soldier) stuck even with waypoints and speaking on the radio. Context: DynamicSimulation is false in this case and I already tried to apply doMove, enableAI "PATH", but the lone wolf unit stays there, stuck. Structure example I am using: THY_fnc_step_one = { // This function makes a group find a building and, after that, move there. // Return nothing. params [...]; private [...]; // <DELETE OLD WAYPOINTS AND GIVE A NEW ONE STRAIGHT TO THE BUILDING> // If the group close enough to the building, execute "step_two". [...] spawn THY_fnc_step_two; // <CODE CODE CODE> // Return: true; }; THY_fnc_step_two = { // This function makes a group, right after the arrival at the building, they wait a while before execute the "step_one" again. // Return nothing. params [...]; private [...]; // If some group's unit stay behind, remove the unit from the group: [...] spawn THY_fnc_remove_from_the_group; // If this original group arrive at the building as planned, take a break and execute again the "step_one": [...] spawn THY_fnc_step_one; // <CODE CODE CODE> // Return: true; }; THY_fnc_remove_from_the_group = { // This function makes a single abandoned unit to be a lonewolf group leader allowed to find out their own buildings to visit. // Return nothing. params ["_faction", "_unit"]; private [...]; _newGrp = createGroup [_faction, true]; [_unit] joinSilent _newGrp; [_faction, _unit] spawn THY_fnc_step_one; // Return: true; };
  3. Hi, I'm kinda experienced already with modding of Items, Uniforms and stuff, but I never had to make any functions in ArmA, and I am only beginning to understand it. I was trying to add a Whitelisted ACE Arsenal to an Ammobox via Function: So far I have this: The Structure is (currently) simple: Addons\Arsenal\ The config just utilizes #includes. cfgPatches.hpp: class cfgPatches { class Nilia_Server_Functions { units[]={}; weapons[]={}; requiredVersion=0; requiredAddons[]={}; version="1.0"; versionStr="1.0"; versionAr[]={1,0,0}; author[]= { "Nilia" }; authorUrl=""; magazines[]={}; ammo[]={}; }; }; cfgFunctions.hpp class CfgFunctions { class Nilia_Server_Functions { class Nilia_Server_Functions { file="\Arsenal\functions"; class Nilia_Arsenal { preInit=1; }; }; }; }; In the functions folder: fn_Nilia.Arsenal.sqf if (!isServer) exitWith {}; private _Unit = this; if (!alive _Unit) exitWith { hint "Arsenal could not be Loaded" }; hint "Arsenal was loaded"; [_Unit, ["Item1","Item2","Item3" ] ] call ace_arsenal_fnc_initBox; If I call this function in the init field of an Ammobox (in the 3den Editor) call fn_Nilia_Arsenal; The Mission is Loading as it is supposed to be, the hint "Arsenal was Loaded", but the Arsenal is not added to the Ammobox. (The item1,2,3 are just placeholders for a bunch of Items, the array is confirmed working, when I replace "_Unit" with "Arsenal" and exectVM the Arsenal.sqf in the init field (and name the Ammobox "Arsenal") it is loading properly.) With this function, I want to achieve to load our restricted Arsenal on my Unit's Server in multiple Missions, without having to update every Mission (instead only the Addon), when I add any Items. This Addon is supposed to be running Server Side. Thank you very much for your Help :D
  4. How can I simplify these three functions without losing their purpose? I get itchy hands when I find myself coding like this, without how to improve my time coding yet. If you'll suggest a functions merge, I will appreciate it if you also explain how should I call it. I have not enough experience with params yet (studying in progress...) THY_fnc_VO_checkPlayerVehRepair = { params ["_eachVeh"]; (alive _eachVeh) AND (speed _eachVeh < 2 AND speed _eachVeh > -2) AND (!underwater _eachVeh) AND ((getPos _eachVeh) select 2 < 0.1) AND (_serviceInProgress == false) AND (!isEngineOn _eachVeh) AND (damage _eachVeh > VO_minRepairService) }; THY_fnc_VO_checkPlayerVehRefuel = { params ["_eachVeh"]; (alive _eachVeh) AND (speed _eachVeh < 2 AND speed _eachVeh > -2) AND (!underwater _eachVeh) AND ((getPos _eachVeh) select 2 < 0.1) AND (_serviceInProgress == false) AND (!isEngineOn _eachVeh) AND (fuel _eachVeh > VO_minRefuelService) }; THY_fnc_VO_checkPlayerVehRearm = { params ["_eachVeh"]; (alive _eachVeh) AND (speed _eachVeh < 2 AND speed _eachVeh > -2) AND (!underwater _eachVeh) AND ((getPos _eachVeh) select 2 < 0.1) AND (_serviceInProgress == false) AND (({getNumber (configFile >> "CfgMagazines" >> _x select 0 >> "count") != _x select 1} count (magazinesAmmo _eachVeh)) > 0) };
  5. Hello again, everyone. I'm doing my first steps into functions and parameters. Everything in this matter is new for me so here is my idea: For studies purposes, I want to put a helmet in each unit I get close. To set the target units for the function, all I would like to do is set a "call" in each unit-target. That said, my try (not working): myFunctions\TAG_fnc_addingHelmet.sqf: if (!isServer) exitWith {}; TAG_fnc_addingHelmet = { params ["_unit"]; if ( ((player01 distance _unit) < 3) AND (headgear _unit != "H_HelmetB") ) then { removeHeadGear _unit; _unit addHeadgear "H_HelmetB"; hint "Oh, thanks for the helmet!"; }; }; [] spawn { while { alive player01 } do { // Do I need to call the TAG_fnc_addingHelmet function in here somehow? sleep 5; }; }; And all I would like to do is put it (below) in unit init for this call my function: Init of any random unit: [this] call TAG_fnc_addingHelmet; Where are my mistakes, folks? More info: description.ext: class cfgFunctions { #include "myFunctions\TAG_fnc_functions.hpp" }; myFunctions\TAG_fnc_functions.hpp: class TAG { class init { class TAG_addingHelmet { file = "myFunctions\TAG_fnc_addingHelmet.sqf"; preInit = 1; }; }; };
  6. Hello mission builders, scripters and developers, I like to introduce my project that is called a3-lib-checks on GitHub. I realy hope it useful for some of you. It is a kind of a BETA VERSION! Your tests in mission runtime envionment are very welcome 🙂. Link to Repository: https://github.com/DevMBeyer/a3-lib-checks Link to Unit tests: https://devmbeyer.github.io/a3-lib-checks/reports/index.html (supplement) TABLE OF CONTENT What these Libraries do The Usage of my libraries My Intension to write these libraries Why I used macro functions My research My conclusion Loops Conditions Lazy Evaluations Declarations Scopes Brackets Copy not everything How do I develop Unit Tests My Problems Test Cases Common Naming's Upload my Repository Website Entrypoint Bugs Feedback Apologizes CONTENT What these Libraries do This project contains several libraries with macro functions in it to enhanced data validation in Arma 3 scripts. The Macros are very system performance developed and should be easy to use. The functions in libraries are thematically and technically ordered. The aim of this project is to make data validation easier for other scripters and myself. Some Macros are a little confusing for you on how to work with them e.g. MB_IS_NIL( ARG ) which is nothing but isNil {ARG }. Nothing really useful but it has to be in the list of structure of macro functions for formality in my opinion. The Usage of libraries They are extremely useful for debugging a script or for conditions in mission runtime in my opinion. It should pull down the system performance in very little, so it is a good thing I guess. It depends on macro of course. My Intension to write these libraries While I was working on my SQF Scripts, I was often stuck with a bunch of errors. So I decided to developed a validation functions, which cost less system performance. As I said, it depends on the function of course. Why I used macro functions Macros must be imported from scripts, they can’t be present itself as script functions. But complex Macro functions are little faster as they are imported as code and not as a reference to the extern code. Later before the release, I will extract the string characters which are not functional like spaces between expressions. Therefor it runs little little little bit faster I hope. My research I tested with diag_performCode every single command or code construct I will work with, which is the fastest. My conclusion It is only my very personal conclusion below on the results of diag_performCode Loops I do not use for-, while- forEach-Loop. forEach loops brings more variables with them like _forEachIndex for example and decrease the system performance. In nearly all cases I don't need to use these variables, so findIf is the goal I found out. It only brings _x with it. It is really faster but it is really confusing because of the complexity. E.g. /* CODE */ \ private _copy = +ARR; \ ( ( _copy findIf { \ private _elem = ARR deleteAt 0; \ !( \ ( TYPES findIf { \ /* CONDITION */ \ } ) isEqualTo -1 \ ) \ } \ } ) isEqualTo -1 ) \ /* CODE */ \ Conditions The if-then-else should be slower than if-exitWith-expression. But both condition constructions do the same thing. // slower if ( CONDITION ) then { STATEMENT_1 } else { STATEMENT_2 }; // faster if ( CONDITION ) exitWith { STATEMENT_1 }; STATEMENT_2 Lazy Evaluations https://community.bistudio.com/wiki/Code_Optimisation#Lazy_evaluation The complex nested conditions are much faster than any other condition constructions like ifs, switch-cases. It depends on how to use them of course. false and true and true and true // slower false and { true and { true and { true } } } // faster Declarations I used as less declarations as possible and found out which the best performance is on declaration is – I guess. [] params [ [ "_foo", 0 ],[ "_bar", 0 ] ] // is little slower private _foo = 0; private _bar = 0; // is faster scopes The declaration private [ "_fnc" ]; _fnc = {}; is slowest as private _fnc = {} but if you declare this recursive function 10000 times, it is really useful and faster when you combine needed function scope to check n nested array as an argument. If the condition is matched in this function with the call 1000 times, the function just breaks out with the return and will not needto level up 1000 times to the first function call. But I am not sure of the results: private [ "_fnc" ]; scopeName "recursive"; _fnc = { /* CODE */ if( (CONDITION) call _fnc ) exitWith { true }; false breakout "recursive" }; ARG call _fnc; this function does not do anything but I hard coded to show what I means. Brackets I used brackets anywhere to enclose an expression like (_a+_b). The interpreter should like brackets, because he mustn’t search were the expression ends and prioritize which expression gets first. Again, it is my conclusion on the test results. ARR select 0 select 1 isEqualTo 0 // slower ( ( ( ARR select 0 ) select 1 ) isEqualTo 0 ) // faster Copy not everything I referenced not all Macro functions because they are sometimes dumplicates on commands in both functions so I must develop by foot e.g. MB_COMPARE_ARRAY_SIZE( ARR, 1 ) or { MB_COMPARE_ARRAY_SIZE( ARR, 2 ) } It is compact and more readable but both functions checks nil and array first, and that’s exaggerated. So I’ decided to solve this way on foot. !isNil{ARR} \ and { \ ( ARR isEqualType [] ) \ and { private _cnt = count ARR; \ (_cnt isEqualTo 1) \ or { _cnt isEqualTo 2 } \ } \ } \ I want only show what I mean. How do I develop I used my tag `MB` nearly everywhere in the code, therefore shouldn't be any name conflicts in the namespaces. I adopted BI Code Comments style in general with individualities I used K&R Code style My code should be well documented so far (if you leave out my grammar). Therefore the script comments should be understandable. Unit Tests I've written test cases and tested them with simple Unit Tests for every single macro function. Every Test Results from unit tests is generated as a report. You can see the reports of test results which were generated in html code. Unit test case arguments were changed, deleted, or expanded throughout the test by me. The reason: I have to correct individual test cases to show the differences in the individual test results. My Problems Test Cases I have optimized test cases and test arguments, while I tested each macro function to each test case. Meanwhile between past and now there are partly different and extended test arguments in unit test cases. It can be seen in the different unit test files and reports. I didn't write the test arguments to test the test arguments but to test the macro functions. So it is ok I think 👍. Common Naming's Partly it is very hard to choose the right name of each definition to show what the definition stands for regardless if function variables or constants. Upload my Repositorry I used Git of course for my project a3-lib-checks. when I started to upload there was an error occurred. Something with ssh I need to use and not TSL as the standard. So I Website Entrypoint I set the entrypoint of GitHub webpage. Nothing happes. I'm on to get thing done! Bugs As I said, the project is a BETA VERSION so there could bugs occurs, regardless of units tests! I’m just one person in the Project! Please email me or contact me in this thread or write a PN to me in this platform if there is any bug displayed with my macros if you include correctly of course 😉. Feedback Feedback is very welcome 🙂. It is useful for me to get feedback on my macros and my project. You can Criticism me, regardless if positive or negative. Every feedback is useful if the feedback is objective. Apologizes English is not my mother tongue. I hope, it can be understandable if someone reads my scrip comments I am just a Developer with amateur experience on Arma coding. I'm a greenhorn in https://github.com/. It is completely new to me. So I hope everything is clear by now 😬🙄 . Enjoy Coding 😊 Best regards MB
  7. So I have a dedicated server. I've been using inline functions (some on server, some on clients) since some server functions doesn't need to be called on client machines and vice-versa. Recently I discovered CfgFunctions in Description.ext which promisses to prevent functions from being recompiled, addition to Functions Library, hack-proofing, possibility to preInit and posInit, all that good stuff. But I'm under the impression that if I compile all my functions from there, both parties (server and clients) would have allocated RAM resources to ALL those functions, am I correct? Is there a way to define which functions to compile (using CfgFunctions) so I can free clients from compiling the ones they don't need, but make them DO compile functions they need to have? Or am I stuck with inline functions?
  8. Here's a couple fire related functions, you_createFire, *Updated you_fnc_houseFire (demo), Burn buildings to the ground! Spawn one central fire with smoke and a number of FX fires (performance) in the building. The building takes damage over time. Once the building is destroyed the performance fires are deleted and later the main fire. Fire will spread based on the distance supplied to the function ("_dist"). Use the parameter "_damage" (default true) to make persistent fire that does not damage the building over time or spread to other buildings.* Use parameter "_time" to determine how long each building will burn (default: 10, demo: 1). 1 second is equal to 20 seconds total burn (each iteration is %10 damage) and the main fire burns for the same amount of time again (1x10x2). The default value is 10 or 200 seconds (100 to collapse and 100 more to extinguish). 1) create a helper object on/near the building(s) ** 2) paste the function in init.sqf (or wherever) 3) see call methods in demo init.sqf * keep track of effects in the supplied array ** editor placed buildings may be "_caller" Have fun!
  9. Hello, @super-truite and I have made a little piece of script to allows missions maker to make a better use of AIs and vehicles on missions. We are guessing that a similar system already exists but we wanted to have a custom system for some of our projects and thought it would be nice to share it. This compilation of script allows a mission make to cache units suchs as vehicles and soldiers with their respective properties (waypoints, stance, direction, position, health, ...). This allows for greater performance and (if chosen) persistence. Features: Grid caching GCS allows the mission maker to automatically cache into the memory AIs andvehicles. Waypoints assigned to a group or a unit are also cached and are reapplied when the unit or group is set up. The mission creator, if necessary, can also exclude a unit or a vehicle from the cache so that the system does not take it into account. Persistence system (optionnal) In addition to all the caching made, the mission maker can also integrate a data persistence system via MySQL so that, even with a restart of the mission or the machine, the units and vehicles will still be saved. How it works: GCS will create a virtual grid on the map based on three parameters available in GCS_configServer.sqf : GCS_VAR_SIZE_SQUARE_GRID - Represents the total size of each cell on the grid GCS_VAR_SIZE_ACTIVATION_SQUARE_GRID - Represents the trigger distance where AIs and vehicles will be created in the cell GCS_VAR_SIZE_UNSPAWN_SQUARES - Represents the trigger distance where AIs and vehicles will be cached and removed in the cell Each cell is defined by these three variables, as described, GCS_VAR_SIZE_UNSPAWN_SQUARES will trigger the caching and removal of units for the given cell, GCS_VAR_SIZE_ACTIVATION_SQUARE_GRID will activate a cell, retrieve it's cached content for the memory or database and will spawn the units. GCS_VAR_SIZE_SQUARE_GRID Defines the cell size. You can disable the caching system on a unit or vehicle by adding the variable "UseGrid" to false on the unit/vehicle init: this setVariable ["UseGrid", False] In this way, even if no player is near the unit or vehicle, it will never be cached and removed. The following gif shows a simple example with a single grid cell being cached, unloaded (player leaving the cell) and reloaded with cached data once the player re-enter the cell: https://i.imgur.com/ai7PeLh.mp4 and the picture below demonstrates a more complete case: Video example: https://streamable.com/jrh43r (4601 units on Stratis) By default, the persistence system is disabled, you will need to install a MySQL database, have the InterceptDB mod installed aswell with CBA. A full tutorial is available on the readme on Github (https://github.com/Super-truite/arma3_GCS.vr/blob/master/README.md) Download: Get the latest release here: https://github.com/Super-truite/arma3_GCS.vr
  10. I have been working on a spawnPoints generation script for my missions, and I have a few issues with it, so I am looking for advice and assistance. I am making it for a general all purpose spawn point generation system, all side mission with many players. The Issues I am having include: - An error when BIS_fnc_removeRespawnPosition is used as I generate it dynamically, and cannot seem to fetch the ID # associated to the object when it is spawned. - An error when respawning on created point at the respawn MenuPosition: BIS_fnc_showRespawnPositionMapDraw Draw Icon: type any, expected string. The fnc is still listed as //TODO in the functions in game, not sure if there is anything that can be done. - And my primary concern is that the new Respawn position seems to remove the existing name off of the initial spawn point, and replace it with the name that should be used for the first BIS_fnc_addRespawnPosition; basically switching the two. Edit: Just played an old mission with a different version of spawning respawn positions, and got the same issue can somebody verify this? Also, still unsure how many problems may arise as multiple triggers are fired, multiple fires of the same trigger, and other "Unknown" multiplayer issues can be prevented; Therefore Advice is welcomed. I have spent quite a few days getting this to where it is at currently, as well as searching high and low for examples; so I am attempting to generate my own that basically anyone could use easily. Your help is greatly appreciated.
  11. I'm going to learn how to use params in order to make future scripts more effective and you might learn something about params, too (please use the debug console if you want to follow along). A simple example, fnc_learnThis= { params ["_caller","_some","_thing","_luck"]; if (_luck>0) exitWith { systemChat format ["%1", _caller]; systemChat format ["%1 %2", _some, _thing]; }; }; With some luck this call will prompt the functions to run with the parameters set, [player, "is", "cool",1] call fnc_learnThis; The next example shows how to select from an array and sub-array. We can create some helpers and make the orb jump between them. Make three sets so the result isn't binary. Create the array of helpers from named objects like this, Enter the function, and call the function with, [orb, 0] call you_fnc_help; The orb should continue to go around between the three helpers each time you enter the call. To change to the next helper group, [orb, 1] call you_fnc_help; More examples continue throughout the discussion below, Have fun!
  12. So I have made "script" for myself that I put in the Player Init. This only executes once. But I want it to execute every time I spawn/respawn (so everytime the player starts existing). The script works great if I put it in the Init of the Player. But i wanted to make a .sqf file I could call/execute so I wont have to put everything in every Player. But the scipt is not working/compiling. The code I put in to the Init: varPlayer=this; spawnPos=getPos varPlayer; telePos=getPos varPlayer; [varPlayer, 3] call BIS_fnc_traceBullets; varPlayer addAction["<t color='#59b300'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal;}]; varPlayer addAction["<t color='#d9006c'>Go to Spawn</t>", {varPlayer setPos spawnPos;}]; varPlayer addAction["<t color='#bfff00'>Teleport</t>", {varPlayer setPos telePos;}]; varPlayer addAction["<t color='#4cffff'>set Teleport</t>", {telePos=getPos varPlayer;}]; varPlayer addAction["<t color='#0080ff'>Teleport with Map</t>", "teleport.sqf"]; The code I put in to the .sqf: _spawnPos=getPos _this; _telePos=getPos _this; [_this, 3] call BIS_fnc_traceBullets; _this addAction["<t color='#59b300'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal;}]; _this addAction["<t color='#d9006c'>Go to Spawn</t>", {_this setPos _spawnPos;}]; _this addAction["<t color='#bfff00'>Teleport</t>", {_this setPos _telePos;}]; _this addAction["<t color='#4cffff'>set Teleport</t>", {telePos=getPos _this;}]; _this addAction["<t color='#0080ff'>Teleport with Map</t>", "teleport.sqf"]; How I called it in the Init: _nul = []execVM "myFunction.sqf"; It wont run, but why? So for short. What i need help with is: finding the problem with the sqf executing the sqf every time the player starts existing Thx for reading my crap and I hope you can help me. :)
  13. Hi there, It's quite annoying when someone else has used the gunner seat of a Heli, offsetting its position, and you later decide to Manual Fire from the pilot's seat and have a misaligned gun. I've been putting a lot of effort into setting up a script that can deal with this via a User Action, however I'm getting a few errors. A few of them are about missing " ) ", " ] ", " ; " (though I have done my best to never leave these out, including using a bracket checker plugin), or invalid variables (which is probably because it's checking a variable before it's set). To summarise, when a player pilot is in an armed Heli, they shall get a user action to centre the turret. This will have either the current AI or a temporary, invisible AI in the gunner seat target a spawned marker in front of the vehicle (if a player is in the seat it won't affect them). I currently have five six files in relation to this. EDIT: Below has been updated to the latest working script - If you get errors make sure there's no invisible characters using Word It requires CBA mission.Malden\init.sqf mission.Malden\description.ext mission.Malden\functions\functions.hpp mission.Malden\functions\fn_centreTurret.hpp mission.Malden\functions\fn_allowCentreTurret.sqf mission.Malden\functions\fn_turretDir.sqf Currently, unit spawning, marker generation and AI watching are working as intended, however the user action does not appear and if i set off turretdir.sqf manually ( [] execVM "turretdir.sqf"; ) it errors. EDIT: All working as intended. I'm not as proficient at SQF scripting as I'd like to be, so I've probably made some very obvious mistakes. Any help setting this up correctly and optimising would be appreciated. I will keep trying in the meantime.
  14. Hello. I am working on a mission on Lythium and I am wondering about the functions used in Combat Patrol for garrisoning buildings and spawning random objectives. It would be nice if there was a way to use these in any mission by referencing code functions. Is there a way to do this? It would be a cool way to spawn a side mission using the Combat Patrol functions. And as they are BI built-in functions, they would be fast and reliable. Is this possible? Thanks.
  15. Afternoon all, I'm after a bit of advice with calling postinit and preinit functions from a mod. I've created a mod which is basically a functions library. I have one rather inconvenient issue. My Postinit and preinit functions execute on Arma 3 start, for example: I have dynamic text appearing on the main menu, which whilst amusing, isn't particularly professional. My question: How do I execute postinit and preinit functions only on Mission start when called within a @mod? Thanks in advance!
  16. Hey guys! I come across a mean issue where I am not able to use the function configuration that works for my addon-test mission in my packed addon.pbo. Erros in .rpt on startup 15:20:01 Warning Message: Script camp\fn_buildCampsite.sqf not found 15:20:01 Warning Message: Script camp\fn_packCampsiteItem.sqf not found 15:20:01 Warning Message: Script init\fn_init.sqf not found 15:20:01 Warning Message: Script init\fn_backpackInit.sqf not found 15:20:01 Warning Message: Script utils\fn_log.sqf not found .pbo file structure CfgFunctions.hpp class CfgFunctions{ class ReconMod{ class Camp{ file = "camp"; class buildCampsite {}; class packCampsiteItem {}; } class Init{ file = "init"; class init{preInit = 1;}; class backpackInit {}; } class Utils{ file = "utils"; class log{}; } } } CfgPatches.hpp class CfgPatches { class ReconMod { author = "xetra11"; name = "Recon Mod"; version = "1.0"; units[] = {}; weapons[] = {}; requiredVersion = 1.0; requiredAddons[] = {}; }; }; config.cpp #include <CfgFunctions.hpp> #include <CfgVehicles.hpp> #include <CfgPatches.hpp> Did I miss a part where it says to have functions work in an addon I have to go another way of declaring functions? Thanks for your help in advance!
  17. Last content update: 6/13/2018 showing how to use the radius for addAction, using params instead of select, adding to arrays with various commands, altering arrays with various commands, get/setUnitLoadout Last content update: 6/10/2018 going through config files and getting details to sort what you want, using radius with addAction, params, and altering arrays with resize, pushBack, pushBackUnique, set, and append and going over to assist with resize count. Last content update: 5/27/2018 added GUI tutorial for how to make a weapon selector using cfgWeapon Last content update: 5/24/2018 added sector control tutorial Last content update: 5/21/2018 This is my arma 3 scripting tutorial series which is aimed to help both people getting into making their own scripts with fairly detailed simple tutorials as well as for the intermediate person looking to create their own features for their missions. The plans for this series is to almost fully cover everything behind the arma 3 missions that people play on a daily basis and have enough content provided in the videos where people can go off and make their own vision for their mission with the knowledge gained. Most of these videos are made on the fly at 1AM-4AM without any pretesting which should give someone the idea of what goes into finding syntax errors and narrowing down a bug that's causing your feature to not function properly. It is also an excuse for you to cut me some slack if you see mistakes :) . A lot of these tutorials are made with multiplayer in mind since I think most people want to play their missions online with their friends(which is why publicVariable has been utilized so much so new people can get a good grasp on the power those commands have). New videos are added to the playlist almost every day so if your stuck with something, maybe it has been covered in a video. If you have any requests on what you would like to see made then please suggest it here. topics covered so far Scripting tutorial playlist Database tutorials with INIDBI2 playlist GUI/Dialog tutorials playlist
  18. RED FRAMEWORK A collection of useful functions for mission maker. Website under construction: http://www.redframework.com Version: 1.0.9 Release date: 11-03-2018 WORKSHOP: https://steamcommunity.com/sharedfiles/filedetails/?id=1226877632 GITHUB: https://github.com/RedBelette/RED_FRAMEWORK LICENSE: https://github.com/RedBelette/RED_FRAMEWORK/blob/master/LICENSE MISSION TEMPLATE (take it for a quick start !) https://github.com/RedBelette/RedFramework-Simple-Template https://github.com/RedBelette/RedFramework-TGV-Template INITIALIZATION - Voice is disabled for players (just for ingame recorded speeches, not VOIP). - Saving is disabled. FUNCTIONS ace improvements // This feature allows you to use a huntir ammo as a satellite that you can later use via ACE's huntir monitor. _huntirAmmo = [satellitePos] call RF_fnc_huntirSatellite; Action mecanism Trigger (by script) in arma are very useful but contain a lot of code to do something. We need to create new paradigm to replace it and to enhanced the behavior. We need an action mechanism. An action is to execute something when the condition is true. In more we can specify if the action is a one shot or in a loop. Maybe you want that the action is timed also. By creating a registry of action we can start and stop an action. // This function acts as a trigger and executes code when a condition is true. _action = [_condition, _codeAsString, _params(*default=[])] call RF_fnc_action; // This function acts as a trigger and executes code when a condition is true with a delay time. _action = [_condition, _codeAsString, _delayAsSecond, _params(*default=[])] call RF_fnc_delayedAction; // This function acts as a trigger and executes code every x seconds. _action = [_condition, _codeAsString, _timeToTheNextExecutionAsSecond, _params(*default=[])] call RF_fnc_repeatedAction; // This function acts as a trigger and executes code when a condition is true on the targeted remote side. _action = [_condition, _codeAsString, _params(*default=[]), _target(*default=0)] call RF_fnc_remoteAction; // This function acts as a trigger and executes code when a condition is true with a delay time on the targeted remote side. _action = [_condition, _codeAsString, _delayAsSecond, _params(*default=[]), _target(*default=0)] call RF_fnc_remoteDelayedAction; // This function acts as a trigger and executes code every x seconds on the targeted remote side. _action = [_condition, _codeAsString, _timeToTheNextExecutionAsSecond, _params(*default=[]), _target(*default=0)] call RF_fnc_remoteRepeatedAction; // This function opens a register of actions, allowing you to start or stop an action. call RF_fnc_actionRegistry; // The RF_fnc_actionRegistry function needs to be called beforehand to open an action register. _action = [_actionIdAsString, _actionAsReturnedAction] call RF_fnc_addAction; // This function allows you to find an action in the action register. _action = [_actionIdAsString] call RF_fnc_getAction; // Activate the action from the action register. [_actionIdAsString] call RF_fnc_runAction; // Desactivate the action from the action register. [_actionIdAsString] call RF_fnc_stopAction; // Remove action from the action register. [_actionIdAsString] call RF_fnc_unregisterAction; Ai behavior // Surrender occurs when the remaining units of the desired faction are below the desired minimum number. _trueOrFalse = [_side, _minUnitsToSurrenderTheSide] call RF_fnc_makeSideSurrender; // Order the entire faction to defend an area around a radius. [_side, _position, _radius] call RF_fnc_sideDefendArea; Ambience // Flash on the desired area (like zeus). [_position, _delay(*default:0)] call RF_fnc_lightningBolt Animation // Play a looping animation with the playMove instruction [_unit, _animClassName] call RF_fnc_playMoveLoop; Condition // Check if the unit is inside a vehicle _trueOrFalse = [_unit] call RF_fnc_isInVehicle; // Checks if a player is close to an entity following a radius _trueOrFalse = [_entity, _radius] call RF_fnc_isPlayerNearEntity; Converter // Convert string on side ojbect _side = [_sideAsString] call RF_fnc_convertSideStr; Heli control // Initialize a helicopter so that it stays quietly on the ground. [_group] call RF_fnc_heliInit; // Order the helicopter to land in the desired area. [_group, _position] call RF_fnc_landHeli; // Send the helicopter to fight. [_group, _position, _radius] call RF_fnc_sendHeliToFight; // The helicopters unload the units present in an area and then disappear. [_vehicle, _landingPosition, _getOutPosition] call RF_fnc_unloadUnitsWithHeli; Init // This function allows you to wait for the end of the loading screen. call RF_fnc_loadingComplete; waitUntil {loadingFinished}; Layer // Enable 3den editor layer. [_layerIdAsString] call RF_fnc_enableLayer; // Disable 3den editor layer. [_layerIdAsString] call RF_fnc_disableLayer; Mission generator This engine offer to you a complete engine to manage tasks and missions. You have a completer CRUD fort the task to create, changing state, close or remove it. You can also generate a random mission with a little configuration from description.ext. // Creates a new mission in the framework and generates an Arma task. This task may not be visible to players. _missionIdUnique = [_missionIdAsString, _side, _parentMissionIdAsString, _title, _description, _taskType(*default="default"), _taskDestination(*default=objNull), _taskSetCurrent(*default=false), _taskPriority(*default=0), _taskNotification(*default=true), _taskSharing(*default=false)] call RF_fnc_createMission; // Closes the mission identified by the missionID passed in parameter. By default, the status of the mission will be successful and an alert will be displayed. [_missionIdAsString, _taskStatus(*default="SUCCEEDED"), _taskShowHint(*default=true)] call RF_fnc_closeMission; // Returns true when the mission is closed. _trueOrFalse = [_missionIdAsString] call RF_fnc_isMissionClosed; // Return the task state of the mission _taskStatus = [_missionIdAsString] call RF_fnc_missionState; // Returns all the cities of the map. _locations = call RF_fnc_locations; // Return a random location of the map. _randomLocation = call RF_fnc_locationGenerator; // Generate a random mission based on the description.ext. (see config on the bottom) _missionIdUnique = call RF_fnc_missionGenerator; // Generates an example mission based on the condig file or past parameters. _missionIdUnique = [_side(*default=config), _helicopterClassName(*default=config), _unitsClassNameArray(*default=config)] call RF_fnc_spawnMissionHelicopterCrashInTown; Spawn // Create units. _group = [_side, _unitsClassNameArray, _position] call RF_fnc_spawnUnits; // Create garrisons around an area based on the description.ext or parameters. _allGroups = [_position, _radius(*default=config), _side(*default=config), _unitsClassNameArray(*default=config), _randomDistance(*default=config)] call RF_fnc_spawnGarrison; // Create patrols around an area based on the description.ext or parameters. _allGroups = [_position, _radius(*default=config), _side(*default=config), _unitsClassNameArray(*default=config), _radiusPatrols(*default=config)] call RF_fnc_spawnCirclePatrols; // Create a helicopter and teleport the group inside to the desired position. After landing the helicopter drops off the group, returns to its starting position and disappears. [_groupWillTeleportedInsideHeli, _spawnPosition, _landingPos, _heliClassName(*default="B_Heli_Light_01_F"), _side(*default=west), _driverClassName(*default="B_Helipilot_F")] call RF_fnc_spawnByHeli; Spectator // This script will allow you to create the spectator's mode. (config acre and tfar inside) call RF_fnc_spectator; // Add an action into object to enter spectator mode [_object] call RF_fnc_addSpectatorAction; Ui // Displays an image in full screen for a given time. [_imagePath, _timeInSecond] call RF_fnc_imageFullScreen; // Displays an image in full screen in the sky during a given time. [_imagePath, _timeInSecond] call RF_fnc_imageInSky; // Simplify the code to create a progress bar. [_object, _progressBarId, _titleAction, _titleBar, _codeAsString, _cancelCodeAsString, _parametersToTheCode, _timeInSecond, _actionType(*default=0), _actionParent(*default="ACE_MainActions"), _actionIcon(*default="")] call RF_fnc_progressBar; // Displays the name of the scenario and its author at the bottom right. [_missionName, _byAuthor] call RF_fnc_scenarioTitle; Vehicle // Charge a group of players in the cargo of a vehicle. The basic moveInCargo instruction is defective in MP. [_group, _vehicle] call RF_fnc_moveInCargo; Zeus // Allows zeus to modify all new spawner units by script. call RF_fnc_makeAllUnitsEditableForAllCurators; // Allows to make editable all the objects passed in parameter. [_objectArray] call RF_fnc_makeObjectsEditableForAllCurators; Zombie /* * The mod zombie Ryan's spawner module seems to pose performance * concerns in MP so here is a spawner optimize. * * Parameters * side: west, east, ... * gameLogic: gameLogic module * numberByWave: number of Z max spawned by wave. * time: delay between wave * type: (default: mediumCivilian) * - fastCivilian * - fastSoldier * - fastCivilianAndSoldier * - mediumCivilian * - mediumSoldier * - mediumCivilianAndSoldier * - slowCivilian * - slowSoldier * - slowCivilianAndSoldier * - walkerCivilian * - walkerSoldier * - walkerCivilianAndSoldier * - demon * - spider * - brittleCrawler * - mixedZombie * - mixedZombieNoSpiderNoCrawler */ [_side, _gameLogic, _numberByWave, _time, _type(*default:'mediumCivilian')] call RF_fnc_zSpawner Configuration in description.ext (optional) // Example class RedFrameworkConfig { class missionCfg { addItemEarPlugs=true; putInEarPlugs=true; putSafeMode=true; }; class MissionGenerator { missionPaths[] = { // HERE THE PATH OF YOUR MISSION "pathofmission1.sqf", "pathofmission2.sqf" }; }; class combatPatrol_CfgEnemis { side = "east"; // HERE THE DEFAULT SIDE }; class combatPatrol_SpawnCirclePatrols { // HERE THE FUNCTION DEFAULT VALUES distance = 200; unitTypes[] = {{"LOP_US_Infantry_SL", "LOP_US_Infantry_Rifleman_4", "LOP_US_Infantry_TL"}, {"LOP_US_Infantry_MG_2", "LOP_US_Infantry_MG_Asst"}, {"LOP_US_Infantry_Rifleman_2", "LOP_US_Infantry_Rifleman_4"}, {"LOP_US_Infantry_Rifleman_2", "LOP_US_Infantry_Rifleman_4", "LOP_US_Infantry_MG_Asst", "LOP_US_Infantry_MG_2"}}; radiusPatrols[] = {50, 100, 200}; }; class combatPatrol_SpawnGarrison { // HERE THE FUNCTION DEFAULT VALUES distance = 100; unitTypes[] = {{"LOP_US_Infantry_SL", "LOP_US_Infantry_Rifleman_4", "LOP_US_Infantry_TL"}, {"LOP_US_Infantry_MG_2", "LOP_US_Infantry_MG_Asst"}, {"LOP_US_Infantry_Rifleman_2", "LOP_US_Infantry_Rifleman_4"}, {"LOP_US_Infantry_Rifleman_2", "LOP_US_Infantry_Rifleman_4", "LOP_US_Infantry_MG_Asst", "LOP_US_Infantry_MG_2"}}; ramdomizeDistance = 80; }; class combatPatrol_missions { class combatPatrol_helicopterCrashInTown { // HERE THE FUNCTION DEFAULT VALUES helicopterClass = "B_Heli_Light_01_dynamicLoadout_F"; unitTypes[] = {{"LOP_US_Infantry_SL", "LOP_US_Infantry_Rifleman_4", "LOP_US_Infantry_TL"}}; }; }; }; CHANGELOG ## 05-02-2018 version 1.0.1 - ADD RF_fnc_moveInCargo - FIX RF_fnc_spawnByHeli with the new move in cargo (MP fail) ## 05-05-2018 version 1.0.2 - FIX RF_fnc_moveInCargo: brute force moveInCargo with infinite loop protection ## 05-10-2018 version 1.0.3 - ADD RF_fnc_lightningBolt to flash on desirated area. - ADD RF_fnc_spectator create the spectator's mode on client - ADD RF_fnc_addSpectatorAction to addAction your object with the previous spectator's function. - ADD RF_fnc_zSpawner to spawn Zombie and Demons with more performance in MP ## 05-10-2018 version 1.0.4 - ADD Configure your mission with features: add and put earplugs, security safemod for weapons. // Example description.ext: class RedFrameworkConfig { class missionCfg { addItemEarPlugs=true; putInEarPlugs=true; putSafeMode=true; }; }; ## 05-13-2018 version 1.0.5 - FIX counter variable's name mistake, '_' missing CHANGELOG version 1.0.6 ## 05-20-2018 - HOTFIX: Resolve default value on the init - HOTFIX: Partial hotfix for RF_fnc_moveInCargo and RF_fnc_spawnByHeli CHANGELOG version 1.0.7 ## 06-02-2018 - ADD capabilities to recieve code instead string for the executed job. - ADD capabilities to recieve parameters - ADD remote action for all the types of actions see action mecanism for more details ## 07-15-2018 version 1.0.8 - FIX when you try to configure earPlug with description.ext ## 11-03-2018 version 1.0.9 - FIX move in cargo for MP
  19. Alright. Welcome everyone. I have a very interesting problem, and I couldn't find a solution for it. I have been really trying to get past this but I can't solve this riddle. I have this small code snippet inside the initPlayerLocal.sqf: if (didJIP) then { [getPlayerUID player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; And here is the CHAB_fnc_jipcam: _uid = _this select 0; private "_player"; private "_local"; private "_localID"; { if ((getPlayerUID _x) isEqualTo _uid) then{_player = _x;}; } forEach allPlayers; _local = ???; _localID = ???; As you can see, I clearly have no clue who is the owner of machine ? In my mind's eye remoteExec sends a message to every player that they have to run this script with the given parameters. Here is what I tried so far: Create a global variable (not public) for each player and give it the playerUID -> Result is that inside the jipcam the returned value is "any" on each PC. Create a missionnamespace variable (global but not public) and give it the playerUID -> same results as before I have completely run out of ideas, I tried mostly everything I could think of. Is there anyone who has more tricks up his sleeve?
  20. Hello. I am using this script to get all the cities into an array, then make a marker on them. 95% of the time it works, and then rarely it just creates a marker at [0,0,0] and then the script is just useless. Help, please. tasknumber = ["task1","task2","task3", etc ... ]; publicVariable "tasknumber"; publicVariable "current_tasknumber"; publicVariable "current_task"; cities = nearestLocations [getPosATL officer_jeff, ["NameCity"], 25000]; publicVariable "cities"; _city = cities call BIS_fnc_selectRandom; _citypos = locationPosition _city; _citymarker = createMarker ["citymarker", _citypos]; current_taskmarker = _citymarker; current_tasknumber = tasknumber call BIS_fnc_selectRandom; [west,[current_tasknumber],["Clear out the area","Clear out",current_task],[0,0,0],true,2,true,"attack",true] call BIS_fnc_taskCreate; [current_tasknumber,current_task]call BIS_fnc_taskSetDestination; [current_tasknumber]call BIS_fnc_taskSetCurrent; ....spawn enemies etc ...
  21. With @Larrow's assistance, I was able to hash out the program I wanted to manage my soldiers with addAction menus. I will create a mod thread when I have the vehicle assignment actions added. Full script: myGrps = []; myGrps resize 10; myGrps = myGrps apply { [ grpNull ] }; TAG_fnc_hasBlankHC = { _bool = false; { _x params[ "_HCGrp", "_HCActionID" ]; if ( isNull _HCGrp ) exitWith {_bool = true;}; }forEach myGrps; _bool; }; TAG_fnc_isLastHCMan = { _bool = false; { _x params[ "_HCGrp", "_HCActionID" ]; if (( Group cursorTarget isEqualTo _HCGrp ) && {{ alive _x }count units _HCGrp isEqualTo 1}) exitWith {_bool = true;}; }forEach myGrps; _bool; }; TAG_fnc_JoinFunction = { _unit = _this select 0; _grp = _this select 1; _str = _this select 2; //accepting variable "unit or from Group" and "target group" if (_str == "unit") then { [_unit] joinSilent _grp; }else { { [ _x ] joinSilent _grp; }forEach units _unit; }; _leader = Leader _grp; { if(!(_leader isEqualTo _x) && {(rankId _x) > (rankId _leader)}) then { _leader = _x; }; }forEach units _grp; _grp selectLeader _leader; }; TAG_fnc_createNewHCGroup = { params[ "_unit", [ "_create", true ], [ "_wholeGroup", false ] ]; _CompanyNames = ["CompanyXray","CompanyNovember","CompanyNovember","CompanyNovember","CompanyNovember","CompanyWhiskey","CompanyWhiskey","CompanyWhiskey","CompanyWhiskey","CompanyXray"]; _PlatoonNames = ["Platoon1","Platoon1","Platoon1","Platoon2","Platoon2","Platoon1","Platoon1","Platoon2","Platoon2","Platoon1"]; _SquadNames = ["Squad1","Squad1","Squad2","Squad1","Squad2","Squad1","Squad2","Squad1","Squad2","Squad2"]; { _x params[ "_HCGrp", "_HCActionID" ]; if ( !isNull _HCGrp && { { alive _x }count units _HCGrp isEqualTo 0 } ) then { deleteGroup _HCGrp; player hcRemoveGroup _HCGrp; if ( _HCActionID isEqualType 0 ) then { player removeAction _HCActionID; }; myGrps set [ _forEachIndex, [ grpNull ] ]; _HCGrp = grpNull; }; if ( _create && { isNull _HCGrp } ) then { private [ "_group" ]; if !( isPlayer _unit ) then { _group = createGroup side player; }else{ _group = group player; }; _group setGroupIdGlobal [ "%GroupNames %GroupCompany %GroupPlatoon-%GroupSquad", "Yankee", _CompanyNames select _forEachIndex, _PlatoonNames select _forEachIndex, _SquadNames select _forEachIndex ]; if !( _unit in units _group ) then { _oldGroup = group _unit; if ( _wholeGroup ) then { units _oldGroup joinSilent _group; }else{ [ _unit ] joinSilent _group; }; if ( count units _oldGroup isEqualTo 0 ) then { deleteGroup _oldGroup; }; }; _actionID = if !( isPlayer _unit ) then { player hcSetGroup [ _group ]; [ _group ] call TAG_fnc_joinHCGroup; [ _group ] call TAG_fnc_groupJoinHCGroup; }else{ objNull; }; myGrps set [ _forEachIndex, [ _group, _actionID ] ]; _create = false; }; }forEach myGrps; }; TAG_fnc_grpJoinMe = { player addAction [ "Group Join Me", { cursorTarget setCaptive false; {[ _x ] joinSilent group player;}forEach units group cursorTarget; [ objNull, false ] call TAG_fnc_createNewHCGroup; }, [], 1, false, true, "", " !(isnull cursortarget) && (_this isEqualTo _target) && { (cursorTarget isKindof 'Man') && { (alive cursortarget) && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { (leader group cursorTarget isEqualTo cursorTarget) && { ({alive _x} count units group cursorTarget > 1) && (({ alive _x } count units group cursorTarget) + ({ alive _x } count units group player) < 12) } } } } }" ]; }; TAG_fnc_joinMe = { player addAction [ "Join Me", { cursorTarget setCaptive false; [ cursorTarget ] joinSilent group player; [ objNull, false ] call TAG_fnc_createNewHCGroup; }, [], 1, false, true, "", " !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { !(group cursortarget isEqualTo group player) && { ({ alive _x } count units group player < 12) } } } } }" ]; }; TAG_fnc_groupJoinHCGroup = { params[ "_HCGrp" ]; _actionID = player addAction [ format [ "Group Join %1", groupID _HCGrp ], { params[ "_target", "_caller", "_ID", "_args" ]; [ Group cursorTarget, _args, "" ] call TAG_fnc_JoinFunction; if (Group cursorTarget in myGrps) then { [ objNull, false ] call TAG_fnc_createNewHCGroup; }; }, _HCGrp, 1, false, true, "", format [" _group = %1 call BIS_fnc_groupFromNetId; !(isnull cursortarget) && (_this isEqualTo _target) && { (cursorTarget isKindof 'Man') && { (alive cursortarget) && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { (call TAG_fnc_hasBlankHC) && { !(Group cursorTarget isEqualTo _group) && { !(Group player isEqualTo _group) && { (leader group cursorTarget isEqualTo cursorTarget) && { ({ alive _x } count units (group cursorTarget) > 1) && { ({ alive _x } count units (_group) > 0) && (({ alive _x } count units (_group)) + ({ alive _x } count units cursorTarget) < 12) } } } } } } } } }", str ( _HCGrp call BIS_fnc_netId ) ] ]; _actionID; }; TAG_fnc_joinHCGroup = { params[ "_HCGrp" ]; _actionID = player addAction [ format [ "Join %1", groupID _HCGrp ], { params[ "_target", "_caller", "_ID", "_args" ]; [ cursorTarget, _args, "unit" ] call TAG_fnc_JoinFunction; [ objNull, false ] call TAG_fnc_createNewHCGroup; }, _HCGrp, 1, false, true, "", format [ " _group = %1 call BIS_fnc_groupFromNetId; !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { !(group cursortarget isEqualTo _group) && { ({ alive _x } count units (_group) > 0) && ({ alive _x } count units (_group) < 12) } } } } }", str ( _HCGrp call BIS_fnc_netId ) ] ]; _actionID }; TAG_fnc_HCActions = { player addAction [ "Unit to HC Group", { [ cursorTarget, true ] call TAG_fnc_createNewHCGroup; }, [], 1, false, true, "", " !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { (call TAG_fnc_hasBlankHC) } } } }" ]; player addAction [ "Group to HC Group", { [ cursorTarget, true, true ] call TAG_fnc_createNewHCGroup; }, [], 1, false, true, "", " !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { !(hcLeader Group cursorTarget isEqualTo player) && { (call TAG_fnc_hasBlankHC) && { leader group cursorTarget isEqualTo cursorTarget && count units group cursorTarget > 1 } } } } } }" ]; player addAction [ "Dismiss HC Group", { player hcRemoveGroup group cursorTarget; { _x params[ "_group", "_action" ]; if ( _group isEqualTo group cursorTarget ) exitWith { player removeAction _action; player hcRemoveGroup _group; myGrps set [ _forEachIndex, [ grpNull ] ]; }; }forEach myGrps; }, [], 1, false, true, "", " !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { leader group cursorTarget isEqualTo cursorTarget && { group cursorTarget isEqualTo ( _x select 0 ) }count myGrps > 0 } } } }" ]; }; _null = [ player, true ] call TAG_fnc_createNewHCGroup; _null = [] call TAG_fnc_joinMe; _null = [] call TAG_fnc_grpJoinMe; _null = [] call TAG_fnc_HCActions;
  22. I'm quite new to functions with variables and scripting in general and I would really appreciate some help! The code will not even execute and I've been banging my head for hours now. Can someone please take a look? The function I'm trying to run is called spawnHeli (see code below) and its written in a file called functions.sqf. functions.sqf is called in init.sqf by execVM "functions.sqf"; and the spawnHeli function is called in a trigger in the editor by _nul = [getMarkerPos "heliSpawnPoint", "ocra"] spawn spawnHeli; The spawnHeli function I want to run as it is written in functions.sqf: It seams like already in the init phase the end of the functions.sqf file is not reached so can it be some error in the spawnHeli function preventing it from compiling? spawnHeli = { private["_xPos","_yPos","_zPos","_type"]; _xPos = this select 0; _yPos = this select 1; _zPos = this select 2; _type = _this select 3; _spawnMarkerPos = [_xPos,_yPos,_zPos]; if (isServer) then { _heli = []; _crew = []; _crew = creategroup EAST; if(_type == "ocra") then { _heli = [_spawnMarkerPos, 180, "O_Heli_Light_02_F", _crew] call bis_fnc_spawnvehicle; } else { if(_type == "kajman") then { _heli = [_spawnMarkerPos, 180, "O_Heli_Attack_02_F", _crew] call bis_fnc_spawnvehicle; } else { exitWith {}; }; }; _wp = _crew addWaypoint [getPos player, 0]; _wp setWaypointType "SAD"; _wp setWaypointCombatMode "RED"; _wp2 = _crew addWaypoint [getPos player, 1]; _wp2 setWaypointType "LOITER"; _wp2 setWaypointCombatMode "RED"; uiSleep 300; _wp3 = _crew addWaypoint [getMarkerPos "wpCas", 2]; _wp3 setWaypointType "Move"; _wp3 setWaypointCombatMode "green"; _Ocra = _heli select 0; waitUntil{ (getPos _Ocra) distance (getmarkerpos "wpCas") < 2000}; {deleteVehicle _x} forEach (crew _Ocra); deleteVehicle _Ocra; } else {}; };
×