• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Bug with "Unit Type Cost"?

Status
Not open for further replies.
Level 1
Joined
Jan 29, 2012
Messages
2
I'm trying to use the UnitTypeGetCost function ("Unit Type Cost") to return the mineral cost of a unit I made, but for some reason it keeps on returning 0.

The really interesting thing about it is that I've been able to reproduce the problem with the built-in MULE unit. Even though the editor says it has a cost of 50 minerals, if you try to get the cost using UnitTypeGetCost it returns 0. I realize that the MULE isn't a normally buildable unit, but I didn't think that would be a factor in this situation since the function simply looks at its cost property, correct?

An easy way to reproduce this would be to create a new map, create a trigger at Map Initialization to "Display (Text((Minerals cost of MULE)) and play <whatever> for (All players)". Start the map and observe that the number "0" is displayed instead of "50".

Try it with most other units and it works fine. The MULE is the only built-in unit I've noticed that it doesn't work for, but there may be others.

Am I missing something or is this a bug?
 
Level 1
Joined
Jan 29, 2012
Messages
2
Does this happen for both preplaced (permanent) and summoned mules?

Checking the unit type, not any specific unit.

i think this is a bug or has anything to do with unit flags etc.
anyway you can avoid this by using catalog values: Catalog : units ; path: CostResource[Minerals]; entry: MULE. this works fine.

TYVM for that suggestion. I haven't tried it yet, but it sounds like it should do the trick. I'll post back again if it doesn't.

EDIT: It worked, thanks again!
 
Status
Not open for further replies.
Top