Reviving creeps (dota style?)

Bigheaded

New Member
Reaction score
4
Background:
I'm currently working on a pretty lame melee style map, mostly for my own use.

The idea being you can get heroes above level 10, experience is granted at a much greater rate and creeps respawn.

I did look around and found one or two hopeful links such as this one:
http://www.thehelper.net/forums/showthread.php/148955-Automatic-Creep-Revival
and an old 2005 one, which had a map attached which was useful in some aspects.


The problem:

1. I need to make creep camps which respawn at their original location. Also to not used "when unit dies" as i have problems replacing units which are being charmed/transmuted/goodness knows what.
2. How do i make the units still spawn items, even if killed in this manner? I suspect transmute still kills the unit so "when unit dies, have 20% chance to drop xxx item" should still work, i dont think this worked for charm though, so the item would not be available.
3. Respawning gold mines? i just want a simple revive or even to have a gold mine with 0 gold in it, then get it set to have 25000 gold in it again after 5 minutes waiting. I like the idea that your main base will only be disrupted after losing it's gold mine and you will get miles behind if you don't have any mines, but not out the game as it will come back.

Possible Solutions??
1. Using regions? not looking forward to making 40 regions, 1 for each creep camp. I think i have the concept, some help on the coding (preferably plain old editor code, i don't bother with custom script, if i do use custom script, it's copy and pasted from here ;) ) if you can be bothered to make a map with it, i will be most grateful.
2. ????
3. ???? gold mines don't "die" by the way, or if they do somehow my code has gone wrong.


So does anyone have some awesome sounding solution which means i dont need to add tonnes of regions? if not any way to make camps which spawn similar creeps (i.e 2 lvl 1 units and 1 level 2 unit is there about 6 times on the map) to do it in one trigger, rather than 1 for each camp (so 6 individual triggers in this case).

So any genius suggestions? or even ideas? more than willing to have a shot at any idea i like the sound of. If you think regions is the best solution i suppose i'll get on with it and do it, but do go out and post :p


Map is available on request if you want to edit it on that if it helps, or to see what i've currently done and attempt to edit my current coding.
 

Grags_1977

Ultra Cool Member
Reaction score
32
I don't know if this off any help to you. But figured i'd post it just in case.

Trigger:
  • Store Creeps
    • Events
    • Conditions
    • Actions
      • Set UnitGroup_Hostiles = (Units owned by Neutral Hostile)
      • Unit Group - Pick every unit in UnitGroup_Hostiles and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Set Integer_CreepCount = (Integer_CreepCount + 1)
            • Set Point_CreepPosition[Integer_CreepCount] = (Position of (Picked unit))
            • Unit - Set the custom value of (Picked unit) to Integer_CreepCount


Trigger:
  • Revive Creeps
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in UnitGroup_Hostiles) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from UnitGroup_Hostiles
      • Wait 120.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at Point_CreepPosition[(Custom value of (Triggering unit))] facing (Random angle) degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
      • Unit Group - Add (Last created unit) to UnitGroup_Hostiles


You can change the wait 120:00 seconds to around 500 if you change...

Advanced/Gameplay Constants/Decay Time (Sec) - Bones: To around 350

Hope this helps.




EDIT: Oh, and you might not need the unit group in there. This was copied from my map and I needed that group for something else.
 

Bigheaded

New Member
Reaction score
4
i did mention i was having trouble with "unit dies" as i was using charm on creeps and on my current trigger which revives them at where they died, a unit dying which does NOT leave a corpse (i.e charm/transmute never leave corpses) will cause the trigger to fail.

so looking for a trigger without the event "a unit dies" to trigger it.

Thanks for the post though.
 

Grags_1977

Ultra Cool Member
Reaction score
32
You're welcome.

I'm not a very good reader, never have been (I can't read a full paragraph properly without forgeting what the first 2 sentences were, my short term memory sucks). I kinda figured before I posted that it wasn't what you were looking for. But I thought i'd chance it.

However, i'm certain there's a way around leaving corpses. You could try, making your own charm/transmute. Or add an event for when someone casts transmute/charm to add the Target Unt of ability being cast to a unit group.
 

Bigheaded

New Member
Reaction score
4
Added all the regions, but this is the bit which is annoying, making a trigger which does it all, rather than 1 or 2 separate triggers for each creep camp.

I sort of have the idea of it in my head, writing it here is probably helping me think it through lol.

So the idea is, Event is periodic: every 60 seconds.
I then need it to run a check on every region on my map. So i have made a region variable with array size 1, and an integer variable.
So it would run a new trigger?
So new trigger:
No event
No conditions
Actions: If/then/else:
Condition "unit count of units owned by player 12 in region(integer) equal to 0"
then:
respawn units in region(integer)
variable - integer = integer + 1
Trigger - run this trigger?
else:
variable: integer = integer + 1
Trigger - run this trigger


I will probably need to also have a trigger to define each of the regions i.e
Event: Map initialisation
Condition: none
Variable: Set integer = 1
Set greencampnorth = region(integer)
Variable: Set integer = 2
Set greencampwest = region(integer)
etc etc

