Jump to content

Prectatorium

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Medals

Community Reputation

0 Neutral

About Prectatorium

  • Rank
    Private
  1. @Larrow, thank you. I later on found something like : _this select 3 select 0, in a mod from S.Crowe, as in how to dig in an array within an array, it just kind of made sense. Still don't like the language... There is a saying in portuguese, "Estou aqui para aprender, não ensinar", which roughly translate to, "I'm here to learn, not teach". That said, if you have the time and patience, I'll go make some popcorn 😉. Now that we're at it, I do have another question 😆... I've been banging my head today on how to go about verifying if an object is a container (crate, box, backpack, vest, vehicle,...). The idea would be to go though all objects (haven't found a function that would just get me an array with all "containers"), verify if it is indeed a container, and add an action to it. You actually popped up in this thread, but not quite the info I'm looking for. This got me thinking on what object the action should be tethered with. This makes me want to take a step back, and this dude makes me nervous. He seem very knowledgeable about this stuff, as do you guys in this tread, but he kind of seems like he has no more patience for noob question and whatnot. Makes me think twice before asking for help, one is dissuaded to participate... I digress, I've searched in the forum as well, not just relying on a search engine, so if I missed something, I'll be happy with just a link, not sure I want to start a new post... you know, for reasons... Thanks again.
  2. Ok, @Harzach, @pierremgi, I knew I came to right place... This does simplify things a lot.
  3. Oh shoot, the object unit itself is a unique identifier? private _unitSidesWhenAlive = allUnits apply {[_x, side group _x}];
  4. Also nice to know. Hypothetically, if one was to reference data from an array to another, and ID would be simpler/faster, I guess, and one would have to working with unique identifiers, this is, the ability to reference a unit exclusivlly. I could, or not, use the units name, but it has come to my attention that you may have more then one unit in SP map with the same name. But hey still open to suggestions. Once again hypothetically, if one would want to create an array with some data, and later on cross reference that data with some data in some other array, within the context of ArmA, how would one go about it?
  5. Also nice to know. Maybe using find or splitString for the first 3 letters and then a string compare condition to associate to a side to get a color, because BIS_fnc_sideColor doesn't use faction as parameter. A little more work but should be solid.
  6. I almost don't understand, I mean it's clear what you're saying, but given the fact this verification occurs within a handle as soon as it is triggered, I mean, how fast, or slow does one have to be? I'm asking, thou I have already tested you're approach, and so far it seems to be working flawlessly. Kill some CSAT, marker is red, kill some AAF, it's green, kill some CIVIES, don't kill civies we already know it's purple, overdo with some friendly fire, markers blue. All is good with life. Aside from "timely manner", only one question still lingers, cuz I know I'm going to fall on this again, referencing data that resides in an array, itself in an array. Any example on how I can achieve this? Getting_an_element: Helpfull, but I'm brainless; Array_Copy: Does help a bit; private _myArray = [["a", "b", "c"], ["d", "e", "f"]]; private _subArray1 = _myArray select 0; _subArray1 set [1, "z"]; // _subArray1 is now ["a", "z", "c"] // _myArray is now [["a", "z", "c"], ["d", "e", "f"]] But how about constructing an array dynamically: _unitSidesWhenAlive = []; { _unitSidesWhenAlive set [_forEachIndex, [_x call BIS_fnc_netId, side _x]]; } forEach allUnits; I think you know what I'm trying to do here. Is this how it is done?
  7. This my friend is an interesting approach. One question though, somewhere through all the searching, digging and scratching, I believe I read when all members of group are dead, the group is removed/deleted. If so, how would this play out if the last unit of a group is gracefully terminated?
  8. Hey guys, Same old, same old, yet another noob looking for clarification. The objective of the script is to: a) after loading map, go through all units, verify which are dead (cuz yeh, in SP you get this, in fact you get units that kill themselves as soon as the map loads, nothing you don't already know), and place a marker on the map. b) every time something is killed, well place a marker on the map. Why? Because reasons... I kid, you all know the camo in this game is too good. Ever spent a couple of minutes looking for a corps to loot that you killed at I don't how many hundreds of meters? Thing is, and as you all know, a dead body is a CIV body. Is this an issue? No, but yes. The issue arises when I attempt to get a color from a unit side, to make the marker that color. It's always "ColorCIV". Closes I've got was this. My approach is to create an array with all units, containing netId and side, them when the EventHandler for "EntityKilled" is triggered, get the id from the unit, cross reference it with the array created at map loading time, to get the side the unit was once apart of. The code is as follows // Create the array of the not yet dead I hope, and each not dead has an array with [ID,SIDE] _unitSidesWhenAlive = []; { _unitSidesWhenAlive set [_forEachIndex, [_x call BIS_fnc_netId, side _x]]; } forEach allUnits; // Create EH to take care of marking for all killed during gameplay addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator"]; if (isNull _instigator) then { _instigator = UAVControl vehicle _killer select 0 }; // UAV/UGV player operated road kill if (isNull _instigator) then { _instigator = _killer }; // player driven vehicle road kill _markerName = str(format ["%1 killed by %2",name _unit, name _killer]); // _sideColor = [side _unit, true] call BIS_fnc_sideColor; // My difficulties start here // An array within an array, attempting to get the index of the array, that contains the array with the units ID and SIDE // That is provided I'm actually contructing the array correctly. _unitNetId = _unit call BIS_fnc_netId; // The ID of unit that triggered "EntityKilled" _unitNetId_Index; // Were I hopefully am able to store the element of the unit's array, within the array contructed at the beginning { _unitNetId_Index = _x findIf { _unitNetId }; // Returns index of the unit's array I hope if (!isnil _unitNetId_Index) exitWith {}; // If the above is right, and we have an index, go no further. Boy does this scripting language } forEach _unitSidesWhenAlive; // have a learning curve // Create a new array to be able to get SIDE from ID _unit_Array = _unitSidesWhenAlive select _unitNetId_Index; // Set the damn color, that of the SIDE the unit used to belong to before it hit the dust _sideColor = [_unit_Array select 1, true] call BIS_fnc_sideColor; _marker = createMarkerLocal [_markerName, position _unit, playerSide call BIS_fnc_sideID, player]; _marker setMarkerAlphaLocal 1; _marker setMarkerColorLocal _sideColor; _marker setMarkerDirLocal (direction _unit); _marker setMarkerShadowLocal false; _marker setMarkerShapeLocal "ICON"; _marker setMarkerSizeLocal [1,1]; _marker setMarkerTextLocal _markerName; _marker setMarkerTypeLocal "hd_dot"; systemChat format ["%1 has been killed by %2", name _unit, name _killer]; // Extract from the log // I guess "_unit_Array select 1" does not return a SIDE? // Error in expression <e _unit, name _killer, side _unit_Array select 1, _sideColor]; // }]; // // { // _kind = ""> // 14:18:54 Error position: <select 1, _sideColor]; // }]; // // { // _kind = ""> // 14:18:54 Error select: Type Side, expected Array,String,Config entry // 14:18:54 File TGF_Init\functions\fn_markOnMapUnitKilled.sqf..., line 33 hint format ["%1 has been killed by %2. %3 color %4", name _unit, name _killer, side _unit_Array select 1, _sideColor]; // line 33 }]; // Mark all the dead after map has loaded // This actually works :) { _kind = ""; switch (true) do { case (_x isKindOf "Car"): {_kind = "Car"}; case (_x isKindOf "Tank"): {_kind = "Tank"}; case (_x isKindOf "Ship"): {_kind = "Ship"}; case (_x isKindOf "Helicopter"): {_kind = "Helicopter"}; case (_x isKindOf "Plane"): {_kind = "Plane"}; default {_kind = ""}; }; _text = ""; _markerType = ""; if (_kind == "") then { _text = "already dead"; _markerType = "KIA"; } else { _text = "already destroyed"; _markerType = "loc_destroy"; }; _markerName = str(format ["%1 " + _text, name _x]); _sideColor = [side _x, true] call BIS_fnc_sideColor; // This here, observation: // Syntax: createMarkerLocal [name, position, channel, creator] // I thought by providing "creator", I would have the ability to remove the markers, but not the case _marker = createMarkerLocal [_markerName, position _x, playerSide call BIS_fnc_sideID, player]; _marker setMarkerAlphaLocal 1; _marker setMarkerColorLocal _sideColor; _marker setMarkerDirLocal (direction _x); _marker setMarkerShadowLocal false; _marker setMarkerShapeLocal "ICON"; _marker setMarkerSizeLocal [1,1]; _marker setMarkerTextLocal _markerName; _marker setMarkerTypeLocal _markerType; systemChat format ["%1 " + _text, name _x]; hint format ["%1 " + _text + "." + "Side %2, color %3", name _x, side _x, _sideColor]; } forEach allDead; So, referencing data that resides in an array, itself in an array is my issue at the moment. Disclaimer: If you say I'm doing it wrong, to me, that much is a given. If you say this is pointless, hey, you clicked the link, you read the post, you know were I'm going with this. I very much do not enjoy this scripting language, the learning curve is... it's $@#% up. I guess until you get to know it... still $@#% up. Thank you.
×