Shanflower
New Member
- Reaction score
- 2
Hi all,
I am making a Dota-based game, and I'm having problems setting the respawn times of heroes who die.
Ideally, the hero takes X seconds to respawn, where X is:
- Level of the hero when he died * 2
plus
- Max hitpoints of the hero when he died / 90
plus
- Max mana of the hero when he died / 80
I tried this:
and then, in another trigger:
As you can see it creates MASSIVE lag, and doesn't work. I'm okay with GUI coding but utterly clueless to custom script (JASS and whatnot)...
Any help with how I can make it work (laglessly) is appreciated
I am making a Dota-based game, and I'm having problems setting the respawn times of heroes who die.
Ideally, the hero takes X seconds to respawn, where X is:
- Level of the hero when he died * 2
plus
- Max hitpoints of the hero when he died / 90
plus
- Max mana of the hero when he died / 80
I tried this:
Trigger:
- Events
- Time - Every 5.00 seconds of game time
- Actions
- Unit Group - Pick every unit in (Units owned by Player 3 (Teal) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)
- Loop - Actions
- Set respawntime[(Player number of (Owner of (Picked unit)))] = (((Hero level of (Picked unit)) x 2) + (((Integer((Max life of (Picked unit)))) / 90) + ((Integer((Max mana of (Picked unit)))) / 80)))
- Loop - Actions
- -------- Repeat above for every player (there are ten players) --------
and then, in another trigger:
Trigger:
- Events
- Unit - A unit Dies
- Conditions
- ((Dying unit) is A Hero) Equal to True
- Actions
- Countdown Timer - Start herorespawntimer[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in (Real(respawntime[(Player number of (Owner of (Dying unit)))])) seconds
- Countdown Timer - Create a timer window for (Last started timer) with title ((Name of (Owner of (Dying unit))) + respawns in: )
- -------- -- --------
- Wait (Real(respawntime[(Player number of (Owner of (Dying unit)))])) seconds
- Hero - Instantly revive (Dying unit) at (Center of (Playable map area)), Show revival graphics
As you can see it creates MASSIVE lag, and doesn't work. I'm okay with GUI coding but utterly clueless to custom script (JASS and whatnot)...
Any help with how I can make it work (laglessly) is appreciated