| 04-09-2007, 03:29 AM | #1 |
I used the search function hoping to find a very old thread that is exactly this one, but it seems like it's dissapeared(I guess it was before wc3c almost died). Anyhow, I was hoping that I would be able to ask the same question again. The spell I am making is based on a percent of remaining life the spell target has. If the random number trigger gets a number lower then the percent, the unit lives. If not(the number's higher), they die instantly. So the more life the unit has, the less likely they are to die. Examples: If the unit has 60% of their total life, there is a 40% of instantly dying. If the unit has 1% if their total life, there is a 99% of instantly dying. If the unit has full health, they are unaffected. I tried to create the percent variable, but failed horribly. So the primary reason is to ask: Would someone create this variable for me to use(I might as well give credits)? If what I have written is unclear, please write it so. Thank you in advance. |
| 04-09-2007, 03:44 AM | #2 |
If you can't even do such a basic logical task I suggest you improve your skills on your own or give up, because you won't get far if you just look for handouts every time you come up to some tiny problem |
| 04-09-2007, 04:01 AM | #3 |
Random real = (Percentage lower than Percentage of Unit's HP) Geez man, what are you smoking? |
| 04-09-2007, 04:50 AM | #4 |
Instead of trying to work with percents, work with decimals. Percentages are really just representing hundreths, anyway. Instead of 60%, use 0.60. |
| 04-09-2007, 09:18 AM | #5 |
And he is attempting satire. But people don't need to know that so I'll delete all the spam. To the OP: grim's first post is pretty much right, but what the hell do you mean by 'someone create this variable for me'? |
| 04-09-2007, 12:21 PM | #6 |
Render the chance to die as a function of the life remaining. Code:
(Die%) = 100-(Life%) Then just plug in the % life they have and voillah, you've got your chance to instakill the unit. And yes, work in decimals, makes life easier. |
| 04-09-2007, 04:12 PM | #7 |
he meant he want a variable with data type as percent. but as grim said, this is rediculious. but here is solution in pseudo code form (false code): Code:
set unit_life_percent = unit_life/unit_max_life
set death_chance = RandomReal(0,1)
if (death_chance>unit_life_percent) then
call Kill_The_Freakin_Noob()
endif |
| 04-09-2007, 11:24 PM | #8 |
Ahahahahahaha, I guess I was thinking about it too hard. Thanks anyways, you guys. |
