• 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.

How to set a unit's scale size?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
Hi,

So in object editor a unit's scale size is set with a real value,

e.g. "1.25" would mean 125% the size of the model.

What native sets a unit scale size?

I found this one "SetUnitScale," but it takes three values, and not one...

JASS:
call SetUnitScale(u, 125.0, 125.0, 125.0)

would that scale it to 125% size?
 
SetUnitScale is the native you're looking for. It takes in three components, XYZ. Unfortunately, in most cases, if not all, you can't have separate scales. So usually people will just set the X to a value and then the YZ to 0, or they'll set them all equal.

Anyway, you used it correctly, but instead of 125%, you set it to 12500%. 0 represents 0%, 1 represents 100%, 2 represents 200%, etc.. so you would actually input 1.25 in each input.

Or you can use the BJ. Generally, if you are unsure about what values a native takes in, look at the BJ. A lot of the BJ's adjust the values to make more sense from a GUI perspective. In this case, SetUnitScalePercent() will take your input and divide it by 100 (100% becomes 1). In other cases, such as vertex coloring, it'll take the percentage and scale it appropriately to a number between 0-255. etc. Check the link in my signature for a list of the blizzard.j. Usually you can just do a quick ctrl+f and find the function you need more information about. Sometimes they'll even have comments.
 
Status
Not open for further replies.
Top