| 01-08-2006, 04:51 AM | #1 |
How can I retrieve the name of a type of unit? The only functions I can find return the name of a specific unit. I could make a workaround with creating a temp unit of the type I want, but I really don't want to do that. Note - I'm not trying to retrieve the A001 code, I'm trying to retrieve 'Footman'. |
| 01-08-2006, 05:52 AM | #2 |
I may not completly undestand your question but is this what you are looking for? Trigger: Game - Display to (All players) the text: (Name of Any_Unit) |
| 01-08-2006, 05:58 AM | #3 |
I know about that function. What I'm trying to do is: Game - Display to (All Players) the text: (Name of unit-type(MyUnitTypeVariable)) The problem is I can't find a function that says that. |
| 01-08-2006, 06:09 AM | #4 |
You could try getting a function that returns unit type and then convert it to a string. Not sure that's possible though. |
| 01-08-2006, 06:10 AM | #5 |
Trigger: Actions![]() Set MyUT = Footman![]() Game - Display to (All players) the text: (String(MyUT))MyUT=unit type variable |
| 01-08-2006, 06:18 AM | #6 | |
Quote:
No idea what you're talking about, elaborate please. Immoralis: What are you using to convert to string? 'Conversion - Convert Unit-Type to String'? That was what I originally was using, but for some reason it returned "custom_A001" or something along those lines. What I want to be returned is "Footman", etc. |
| 01-08-2006, 06:20 AM | #7 |
hmm havent test that out accually ill get back to it edit: just test it works, it says footman, |
| 01-08-2006, 07:15 AM | #8 |
Because you are using normal foot. Try using custom unit and it will be custom_a024 |
| 01-08-2006, 07:29 AM | #9 |
You guys keep making it more complex. Trigger: same as the last trigger, cept fatman is a footman called fatman... the accual unit has to be on the map tho, cuz you have to pick it to find the name and it works |
| 01-08-2006, 07:32 AM | #10 |
Isn't ForGroupBJ leaking? ![]() |
| 01-08-2006, 08:02 AM | #11 | |
Quote:
|
| 01-08-2006, 08:37 AM | #12 |
what are u talking about? it is 10:37 AM :P |
| 01-08-2006, 10:38 AM | #13 |
The problem is that the GUI system uses the function 'UnitId2String' (which, as far as I can tell, exists for no purpose), while the function you need is 'GetObjectName' (which takes an id # just like UnitId2String, but gets the actual name field for anything that has one). |
| 01-08-2006, 10:57 AM | #14 |
| 01-08-2006, 12:07 PM | #15 |
Well, Extrarius deserves rep, I needed that func |
