Jump to content
Sign in to follow this  
BullyBoii

How to return units description

Recommended Posts

Titles say it all, how do you return a units description that has been

set in the units description field from the editor, i assum its a variable

somewhere in the game,

if anyone knows how to do this, please help

thankyou

Share this post


Link to post
Share on other sites
http://community.bistudio.com/wiki/getText

This command is what you want.

Can you be a little more specific? The scriptcommand getText says it works only for config entries not objects or units. For example:

I have a game logic named fh1 with a description of Field House 1. What do I have to script to return the description(Field House 1) when the fh1 (object name) is referenced in the script?

or

I have a unit named alpha1_1 (name field in editor) and Alpha Squad Leader (description field in editor). How do I return "Alpha Squad Leader" in a script referencing the unit's name (alpha1_1) ?

Edited by tomturner

Share this post


Link to post
Share on other sites
_description = getText (configFile >> "CfgVehicles" >> typeOf alpha1_1 >> "displayName");

Share this post


Link to post
Share on other sites

He doesn't want the unit's display name from config, he wants the custom text from the 'Description' box in the editor.

I don't know if there's a way to get that, but if it's feesible, you might try using setVariable on the units. For example

alpha1_1 setVariable ["description", "Alpha Squad Leader", true];
alpha1_2 setVariable ["description", "Alpha Medic", true];

...et cetera.

And then you can do this:

_unitDescription = _unit getVariable "description";

But tom, if you've named all the units anyway, can't you just used their variable names to get what you know their description is?

Edited by 2nd Ranger

Share this post


Link to post
Share on other sites
He doesn't want the unit's display name from config, he wants the custom text from the 'Description' box in the editor.

I don't know if there's a way to get that, but if it's feesible, you might try using setVariable on the units. For example

alpha1_1 setVariable ["description", "Alpha Squad Leader", true];
alpha1_2 setVariable ["description", "Alpha Medic", true];

...et cetera.

And then you can do this:

_unitDescription = _unit getVariable "description";

But tom, if you've named all the units anyway, can't you just used their variable names to get what you know their description is?

I have an array of game logics (12ea). In their description I have what corresponds to their taskName. For example gl1 for gamelogic 1 and its Decription field has "objArea1". In a script I can use the gl1 as the "destination" for the missionTask and the objArea1 for the taskName. Apparently you can't use "find" or "count" , etc on complex arrays or that would be the easy way.

Share this post


Link to post
Share on other sites

thanks guys, i was wondering if there was a work around for this :)

what second ranger is correct i wanted to be able to assign units a sort of description variable to use a custom respawn

script of mine. Thanks for all the feedback and responses though :)

Share this post


Link to post
Share on other sites

Hm, maybe you can somehow get mission config and read description from there?

Share this post


Link to post
Share on other sites

Sorry to dig this one out but I'm facing the exact same problem. I wish to read out the description line which can be set in the editor below a unit's init field. Is there really no dedicated script command for that one out there? (getDescription for example does not return what I expected it to.)

Share this post


Link to post
Share on other sites

Sorry to dig this one out but I'm facing the exact same problem. I wish to read out the description line which can be set in the editor below a unit's init field. Is there really no dedicated script command for that one out there? (getDescription for example does not return what I expected it to.)

I think you're looking for roleDescription.

Share this post


Link to post
Share on other sites

I think you're looking for roleDescription.

 

Ah, brilliant, thanks! Strange though, it didn't show up in neither google nor Biki searches.

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  

×