I need a revival system for my hero-creeps

NeosDany

Member
Reaction score
1
Hi, I am making a map rpg-style and I am needing a system to revive my creeps, and they are heros owned by player 12.
They have 4 skills that define the time to revive.
1st one is "creep" should revive 60 seconds after his death in the original place he started.
2nd one is "mob" should revive 30 seconds after his death in the original place he started.
3rd one is "leader" should revive 120 seconds after his death in the original place he started.
4th one is "boss" should revive 240 seconds after his death in the original place he started.

I have tried lots of systems, so is there a way to revive creeps if they are owned by player 12 and are heros?
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
is there just 1 unit of each type or multiple units of each type?
 

NeosDany

Member
Reaction score
1
There are many units of each type in map at the same time. Spider coast has: 4 spiders same unit type, one is lv2 and others are lv1.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
this is really easy:
.a create 4 dummy abilites, a int variable also a point variable with arrays
.b make a trigger that starts 0.00 seconds after the game have started.
and set the "int" variable to zero at the start of your trigger
.c make it pick every unit owned by player 12 with the ability "revive type 1"
.d set "int variable = int + 1" and set custom value of the picked unit to int, and set the "point" array[int] to position of picked unit.
.e repeat last step for every "revive type x" ability you need
.f create a new trigger with the event "a unit dies" and make an "or - condition" and check if the unit has ether abilty x or abilty y
.g make a if then else for every ability revive type(check in the condition of the if then else if the triggering unit level of ability x is greater then 0) then simple wait x seconds and revive Triggering unit at point[custom value of triggering unit]

if you need more help, send me a pm and i could make you a template for this
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
wow what a lot of work to do :p

Trigger:
  • Rez SU
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Custom value of (Triggering unit)) Equal to 0
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Paladin
        • Then - Actions
          • Hashtable - Save Handle Of(Position of (Triggering unit)) as (Key L) of (Key (Triggering unit)) in (Last created hashtable)
          • Unit - Set the custom value of (Triggering unit) to 30
          • Trigger - Add to Rez <gen> the event (Unit - (Triggering unit) Dies)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Archmage
        • Then - Actions
          • Hashtable - Save Handle Of(Position of (Triggering unit)) as (Key L) of (Key (Triggering unit)) in (Last created hashtable)
          • Unit - Set the custom value of (Triggering unit) to 60
          • Trigger - Add to Rez <gen> the event (Unit - (Triggering unit) Dies)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Mountain King
        • Then - Actions
          • Hashtable - Save Handle Of(Position of (Triggering unit)) as (Key L) of (Key (Triggering unit)) in (Last created hashtable)
          • Unit - Set the custom value of (Triggering unit) to 120
          • Trigger - Add to Rez <gen> the event (Unit - (Triggering unit) Dies)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Blood Mage
        • Then - Actions
          • Hashtable - Save Handle Of(Position of (Triggering unit)) as (Key L) of (Key (Triggering unit)) in (Last created hashtable)
          • Unit - Set the custom value of (Triggering unit) to 240
          • Trigger - Add to Rez <gen> the event (Unit - (Triggering unit) Dies)
        • Else - Actions

Trigger:
  • Rez
    • Events
    • Conditions
    • Actions
      • Wait (Real((Custom value of (Triggering unit)))) seconds
      • Hero - Instantly revive (Triggering unit) at (Load (Key L) of (Key (Triggering unit)) in (Last created hashtable)), Hide revival graphics
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
well asuming i understod what he wanted, hes heroes are preplaced on the map, your trigger will only detect targets that are spawned after the map have started.

as i'm home now i tossed one togheter too:

variables:
group_var = unit group
integer_var = integer
point_var = point with array

abilities:
10 sec = based on "channel", hero ability set to "false"
20 sec = based on "channel", hero ability set to "false"
its not nessary to use abilities, made 2 diffrent ways in the trigger, however using the abilities will save space in the code if you use alot of diffrent heroe types on your map


Trigger:
  • ini revive
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set integer_var = 0
      • Custom script: set bj_wantDestroyGroup=true
      • Unit Group - Pick every unit in (Units in (Entire map) matching ((((Matching unit) is A Hero) Equal to True) and ((Owner of (Matching unit)) Equal to Player 1 (Red)))) and do (Actions)
        • Loop - Actions
          • Set point_var[integer_var] = (Position of (Picked unit))
          • Unit - Set the custom value of (Picked unit) to integer_var
          • Unit Group - Add (Picked unit) to group_var
          • Set integer_var = (integer_var + 1)

*change out player 1 to 12

