Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Community Reputation

18 Good

1 Follower

About HonzaVinCZ

  • Rank

Profile Information

  • Gender
  • Location

Recent Profile Visitors

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

  1. HonzaVinCZ

    Find unit in array of vehicles

    That simple 😐 However it works as I wanted, thank you!
  2. I wonder how can I find a unit (player in my case) in array of vehicles. I spent hell of a time on this one and couldn't find a solution. Example array of my vehicles: _vehicleList = [MGI802,MGI804,MGI809] I need to make it return boolean true/false if player is present in any of vehicles above. Vehicles in array can change so I can't hardtype "crew MGI802" and so on. My further use for that is to set player's marker alpha depending if he is in a vehicle or not; (I know this one is propably extremely unoptimised but I wanted to try make vehicle and player markers on my own) while {true} do { // Vehicle Markers _vehicleList = [MGI802,MGI804,MGI809,MGI810,MGI814,MGI815,MGI1843,MGI818,MGI823,MGI1504,MGI1507,MGI271,MGI253,MGI1847,MGI386,MGI1612,MGI836,MGI829,MGI1437,MGI835,MGI348,MGI824,MGI365,MGI369]; { _name = getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName"); _vehmark = vehicleVarName _x; if (getMarkerType _vehmark == "") then { _vehmark = createMarker [_vehmark, getPos _x]; _vehmark setMarkerType "mil_arrow2"; _vehmark setMarkerSize [0.4, 0.5]; _vehmark setMarkerAlpha 1; }; if (alive _x) then { if ((count crew _x) > 0) then { _crewlist = ""; { _crewlist = format ["%1%2 | ",_crewlist, (name _x)]; } forEach crew _x; _vehmark setMarkerText ([_name, _crewlist] joinString " | "); } else { _vehmark setMarkerText _name; }; _vehmark setMarkerColor "colorWEST"; _vehmark setMarkerDir (getDir _x); _vehmark setMarkerPos (getPos _x); } else { _vehmark setMarkerColor "colorGrey"; _vehmark setMarkerText ([_name, "(Destroyed)"] joinString " "); }; } forEach _vehicleList; // Player Markers _playermark = name player; if (getMarkerType _playermark == "") then { _playermark = createMarker [_playermark, getPos player]; _playermark setMarkerType "mil_triangle"; _playermark setMarkerSize [0.5, 0.8]; _playermark setMarkerAlpha 1; }; if (alive player) then { // HOW TO RETURN PLAYER PRESENCE BOOLEAN FROM _vehiclelist ? if (true) then { _playermark setMarkerText (name player); _playermark setMarkerColor "colorWEST"; _playermark setMarkerDir (getDir player); _playermark setMarkerPos (getPos player); _playermark setMarkerAlpha 1; } else { _playermark setMarkerAlpha 0; }; } else { _playermark setMarkerColor "colorGrey"; _playermark setMarkerText ([name player, "(KIA)"] joinString " "); }; sleep 1; };
  3. No problem! Oh nice, but also I guess from your reply these explosion made craters can't be deleted individually or? Btw sorry for late reply, I was busy during this week.
  4. Oh, that is cool and works perfectly, thank you! Btw the crater I create can be deleted but it won't delete the explosion crater mark, described below my thought hint shows it's "krater.p3d" which is basically "Crater" but if I want to delete it, it just won't delete. Maybe it needs little delay beacause the crater don't get created that quick as the script runs. I left it without creating my own crater and left there the one which is created by the explosion itself, I'll try to code to remove at least that one. Thank you both for your help, I couldn't continue my code without your help!
  5. Hm, it doesn't detect the crater mark created by the explosion. It detects craters placed by the script but for some reason it can't detect crater mark created by the explosion itself. Tested it with hint.
  6. Sure but it doesn't get deleted with the crater model. The crater mark is still on the ground when the crater gets deleted and the mark from the explosion of the IED should not be even there because just after it explodes, there is code below and after that the whole crater thing I want is created. {deleteVehicle _x}forEach nearestObjects[getPosATL _iedObj,["Crater"],4]; Some of the crater markers is still there but idk which one. If that from IED of that I spawned by the code.
  7. ok, gonna test it EDIT: Yeah, this works fine, thank you. But as I edited above, the crater mark on the ground doesn't get deleted, any clue why?
  8. @gc8 I found one more thing I need to ask you or someone else about... This code creates crater when IED explodes but when there is more than one crater, it always deletes just one instead of each of them after 60s. The idea is each crater gets deleted after given time, not all of them at one time. It has to do something with the variables again and I do something wrong again too. The 0.5 sec sleep is to delay the hideObject true because otherwise the explosion gets blocked by the object and it doesn't damage anything. Then the 60 sec delay is for crater deletion, by default it'll be about 15 mins. I tried to use getVar and setVar but this time I use it propably wrong way. I didn't know what to attach the var when it is in [] spawn {}; I have this code called in trigger, it is not all but I'm quite sure there must be the problem: EDIT I had typo in [] spawn {}; where I wrote crater instead _crater... Anyway it leaves crater on the ground even when I have this code after bomb gets spawned {deleteVehicle _x}forEach nearestObjects[getPosATL _iedObj,["Crater"],4]; _crater = "Crater" createVehicle [0,0,0]; _crater setDir (random 359); _crater enableSimulation false; _crater allowDamage false; _crater hideObject true; _crater setPos (getPos thisTrigger); _crater1 = "Land_ShellCrater_02_small_F" createVehicle [0,0,0]; _crater1 setDir (random 359); _crater1 enableSimulation false; _crater1 allowDamage false; _crater1 hideObject true; _crater1 setPos (getPos thisTrigger); _crater2 = "Land_ShellCrater_02_debris_F" createVehicle [0,0,0]; _crater2 setDir (random 359); _crater2 enableSimulation false; _crater2 allowDamage false; _crater2 hideObject true; _crater2 setPos (getPos thisTrigger); [] spawn {_crater = missionNamespace getVariable 'crater'; _crater1 = missionNamespace getVariable 'crater1'; _crater2 = missionNamespace getVariable 'crater2'; sleep 0.5; _crater hideObject false; _crater1 hideObject false; _crater2 hideObject false; sleep 60; deleteVehicle _crater; deleteVehicle _crater1; deleteVehicle _crater2}; missionNamespace setVariable ["crater", _crater]; missionNamespace setVariable ["crater1", _crater1]; missionNamespace setVariable ["crater2", _crater2];
  9. Woah, now this works! Thank you very much for all your help!
  10. Tried "nameCity", "nameVillage", "name" and it shows just one name, for ex. Arobster on all markers 😕
  11. Added _loc same way as you did and it works!... but still some places seem like they don't recognize location. Any idea why? idk, code below seems good to me but it isn't for some reason. _loc = text nearestLocation [_pos, ""];
  12. You're right, now the mission works perfectly! Thank you. Now I only need to fix the location names doesn't show properly in task desc, title and debug markers. Simliar way as you did here?
  13. just tested it, tasks doesn't get created.
  14. Sorry, I still have massive problems with variables here. Suffering with it over three hours today already and can't make it work. I do something wrong, I know, but I can't make it working, I just don't know how. I need variable for each weapon cache. Each weapon cache needs its position, task, marker and location name but it doesn't work the way I try all time. I changed the way weapon caches are recognized, I placed them on the map and used this to call the script for them: this is how it looks like on the map... tasks are creating at one same place and it seems like they get accomplished randomly when I destroy any of the caches. actual script looks like this: // Lythium weapon caches script by HonzaVinCZ #define __dbug__ _wCache = _this select 0; wCache = _wCache; _posATL_1 = _this select 1; _posATL_2 = _this select 2; _posATL_3 = _this select 3; _posATL = selectRandom [_posATL_1, _posATL_2, _posATL_3]; _wCache setDir (random 359); _wCache setPosATL _posATL; _pos = getPos _wCache; _loc = text nearestLocation [_pos, ""]; loc = _loc; tskCrt ={ taskwcache = [west, [format["task_%1",(random 1000)]], [format ['Destroy enemy weapon cache near %1', loc], format ['Destroy Weapon Cache near %1', loc], ''], wCache, 'CREATED', -1, true, 'destroy', true] call BIS_fnc_taskCreate;deleteVehicle thisTrigger}; _trig = createTrigger ["EmptyDetector", _pos]; _trig setTriggerArea [10,10,0,FALSE,10]; _trig setTriggerActivation ["ANYPLAYER","PRESENT",false]; _trig setTriggerTimeout [0,0,0,false]; _trig setTriggerStatements[ "this", "call tskCrt", ""]; #ifdef __dbug__ _mkrID=format["wCache_%1",_pos]; _mkr=createMarker[_mkrID,_pos]; _mkr setMarkerShape"ICON";_mkr setMarkerType"mil_dot";_mkr setMarkerBrush"Solid";_mkr setMarkerAlpha 1;_mkr setMarkerColor"ColorEast";_mkr setMarkerText format ["wCache %1", _loc]; #endif _wCache enableDynamicSimulation true; waitUntil{sleep 1; !alive _wCache}; if (true) then { [taskwcache,"SUCCEEDED"] call BIS_fnc_taskSetState; "Bo_GBU12_LGB" createVehicle _pos; deleteVehicle _wCache; } else { "Bo_GBU12_LGB" createVehicle _pos; deleteVehicle _trig; deleteVehicle _wCache; };
  15. _exists = ["wcachetask_"] call BIS_fnc_taskExists; waitUntil {sleep 1; !alive _wCache}; if (_exists) then { [["wcachetask_"],"SUCCEEDED"] call BIS_fnc_taskSetState; "Bo_GBU12_LGB" createVehicle getPos _wCache; deleteVehicle _wCache; } else { "Bo_GBU12_LGB" createVehicle getPos _wCache; deleteVehicle _trig; deleteVehicle _wCache; }; Sadly, it doesn't work. Shows no error but also the mission doesn't get accomplished as it should. ok, thank you. I'll also need some explain how to "import" the variables to that tskCrt, because I really need them there. Same with the task ID.