Jump to content

Niktus Acid

  • Content Count

  • Joined

  • Last visited

  • Medals

Community Reputation

0 Neutral

About Niktus Acid

  • Rank
    Private First Class
  1. Niktus Acid

    preInit variables

    Another great advise, I didn't knew about the loading screen command... I'm gonna use it Thanks again Larrow, you are the man!
  2. Niktus Acid

    preInit variables

    That's a nice approach, it should work perfectly I'm just starting to playing around with preInit functions, never needed to do so, but I discovered that if you really want to parse and process data in massive arrays from a map, it is the way to go.
  3. Niktus Acid

    preInit variables

    He did, I still don't completely understand what did the trick. I suppose you need to properly declare your function in the library My init line is quite complex. What I do basically in this civilian module is activate locations by player's distance, and then moving agents around the player all the time, so you can simulate like the whole world is more or less alive, without killing your FPS. In my old FX8350, looks like 60 pedestrians and 20 cars allows me to barely keep 30 FPS. Then you have to take care the whole time that no car kill the smart agents that loves to walk at roads center... another story 🙂
  4. Niktus Acid

    preInit variables

    Woow, that's awesome Larrow... it works pitch perfect And I'm checking your code changes too, need to study those techniques... I'm not a pro, just a big enthusiast I would buy you a beer but I don't have my paypal with funds from a long time I've learned a lot from your forum comments in many different topics, thank you so much!
  5. Niktus Acid

    preInit variables

    This whole thing is about to have really well organized, secured and filtered data variables with map information, and most of all, gain performance... because I'm always using the engine on the limit of what FPS allows me, so, if a I can grab all this data before mission starts is even better... so I don't need to bother to find buildings, or roads or any secure position when game is running as I already have anything that any unit could need. For this particular case, I'm going to use this data to populate civilian life, people and vehicles moving around, randomly. Each agent has a loop function that checks periodically its current position, and when they reach their destination, they choose another one randomly from an array of destinations available to that particular unit. I just need one example of a variable created in a function triggered in preInit, that I could later retrieve from the init. That's all I need, and I'm sure this could be perfectly doable, I just don't know what am I missing here.
  6. Niktus Acid

    preInit variables

    Oh, looks like a typo, it is supposed to be a private variable for internal use (_roads_positions), it works anyway of course Final variables are constructed here: missionNamespace setVariable [_var_name,_compose];
  7. Niktus Acid

    preInit variables

    This is my function loaded in a preInit private ["_all_locations"]; _all_locations = nearestLocations [[worldSize/2,worldSize/2], ["NameCity","NameCityCapital","NameVillage"], worldSize]; // PARSE LOCATIONS AND COMPOSE VARIABLE { // NAME _name = text _x; // UNIFY CHARACTERS FOR TWO WORD LOCATIONS _split = _name splitString " "; _name = _split joinString ""; systemChat format["... parsing %1 ...",_name]; // CENTER - insert in final var _center = locationPosition _x; // FIND BUILDINGS _buildings = _center nearObjects ["building", 500]; // FILTER BUILDINGS ENTERABLE - insert in final var _buildings_enterable = []; { if ( [_x] call BIS_fnc_isBuildingEnterable ) then { _buildings_enterable pushBack _x; }; } forEach _buildings; // REDUCE BUILDINGS NUMBER IF THERE ARE MORE THAN 50 if (count _buildings_enterable > 50) then { _work = _buildings_enterable; _buildings_enterable = []; _buildings_enterable = [_work,count _work,["RANDOM_REMOVE",[0.5]]] call eze_fnc_math_array_filter; }; // GRAB BUILDINGS POSITIONS _buildings_positions = []; { _getPos = getPos _x; _buildings_positions pushBack _getPos; } forEach _buildings_enterable; // PEDESTRIANS PART ////////////////////////////////////////////////////////////////////////////// // FILTER BUILDING DISTANCES FOR PEDESTRIANS _buildings_filtered = [_buildings_positions,count _buildings_positions,["MIN_DISTANCE",[50]]] call eze_fnc_math_array_filter; // PEDESTRIAN POSITIONS - insert in final var _positions_pedestrians = []; { _findPos = _x findEmptyPosition [0,30]; if (count _findPos > 0) then { _positions_pedestrians pushBackUnique _findPos; }; } forEach _buildings_filtered; // VEHICLES PART ////////////////////////////////////////////////////////////////////////////// // FILTER BUILDING DISTANCES FOR CARS _buildings_filtered = [_buildings_positions,count _buildings_positions,["MIN_DISTANCE",[100]]] call eze_fnc_math_array_filter; // FIND NEAR ROADS - insert in final var roads_positions = []; // ADD AT LEAST ONE ROAD FOR CITY CENTER _near_roads = _center nearRoads 50; if (count _near_roads > 0) then { _select = selectRandom _near_roads; _roadPos = getPos _select; roads_positions pushBackUnique _roadPos; }; // ADD ROADS NEAR BUILDINGS { _thisPos = _x; _near_roads = _thisPos nearRoads 50; if (count _near_roads > 0) then { _select = selectRandom _near_roads; _roadPos = getPos _select; roads_positions pushBackUnique _roadPos; }; } forEach _buildings_filtered; // COMPOSE FINAL VARIABLE ////////////////////////////////////////////////////////////////////////////// _var_name = "eze_fw_" + _name; _compose = [_center,_buildings_enterable,_positions_pedestrians,roads_positions]; missionNamespace setVariable [_var_name,_compose]; } forEach _all_locations; systemChat "... parsing finished..."; Basically I'm finding buildings around each map location, and composing different position elements in an array that is called "eze_fw_" + location name End result in one chernarus location end like this: eze_fw_zelenogorsk = [ [CENTER POS],[BUILDING OBJECTS],[PEDESTRIAN POSITIONS],[ROAD POSITIONS] ]; When I run this after init, everything works perfect and I can access all my variables, from preInit, those variables doesn't exist. If you wonder about the call function eze_fnc_math_array_filter, I'm also adding that in the same file, so all the code needed is right there. But what annoys me is that even if I declare in preInit something like dummy_var = "Hello"; I can't call it from the init, doesn't exists. I'm not using the functions library, I have created my own framework of function which I compile in the first lines of the init to gain access accross all my needed functions. I'm still thinking about the PROS and CONS to mount everything in a functions library, but at the moment, my description.ext looks like this #include "eze_fw\DIALOG\defines.hpp" #include "eze_fw\DIALOG\dialog.hpp" class CfgFunctions { class eze { class world { class treesRemove { file = "eze_fw\FNC\eze_fnc_world_pre.sqf"; preInit = 1; }; class parseLocations { file = "eze_fw\FNC\eze_fnc_locations_pre.sqf"; preInit = 1; }; }; }; }; My function to massively reduce or add trees and other map elements before mission starts works perfectly fine, but I'm solving everything right there, no need to create anything that I will call later. I can't say I'm sure that is running because I can't see anything, not even an error pop up, but my other preInit function runs perfect, and I'm following same process. Thanks for your time to give this a look guys! Really appreciate your comments
  8. Hi people I need some enlightment with this topic as I could not found any information on it. I'm trying to create some dynamic variables on the fly in a preInit function, regarding location names, building positions for each location, road positions, etc etc. to be able to access this information later when I needed and the game is running. Problem is, even if I define a global variable in a preInit file, I'm not being able to access that variable from the init. Also tried store variables in missionNameSpace without luck. So, how can I grab data stored in vars created in preInit functions? Thanks!!
  9. Got your point, and I think that now I understand why a simple text doesnt represents an object that you parsed on the engine where there is an actual reference on what object you are referring to. Thanks for helping me clear my mind
  10. That looks nice PolPox, I'll give it a try. Maybe is the fastest implementation if you don't process everything previously. Thanks for taking time to check it 🙂 Still I don't understand why results from nearestTerrainObjects cannot be stored and processed with some execVM. Maybe because those objects doesn't have a class ID? ... dunno
  11. Hi! I want to create a function that allows me to remove trees in entire maps in a balanced way, basically reducing the ammount of trees on heavily crowded forests. I want to do this as quick as possible, so my take on this was to run a function to iterate over hundred thousands trees, choose randomly 50% of all trees (for example), and store the resulting array in a file, that I could call straight away to remove those objects on mission load. And when I run my function to delete those objects, I receive " Error Missing ] " at this point: (#) _remove = [299376: t_piceaabies_3f#.p3d,122775: t_piceaabies_3f.p3d,507279: t_piceaabies_3f.p3d, ... , ... ]; It is asking me to close brackets before .p3d on first element. I'm grabbing all data with copyToClipboard str This problem only happens when I'm trying to store data in an array, but if I run this inside the game, same logic, I can delete everything I want without problem. Any idea what I'm missing here?
  12. Niktus Acid

    Find positions for forest borders

    Thanks for all replys people, I've checked rube post before, trying to figure some nice combination for this matter. I imagine I will need to keep doing experiments combining meadow,forest,trees expressions until get something precise.
  13. Hi, I was wondering if there is any way to find forest border/edges positions. nearestTerrainObjects command has the option to search this with typename "FOREST BORDER" but this always return nothing, so no luck here. selectBestPlaces makes use of different expression, but I can't find any combination that suits my needs, something that exactly returns different points where a forest and a meadow joins (and without killing cpu/fps in the process) I'm trying to give AI the best instructions possible for waypoints and forest borders are massive strategic points. Any idea somebody? Thanks!
  14. This matter is fairly easy actually, from my point of view. If you only want to play games, and specially Arma... right now, buy an i7 7700k If besides playing games, you do lots of other things... then buy a Ryzen I always push the FPS limits with my custom missions in Arma with my good old FX8350 / GTX970 and I can't handle much more than 120 AI and not more than 5 or 6 vehicles/tanks/choppers at the same time in a constant war scenario. That is my absolute limit of a good warfare without caching units. (the day that Arma engine can support multiple threads will be glorious) Before Ryzen appeared this year I was considering switch to Intel on my next rig, but now I'm seriously consider a Ryzen rig as the more I read, the more I realize that they are a hell of CPUs specially for the money. I'm also having great expectations for Radeon Vega price/performance ratio. I'm not a fanboy... but I really hope AMD to succeed this year with its new technologies as that's the only way everybody can benefit from price drops / technology improvements.
  15. Yes, I figured out later that I was missing that little detail... Thanks for your answer kauppapekka!