Trigger:
  • respawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in group_var) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Paladin
              • (Level of 10 sec for (Triggering unit)) Equal to 1
        • Then - Actions
          • Game - Display to (All players) the text: revived in 10 sec
          • Wait 10.00 game-time seconds
          • Hero - Instantly revive (Triggering unit) at point_var[(Custom value of (Triggering unit))], Hide revival graphics
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Triggering unit)) Equal to Mountain King
                  • (Level of 20 sec for (Triggering unit)) Equal to 1
            • Then - Actions
              • Game - Display to (All players) the text: revived in 20 sec
              • Wait 20.00 game-time seconds
              • Hero - Instantly revive (Triggering unit) at point_var[(Custom value of (Triggering unit))], Hide revival graphics
            • Else - Actions


code is leakless, gui, mui w/e
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
if they are preplaced you can redo the first trigger as a unitgroup on MI instead of on entering map. Plus it has no limits, it will work for every hero type you add to it, it is gui, mpi, mui, and leakless as well.

BTW you leak a unitgroup.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
i'm totally clueless why this doesn't work :/ try the trigger above and see if you get the same resoult

also, mine does not leak a unit group?
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
Unit Group - Pick every unit in (Units in (Entire map) matching ((((Matching unit) is A Hero) Equal to True) and ((Owner of (Matching unit)) Equal to Player 1 (Red)))) and do (Actions)
Loop - Actions
is what leaks in it, chances are it is not working for him cause an array size issue.
But 1 leak wont hurt anything, people are way to obsessed over leaks when most wont even be noticed till you end the map.
 

HellHeaven

New Member
Reaction score
0
Here is a neat system that will do what you need. http://www.hiveworkshop.com/forums/...ui-218179/?prev=u=defskull&r=20&d=list&page=2

Dameon, he is not leaking that unit group because set bj_wantDestroyGroup = true will destroy the unit group. polo2005, you are leaking a location, when the Hero is revived.

NeosDany, I have one question for you. Are those creeps of yours preplaced or created by triggering?

One problem I found about you method for reviving heroes, polo2005, is that the code will only revive heroes that were added to the group at map initialization. Heroes that spawn later by triggering won't revive. I'd say that is a con of your method.

Why use Or - Any (Conditions) are true? Don't you want both conditions to be true? In addition, I think using abilities just complicate things.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
i strongly disagree, as long as i'm not overwriting a set location, its not leaking
aka as i only have 1 point location for every unit that needs to be reviewed it doesn't leak.
 

HellHeaven

New Member
Reaction score
0
You are leaking a location because you are referencing the unit's position and not destroying it. Each unit's position is a location. Therefore, you are leaking several locations. I hope I did not offend you.
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
ahh I was thinking that bj_wantDestroyGroup = true was just a Boolean or some thing which it is but I didn't know it would clear the group, I don't use jass to often.

As for the location it wont leak, it is just reused every time, so it always call from the same source. So it is a permanent variable and not a leak.

Set point_var[integer_var] = (Position of (Picked unit))
Stores in the varible the current location of the unit, lets just say 0,0
Hero - Instantly revive (Triggering unit) at point_var[(Custom value of (Triggering unit))], Hide revival graphics
on this it accesses the variable, no new data written.
 

HellHeaven

New Member
Reaction score
0
Leaking has nothing to do with how a variable is used. The objects that are stored in variables leak if not destroyed. The location is not reused, but the variable is reused. Also, each unit picked in the group has a different position.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
source please?
i cant see how it will create a memory leak with something just stored without overwriting it.
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
I think you might miss understand what a leak is and how varibles work.
A leak is created when data is created and can no longer be accessed with out being destroyed. So a leak is data that cant be accessed.
He isn't creating new data, he is accessing stored data so there is no leak.

If you don't belive me test it your self according to you this map will leak bad, open wc3 in a window and look at it's file size in the tm, if it leaks as you say then the file size will continue to grow none stop. Note that this takes time cause we are talking about bits here.
 

Attachments

  • leaktest.w3m
    15.9 KB · Views: 271

HellHeaven

New Member
Reaction score
0
I understand that polo2005 is accessing stored data. That accessed data is leaking. Anyways, he is only leaking that accessed data, so the leaks might not matter. Then again, if 100 units were picked at map initialization, that means 100 locations referenced in memory. Here is a source: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/basic-memory-leaks-5889/.

I cannot open the map at the moment because I am on the IPad.

Edit: Dameon, although the data might not be leaking from your definition of a leak, the data is taking what might be valuable space in memory.
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
yes the data is most defiantly taking up memory, it has to do so for what he wants since he wants them respawned where they were first placed, only way around this is to place a region which will take up about the same amount of memory.

If it was a matter of a region it would all be a lot easier, I could do it all in 1 or 2 short triggers, using tweaks from the object editor to set the timers.
 

NeosDany

Member
Reaction score
1
My units are preplaced, and HellHeaven that system is very good, but in multiple regions I have the same creeps, so that system doesn't work too, someone knows another creep revival system?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top