Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

Monsada

Member
  • Content Count

    228
  • Joined

  • Last visited

  • Medals

Everything posted by Monsada

  1. Hi RonnieJ, There are two things to understand with variables: First: Local variables are all that begins with "_" and its visibility is only in the script that is runing. Example: //Local variable _myvar = 5; _myvar is local and it only is visible in the script that it isdefined. Global variables are all that not begins with "_" //Global variable Myvar =5; is a global variable, is visible in any side the game but only in the machine that is runing the script. What this means? If there are two machines playing a mission, one a server and another the client, if the server runs a scritp that sets Myvar =6; only the server has this value, the client not see the change. The correct thing to do when programing is setting value of global variables only in the server, and then propagate its value to all the clients: if (!isServer) exitwith{}; Myvar =5; //Now propagates the value to all machines publicating de variable publicvariable "Myvar"; publicvariable only must be done with global variables.
  2. Versión 4.2.5 Implementada Changes in version: //Version: 4.2.5 // Added // Air transport // Paratroop air transported units // Improved comunications // Modificaciones: // Updated for an action radio of 1000 meters or avove. // Added some translations to english Video:
  3. First I must say that lider cheks for vehicles is he is far away from enemy, that means that u can spawn vehicles in run time. The problem for u is the distance, leader uses next formula for cheking vehicles _dist >= ( _closeenough + KRON_UPS_safedist )*1.2) the problem then is the distance for comunicating and sharing the enemy, if platoon not know enemy will not check and if is far from sharedist from enemy will not known about them, u can set next parameter to put the distance u need in meters. KRON_UPS_sharedist = 1000; chek it and tell me.
  4. Great test Galzohar, this means that the only reason for employing spawn functions is when doing sleeps, interesting, is good to know. Never will go to bed without learning something. Thanks for the info ;)
  5. In spawning with trigger I can not help u, but in patrolling and making support u could try UPSMON. With this u can place stacit platoons, patrol platoons and static or patrol reinforcement platoons, put reinforcements far away in a map with vehicles near, then in your trigger (this that was to make spawn) calls for reinforcement, u could see that Platoons of AI takes vehicles and aproach the objective. with UPSMON IA talks each other groups managing to sourround enemy. Take a look at this test mision. http://www.megaupload.com/?d=9YRQG24O I think is better IA not spawn from air, is much more realistic to see IA aproaching.
  6. jajajaja ok, then I have two new objectives, respawn and air transport and combat. I like it. I need something in change, a video in conditions of how UPSMON works.
  7. I had the same problem and I solve it assigning eachs unit in the correct position, assignasDriver, assignascargo, assignasGunner, and last doing [_units] ordergetin; ---------- Post added at 03:00 AM ---------- Previous post was at 02:59 AM ---------- //Movemos el resto como carga { _x assignAsCargo _vehicle; _units = _units - [_x]; } forEach _units; { [_x] orderGetIn true; } forEach _unitsin - [_driver];
  8. u are right, if u use move on a soldier will move lieader of soldier I use way points for groups and domove for individual soldiers and runs ok.
  9. Hi, here I paste a function I create for UPSMON. Only u need is to assign any soldier to a position of the vehicle, the function below has three parameters _grpid = _this select 0; _unitsin = _this select 1; _vehicle = _this select 2; _grpid: dont mind for u, in UPSMON is for identifying the group in the vehicle _unitsin: array of units to get in the vehicle _vehicle: vehicle to get in. //Funcion que mete la tropa en el vehiculo MON_UnitsGetIn = { private["_grpid","_vehicle","_npc","_driver","_gunner", "_unitsin", "_units" , "_Commandercount","_Drivercount","_Gunnercount","_cargo", "_Cargocount","_emptypositions","_Commander","_vehgrpid","_cargo"]; _grpid = _this select 0; _unitsin = _this select 1; _vehicle = _this select 2; _units = _unitsin; _driver = objnull; _gunner = objnull; _Commander = objnull; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; _cargo = []; _Cargocount = (_vehicle) emptyPositions "Cargo"; _Gunnercount = (_vehicle) emptyPositions "Gunner"; _Commandercount = (_vehicle) emptyPositions "Commander"; _Drivercount = (_vehicle) emptyPositions "Driver"; _emptypositions = _Cargocount + _Gunnercount + _Commandercount + _Drivercount; //Obtenemos el identificador del vehiculo _vehgrpid = _vehicle getvariable ("your_grpid"); _cargo = _vehicle getvariable ("your_cargo"); if ( isNil("_vehgrpid") ) then {_vehgrpid = 0;}; if ( isNil("_cargo") ) then {_cargo = [];}; //Hablitamos a la IA para entrar en el vehiculo { unassignVehicle _x; _x spawn MON_Allowgetin; }foreach _units; { if ( _x == leader _x && _Cargocount > 0 ) then { _x assignAsCargo _vehicle; _units = _units - [_x]; [_x] orderGetIn true; }; }foreach _units; //Si el vehiculo pertenece al grupo asignamos posiciones de piloto, sinó solo de carga if ( _vehgrpid == _grpid ) then { //Asignamos el conductor if ( _Drivercount > 0 && count (_units) > 0 ) then { _driver = _units select 0; [_driver,_vehicle,20] spawn MON_assignasdriver; _units = _units - [_driver]; }; //Asignamos el artillero if ( _Gunnercount > 0 && count (_units) > 0 ) then { _gunner = _units select 0; _gunner assignAsGunner _vehicle; _units = _units - [_gunner]; }; //Asignamos el comandante if ( _Commandercount > 0 && count (_units) > 0 ) then { _Commander = _units select 0; _Commander assignAsCommander _vehicle; _units = _units - [_Commander]; }; }; //Movemos el resto como carga { _x assignAsCargo _vehicle; _units = _units - [_x]; } forEach _units; { [_x,0] spawn MON_dostop; [_x] orderGetIn true; } forEach _unitsin - [_driver]; _cargo = _cargo - _unitsin; //Para evitar duplicados _cargo = _cargo + _unitsin; //Añadimos a la carga _vehicle setVariable ["your_cargo", _cargo, false]; }; I had other functions that may be utils for u like looking for nearest vehicles, getout.. u can find it in MON_functions.sqf in UPSMON http://forums.bistudio.com/showthread.php?t=91696
  10. _car addEventHandler ["GetIn", { if ((_this select 1) == "gunner") then {_this execVM "your_script_getin.sqf"}}]; _car addEventHandler ["GetOut", {_this Call Compile PreProcessFile "your_script_getout.sqf";}]; then only u need is putting the addaction in your_script_getin.sqf and remove action in your_script_getout.sqf the functions will receive an array, check addEventHandler in wiki for more info. but I think that is [car,position,x] car = vehicle with de eventhandler position = position occupied, gunner, driver, cargo.. x = I dont remember :P
  11. Platoons will use any eart vehicle, if people want I will do the same with helicopters for doing paradrops near objectives. For implementing only u need is putting empty vehicles in map, like players IA will use them if enemy is far away, by the distance needed for using vehicles they will use them when called for reinforcement. U can see this in the sample mision http://www.megaupload.com/?d=9YRQG24O Why Ias get in vehicles? When reinforcement is called (KRON_UPS_reinforcement = true; put in the trigger of detection) Platoons that were far away get the position of enemies, then check the distance to the closest target, if the distance is more than ( close_enouht + safe_dist ) * 1.2 is considered far and leader look for any vehicle near (cars, tanks, trucks), if there is any all platoons reserve positions in and get in. They will use vehicles of civilians too if they need! ---------- Post added at 02:05 AM ---------- Previous post was at 01:53 AM ---------- Now I agree with u but disapoint in one thing, in my case I have some functions that requires sleeps for working properly, moreover this functions are used in any soldier of platoon, this means a sleep for each soldier and the result was an execution too slow on the main script, thanks to spawning functions I can run this ones in "parallel" while main script continues executing and dont wait for this sleeps, in this case I can see performance is much more better. I spect that spawn functions will use in low level new threads but this is only work of bohemia if it does or not. In Arma 2 has said that gets better profit of multiple cores I think in some way this will be doing, maybe someone of bohemia could respond to this better and get of any doubt. I propose u take a test with debug mode = 1 execute mision test, next do another test on a copy of the mission but changing all spawn for calls, then u will can see what I'm saying, version with spawn runs more faster and smother than version with calls.
  12. All u want is implemented in UPSMON, platoons of AI share known enemys to each others using a simple metod like this: { IF (_npc distance (_x) <= _sharedist ) THEN { _npc reveal (_x); }; } foreach _targets; _npc is leader group _targets is an array of known targets _sharedist is distance to share the information not so simple is fullfilling _targets array: { _knows=_npc knowsabout _x; if ((alive _x) && (_knows>0.2)) then { call (compile format ["KRON_targets%1 = KRON_targets%1 - [_x]",_sharedenemy]); call (compile format ["KRON_targets%1 = KRON_targets%1 + [_x]",_sharedenemy]); if ((_npc distance (_x) < _npc distance (_newtarget)) || !(alive (_newtarget))) then { _newtarget = _x }; if (_maxknowledge==4 && _newtarget == _x) exitWith {}; _opfknowval=_opfknowval+_knows; _maxknowledge=_knows; }; } forEach _enemies; y use dinamic arrays of enemys because of the side of AI will be different. if u want to simplify only use _targets array.
  13. try to set typeOf crate in a variable _tcrate = ""; _tcrate = typeOf crate; if(isServer && (_tcrate == "USSpecialWeaponsBox")) then{ crate setVehicleInit "handle = [] execVM ""scripts\weaponcargo.sqf"""; }; maybe u must do than too: _tcrate = toUpper(_tcrate)
  14. Monsada

    variables

    public variable is that begins other than "_" such as: SCOPY_mycounter = 10; //this is a global variable Local variable are all ones that begins with "_" visibility of this variables is only in the current script or function. _SCOPY_mycounter = 10; //this is a local variable
  15. This is because KRON_UPS_Debug = 1. set the variable KRON_UPS_Debug = 0; in scripts\common\init_UPSMON. Sorry avout language, u are right, I will try to translate in next revision. ---------- Post added at 01:33 PM ---------- Previous post was at 01:20 PM ---------- Yes is posible but u need to change the reference to script of UPS scritp UPS_INIT changing UPS_INIT for this // UPS_init.sqf // © JULY 2009 - norrin _unit = _this select 0; _marker = _this select 1; [_unit,_marker] execVM "scripts\upsmon.sqf"; if (true) exitWith {}; but I see that is not implemented any parameters of ups. If is util I will implement a parameter of respawn in UPSMON for doing this. Don't forget to add the reference to INIT_UPSMON in int.sqf call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf";
  16. Monsada

    variables

    Hi scopy, 1-Try using global variables, instead of using _amountofbombs try SCOPY_amountofbombs for example. 2- too u could try using the player as a container of your variables player setVariable ["SCOPY_mycounter", _amountofbombs, true]; _amountofbombs = player getVariable "SCOPY_mycounter"; 3- U can pas the variable as a parameter to each function NOTE:is important that if u use global variables or variables in objects u personalize this like "SCOPY..." to minimice the risk of other script of other people can use the same name. I hope this will help u
  17. Hi all, Thanks for the translation Splicer, I forget to translate :p in armaholic has been translated too. http://www.armaholic.com/page.php?id=9213 v4.2.2 - Added frontal attack - Added battle formations depending on situation. - AI can enter buildings to take defending positions or while attacking AI can patrol the buildings searching for enemies or fire positions. - Improved system to find, assign and get in the vehicles. - Optimized performance, it can be executed every 20 seconds. - Parameters modified: sharedist increased, react lowered, cycle increased. - Modified the AI combat behavior, it will change depending on the situation. - Fixed bug where reinforcements stopped patrolling if they hasn't any target. - More dynamic flanking positions. - Platoon with "NOMOVE" tends to hold positions and use the surrounding buildings. Well, when I say better performance I mean that I had have reduced the frecuency that needs to be executed for doing calculations. KRON_UPS_Cycle now is 20 seconds. This late represents the time to comunicate with other platoons. In adition to this I had added a wait in the init of each group for avoiding calculations will be done for each in the same time and free the processor. If u test, u could see that IA is more hard, "NOMOVE" platoons tends to hold position while "MOVE" platoons do flanking movements, in adition to this has been added formations, in close combat situations they usually move together in COMPACT COLUMN, while holding positions forms a LINE in front of enemy, moving large distances forms a COLUMN etc.. Flanking position has been dinamiced, has been added frontal atack when flanking positions has been covered by friendly platoons. The most impresive in this version is seen platoons catching vehicles for long transports and the patrol of buildings. I tried to do videos for showing the news but I don't know why not sound, I hope someone can do a better video than these, I think this will not be so dificult XD. This is a sample mission for view how to implement UPSMON u can teleport doing click on map. SAMPLE MISION: http://www.megaupload.com/?d=9YRQG24O A litle explanation of marks: Green dot with number is the number of platoon and this actual position, green litle circle with cross is the destination of platoon. For your misions remember to change the debug parameter in init_UPSMON.SQF in order to quit messages and marks of position and destination platoons. KRON_UPS_Debug = 0; // With 0 no debug coments and no mark position. I hope see your impresion and ideas for news. Thanks to all Best regards, ---------- Post added at 09:50 AM ---------- Previous post was at 09:18 AM ---------- "The new script is running in parallel, spawn does not wait for it to be done, instead spawn returns a Script handle. " http://community.bistudio.com/wiki/spawn I don't know how low level it runs but in my testings I noticed that spawning functions seems to run in parallel, principal process don't wait to finish it and continues runing, the result was more better performance than doing it with call. This is much util more over ordering units of group doing things like animations, getin, getout of vehicles and more commands that requires a litle sleep for good completion like enableAI. You can do the order and continue the principal process, each unit will do the order runing it in "parallel". In the only I don't noticed nothing is spawning the enterely script in the init of leader group, as u could see in the sample. I tried it with 20 platoons spawning UPSMON and another time with EXECVM, I noticed no diference, I think i read somewhere that each units runs in parallel, same as spawn.
  18. New version available //Version: 4.2.2 // Added // Se ha añadido ataque frontal // Formaciones de combate en función de la situación // La IA puede entrar en los edificios a tomar posiciones de defensa y en ataque puede patrullarlos en busca de enemigos o posiciones de fuego. // Modificaciones: // Mejorado el sistema para localizar, asignar y entrar en vehiculos,. // Optimizado el rendimiento. Se ha mejorado para que se pueda ejecutar cada 20s. // Modificada la parametrización, sharedist incrementado, react reducido, cycle aumentado. // Modificada la actitud e la IA en combate, se ha dado más especialización en función de la situación. // Corregido bug que al enviar refuerzos hacía que dejaran de patrullar si no tenian ningún target // Posiciones de flanqueo más dinámicas. // Las escuadras con rol "NOMOVE" tienden a asegurar la posición y a hacer mayor uso de los edificios del entorno. Vehicle getin improved: Building patrol: Download To install you must put folder scripts of rar in your mission. MON_functions updated too.
  19. Hi all, I'm working in new version wich improves IA's one more time. This is an advance, IA will use formations depending on the situation, for example in close combats will remain together. I am working in a better system to find and use vehicles too, that allow IA to use empty vehicles in base or of citicen in towns. This system will allow me to use helis and paratrops if far far away. Answering questions. KRON_UPS_reinforcement allows IA to send reinforcements. How it works, u need a group of IAs that will be reinforcement, that groups must have atribute "reinforcement" in this init, like this: nul=[this,"town", "nomove","reinforcement", "delete:",600] execVM "scripts\upsmon.sqf"; Well, now only you need is to set KRON_UPS_reinforcement = true when u want to be reinforces called, for example when enemy is detected in the heart of a base or town, you create a trigger of detection and put in act: KRON_UPS_reinforcement = true; If u put some empty trucks or cars near u could see that IA uses it to aproach the near war point. I have been testing with calling UPSMON with spawn, the only way to run as spawn is compiling the function in the init of each unit, but I have not noticed diference. If any one want to test it try this: UPSMON = compile preprocessFile "scripts\UPSMON.sqf"; nul=[this,"town", "move","reinforcement", "delete:",600] spawn Upsmon;
  20. In UPSMON this don't happens, IA's may meet each others but is ocasionally, they patrol all the marker.
  21. Init_upsmon.sqf and upsmon.sqf are sincroniced, upsmon.sqf waits until init_ups has been executed, then this will not be the problem. I think may be spawn that executes in a new thread but i don't really know the way with the global variables. Put in init_upsmon.sqf KRON_UPS_DEBUG = 1 and saw the messages executing it in normal mode, in call mode and in spawn mode, this will report you if any problem find. Added some traslations in main post, may be not good english but I espect wil be mor readable than google translator
  22. Hola Splicer, gracias por avisar. Sorry, seems to be a problem in links of CHS, I added a new one to megaupload in main post http://www.megaupload.com/?d=0D49SKPE
  23. http://forums.bistudio.com/showthread.php?p=1512411#post1512411
  24. Hi all, I am worried with a problem, I am doing an script for IA and want the group exit vehicle when near objective. I trid this: { If (_x!= gunner _vehicle && _x!= driver _vehicle) then { _x leaveVehicle _vehicle; }; } foreach crew _vehicle; the problem is gunner returns a relative name to vehicle _vehicle = A_1_1 gunner _vehicle = A_1_1G driver _vehicle = A_1_1D but crew returns another names: example 1_2_3 1_2_4 1_2_5 how to identify de gunner and driver using crew for avoiding disembark gunner and driver? (corrected _x, thankhs nuxil)
×