How to: Create a Creep Revival System

Discussion in 'Tutorial Repository' started by Tinki3, Apr 14, 2007.

  1. San-D

    San-D New Member

    Ratings:
    +15 / 0 / -0
    The simplest, most fair Creep Revival sys in the known maping society.
     
  2. Tinki3

    Tinki3 Special Member

    Ratings:
    +418 / 0 / -0
    > If I got an items on the creep that dies, will the one that respawn have the same items?

    Annoyingly, no, as the "revived" creep is a whole new unit.
    You'd need triggers to assist you here, as you already stated.

    Thanks for the comment San-D.
     
  3. FireBladesX

    FireBladesX Eating my wings!

    Ratings:
    +123 / 0 / -0
    I put this in to my map, but with 30 second wait, and they don't respawn.
    Could this be because the corpses don't last 30 seconds in my map?

    However, I tried this with a 2 second wait, and it worked fine.
     
  4. Tinki3

    Tinki3 Special Member

    Ratings:
    +418 / 0 / -0
    > Could this be because the corpses don't last 30 seconds in my map?

    That (if you've edited some gameplay constants), or because the creeps don't leave corpses at all.
     
  5. FireBladesX

    FireBladesX Eating my wings!

    Ratings:
    +123 / 0 / -0
    Yeah, i edited the constants, but is that what makes the creeps not revive?
    fast reply, btw o_O
    I think water elementals respawned, btw. logic defying? (i could b mistaken, however)
    ---> also, i'm pretty sure that the golems came back, too
     
  6. Tinki3

    Tinki3 Special Member

    Ratings:
    +418 / 0 / -0
    > i edited the constants, but is that what makes the creeps not revive?

    If "Decay Time - (Bones)" + "(Flesh)" gives a value less than 30, then that means the unit is removed before 30 seconds has expired.
    Just check those 2 constants.
     
  7. modeskon2006

    modeskon2006 Guest

    Ratings:
    +0 / 0 / -0
    When I use this trigger, and I kill some creeps, there spawn more creeps then i kill, even tho it says only 1 will respawn in the trigger? ..
     
  8. Lionhearte

    Lionhearte New Member

    Ratings:
    +0 / 0 / -0
    I seem to have a bit of a problem.
    In my map, after killing said creeps, and waiting the appropriate time set in the trigger, the creeps do not spawn. After testing it by killing a bunch of creeps, which are located in the north west part of the map, I started noticing a large blot in the middle of the map. It was the creeps, respawning (underwater) in the middle of the map, and not where they should be.

    I may have done some of the triggers wrong, but after checking over them thrice, it appears everything is in place.

    The gameplay constants for "Flesh" and "Bones" are at default. I've tested it a few times, thinking it was because I deleted "Use melee game time" from Map Initialization, but after restoring that and testing again, the problem persists.

    Any help on this would be much appreciated :D
     
  9. Dameon

    Dameon "All the power in the world resides in the eyes"

    Ratings:
    +127 / 0 / -0

    You will want to post a help thread for this, and when you do be sure to include the trigger, just copy it as text and paste it. I have an idea what is wrong but can't be sure unless I see the trigger, I think you are useing create unit at location of dieing unit which after a wait will no longer be in the memmorie
     
  10. TheDarkBoy

    TheDarkBoy New Member

    Ratings:
    +3 / 0 / -0
    I can't seem to find the "Set Integer" in actions?
    Oh sorry. There it is :D.
     
  11. Flare

    Flare Stops copies me! Staff Member

    Ratings:
    +662 / 0 / -0
    It's Set Variable - just find your integer variable from the list of variables, and then you can give it a value
     
  12. Antizer

    Antizer Guest

    Ratings:
    +0 / 0 / -0
    I have a question... Can this trigger be used for player units? For instance, there are two training areas in my map. The player "Player 6" has units in these areas (only in these areas), and i want these units to respawn after five seconds.:)
     
  13. The newbie

    The newbie New Member

    Ratings:
    +0 / 0 / -0
    Something's wrong

    Hello, I have spent hours trying to get those fucking mobs to spawn, but I prolly fucked something up along the way xD.

    At first I couldn't even get it to work, but now they spawn...it's just the wrong place, they revive at around the middle, which is the "leak" you are talking about I suppose? Well take a look and maybe someone can explain what I've done wrong ;(
    Code:
    Events
        Unit - A unit Dies
    Conditions
        ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
    Actions
        Wait 10.00 game-time seconds
        Set tempPoint[1] = (Center of (Entire map))
        Set tempPoint[2] = (tempPoint[1] offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))]))
        Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at ((Center of (Entire map)) offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))])) facing (Random angle) degrees
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
        Custom script:   call RemoveLocation(udg_tempPoint[1])
        Custom script:   call RemoveLocation(udg_tempPoint[2])
    Code:
    Creep revival system initialization
        Events
            Map initialization
        Conditions
        Actions
            Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
                Loop - Actions
                    Set Integer = (Integer + 1)
                    Unit - Set the custom value of (Picked unit) to Integer
                    Custom script:   set udg_Creep_X[udg_Integer] = GetUnitX(GetEnumUnit())
                    Custom script:   set udg_Creep_Y[udg_Integer] = GetUnitY(GetEnumUnit())
    
    There is also this:
    JASS:
    function Trig_RespawnCreeps_Test takes nothing returns boolean
        return ( IsUnitEnemy(GetFilterUnit(), Player(PLAYER_NEUTRAL_AGGRESSIVE)) )
    endfunction
    
    function Trig_RespawnCreeps_Actions takes nothing returns nothing
        local location Position = GetUnitLoc(GetDyingUnit())
        local integer Level = GetUnitLevel(GetDyingUnit())
        loop
            call PolledWait( GetRandomReal(25.00, 55.00) )
            exitwhen ( IsUnitGroupEmptyBJ(GetUnitsInRangeOfLocMatching(1536.00, Position, Condition(function Trig_RespawnCreeps_Test))) == true )
        endloop
        call CreateNUnitsAtLoc( 1, ChooseRandomCreepBJ(Level), Player(PLAYER_NEUTRAL_AGGRESSIVE), Position, bj_UNIT_FACING )
    endfunction
    
    function InitTrig_RespawnCreeps takes nothing returns nothing
        set gg_trg_RespawnCreeps = CreateTrigger(  )
        call TriggerRegisterPlayerUnitEventSimple( gg_trg_RespawnCreeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
        call TriggerAddAction( gg_trg_RespawnCreeps, function Trig_RespawnCreeps_Actions )
    endfunction


    But in these
    line 213: Expected a variable name
    line 214: Expected a name
    line 215: Expected a name
    Code:
     set gg_trg_RespawnCreeps = CreateTrigger(  )
        call TriggerRegisterPlayerUnitEventSimple( gg_trg_RespawnCreeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
        call TriggerAddAction( gg_trg_RespawnCreeps, function Trig_RespawnCreeps_Actions )
    endfunction
    Something like that happened also earlier with Finki's creep reviver, but it seems to be fixed now for me.

    If u can't find out what's wrong maybe someone have a creep revive that is easy to use and very simple, i am still learning and the creeps are far from the most important in my map ^^
    Maybe a custom written to copy ;)?
     
  14. tork

    tork New Member

    Ratings:
    +2 / 0 / -0
    Thank you very much for this is has helped alot +Rep

    But it does leak if you just change a couple things it good

    Trigger:
    • Creep Revival System Initialization
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set Temp_Group = (Units in (Playable map area) owned by Neutral Hostile)
        • Unit Group - Pick every unit in Temp_Group and do (Actions)
          • Loop - Actions
            • Set Integer = (Integer + 1)
            • Unit - Set the custom value of (Picked unit) to Integer
            • Custom script: set udg_Creep_X[udg_Integer] = GetUnitX(GetEnumUnit())
            • Custom script: set udg_Creep_Y[udg_Integer] = GetUnitY(GetEnumUnit())
        • Custom script: call DestroyGroup (udg_Temp_Group)


    Trigger:
    • Revive Creeps 1 by 1
      • Events
        • Unit - A unit Dies
      • Conditions
        • ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
      • Actions
        • Wait (Random real number between 100.00 and 150.00) seconds
        • Set Temp_Point = ((Center of (Entire map)) offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))]))
        • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at Temp_Point facing (Random angle) degrees
        • Custom script: call RemoveLocation (udg_Temp_Point)
        • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
     
  15. 13loodfangz

    13loodfangz New Member

    Ratings:
    +0 / 0 / -0
    problem

    After sweeping through this thread and my own map i still could not find the problem in the creeps not spawning, could you have a look for me to find out what is wrong inside?

    much appreciated and thanks.
     

    Attached Files:

  16. TheDanish

    TheDanish New Member

    Ratings:
    +0 / 0 / -0
    As far as I can tell, this respawn system does not work properly.

    The triggers proposed, of course, leak. These leaks are easy to fix, but when they are fixed, units seem to spawn at the center of the map. It seems that most respawn systems that use similar triggers run into these problems.
     
  17. Gtam

    Gtam Lerning how to write and read!! Yeah.

    Ratings:
    +164 / 0 / -0
    show your triggers then i can see
     
  18. UndeadDragon

    UndeadDragon Super Moderator Staff Member

    Ratings:
    +450 / 0 / -0
    If you are calling the unitX and unitY positions leaks and removing them, then of course the unit will spawn in the middle of the map. You would not have any offsets to refer to.
     
  19. kiren17

    kiren17 New Member

    Ratings:
    +2 / 0 / -0
    My two triggers are
    Trigger:
    • Creep Revival System Initialization Copy
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
          • Loop - Actions
            • Set Interger = (Interger + 1)
            • Unit - Set the custom value of (Picked unit) to Interger
            • Custom script: set udg_Creep_X[udg_Integer] = GetUnitX(GetEnumUnit())
            • Custom script: set udg_Creep_Y[udg_Integer] = GetUnitY(GetEnumUnit())


    Trigger:
    • Revive Creeps 1 by 1
      • Events
        • Unit - A unit Dies
      • Conditions
        • ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
      • Actions
        • Wait ((Real((Level of (Triggering unit)))) x 5.00) game-time seconds
        • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at ((Center of (Entire map)) offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))])) facing (Random angle) degrees
        • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
    but i get "Error: Expected a name". I copied the two triggers from your map.

    Edit: never mind working now.
     
  20. Newbie12

    Newbie12 TH.net Regular

    Ratings:
    +2 / 0 / -0

Share This Page