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!
Is there a way (Jass or GUI) to scale a hero on levelup. I'm thinking along the lines of the units in Dungeon Keeper.
I'm hoping there is a way without making 30 copies (levels are going to 30 I believe) of the same unit at a different scale, and then either having to make the player reselect their abilities, or having to transfer all the abilities and items to the new hero.
I'm thinking just a "set unit scale" or something along those lines. If nothing else works I could make a global caster I guess, and cast a buffless version of bloodlust that has (whatever the max duration is) and then recast it before it wears off, but that seems A) Ridiculous, and B) Very inefficient.
If there's a way to do this differently it would be alot of help.
The Math is not the problem. Finding a function that will do the scaling(as opposed to changing the model's scale in the object editor) is what I haven't been able to do. And in Dungeon keeper the creatures scale whenever they level up (all the creatures level up). At level 10 (Max level) they're about double size.
dungeon keeper didn't scale up the creatures. The only "scale up" I could remember is the dragon spawn becoming a dragon at level 4, but real scale changes never happened there...
dungeon keeper didn't scale up the creatures. The only "scale up" I could remember is the dragon spawn becoming a dragon at level 4, but real scale changes never happened there...
I thought about that already, youd need dirt that conforms to the size of a tile and is in square chunkc, as well as another one for gold. It would work if you had those though. They would have toi be a destructible.
And I dunno about DK2, but in DK1 all the monsters scaled. I remember I trained an imp to level 10 (most people wouldnt, theyre just imps) (crappy builder units) - but the imps get haste if you level them up a bit and then work much faster and run much faster.
Also for a DK map in WC3, how would you work the dungeon keeper in, who can pick up any of his units and drop them anywhere on his own terrain?
a DK map would be awesome, but alot of work. I'd start one if there were others who wanted to work on it with me though.
We'd need someone who's completely proficient in jass. I could do any of the other parts, though if there were a few peopel things would go faster.
We could use wc3 models for a while but eventually we'd need the more unique ones, like the horned reaper.
And yet still, I'm trying to come up with a jass function that handles the scaling of a unit, and I havent found anything from looking it up and there doesnt seem to be anything in gui.
A spell that you target the unit you want to move saving it into a variable (unit), then you use the spell (same or another that replaces it) to set the specific area you want it to fall down to, and by triggers you use:
Unit - Move unit to target position of ability being cast.
A spell that you target the unit you want to move saving it into a variable (unit), then you use the spell (same or another that replaces it) to set the specific area you want it to fall down to, and by triggers you use:
Unit - Move unit to target position of ability being cast.
Ok first off, do you have JassCraft?
(If not get it, helps sh*tloads)
Second, do you have the 1.21b patch of Warcraft?
(Again, if not, get it you may need it)
The function actually is SetUnitScale(), except some patches do not have certain functions
If you get JassCraft, you can search for functions based on like half of a word
Ok first off, do you have JassCraft?
(If not get it, helps sh*tloads)
Second, do you have the 1.21b patch of Warcraft?
(Again, if not, get it you may need it)
The function actually is SetUnitScale(), except some patches do not have certain functions
If you get JassCraft, you can search for functions based on like half of a word
got jasscraft. It came with the Jass NewGen pack I believe. I found it under animation - setunitsize, i think it was. It's up above. It's working great now GhostWolf put the function up.
My only question now is, when the hero dies and gets revived, does the scaling stay? I'm going to set the scaling to considerably larger (like 4x size per lv) so that I can kill the hero, revive it, and see if it takes. And I gotta see if i can increase collision size and select scale. I probably can.
- Can't find collision size and selection scale in JassCraft. I think I have the patch I need. I'm the patch behind the no-cd.
I think it actually does, pretty recently I made a map where the unit tmeporarily has the avatar ability, which makes him like 1.5x the size, after he lost the ability + died before spell wore off, he rezed with his 1.5x scale
So I think it will stay if you do not change it back
Else, you could always just reset it with the death event
It kinda sucks, but I don't think you can change the collision size or the selection scale, at the same time I don't think the collision size even does anything >< (or at least works improperly)
Btw, if it takes you 5 mins to create a unit and/or change its name, thats due to the rush list being on, to turn it off go to the top of the World Editor --> Window --> Uncheck "Brush List" from the drop-down menu
Yeah, I'm not sure I think it might've had to do with something in the avatars coding, because there was supposed to be some kind of exit, but the spell was removed so it stayed permanent
I suppose if you don't feel like coding it in, you could just do that (add avatar ability, use it, then remove it) although that may be more code than the other way
function Trig_Hero_Scaling_Actions takes nothing returns nothing
//To make it easier to figure out scale
local integer herolevel = GetHeroLevel(GetTriggerUnit())
local integer maxlevel = 10
local real finalsize = 200.00
local real scaler
set scaler = 100.00 + ( (I2R(herolevel))*(finalsize/(maxlevel-1))) - (finalsize/maxlevel) )
call SetUnitScalePercent( GetTriggerUnit(), scaler, scaler, scaler )
call SetUnitMoveSpeed(GetTriggerUnit(), (40.00 *(scaler/100)))
set scaler=null
set finalsize=null
set maxlevel = null
set herolevel = null
endfunction
Theres a syntax error on the set scaler line that I can't see. And my math is bad. can someone fix my formula?
Oh, and the scaling does stick.
And thirdly. is there a way to get a units id without making a gui function with it, converting it to custom text, copying the id, then scrapping the useless trigger, cause thats how I've been doing it because I can't figure out how to get to that info.
function Trig_Hero_Scaling_Actions takes nothing returns nothing
//To make it easier to figure out scale
local integer herolevel = GetHeroLevel(GetTriggerUnit())
local integer maxlevel = 10
local real finalsize = 200.00
local real scaler
set scaler = 100.00 + ( (I2R(herolevel))*(finalsize/(maxlevel-1))) - (finalsize/maxlevel) )
call SetUnitScalePercent( GetTriggerUnit(), scaler, scaler, scaler )
call SetUnitMoveSpeed(GetTriggerUnit(), (40.00 *(scaler/100)))
set scaler=null
set finalsize=null
set maxlevel = null
set herolevel = null
endfunction
function Trig_Hero_Scaling_Actions takes nothing returns nothing
//To make it easier to figure out scale
local integer herolevel=GetHeroLevel(GetTriggerUnit())
local integer maxlevel=10
local real finalsize=200.
local real scaler
set scaler=100.+((I2R(herolevel))*(finalsize/(maxlevel-1)))-(finalsize/maxlevel)
call SetUnitScalePercent(GetTriggerUnit(),scaler,scaler,scaler)
call SetUnitMoveSpeed(GetTriggerUnit(),(40.00*(scaler/100)))
endfunction
You can't null reals and integers, and you had an extra parenthisis after (finalsize/maxlevel).
function Trig_Hero_Scaling_Actions takes nothing returns nothing
//To make it easier to figure out scale
local integer herolevel=GetHeroLevel(GetTriggerUnit())
local integer maxlevel=10
local real finalsize=200.
local real scaler
set scaler=100.+((I2R(herolevel))*(finalsize/(maxlevel-1)))-(finalsize/maxlevel)
call SetUnitScalePercent(GetTriggerUnit(),scaler,scaler,scaler)
call SetUnitMoveSpeed(GetTriggerUnit(),(40.00*(scaler/100)))
endfunction
You can't null reals and integers, and you had an extra parenthisis after (finalsize/maxlevel).
-----------------------
Finished
-----------------------
If anyone's curious, this is the formula to scale according to size evenly, and accurately. it took me 4 hours to figure it out. I'm not a big fan of math formulas. Strangely enough my Girlfriend who's taking calculus and doing well ghave me a formula that didnt work and I had to figue it out by myself. Damn math.
JASS:
//variables
local real scaler //the number to set the scale to in setunitscalepercent()
local integer maxlevel //the max hero level in the map
local integer herolevel //the current level of the hero
local real finalsize //the max sixe to scale the hero to, upon reaching the final level
//This formula assumes you're starting scaled at 100% To use another number I have no idea, and I don't want to try to figure it out right now. too much math.
set scaler=100-(1/(maxlevel-1)*100)+((I2R(herolevel))*(finalsize-100)/(maxlevel-1))
Couldn't understand why you do not just do something like Level*Constant.
Something like this:
JASS:
globals
constant integer int = 10 // each level the unit will get bigger by 10
endglobals
function scalar takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer r = GetUnitLevel(u)
call SetUnitScale(u, r * int, r * int, r * int)
set u = null
endfunction
And put the Max values (max level, max size) in a global block, no point recreating the locals every time.
Couldn't understand why you do not just do something like Level*Constant.
Something like this:
JASS:
globals
constant integer int = 10 // each level the unit will get bigger by 10
endglobals
function scalar takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer r = GetUnitLevel(u)
call SetUnitScale(u, r * int, r * int, r * int)
set u = null
endfunction
And put the Max values (max level, max size) in a global block, no point recreating the locals every time.
I want to be able to change the max level or max size and have it tweak all the levels to evenly scale to that size accordingly, as I'm not sure what the max scale or level are going to be yet. And I don't want them to NOT get to max size by max level, or to get to max size BEFORE max level. However, if you can change my formula to take another variable instead of 100, say MinSize, still evenly scale to max size by max level, and still have an initial size which is constant (this would be what the new variable would do), that would be really helpful. So if I put MinSize to 80, then at level 1 it would be 80 regardless of what maxsize was, and it gets to maxsize at level 10, regardless of what it is then its the perfect function.
Animation - Set units scaling value to ((current (X)scaling value of (Triggering unit) + (5)) (current (Y)scaling value of (Triggering unit) + (5)) (current (Z)scaling value of (Triggering unit) + (5))
Done, that trigger would increase the overall scaling of the hero by 5% when it level ups.
Not sure if that is what you need, but here it is anyway.
Edit: oh, already a solution, posted while i wrote... oh well.
I want to be able to change the max level or max size and have it tweak all the levels to evenly scale to that size accordingly, as I'm not sure what the max scale or level are going to be yet. And I don't want them to NOT get to max size by max level, or to get to max size BEFORE max level. However, if you can change my formula to take another variable instead of 100, say MinSize, still evenly scale to max size by max level, and still have an initial size which is constant (this would be what the new variable would do), that would be really helpful. So if I put MinSize to 80, then at level 1 it would be 80 regardless of what maxsize was, and it gets to maxsize at level 10, regardless of what it is then its the perfect function.
Animation - Set units scaling value to ((current (X)scaling value of (Triggering unit) + (5)) (current (Y)scaling value of (Triggering unit) + (5)) (current (Z)scaling value of (Triggering unit) + (5))
Done, that trigger would increase the overall scaling of the hero by 5% when it level ups.
Not sure if that is what you need, but here it is anyway.
Edit: oh, already a solution, posted while i wrote... oh well.
Your simplified scaling is nice, but won't work for me for the reasons specified above. I want the amount to scale per level to be calculated on a number of variables, and upon changing the variables I don't want to need to alter the formula.
I need Something that uses the Following Variables StartSize - The size of the hero at level 1. it's a percentage times 100. 100 is default scale - It would be nice if this could take in whatever size I have set in the object editor somehow. The I can have it start from a different size depending on the unit EndSize - The size we want him to grow to over however many levels a hero can get CurrentLevel - Current Level of the hero. used to calculate what amount of the MaxSize to apply to the hero MaxLevel - The Max level used in the map. If someone can make this actually use the customdata specifiec in the map without rewriting it into the variable that would be nice. Scaler - This is just a variable to hold the answer.
If someone can adjust my formula to use the variables to better create the effect I'm looking for it would help alot.
Sidenote, I'm adjusting movement speed by the same amount. is there a way to access the default movement speed of a unit instead of what it's currently set to?
JASS:
//variables
local real scaler //the number to set the scale to in setunitscalepercent()
local integer maxlevel
local integer currentlevel
local real startsize
local real finalsize
//This formula assumes you're starting scaled at 100% To use another number I have no idea, and I don't want to try to figure it out right now. too much math.
set scaler=StartSize-(1/(maxlevel-1)*StartSize)+((I2R(currentlevel))*(finalsize-StartSize)/(maxlevel-1))
Here are some examples as to how the current formula works out. CurrentLevel=10 MaxLevel=10 FinalSize=200
Apparently my formula only works at all if the maxlevel is 10. Can someone help me?
Conditions the formula needs to meet. (which my formula does not)
If CurrentLevel=Maxlevel, scaler = FinalSize
If CurrentLevel=1, scaler = StartSize
it should not matter what startsize, finalsize, or maxlevel are.
I think your making this way more complicated than it really needs to be, although, I did notice something strange about the scaling when I did snowballs, the scaling was very odd, like 1000 compared to 100 was more like 100 ^ 10 rather than * 10
I don't know, I'll sleep on it and give you an answer
I think your making this way more complicated than it really needs to be, although, I did notice something strange about the scaling when I did snowballs, the scaling was very odd, like 1000 compared to 100 was more like 100 ^ 10 rather than * 10
I don't know, I'll sleep on it and give you an answer
I'm scaling plants. they can get pretty big. However, I don't want them to fill more than half the screen. Also, I don't know what size they will be, or what our max level will be yet. Since you'll be limited to 1 hero per player it will be more than 10.
Umm. I'm asking how to access it via a script. You know. so if Unit A has default scaling of .85, and unit b has default scaling of 1.4, then it will use .85 as the base for unit a, and use 1.4 for unit b
...
I thought I explained myself as to why that wouldn't work.
The unit will be scaling as it gains levels, therefore getting bigger. I'll be doing this with more than one unit, and they may not all have the same default scale in the object editor.
Therefore, depending on the hero, I may have to start with a different value. If I can do it by having it retrieve what the thing says in the object editor, then I won't have to store the values of all my heroes starting scales in variables.
It just hit me that the scaling value in the object editor that you can manipulate, is exactly the same thing that is manipulated when you use triggers...
That'd be why the scale is all screwed up, it's like the percentage of the models proportions (or something odd like that), I tend to just increase them by small percentages (like 10% is usually significant, but not too much to be bothering)
Btw, if your not using it for anything else, using the custom value of a unit is great for animation type things that can't be edited normally (also for coloring you need to set to a variable)
It just hit me that the scaling value in the object editor that you can manipulate, is exactly the same thing that is manipulated when you use triggers...
That'd be why the scale is all screwed up, it's like the percentage of the models proportions (or something odd like that), I tend to just increase them by small percentages (like 10% is usually significant, but not too much to be bothering)
Btw, if your not using it for anything else, using the custom value of a unit is great for animation type things that can't be edited normally (also for coloring you need to set to a variable)
The custom value of a unit is mostly used in gui (I have yet to see it in jass), but basically it is an integer attached to a unit, and every single unit in the game has a custom value
It's an integer for... a custom value...
It's just a value a unit has that doesn't have any meaning at all. The meaning the number has is entirely determined by the creator of the map, as he decides what the number does. It's actually quite a useful unit value, because unlike HP or Mana, you define yourself what the value is supposed to do.
In jass it's called "UserData", and gotten/set by a GetUnitUserData / SetUnitUserData functioncall.
Usually a handlevar system is used instead of this, although getting / setting the custom value is much faster than using a handlevar system.
In most cases vJass removes the need for custom value.
In normal Jass I often needed it actually.
In GUI you need it like... ALOT.
Therefor, someone *points randomly at smart people* needs to create a system that can set and read custom values with diffrent digits.
For example: 111111111 as a base custom value, now you can for example change it to 111211111 and READ (if need be) that the 4th 1 was changed to 2.
Nifty Idea. I could do that easily if this were java or vb. but I dunno if I could with jass.
Care to explain how jass is different than vjass? I know you need to instill something to use vjass, but I don't know what or what it does when you do.
Alright. I'm going to devise a system to deal with it. I'll encode an algorithm to change the numbers so it'll work, and instead of going by digit place I'll use 0 as a space. I'll do it by converting it to a string. I dunno how well it will work but I think its definitely worth a try. This of course means that you won't be able to use the standard function to access it or you'll just get a bunch of gibberish. However, I'm making a map where all sorts of creatures will have a fuckload of variables on them. And I don't know how I would deal with it other than making bigass arrays. This may work better.
vJass allows you to use Jass in ways that are more OOB (Object Oriented whatever).
This means you can use structs (classes in Java), libararies and scopes.
In addition you can put global boxes to declare globals with text instead of the crappy variable editor, and it gives you some extra options in the Object Manager (shows some skills WE doesn't, allows you to specify a units rawcode when you make it, etc.).
To get vJass, you need to download JNGP (Jass New Gen Pack) which is a bunch of nice programs for Jass people made, and what it basicly do together is hack the WE.
In case you want to download it (very suggested for Jass users) click here.
hmm. I have JNGP. How do I go about actually using vjass instead of Jass. I know now I have a native function checker, and that's nice, but for actual vJass how do I do access code libraries and what not.
Also how do I specify a rawcode when making a unit? And how do I make a function I can just call without having to make an actual trigger?
You should read some vJass tutorials to know how to use it.
If you want to call a function from anywhere, you can either put it in the header (where your map name is in the trigger editor), or put it inside a libarary.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.