Jump to content

kaleb c0d3

Member
  • Content Count

    27
  • Joined

  • Last visited

  • Medals

Everything posted by kaleb c0d3

  1. Sup all! I've made a modification of BIS_fnc_markerToString and BIS_fnc_stringToMarker to allow Polylines (map drawings) to be serialized/unserialized, because native scripted functions does not allows it. I'm currently using this because my players sometimes participate in a pre-mission recon and this allows them to save important map intel data, that will be re-renderized on their maps on the official mission day. Use/modify them as you see fit. Enjoy! GLMRK_fnc_markerToString: GLMRK_fnc_stringToMarker:
  2. Sup all! Do you know if there's a event handler that fires from the client side when the player disconnects? I'm working on a survival mod wich persists player info into a database, and need to force an update when the client disconnects. If I use the serverside events (HandleDisconnect, onPlayerDisconnected, and so on), some player data is not available because the client is no more online, and cannot query for it. Thanks in advance.
  3. Thank you @sarogahtyp & @mrcurry. I already have the 'autosave' mechanic, with a configurable frequency (1 per minute atm). I have 2 different scenarios for wich I need a disconnect EH on the client-side: 1. Player lost connection: I have the last autosave data, <= 1 minute of the last save. No major problem here... it is obvious that the client went on a critical state and any data (updated or not) is better than nothing. 2. Player quits (via menu or alt+f4): I want to take that 'last update before leaving', so when the player comes back, will be in the exact same state. I think the 'save on pause menu' is a good approach; not the best, but a very good one. Extra: performance wise, I've made the persistence engine this way: Client request save to server >>> Server saves data via API to a webservice >>> Client gets operation status Doing this, the server only have to kick the api with the data, and all the database stuff is made on another hardware. Very low performance impact so far. The webservice is running in a Debian 11: Laravel APP, MySQL, Apache, running smoothly.
  4. Sup all. I've have another question, this time, related to map markers. I'm running missions that slipts into two events: one day for recon, and the other for the mission itself. On recon day, a small group of players inserts into the map and makes a survelliance run, gathering the intel for the second day, that is, "the mission" itself. I want to save all the players markers on recon event (wich I can do via scripting), and then export them to the "mission map". The thing is that on single player, I can grab the map markers array data and export it as a string using "copyToClipboard", but according to Bohemia wiki, it's a server side only function. On a dedicated server, I'm running into problems to get that data from a client. What I achieved so far: Server side script: grab all the players markers into an array, then "send" that data to a zeus enabled player (client). On client side, I've got the markers data. Missing: how can I do to "export" that data. Any ideas? Thanks in advance.
  5. kaleb c0d3

    Save players' map markers on MP

    Thank you very much @alpha993!!! Will try that and update any result.
  6. Sup all. I'm asking for advice on a strange AI behaviour using moveInCargo. Scenario: I'm making a teleport module that allows a player to teleport to other player (a quality of life mod to help zeus with players disconnections). The first release of this mod was simple: a custom dialog that let the player pick a teleport location using the others players positions. The problem was when the "target player" was inside a moving vehicle... the teleported player was usually killed by a car accident 😛 In the second release, I want to improve the mod: if the "target player" is inside a vehicle, and the vehicle has free seats, teleport the player to one of these seats. Implementation: If the "target player" is on foot, its a normal teleport (player setPosASL _target_player). If the "target player" inside a vehicle, check for available seats (using "fullCrew"), and then using "moveInXXXXX" (cargo, commander, gunner, etc), "assignAsXXXXX" (cargo, commander, gunner, etc), I was able to teleport the player to one of the free seats on that vehicle. If no seats are available, just a "normal" teleport near the vehicle (TODO: air vehicles?). The problem: When I used one of the "moveInXXXX" functions against a player and a vehicle, the vehicle seat gets 'dirty': no AI can get into that seat anymore. Initially I tought it was some arma-3-wichcraft, a conflicting mod or an error with my code, but taking things to the basic, I was able to reproduce this strange AI behaviour on a fresh & clean mission, without any code. You can reproduce this weird thing like this: Create a new mission. Place a vehicle with only a unit as driver, and set it to "player unit". Place the zeus (curator) module. Start the mission. Get out from the vehicle. Enter zeus, spawn an allied squad (4+ units), and order them to get into the vehicle. You will see that the AI won't occupy the 'dirty' player seat. Try switching player seat in the editor and try again, and you will see how the 'dirty seat' changes. Why is that? Inspecting things a little, and exporting the mission to SQF code, you can see that the Arma 3 engine moves the player unit into a vehicle using "moveInDriver", just like I did it on the teleport code. Another thing is that the problem is consistent using other "base" mods, for example ACE3: if you want to load a prisioner/wounded AI unit into a 'dirty seat', that seat is not usable anymore. Final toughts: I think that the scripted versions of moving a player into a seat does not clear/set certain flags on the vehicle, rendering that position unusable for the AI. Sorry for the long post. Thanks in advance. Solution #1 (edited post @ 05/02/2022): Thanks to @fn_Quicksilver, this is one way to fix this: // Add this at initPlayerLocal.sqf or function with preInit/postInit to fix the 'dirty seat' behaviour. player addEventHandler ["GetOutMan", { params ["_unit", "_role", "_vehicle", "_turret"]; if !(isNull assignedVehicle _unit) then { unassignVehicle _unit; }; }];
  7. Thank you very much @fn_Quiksilver, you nailed it! Managed to patch it using an event handler like this (works in SP & MP): // Add this at initPlayerLocal.sqf or function with preInit/postInit to fix the 'dirty seat' behaviour. player addEventHandler ["GetOutMan", { params ["_unit", "_role", "_vehicle", "_turret"]; if !(isNull assignedVehicle _unit) then { unassignVehicle _unit; }; }]; The "if !(isNull assignedVehicle _unit)" is used to made the fix stacked event handler friendly, just in case of another mod doing magic with the "GetOutMan" EH. Thanks again, man.
  8. @IndeedPete first let me thank you for this awesome conversation system. About one of the limitations: "For full conversations, both participants NEED a variable name. (It's necessary for a workaround to make the MC work.)" I think this will do the trick with the player unit. Tested in SP (should work in MP) with a player controlled unit without variable name and worked. Add this in "initPlayerLocal.sqf". // Create a fancy player global var name. Not checking against duplicates... maybe use SteamID value? private _playerVar = format ["player_%1", [name player] call BIS_fnc_filterString]; // Create the var missionNamespace setVariable [_playerVar, player, true]; (missionNamespace getVariable _playerVar) setVehicleVarName _playerVar; Cheers 🙂
  9. kaleb c0d3

    Need fast reload advice

    Thank you very much, @alpha993 Will post updates as soon as I can type some code.
  10. Sup everyone. I'm working with a code snippet for fast reload (an old idea that never finished). The concept is to reload the current weapon, dropping the magazine to the ground and cutting the required time to reload to half (I'm a IPSC shooter IRL, so grabbed the concept from there). So far, i've achieve this: 1. Get magazine type and ammo count for current weapon. 2. Remove the magazine from current weapon. 3. Create a magazine of the same type and ammo count on the floor. 4. Insert a magazine from inventory to current weapon. Extra: using ACE, binded the action to double R key tap. The thing is that I cannot control the animation speed. I mean, I want to start the reload animation but at a faster speed; in fact, i need any animation to replace the standar one. Any advice is welcome. Thanks in advance!
  11. kaleb c0d3

    Need fast reload advice

    Thanks @alpha993, will try that. In an early reply, you've mentioned something about other gestures, and/or modifying existing ones (via config, i suppouse). Do you have an example or link to something like that? Thanks!
  12. kaleb c0d3

    Need fast reload advice

    Yep, already went to that obscure corners... setSkill only affects AI, and setAnimSpeedCoef works for movement-like animations. Thanks anyway, @johnnyboy
  13. kaleb c0d3

    Random ennemy placement

    I think he wants to move a group of them, not just one.
  14. kaleb c0d3

    Random ennemy placement

    Please, use and modify it as you see fit! I'm glad to help you 🙂 When you define parameters that way, you are declaring with a type and a default value, like this: params [ ["_p", "no value", ["", 0]] ]; // _p : parameter name // "no value" : default value for _p, if not specified at fuction call (an "optional" parameter) // ["", 0] : array of data types accepted for _p, in this case, a string ("") or an integer (0) For more info, take a look at this. And about your code, take a look at this piece (not tested tho...) private _possibleLocation = [trig01, trig02, trig03] private _hostagePos = selectRandom _possibleLocation; { private _unitsInArea = allUnits inArea _x; { deleteVehicle _x } forEach _unitsInArea; } forEach (_possibleLocation - [_hostagePos]); If you try my fn_randomPlacement function, let me know how it worked, just to have feedback 😄
  15. kaleb c0d3

    Random ennemy placement

    Sup @Marin Lorre. I've made a script that do the same, but with a different approach. Take this example: I've got a VIP, wich need random placement. I've got several possible spots for placement (different buildings inside a town). The VIP has bodyguards; these units are different, depending on the selected placement. The script does this: the VIP is synchronized against multiple empty logics. Each logic position is a possible location (latitude, longitude and height matters). Then, i've got several AIs synchronized to each logic (the bodyguards at each location). When mission starts, the init code from the VIP gets fired and selects a random location (a randon logic), then places the VIP into that position (with an optional random radius). After that, it takes all the non-selected logics and delete the "orphans" bodyguards. Take a look at this function (fn_randomPlacement.sqf): params [ ["_target", objNull, [objNull]], ["_randRadius", 0, [0]] ]; // Get only synchronized "Logics" private _syncLogics = (synchronizedObjects _target) select { typeOf _x == "Logic" }; private _selectedLogic = selectRandom _syncLogics; // Set target position _target setVehiclePosition [_selectedLogic, [], _randRadius, "CAN_COLLIDE"]; // Delete all objects associated with the non-selected Logic { // get attached objects (exclude the _target itself) private _attachedObjects = (synchronizedObjects _x) - [_target]; { deleteVehicle _x; } forEach _attachedObjects; } forEach (_syncLogics - [_selectedLogic]); Then, in the VIP init field (this code is fixed for MP missions): if (local this) then { [this, 3] call GLMFW_fnc_randomPlacement; }; In the editor, I've got this: /--BODYGUARD1 /-------------LOCIG1---BODYGUARD2 / \--BODYGUARD3 / / /--BODYGUARD4 VIP----------------LOGIC2 \ \--BODYGUARD5 \ \ \------------LOGIC3---BODYGUARD6 If LOGIC1 is selected at random, you keep BG 1, 2 and 3 (4, 5 and 6 are deleted). If LOGIC2 is selected at random, you keep BG 4 and 5 (1, 2, 3, 6 are deleted). If LOGIC3 is selected at random, you keep BG 6 (1, 2, 3, 4, 5 are deleted). In your example, you can place one "main" hostage as vip, place different logics as possible locations, and synch more hostages into each location. Good luck and happy coding! -EDIT- When using this script, I've synchronize other objects at each "LOGIC" position, such as cars, boxes, intel, etcétera, to make the selected spot more "immersive friendly" (i mean, you are not tied to AI units at each possible location).
  16. kaleb c0d3

    More players, More enemies

    @fin_soldier as promised: download this mod and give it a try (Systems -> GravisLudum Mission Framework -> Dynamic Balance). If you want to go deeper, decompile GL_DynamicBalance.pbo ; then take a look at fn_globalBalance.sqf and fn_adjustGroup.sqf I've made the english translation (Spanish & English atm). We don't have a public Git yet, but feel free to use, modify & adapt it as you see fit (we have a Creative Commons licence CC BY-NC-SA 4.0, https://creativecommons.org/licenses/by-nc-sa/4.0). Good luck and happy coding!
  17. kaleb c0d3

    More players, More enemies

    @fin_soldier , I've made a balancing mod (in beta ATM). Because I play with a closed small group (8 members max), I have the same issue. My approach was this (before converting the code into a module): Sync AI groups to be balanced to an empty logic object. Used a function that has these parameters: the logic, minimum players, maximum players, delta, timeout. the logic: as explained above minimum players: if player count goes below this value, remove "delta" units from synced groups. maximum players: if player count goes above this value, add "delta" units to synced groups. delta: the amount of units to be added or subtracted when balancing. timeout: number of seconds to wait until balancing. The function must run server side only. The logic init code is something like this: [this, 4, 6, 1, 300] call GLMFW_fnc_globalBalance; I'm sorry that i cannot share code right now (I don't have access to my terminal ATM). Basically, I've got this scenario: After some time, the script will kick in and balance AI's based on players connected at that moment. If we are between min and max threshold, nothing happens. If we are below min, each synced group gets "delta" units deleted at random (if delta is 1, one unit is deleted per missing player). If we are above max, each synced group gets "delta" added units (duplicating one random group member). I hope this gives you an approach to make your balancing script. As soon as I get home, I will share my code with you. Take care and good luck. (Please excuse my english)
  18. Sup all. I've got a question that is floating around my head for so long... How do you develop a mod? I mean, what's your development cycle? In my case, I do this: A. Start with a empty mission (VR generally), and throw/test some scripts. B. Transform that scripts into compiled functions, with their corresponding Cfg class. C. Make them a module to use directly from the editor (EDEN). My problem is that at step C, I usually do this: 1. compile the code into a mod 2. open Arma 3 3. test 4. get the bugs 5. close Arma 3 6. patch code 7. repeat I'm sure that I am doing it wrong... it's very annoying to open/close Arma 3 in every code iteration, more if i'm trying & testing to figure out some nasty bug. Any advice about impoving that cycle? Thanks in advance.
  19. Sup again. I'm migrating a bunch of loose functions to mods, so my group can use them when editing missions (they know little to no scripting). So far, i was able to create modules and place them into the editor. But now i'm struggling with a module attribute. In this particular case, I need an "activation script" attribute, just like the triggers. I saw that theres a class named "EditCodeMulti5" that fits perfecly, but when tried to edit the placed module properties, i'v got an error: no entry 'bin\config.bin/Cfg3DEN/Attributes' My config is this: class CfgVehicles { class Logic; class Module_F: Logic { class AttributesBase { class Default; class Edit; class EditCodeMulti5; // <-- added this class Combo; class Checkbox; class CheckboxNumber; class ModuleDescription; class Units; }; class ModuleDescription { class Anything; }; }; class GLKP_ModuleKeyPad: Module_F { author = "Kaleb"; scope = 2; displayName = $STR_GL_KeyPadPanel; icon = "\GL_KeyPad\images\gl_keypad.paa"; category = "GL_Category"; function = "GLKP_fnc_initKeyPad"; functionPriority = 110; isGlobal = 1; isTriggerActivated = 0; //isDisposable = 1; is3DEN = 0; class Attributes: AttributesBase { class EnterCodeCallback: EditCodeMulti5 // <-- module attribute { property = "gl_enterCodeCallback"; displayName = $STR_GLKP_EnterCodeCallback; tooltip = $STR_GLKP_EnterCodeCallback_Tooltip; typeName = "STRING"; validate = "expression"; defaultValue = """true"""; }; }; }; }; The error produces after placing the module into the editor, when double clicking on it to edit it's attributes: no entry 'bin\config.bin/Cfg3DEN/Attributes' If I change the attribute EnterCodeCallback to inherit from a "base" control, let's say Edit , it doesn't show any errors and allows me to edit the attribute. Any help is appreciated. Thanks in advance.
  20. kaleb c0d3

    Help with Module attributes

    By reverse engineering other vanilla modules, I made it work now... but I'm not %100 sure how. I have my suspicions by reading the Bohemia wiki that modules has their own set of "common" attributes, and if you want something more fancy, you have to mess with Cfg3DEN. Long story short, this is the fixed thing. class CfgVehicles { class Logic; class Module_F: Logic { class AttributesBase { class Default; class Edit; // removed the EditCodeMulti5 class class Combo; class Checkbox; class CheckboxNumber; class ModuleDescription; class Units; }; class ModuleDescription { class Anything; }; }; class GLKP_ModuleKeyPad: Module_F { author = "Kaleb"; scope = 2; displayName = $STR_GL_KeyPadPanel; icon = "\GL_KeyPad\images\gl_keypad.paa"; category = "GL_Category"; function = "GLKP_fnc_initKeyPad"; functionPriority = 110; isGlobal = 1; isTriggerActivated = 0; //isDisposable = 1; is3DEN = 0; class Attributes: AttributesBase { class EnterCodeCallback // <--- fixed this entire block { control = "EditCodeMulti5"; property = "gl_enterCodeCallback"; displayName = $STR_GLKP_EnterCodeCallback; tooltip = $STR_GLKP_EnterCodeCallback_Tooltip; typeName = "STRING"; validate = "none"; defaultValue = """true"""; expression = "_this setVariable ['gl_enterCodeCallback', _value, true];"; }; }; }; }; I hope it helps.
  21. kaleb c0d3

    MOD development cycle

    I've thought that if you're programming a mod, the mod gets loaded at Arma start, and cannot be modified until the game is closed (the Arma process has a open file handler onto the mod files). I mean.. can you recompile a mod without closing Arma? If that's the case, it will be the solution (I have in mind that you cannot do that, but I may be wrong).
  22. kaleb c0d3

    Eden Composition Spawning

    You're welcome. Ok... maybe they do not start because my way of implementing it. I've made a dynamic mission objective module, wich do it's thing inside a function declared with postInit = 1 (where after some config data fetching, it calls LARs_fnc_spawnComp). As far as I understand, it should work ok, but Arma engine has it's own witchcraft. I will implement the getCompObjects call to make it right, but I'm not having that problem because I clean the area prior the placement (I've extended the composition definition config to add some parameters, for example the center offset and "clearArea=true"). An example: class CfgCompositions { // ---- Base Compositions Classes [DO NOT EDIT THIS!] --------------------- class BaseComposition { enabled = true; // Can this be used by DynamicOps module? compType = "none"; // Can be one of: none, roadblock, fob, .... aiAreaRadius = 50; // Radius used to estimate the AI occupation zone. areaRadius = 20; // Radius of the composition area. centerOffset[] = {0, 0, 0}; // Center Offset for the composition hideExisting = false; // Hide existing world objects inside composition area? }; // ---- FOBs -------------------------------------------------------------- class FOB_01 : BaseComposition { compType = "fob"; areaRadius = 30; hideExisting = true; #include "fob_01.sqe" }; };
  23. kaleb c0d3

    Eden Composition Spawning

    Sup Larrow! In first place, must say that this works like a charm. I've noticed that if you have smoke or fire modules in the composition (from modules > effects on EDEN), they do not "start" upon composition placement. Found a workaround that want to share with you: _compReference = [ .... ] call LARs_fnc_spawnComp; { _x setvariable ["BIS_fnc_initModules_activate", true]; } forEach (nearestObjects [_compPosition, ["ModuleEffectsFire_F", "ModuleEffectsSmoke_F"], _compRadius, true]); I hope it helps. Thanks again for your work, man. - edit - Tested in SP and MP, and works.
  24. kaleb c0d3

    Player Persistent Stash

    @.Marti, it worked like a charm. Thank you!
  25. Sup! I need advice to approach a solution. I'm coding a persistent stash (like Diablo 3 stash), allowing a player to save items (weapons, clothes, etc) into a box or an arsenal. By some external .dlls and dark sorcery, the stash contents are persisted into a database. By design, the item count must be kept, i.e.: if the players "saves" 3 binoculars, will be able to retrieve only 3 binoculars. Long story short, when the player opens his stash it gets populated with the database info, and when closes it, the database is updated. Tried to code the stash using a container (a box) or Arsenal, but I'm having some issues: Using a container: Simple objects (the ones with no attachements) are easy to add to/get from container via scripting, but the complex ones (a weapon with attachements for example, a backpack with items in it, or a half-used magazine) are a headache. With a unit, I can "getUnitLoadout/setUnitLoadout" it, and get/set all items along with its configurations, but there's not "getCargoLoadout/setCargoLoadout" functions (at least none of I'm aware of). Using Arsenal: by design the arsenal have an unlimited item count, wich goes against my intention; i can "unlock" an item and the player will have unlimited amount of it, wich I don't want. If i could preset the Arsenal with an array of items/count available when the players opens it, and get it state after he closes it (to persist the stash in the database), it will be the optimal scenario. Thanks in advance and please excuse my english (not my natural lang). Edited: I'm using CBA_A3 and ACE3, if it helps.
×