Jump to content
Sign in to follow this  
ColonelSandersLite

Get Unit Icon From A Script?

Recommended Posts

Yet another odd question that I'm sure I already know the answer to, but....

Is there any obscure way to get a unit's icon from a script. By Icon, I mean the icon that shows in the command menu and teamswitch menu (any probably a few other places as well).

Share this post


Link to post
Share on other sites

You should be able to scan the config and pull out the line

picture = "\Ca\characters\data\Ico\i_null_CA.paa";

Share this post


Link to post
Share on other sites

Looks like a moot point anyways.

Unless someone knows how to get onLBDrag, onLBDragging and onLBDrop working. It appears they're broken. Either that or I'm not defining something that needs to be defined in order to allow dragging on a listbox. Oh, and yes, I know what I'm doing with UI eventhandlers in general.

Edit:

Got it working.

canDrag = 1;

must me defined in the control wink_o.gif

So the question still stands!

Edit again:

It *is* slightly broken. It's supposed to also return the item's index but always returns 0. I can live without that though. So, it still stands.

Share this post


Link to post
Share on other sites

Do you mean something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unitClass = typeOf _unit;

_iconPath = getText(configFile >> "CfgVehicles" >> _unitClass >> "picture");

Share this post


Link to post
Share on other sites

Huh, new commands I never noticed. I'll have to play with them to see what I can get out of them.

The are a few challenges here though. For starters, since this is for a release script, I have no reliable way of knowing what sort of unit it will be run on. I can't say for sure what config it will come out of, or if it will even be run on men or vehicles, so I must assume for reliability sake that addon units and mixed peopel and vehicles are the order of the day. Depending on what the commands can do, that may or may not make it impossible. Moreover, the examples provided (from what I saw) where terse to say the least. If you happen to know of anything that actually uses these commands, it may be helpful.

Share this post


Link to post
Share on other sites

No, they're just standard commands which you need to become familiar with. They're basically used for accessing all the lovely internal data info. Eg: map town names, weapon names, weapon icons, weapon ammo types, images, etc.

If you're worried about reliability and safe use, then add some checks. Eg: In the example below, it checks isClass and isText to validate it before accessing it.

fn_GetDisplayName.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// Desc: Get config display name of object type. Result: string

private["_ObjType", "_dispName", "_classPath", "_class"];

_ObjType = _this select 0; // eg: typeOf obj

_dispName = _ObjType;

_classPath = configFile >> "cfgVehicles" >> _ObjType;

if (isClass _classPath) then

{

_class = _classPath >> "displayName";

if (isText _class) then

{

_dispName = getText _class

};

};

_dispName;

Share this post


Link to post
Share on other sites

Do you know any way to get the icons that display the unit type (ie. sniper, AT-specialist, machinegunner...) from the HUD? "picture" is just the teamleader/medic/sf overlay as stated above and "icon" is the map editor - icon. I have tried to find it in the BIKI but couldnt. Any help?

Edit:

Found it! You would have to look into the CfgWeapons config on the weapon of the unit and the "UiPicture" - config:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_weaponclass = primaryWeapon _unit;

_iconPath = getText(configFile >> "CfgWeapons" >> _weaponclass >> "UiPicture");

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×