• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] An Issue With a Creep Respawn Trigger

Status
Not open for further replies.
Level 3
Joined
Oct 27, 2016
Messages
34
Hey! Hi! Hello!

I vividly remember getting a system like this to work very well many years ago, and I was pretty proud of being able to do what was (at least at the time) considered "impossible." However, I have grown to a...high level of rustiness, and I am having more than a fair number of issues with this trigger.

*Note: I have all of the variables defined in other triggers, don't worry about that, unless it really seems to be part of the issue here

  • CreepValue
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units owned by Neutral Victim)) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in (Random 1 units from (Units in (Playable map area) owned by Neutral Victim)) and do (Actions)
            • Loop - Actions
              • Unit - Set the custom value of (Picked unit) to CreepPositionNumber
              • Set CreepPositionNumber = (CreepPositionNumber + 1)
              • Set CreepPositions[(Custom value of (Picked unit))] = (Region centered at (Position of (Picked unit)) with size (100.00, 100.00))
              • Unit - Change ownership of (Picked unit) to Neutral Hostile and Change color
        • Else - Actions
          • Trigger - Turn off (This trigger)
For those of you unclear as to what I am trying to accomplish: this trigger (and a couple of others) is designed as part of a system that will have Creeps (Neutral Hostile units) respawn a few seconds after being killed at the exact location they were in during Map Initialization.

*Note: simply respawning at "location of triggering unit" chooses the location of death, which does not help here. It can have some.... fun and messy outcomes that I am trying to avoid here.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
  1. Don't use regions like that. What you want to do is store (position of (picked unit))
  2. Your trigger runs every 0.10 seconds for no discernible reason. What you want are two triggers: one that runs at map init and sets the CreepPositions[] and one that runs when a creep dies to respawn it.
  3. You're picking a random neutral victim unit and turning it into a neutral hostile, but I see no respawning of any kind. Generally speaking most of this trigger seems to be doing nothing useful.
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set CreepPositionNumber = 1
    • -------- Units have custom value 0 by default, so start >0 so you know what's a respawnable creep --------
    • Custom script: set bj_wantDestroyGroup = true
    • -------- The above line auto-clears the group leak from the line below this --------
    • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
      • Loop - Actions
        • Unit - Set the custom value of (Picked unit) to CreepPositionNumber
        • Set CreepPositionNumber = (CreepPositionNumber + 1)
        • Set CreepPositions[CreepPositionNumber] = (Position of (Picked unit))
        • Set CreepType[CreepPositionNumber] = Unit-type of (Picked Unit)
  • Events
    • Unit - A unit dies
  • Conditions
    • (Custom value of (Triggering Unit)) greater than 0
  • Actions
    • Custom script: local integer CV
    • -------- JASS local variable to temporarily store the unit's custom value while waiting to respawn it; this MUST be the first line of the trigger --------
    • Set CreepPositionNumber = Custom vale of (Triggering Unit)
    • Custom script: set CV = udg_CreepPositionNumber //This should be udg_ plus whatever the name of your variable is in the variable editor
    • Wait 2.00 seconds
    • Custom script: set udg_CreepPositionNumber = CV
    • Unit - Create 1 CreepType[CreepPositionNumber] for Neutral Hostile at CreepPositions[CreepPositionNumber]
    • Unit - Set custom vale of (last created unit) to CreepPositionNumber
    • -------- Create some SFX if you want --------
You could get around needing the local variable by pausing the creeps when they die to prevent them from decaying and then unpausing them (to let them decay) once their replacement is made. If they decay before you make a new one you won't be able to know the CV of the dying unit to properly respawn, and if you store it in a (global) variable it will get overwritten if another creep dies before the first is actually respawned.
 
Last edited:
Status
Not open for further replies.
Top