Jump to content

soldierXXXX

Member
  • Content Count

    68
  • Joined

  • Last visited

  • Medals

Community Reputation

75 Excellent

About soldierXXXX

Profile Information

  • Gender
    Male
  • Location
    Czech Republic

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. soldierXXXX

    Circular Reference in HashMap

    Ah alright cool. That makes sense. I thought that value should also be hashable, but looking at the syntax it could be anything. So in that case yes that is indeed a bug. Thanks for clarifying 🙂.
  2. soldierXXXX

    Circular Reference in HashMap

    Edit: Please ignore this comment. I was wrong.Values i was referring to do not have not be hashable. To me it doesn't seem like a bug, but rather like unsupported type of the value, because value that you give to the key must be hashable to be properly stored. You can find here all the supported types you can use as value with hashmap. Further reading how hashmap works is here. What might be happening is that hashmaps somehow create strong reference on each other and cannot be released from the memory resulting into memory leak, but I'm not a programmer so i don't know for sure, also we don't have direct access to the engine so we cannot check. I might be wrong on that though. Question is what is the use case of having hashmap inside hashmap? Why cannot be either array of hashmaps or hashmap with key and array value?
  3. Hi, yes it is possible thanks to procedural textures. You can create text and show all possible variables. Here i created simple script to show you how it can be done. To test this, open empty mission, place player, few unarmed enemies and a screen which object variable name is TV. Then copy paste this code to debug console and execute. Everytime you kill someone the screen will be updated with the number of kills. I'm sure you'll manage to implement similar code into whatever you're doing. If not, do not hesitate and ask for further assistance 🙂. //run this code in debug console-script serves as example how to make variable show as texture Kills = 0;//variable that is updated //function that sets text on the screen as texture soldierXXXX_fnc_setKillsOnScreen = { scriptName "soldierXXXX_fnc_setKillsOnScreen"; params [["_screen",objNull,[objNull]]]; private _text = format ["Total kills:%1 units",Kills]; private _texture = format ['#(rgb,512,512,3)text(0,0,"Caveat",0.08,"#0000007f","#FF0000",%1)',_text]; _screen setObjectTexture [0,_texture]; }; //Eventhandler that will update the screen everytime someone is killed addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator", "_useEffects"]; Kills = Kills + 1; [TV] call soldierXXXX_fnc_setKillsOnScreen; }];
  4. Hi, if you want to restore last map position you can do it like this. This code will automatically update map position and when you open the map again, map will be set to latest position. You can of course change the variable names (MapCurrentPos and MapCurrentZoom) to whatever you like. I hope this will help you 🙂. addMissionEventHandler ["Map", { params ["_mapIsOpened", "_mapIsForced"]; if (_mapIsOpened) then { private _map = ((uiNamespace getVariable "RscDiary") displayCtrl 51); mapAnimAdd [0,missionNamespace getVariable ["MapCurrentZoom",ctrlMapScale _map],missionNamespace getVariable ["MapCurrentPos",_map ctrlMapScreenToWorld [0.5, 0.5]]]; mapAnimCommit; _map ctrlAddEventhandler ["Draw",{ params ["_map"]; MapCurrentPos = _map ctrlMapScreenToWorld [0.5, 0.5]; MapCurrentZoom = ctrlMapScale _map; hintSilent format ["%1\nzoom:%2",MapCurrentPos,MapCurrentZoom]; }]; }; }];
  5. soldierXXXX

    Cannot Lock/Target spawned in Vehicles

    Hi, when you create any air vehicle, the engine thinks the vehicle is on the ground or at least that's how i understand it. You can fix that by changing createVehicle syntax and set it as "FLY" under special argument. Other method would be to use commands (setPos then move or addWaypoint) so the AI realizes it's in the air, but it's not necessary here. setVehicleTIPars is to help target vehicle immediately. I also added setVehicleAmmo to hide rockets that were on the drone, but sadly you can't retexture the rotor blade or hide collision lights, but hey, it's better than nothing 😄. this addEventHandler ["Fired", { params ["_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile","_vehicle"]; _drone = createVehicle ["O_T_UAV_04_CAS_F", [0,0,1000], [], 0, "FLY"]; _drone setObjectTextureGlobal [0, ""]; createVehicleCrew _drone; _drone setVehicleTIPars [1,1,1]; _drone engineOn TRUE; _drone setVehicleAmmo 0; _drone attachTo [_projectile,[0,0,0]]; nul = [_drone, _projectile] spawn { params ["_drone","_projectile"]; waitUntil {!alive _drone}; _bomb = "SatchelCharge_Remote_Ammo_Scripted" createVehicle getPos _projectile; _bomb setDamage 1; deleteVehicle _projectile; deleteVehicle _drone; }; }];
  6. soldierXXXX

    cant get HQ to work

    I don't think this is relevant. No Face is cfgIdentity config error with identity that moduleHQ function automatically assigns to logic/unit because in config is face = ""; nothing serious. Unable to get word, again it's config error somewhere in RadioProtocolGRE. You can't do anything about it. what might be relevant is 16:55:13 Error in expression <}; private ["_text"]; { _text = _txt param [_forEachIndex,"",["",[]]]; if (t> 16:55:13 Error position: <param [_forEachIndex,"",["",[]]]; if (t> 16:55:13 Error Type Object, expected Array,String 16:55:13 File /temp/bin/A3/Functions_F/Tasks/fn_setTask.sqf..., line 210 that points to wrong syntax used with BIS_fnc_setTask. Not sure if you put anything else between removeAction and sideChat. If there is other code between that might fail silently (no error message) it would stop the code and that would be the reason you might not see sideChat appearing. You might try to switch fuelsmuggler sidechat "You're late!";fuelsmuggler removeAction talkactionsmglr; and see if the action get's removed. Also you can try to insert debuging hint after each command to see how far the code reaches before it fails. That's the only thing that got on my mind that would cause this behavior 😄 If not then i have to say, i don't know 😄
  7. Hi, i put together a little code that should be able to do it. Tell if you need further assistance 🙂. /* Syntax: [ _pos1, <Array position> _pos2, <Array position> _precision <number range 0.001 to 0.5>(optional-default 0.05) ] call soldierXXXX_fnc_checkWater; example: _cursorPos = screenToWorld [0.5,0.5]; [position player,_cursorPos] call soldierXXXX_fnc_checkWater; */ soldierXXXX_fnc_checkWater = { scriptName "soldierXXXX_fnc_checkWater"; params ["_pos1","_pos2",["_precision",0.05]]; _isWater = FALSE; for "_i" from 0 to 1 step _precision do { _curPos = vectorLinearConversion [0, 1, _i, _pos1, _pos2, true]; if (surfaceIsWater _curPos) exitWith {_isWater = TRUE;}; }; _isWater };
  8. soldierXXXX

    cant get HQ to work

    I overlooked that 😄 Corrected. I still can't see what might cause this not to work. I would probably require full code and possibly structure of the mission folder to fully understand, but i don't think anything should be able to do this. The second picture is different problem.
  9. soldierXXXX

    cant get HQ to work

    [] spawn { if !("ItemRadio" in assignedItems player) then {player linkItem "ItemRadio";}; fuelsmugglertruck ="O_T_Truck_02_fuel_F" createVehicle position player; sleep 0.1; fuelsmugglertruck setDir 0; fuelsmugglertruck setVehicleLock "LOCKED"; fuelsmugglertruck setFuel 0; fuelsmugglers = creategroup civilian; sleep 0.2; fuelsmuggler = fuelsmugglers createUnit ["C_Driver_4_F", position player, [], 0, "NONE"]; fuelsmuggler disableAI "path"; removeAllWeapons fuelsmuggler; fuelsmuggler forceAddUniform "U_O_T_Officer_F"; fuelsmuggler unassignItem "O_NVGoggles_ghex_F"; fuelsmuggler removeItem "O_NVGoggles_ghex_F"; fuelsmuggler unassignItem "V_HarnessOGL_ghex_F"; fuelsmuggler removeItem "V_HarnessOGL_ghex_F"; fuelsmuggler addHeadgear "vn_o_helmet_nva_03"; [fuelsmuggler] call BIS_fnc_moduleHQ; talkactionsmglr = fuelsmuggler addAction ["Talk to the smuggler", {fuelsmuggler removeAction talkactionsmglr;fuelsmuggler sidechat "You're late!";}, [], 6, true, true, "", "(fuelsmuggler distance player)<5"]; }; Last try. Can you start the game without any mod, open virtual reality map, place any civilian as player and execute this code from debug console to see if it works the way you intended ? Because if not, then i'm pretty sure it's not the code that is causing this.
  10. soldierXXXX

    cant get HQ to work

    HQ module can't work with synchronized objects. The code is not adjusted for it. What module does is simply creates the HQ entity on itself. If you want to set unit as HQ entity you need to add line [fuelsmuggler] call BIS_fnc_moduleHQ; to your code. This way there shouldn't be HQ module present in the mission (would be useless). Also you would have to change HQ4 sidechat "You're late!" to fuelsmuggler sidechat "You're late!", but i don't see any benefit of setting unit as HQ entity.
  11. Hi, problem with copying arrays is that by writing _grid1 = _grid; you just referencing to the same array. When engine sees the variable it asks what is that variable ? And searches where it is defined. When engine finds the definition and sees it's another variable, then searches to where that other variable is defined and when he finally reaches the last variable that actually contains some data, he assigns the data to the variable you using. That means it will also refer to it as if you made changes to main array. If you want to actually copy the array you should write it as _grid1 = +_grid; This way the engine knows that you want to create copy of the variable that can be changed without changing the other array. You can use isEqualRef to compare if variables are dependent on each other or not. On the page are also examples how the arrays behave.
  12. Just to clarify the difference between BIS_fnc_arsenal_campos_0 and BIS_fnc_arsenal_campos BIS_fnc_arsenal_campos_0 is initial position variable that is loaded when arsenal is created so if you want to use this, this should be declared before arsenal is opened just as in your solution. If it's not declared before, arsenal will use default camera position. This variable is also set again when you exit the arsenal so next time you open it it's on the same position you left it, but with use of "arsenalClosed" the variable is updated on that position instead. That's why "arsenalOpened" won't work on this one because when Opened is called, camera is already set. Variable runs in missionNamespace. BIS_fnc_arsenal_campos on the other hand is variable of latest camera position, with which all positioning scripts inside arsenal function works. When arsenal is opened this variable is set based on BIS_fnc_arsenal_campos_0 position first but then exists on it's own until you exit the arsenal. Variable runs in uiNamespace. "arsenalOpened" will work with this variable correctly, because event is called after all variables are set and scripts used in arsenal function will update it's position based on this variable. That's why your solution works with "arsenalClosed" and mine works with "arsenalOpened". 🙂
  13. ^ @Harzach's solution except i would change "arsenalClosed" to "arsenalOpened" so it sets the angle immediately without previous declaration. In initServer.sqf nobody except the server would see the result. And Arsenal is run locally so initPlayerLocal.sqf makes much more sense.
  14. Hi, solution for this problem is update variable of arsenal camera position based on arsenal system. here is simple code to manually set the camera on fixed position: //easy solution: [missionNamespace, "arsenalOpened", { params ["_display", "_toggleSpace"]; uiNamespace setVariable ["BIS_fnc_arsenal_campos",[8,90,((30 max -89) min 89),[0,0,0.85]]];//fixed position }] call BIS_fnc_addScriptedEventHandler; array is in format [distance of camera, horizontal direction of camera(from -359 to 359),vertical direction of camera (from -89 to 89),target position array (probably modelspace center of object that camera should follow)]. A bit advanced detection if object is in front of camera (not terrain) and if yes then camera will turn by specified number of degrees on the horizontal axis until camera and target object have clear line between them. Be aware it's just a example code put quickly together and would require tweaking, it's not ideal for all situation so first solution will be probably better. I hope it helps 🙂
  15. soldierXXXX

    cant get HQ to work

    Code is alright, but may i ask you how exactly you set up HQ entities ? Pictures/Video would be ideal so we can see where might be the problem. if you do it via module, just assign HQ4 variable to module itself and it should work. If you want to have unit as HQ you can put in it's init [this] call BIS_fnc_moduleHQ; that should also work. Only one unit/module can be set per side. What unit/module is assigned as HQ entity you can check with missionnamespace getvariable ["BIS_fnc_moduleHQ_HQs",[objnull,objnull,objnull,objnull]]; or for specific side only [civilian] call BIS_fnc_moduleHQ; Basically when you read through the code you'll see that only one object can be set as HQ entity, that means when you place two HQ entity modules or assign more than 1 unit per side only one will be used as HQ entity.
×