Jump to content

chronicsilence

Member
  • Content Count

    143
  • Joined

  • Last visited

  • Medals

Posts posted by chronicsilence


  1. a3\ui_f\data\gui\rsc\rscdisplaygear\

    Mixed in with some other icons from the RscDisplayGear

     

    Thanks larrow. I have another question for you if you don't mind. The Inventory screen is display #602, which corresponds to RscDisplayInventory. Within RscDisplayInventory >> controls, there is "SlotPrimary" with idc=610 and type=11 (CT_ACTIVETEXT). However, if you wait for the inventory screen to open and then do this:

    _inv = findDisplay 602;
    _slotPrimary = _display displayCtrl 610;
    systemChat str ctrlType _slotPrimary;

    This will show type 103 (CT_ITEMSLOT). This is strange, how did the type change from the config to the actual display? Also, there seems to be no documentation on type 103 and how to set a picture for it. In the wise words of Bubbles:

     

    IgU4Yh.jpg


  2. Hey folks,

     

    I'm trying to figure out if it's possible to add content to an existing class in the mission config (note: NOT ADDON). In theory it would look something like this:

    class CfgFunctions {    class My_Functions
        {
            tag = "myfuncs";
            class More_Functions
            {
                file = "functions";
                class myfunction{};
            };
        };
    };
    
    class CfgFunctions : CfgFunctions {    class More_Functions
        {
            tag = "morefuncs";
            class More_Functions
            {
                file = "more_functions";
                class anotherfunction{};
            };
        };
    };

    So then in the end, the mission would contain both "myfuncs_fnc_myfunction" AND "morefuncs_fnc_anotherfunction". I'm trying to do this because I have assembled a pack for people to include in their missions, and I want to easily add the pack's content to what's already existing in their mission. It's not just functions, but custom sounds, RscTitles, etc., all of which need to be in a class that the user may have already defined in their mission.

     

    Any thoughts on how to add some content to an existing class? And it would need to be in a way that doesn't fail if that class hasn't been defined.

     

    Thanks!


  3. Hi everyone,

     

    You know when you open your inventory in-game, if you don't have an item equipped in a specific slot (like rifle, secondary, attachments, etc.), it has a grey gradient "ghost" image of it instead? Like these:

    d0ZH1w1.png

     

    Does anyone know where these ghost images can be found in the ARMA files (e.g. "/A3/UI_F/Data/...")? I want to use them elsewhere in a custom GUI, but I can't seem to find them anywhere.

     

    Thanks!


  4. Hi everyone,

     

    Pretty simple thing I'm trying to do, but somehow everything is failing at it. I have a button (RscButton), and I would like to vertically align the text in it. I have tried all of the following:

     

    1) setting "style = 0x0C" (listed as "ST_VCENTER" on this page)

    2) Using the following code (structured text works in buttons for everything except for this)

    _button ctrlSetStructuredText parseText "<t valign='middle'>Button Text</t>";

    3) Adding an "Attributes" sub-class to my button class, with "valign = 'middle';"

     

     

    None of these work, which is insane. Is there not any way to vertically center the text in a button?

     

    Thanks!


  5. The only way you can achieve this is handledamage. Every other approach will lead to inconsistency and the unplanned  death

    You can add damage via the handledamage EH script in a controlled way using sethit or setdamage.

    So run the EH so that the unit doesnt receive damage.

    You can get the actual damage that would have occured from the EH (This is passed to the EH script as (_this select 3) according to the wiki entry

    and then if adding that damage returns a getdamage value of less than 1, then add it.

    So something like the following would be the way to go.

    _u = _this select 0;
    _hitdamage = _this select 3;
    systemchat format ["<<DEBUG >> Hitdamage is %1",_hitdamage];
    if(_hitDamage + (getdamage _u) >= 1)
         then{_u setdamage 0.9}
              else{_u setdamage ((getdamage _u) + _hitDamage)};

    HandleDamage EH wiki entry

     

    Thanks, a couple notes on this:

     

    1) the "hitdamage" (_this select 3) is not the new damage, it's the cumulative damage (pre-existing damage plus new damage to the given selection).

     

    2) some "selections" (hitpoints), like the player's hand, could get 100% damage but still not kill the player. What I need is a way to trigger a script every time a player would otherwise die, but I can't do this just by looking whether damage >= 1 because damage to certain selections can be 1 without killing the player ("hand_l", "spine1", "spine2", "spine3" being some examples of selections that can reach 100% damage without killing the player)

     

    So what I really need is just some sort of trigger that fires when a player should die, but fires before death instead of after death (unlike the "Killed" EVH).


  6. I'm trying to set up a system where a player can take damage as normal up until they are near death, but can't actually die. I have found this very difficult to do with the HandleDamage event handler, because it's not clear what level of damage to which hit points might cause death. For example, a player could get a damage level of 1 to "spine1", but that won't kill them. But if they get damage level of 1 to "head", that will kill them. Does anyone know how to catch death just before it happens and override it? It would be perfect if there was a way to override the "Killed" event handler so it doesn't actually kill the player, but that doesn't seem to work.

     

    Obviously solutions such as "allowDamage false" or returning 0 from the HandleDamage handler won't work because that will prevent ALL damage, which I don't want.

     

    Thanks!


  7. I'm looking for a way to detect bullets that pass near by a player. I know you can use the "firedNear" event handler and then track the path of the projectile to see where it lands, but it says it's limited to weapon firings that happen within ~70m (it's also rather performance intensive to track every bullet within a large radius). I know there are some suppression mods that do this, but after opening up the source code (for LAxemann's Suppress mod) it's not obvious how it's detecting those incoming bullets. Does anyone have any suggestions for a decent way to do this?


  8. Bump? Come on Larrow, you appear to be a wizard or something and I need your magic right now. I realized that it's because the map's "draw" event handler doesn't fire when there's no map to draw. So now I just need to find a way to trigger it without that event handler...

     

    EDIT: nevermind, I got it! I used an "onEachFrame" event handler, then just added a check in it to only run if visibleMap returns true. I had to do a combination of the "draw" and "onEachFrame" handlers, since "visibleMap" returns false when the briefing screen is open.


  9. No, you only need to call it the once, it will then apply it to the map screen after the briefing aswell.

    What are the subject and name of what your trying to add? Its not a conflict with these?

    My test mission is basically what is in post #8, the description for defining the function, the function itself and the init which shows to different subjects one from briefing and onwards and one only applied after the briefing.

     

    Aha, I have figured out the problem. Try this in your init.sqf file:

     

    ["Test","Test", [1,0,0,1]] call myTag_fnc_addDiarySubjectIcons;
    
    player unlinkItem "ItemMap";

    Now when you open the map screen after the mission has started, the added subjects won't be coloured. It looks like opening the map screen when you don't have a map in your inventory causes it to open a different display, which apparently isn't covered in your event handler.


  10. Yes the code in post #8 was copied straight from my test mission that i tested in SP,MP and dedicated just to make sure there were no oddities. I have cast my eye over the code in post #8 and i see no errors that may have occured by the forums formatting. I have re-pasted the code just to make sure, as i said in my last post the only thing that has changed is that one line.

     

    Perhaps it's an issue with how I'm calling it then. If I want it in the pre-mission briefing AND the map screen, do I need to call it twice (with a waitUntil {time > 0} in between)? I tried calling it twice, but that didn't seem to work either. Maybe there's something else I'm missing.


  11. Fixed code in post #8, changed line 37 from

    _subjectList = (uiNamespace getVariable "RscDiary" displayCtrl 1001);
    to

    _subjectList = (ctrlParent( _this select 0 ) displayCtrl 1001);
    The journal is also known as RscDiary, once it has been used it nil's the uiNamespace variable. When you open the map and it tried to get the subjectlist by querying "RscDiary" which of course now didnt exist, so i have changed it to get the maps (ctrl event is added to) parent which will be the display.

     

     

    Unfortunately, this didn't work for me. With the new code, the changes aren't applied in the map screen regardless of whether the journal has been opened yet. Were you able to get it working in a test mission?


  12. I had noticed this when i was playing with it, that subject index != to listbox index.

    Only way i can think of getting around this is to update the listbox per the listboxes lbText.

    Description.ext

    class CfgFunctions {
    	class myTag {
    		class briefing {
    			class addDiarySubjectIcons {
    			};
    		};
    	};
    };
    \functions\briefing\fn_addDiarySubjectIcons.sqf

    //[ Subject, Name, textColor, IconLeft, color, IconRight, color ] call myTag_fnc_addDiarySubjectIcons;
    //["WZ_newcomm", "Communication", [1,0,0,1], "a3\modules_f_curator\Data\portraitradio_ca.paa", [1,0,0,1]] call myTag_fnc_addDiarySubjectIcons
    
    if ( !hasInterface ) exitWith {};
    
    if ( !((_this select [0, 2]) params [
    	[ "_subject", "", [ "" ]],
    	[ "_name", "", [ "" ]]
    ]) || { { _x isEqualTo "" }count [ _subject, _name ] > 0 } ) exitWith {
    	"Diary subject - has no subject and/or name supplied" call BIS_fnc_error;
    };
    
    (_this select [2, (( count _this ) -2 )]) params [
    	[ "_nameColor", [1,1,1,1], [ [] ], [4]],
    	[ "_iconLeft", "", [ "" ]],
    	[ "_ILColor", [1,1,1,1], [ [] ], [4]],
    	[ "_iconRight", "", [ "" ]],
    	[ "_IRColor", [1,1,1,1], [ [] ], [4]]
    ];
    
    if ( player diarySubjectExists _subject ) exitWith {
    	format [ "A diary subject called %1 already exists", str _subject ] call BIS_fnc_error;
    };
    
    if ( !isNil "addedDiarySubjects" && { { (_x select 0 select 0) isEqualTo _name }count addedDiarySubjects > 0 } ) exitWith {
    	format [ "A diary subject named %1 already exists", str _name ] call BIS_fnc_error;
    };
    
    player createDiarySubject [_subject, _name];
    
    if ( isNil "addedDiarySubjects" ) then {
    	addedDiarySubjects = [ [ [_name, _nameColor], [_iconLeft, _ILColor], [_iconRight, _IRColor] ] ];
    	_thread = [] spawn {
    
    		_fnc_addEH = {
    			addedDiarySubjects_EH = (uiNamespace getVariable "RscDiary" displayCtrl 51) ctrlAddEventHandler [ "Draw", {
    				_subjectList = (uiNamespace getVariable "RscDiary" displayCtrl 1001);
    				for "_index" from 0 to ((lbSize _subjectList) -1) do {
    					{
    						_name = _x select 0;
    						_iconLeft = _x select 1;
    						_iconRight = _x select 2;
    
    						if ( (_subjectList lbText _index)  isEqualTo (_name select 0) ) then {
    							if !( (_name select 1) isEqualTo [1,1,1,1] ) then {
    								_subjectList lbSetColor [_index, _name select 1];
    							};
    							if !( (_iconLeft select 0) isEqualTo "" ) then {
    								_subjectList lbSetPicture [ _index, _iconLeft select 0 ];
    								_subjectList lbSetPictureColor [ _index, _iconLeft select 1 ];
    							};
    							if !( (_iconRight select 0)  isEqualTo "" ) then {
    								_subjectList lbSetPictureRight [ _index, _iconRight select 0 ];
    								_subjectList lbSetPictureRightColor [ _index, _iconRight select 1 ];
    							};
    						};
    					}forEach ( missionNamespace getVariable [ "addedDiarySubjects", [] ] );
    				};
    			}];
    		};
    
    		//Wait for briefing screen to initialise
    		waitUntil { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) };
    		//Add EH to briefing map screen
    		[] call _fnc_addEH;
    		//If we added subjects during briefing
    		if ( isNull ( findDisplay 12 ) ) then {
    			//Wait for mission map screen to initialise
    			waitUntil { !isNull ( findDisplay 12 ) };
    			//Add EH to mission map screen
    			[] call _fnc_addEH;
    		};
    
    	};
    
    }else{
    
    	addedDiarySubjects pushBack [ [ _name, _nameColor ], [ _iconLeft, _ILColor ], [ _iconRight, _IRColor ] ];
    };
    
    Init.sqf (just as an example of adding subjects before and after mission start)

    ["test_before", "before", [1,0,0,1], "a3\modules_f_curator\Data\portraitradio_ca.paa", [1,0,0,1]] call myTag_fnc_addDiarySubjectIcons;
    
    waitUntil { !isNull player && time > 0 };
    
    ["WZ_newcomm", "Communication", [1,0,0,1], "a3\modules_f_curator\Data\portraitradio_ca.paa", [1,0,0,1]] call myTag_fnc_addDiarySubjectIcons;

     

    Very cool functions Larrow. One bug that I've noticed: if you open the "journal" (with the J key) after the mission starts, then open the map screen, the colour/icon customization won't be there. It's like opening the journal resets it somehow.


  13. I want to have icons and text above a player's head. I can do this with the drawIcon3D script command, which will draw an icon and a line of text below it. However, I need to draw several lines of text, and it doesn't seem to be able to handle that ('\n' and '<br />' have no effect). I have tried just drawing multiple icons, each with one line and slightly below the previous one, but they often overlap with eachother and generally just look horrible.

     

    Does anyone have any suggestions of a good way to draw multiple lines of text over someone's head?


  14. Oh ok lol, you know i read your OP several times thinking why does he say 50m yet the precision for a UAV is 15m, I put it down to not enough coffee at 5am :) .

     

    Is there a reason you are using a waypoint? are there chained waypoints after this one or things that need syncing to the waypoint?

    If not (not including the precision complication of doMove) then it may be easier to script it.

    If it does need to be a waypoint due to further waypoints or syncing, maybe look into scripted waypoints. examples of which can be found in "CfgWaypoints" and "\a3\functions_f\waypoints" which are available when placing a waypoint by changing the dropdown category to Advanced.

     

    Your own do not necessarily need to be config defined, a script can be called by placing a waypoint of type 'scripted' and filling the script box with the script filename and an array of upto 4 arguments (all of which can be accomplished through setWaypointType and setWaypointScript). This could give you finer control over what you need to accomplish. Ignore the note on the Wiki - 'Note the On Activation script code block can be used to execute any script at any waypoint, making this waypoint type somewhat redundant.' as a scripted waypoint is how the waypoint is accomplished NOT what it does once you get there which is what the activation is.

     

    Just an idea that maybe a valid solution, as i cannot think of another way to precisely pinpoint a waypoint position.

     

    I was using waypoints just because I'm not familiar with anything else that will cause a UAV to fly to a given position (I want it to use its own control loop, i.e. have it pitch more in higher wind, etc.). All I need is for the UAV to fly to a precise given location, and to figure out how it needs to pitch/bank/thrust to get there. Looking at a scripted waypoint, I don't think that will work because I would have to script a path for it to follow, and it wouldn't figure that out for itself.


  15. I have a Darter drone that I create, and I need to set a waypoint on an object for it to move to and follow. This is easy in the editor, but I need to do it dynamically from a script in the mission. This is what I have so far:

    _vehicle = createVehicle ["B_UAV_01_F", getMarkerPos "UAV_spawn", [], 10];
    createVehicleCrew _vehicle;
    _uavGroup = createGroup west;
    [_vehicle] join _uavGroup ;
    _waypointObject = createVehicle ["B_Soldier_02_f", [3800, 13000, 0], []];
    
    _waypoint = _uavGroup addWaypoint [[0,0,0], 0];
    _waypoint waypointAttachObject _waypointObject;
    _waypoint setWaypointType "FOLLOW";
    
    systemChat format["Waypoint position: %1", waypointPosition [group _vehicle, currentWaypoint group _vehicle]];

    So, with this code one would think that I create a new waypoint with position [0,0,0], then attach that waypoint to the object I want the Darter to move to and follow (and since I attach it to something, the initial creation position shouldn't matter). However, it just results in the "waypoint position" being [0,0,0] and the Darter flying off to the corner of the map.

     

    Anyone know what the proper code would be to have the UAV move to and follow the object?


  16. All vehicles in Arma have a config value called 'precision'. If a vehicle is given a waypoint, no matter if you set the completion radius smaller than this value, the waypoint will always complete at a 2D distance of 'precision'. If its the last waypoint the vehicle may come to a stop closer than this dependant on its current velocity when the waypoint completes.

    I believe this is a fail safe so doing things like giving a fast moving plane a waypoint with 0 radius stops it from circling forever because the pilot is unable to hit the tiny waypoint area.

    Even units have a default precision of 1m, most ground vehicles range between 5-15m, helicopters 100m and planes 200m.

     

    The UAV has a precision 15m, you can see this by giving one a waypoint somewhere and in its waypoint statement hinting its distance to destination on completion...

    wp = group driver uav1 addWaypoint [getposatl h1,0];
    
    wp setWaypointStatements ["true","hint str ( [ uav1, h1 ] call BIS_fnc_distance2D ) "];

    The hint will usually be around 14.##m depending on the UAVs speed as it enters it and usually comes to a stop around 8-9m out from its destination.

     

     

    Even doing something like..

    waypointPos = getPosATL h1 vectorAdd [ 0, 0, 30 ];
    
    wp = (group uav1) addWaypoint [waypointPos, 0];
    
    wp setWaypointStatements ["true","
    
        h = this spawn {
    
            while { [ _this, waypointPos ] call BIS_fnc_distance2D > 0 } do {
    
                _this doMove waypointPos;
    
                hint str ( [ _this, waypointPos ] call BIS_fnc_distance2D );
    
                waitUntil { unitReady _this };
    
            };
    
        };
    
    "];
    
    uav1 flyInHeight (waypointPos select 2);

    Will show it, sometimes wildly, repositioning but always coming back as ready when its within the 15m radius (concluding that precision is also relevant to doMove aswell) and never settling on the precise position.

     

     

    If it must be pinpoint accurate to the position i think your only option is once it has completed its waypoint and reports as ready to setpos its position. May look ugly but otherwise i think you are out of luck.

     

    I think you're discussing a different issue here. You're saying that the UAV will report as waypoint completed even if it isn't specifically at its waypoint. This issue I can fix (I think) by just changing the "precision" for that vehicle in an addon/mod from 15 down to 0.1 or something.

     

    The issue I'm asking about is how to prevent the waypoint itself from being placed in a different location than I want. i.e. regardless of when the UAV decides the waypoint has been completed, the following code should return exactly the same coordinates as the ones I specified in "addWaypoint":

    systemChat format["Actual waypoint pos: %1", waypointPosition _wp];

    Whereas by default it returns a slightly different position.


  17. I have a UAV (darter), which I am setting a waypoint for using the addWaypoint scripting command. By default, the UAV will first turn to face the direction of the waypoint, then go forwards towards it. Does anyone know of a way where I can have it remain the way it is currently facing, but still move towards the waypoint (since quadcopters don't need to be facing in the direction they travel)? e.g. if the UAV is facing east and I set a waypoint to the north, I would like it to keep facing east and bank to the right ("strafe" to the right).

×