| 12-02-2007, 11:47 PM | #1 |
.....but how do you add decimal values to a hero attribute...if you use R2I, does that round up? |
| 12-03-2007, 12:11 AM | #2 |
I believe it rounds down, no matter what. If you want the illusion of rounding up, add .50 to the real value. That's what I've been told and what I've heard. |
| 12-03-2007, 01:19 AM | #3 |
I know its doable...I've seen it done before...but all the functions to modify hero attributes take an integer..... |
| 12-03-2007, 02:00 AM | #4 |
Yes, they do... and if you add 0.5 before using the R2Ifunction, it will be round real. But Ignitedstar allready sayed so... |
| 12-03-2007, 02:23 AM | #5 |
grr...but there must be a workaround....although i suppose, that since the stat bonuses are awarded for killing units, i could make a global integer, and whenever that particular unit kills 5 units, it gets +1 str (.2 for units). But then it wouldn't be multi-instancable, since i don't know JASS, so i don't know how to attach integers to units... |
| 12-03-2007, 03:07 AM | #6 |
Use the custom value of the unit. It stores an integer to each unit. When the unit kills a unit, increase this value by 1. The if the value is 5, set the custom value to 0 and add 1 str. Rinse and repeat. |
| 12-04-2007, 01:11 AM | #7 |
But what if I'm already using custom values....is there another GUI solution? |
| 12-04-2007, 02:22 AM | #8 |
Userdata is unlimited if you know how to use it. All you have to do is store a number on a unit, and then use that as an index for as many arrays as you want. |
| 12-04-2007, 02:59 AM | #9 |
or convert to jass and learn how to use structs. Personally, if you have the time, learn jass. It may seem hard at first, but after awhile you will be able to code more complex code quicker and even some of the simpler code will be easier to write out than using GUI. |
| 12-04-2007, 08:12 PM | #10 | |
Quote:
We'll i'm using a system that is constantly changing the custom data of a unit in order to keep track of how many kills it has, so the value is constantly changing... |
| 12-04-2007, 11:11 PM | #11 |
Have a integer array for the kill number. Set the custom value for each unit to a unique value. Then use KillArray[Custom Value of Unit] to get it. And so on for each value you need to track. |
| 12-05-2007, 01:32 PM | #13 |
As a GUI person you might not find this useful, but here are the 4 common rounding operations implemented in Jass: JASS:
///Returns first integer at most as large as r
function floor takes real r returns integer
local integer i = R2I(r)
if (i > r) then
return i-1
else
return i
endif
endfunction
///Returns first integer at least as large as r
function ceiling takes real r returns integer
local integer i = R2I(r)
if (i < r) then
return i+1
else
return i
endif
endfunction
///Returns the integer you get by rounding r
function round takes real r returns integer
return floor(r+0.5)
endfunction
///Returns the integer you get by cutting off the digits after the decimal point in r
function truncate takes real r returns integer
return R2I(r)
endfunction
|
| 12-05-2007, 08:08 PM | #14 |
Well the problem isn't finding an appropriate integer to add...its the fact that the hero field takes an integer, and not a real, so that means no decimals....but I may actually need those for something else, so thanks! |