any help on the middle trigger highlighted in bold? The idea is that it runs through all 40 or so of my regions without doing each one separately.


It works in theory, but i am unsure of what exactly it needs to be done.
 
Reaction score
7
As I understand it, what you're doing is actually making some modifications to Warcraft's normal rules. I don't think that's lame at all.
There is a possible issue though: at level 10 your Hero will have maxxed out all of their abilities, so if you want to go beyond there, you should create additional ability levels.

There is a unit event for when a unit is captured with an ability like Charm: A unit Changes owner. However, the creep revival trigger in the second post won't work here because Position of (Triggering unit) will probably be some other location.
It may not be working for Transmute because the victim is probably being deleted soon after it is Transmuted, so (Triggering Unit) breaks.

I haven't tested this idea, but you could use these slightly modified triggers from the second post:
Trigger:
  • Store Creeps
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Set Integer_CreepCount = (Integer_CreepCount + 1)
            • Set Point_CreepPosition[Integer_CreepCount] = (Position of (Picked unit))
            • Set UnitType_CreepType[Integer_CreepCount] = (Unit-type of (Picked Unit))
            • Set Boolean_CreepDead[Integer_CreepCount] = False
            • Unit - Set the custom value of (Picked unit) to Integer_CreepCount

Trigger:
  • Register Dead Creeps
    • Events
      • Unit - A unit Dies // So that it will work on killed/Transmuted creeps
      • Unit - A unit Changes owner // So that it will work on Charmed creeps
    • Conditions
      • (Owner of (Triggering unit) Equal to Neutral Hostile) Equal to True
    • Actions
      • Set variable Boolean_CreepDead[(Custom value of (Triggering unit))] = True

Trigger:
  • Revive Creeps
    • Events
      • Every 60 seconds of game time // The 60 can be changed to another interval if you wish
    • Actions
      • For each (Integer A) from 1 to Integer_CreepCount, do (Actions)
        • If (Boolean_CreepDead[(Integer A)] Equal to True) then do (Actions)
          • Then - Actions
            • Unit - Create 1 (UnitType_CreepType[(Integer A)]) for Neutral Hostile at Point_CreepPosition[(Integer A)] facing (Random angle) degrees
            • Unit - Set the custom value of (Last created unit) to (Integer A)
            • Set variable Boolean_CreepDead[(Integer A)] = False

The idea is to use another variable array (Boolean_CreepDead) to keep track of dead creeps, and every 60 seconds, respawn the ones for which Boolean_CreepDead[Integer A] is set (the ones that were killed or Charmed). It doesn't refer to the dying unit any more because everything we need to respawn the creeps is in the variable arrays.
It also introduces the array UnitType_CreepType to remember which type of creep it was.
The only issue (apart from increased memory usage) is that there is a possibility that a killed creep might immediately respawn in front of you.
 

Bigheaded

New Member
Reaction score
4
annihilator127
Gah, that looked really useful :banghead:,
but i had already started on regions and "nearly" there i "think".

this is what i am currently using.
I have already done the trigger which defines each creep camp. So each creep camp has a particular number.
i.e
i = 1
Set ALLREGIONS(I) = CreepCampNorth01
i = 2
Set ALLREGIONS(I) = CreepCampNorth02
etc.

then i have this:
Trigger:
  • Respawn Creeps
    • Events
      • Time - Every 80 seconds of game time
    • Conditions
    • Actions
      • For Each (integer I) from 1 to 20, do actions
        • Loop Actions
          • If all conditions = true do following actions, else do else actions
            • If conditions: (Number of units in (units in Allregion(I))) equal to 0
            • Then
              • Creep Respawning (haven't decided exactly how i'm doing this)
              • Variable i = i + 1
            • Else
              • Variable i = i + 1


I was looking for a better way of putting "If conditions: (Number of units in (units in Allregion(I))) equal to 0" as it looks a mess, can't see any reason why it shouldn't work though.
I may try changing the "Store creeps" trigger you have provided to help with creep respawning. I can see how that will work in theory.
Or i may change which creeps spawn as i used a similar trigger for doing this in another map i've made (where i stole that trigger and editted for own use from another map :rolleyes: ).


Any ideas on the gold mine respawning?

edit: removed a section here as it's now resolved.

If you have any ideas about the 2 bolded sections that would be great :)



Edit:
Just added a creep drop system as i wished to implement one anyway, and i was curious how well the changes owner + unit dies event together is. Didn't actually work oddly enough, charm "apparently" doesn't change alliance of the creep according to triggers anyway. So i just made an event based on spell casting, spell being cast equal to charm. Just doubles the amount of triggers i need, but seeing it's a copy + paste job with a few edits it's not so bad :)
Yet to implement my respawning method, as i'm probably going to rotate the creeps so that different creeps are made from the same camp on respawning. But i have got the triggers on another map ready to be stolen.

Questions:
1. Done. I have a partially complete respawning method, which is correctly respawning units. Just needs me to insert more creep types into the triggers.
2. Done. I have some form of item drops from respawned creeps.
3. Gold mine respawning, have a few ideas but not anything concrete which is guarenteed to work
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top