Hashtable + Attribut Bonus

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Jeah, I wanted never use a hashtable, but it seems to be that they are very useful but complicated as well. I tried something and after a half hour I get pissed delete everything because nothing work -_-
So I hope someone out there can help me with my ability.

The ability has 4 levels. If the ability is casted, each dead corpse is picked in a unit group. The picking range is: (300 + (50*Level of Casting Ability)) from position of the casting unit.
Now for each picked unit the casting unit should get a strength bonus (Level 1 = +4 / Level 2 = +5 / Level 3 = +6 / Level 4 = +7) for 5 seconds.
(after this five seconds the bonus will be removed)


So I thing for this is hashtable useful, because I don't know another way, to make this MUI =O

Maybe someone can help with this PLZ?!

( And can someone show me how a Hashtable in Jass looks like? (just simple - save a value and load a value ))
 
Last edited:
Wy dont make it in gui and convert it into custom text if you dont know?
JASS:
local real rx = LoadReal( udg_hashTable, GetHandleId(u), StringHash("X")) 
call SaveReal( udg_hashTable, GetHandleId(u), StringHash("X"),rx)

instead of $TYPE$ you have to write a variable type!
call Save$TYPE$(hashtable,Hash,Hash,variable(you wanna save))
set variable(you wanna load)=Load$TYPE$(hashtable,Hash,Hash,)

so Save it:
JASS:
timer t
unit u
call SaveHandle(hashtable,StringHash("RemoveAttributOrSomethingElse"),GetHandleId(t),u)

And load it when timer expires:
JASS:
set = GetExpiredTimer()
set u = SaveHandle(hashtable,StringHash("RemoveAttributOrSomethingElse"),GetHandleId(t))
Then youre done

BTW: Merry Christmas
 
You only need to set tempgroup with matching conditions so it checks if the unit is dead

then you set an integer to the number of units in the tempgroup

make an integer with the formula for strength

add the integer amount strength to your hero

set the hero into an variable and start a index loop that checks when the times up, removes the "integer amount" strength from the unit and voila
 
Status
Not open for further replies.
Back
Top