• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Kill/create/respawn

Status
Not open for further replies.
Level 2
Joined
Jul 23, 2009
Messages
16
  • Life
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Cooperlsxl
          • (Unit-type of (Killing unit)) Equal to Treant
        • Then - Actions
          • Unit - Create 1 Treant for (Owner of (Dying unit)) at (Random point in Center Spawn <gen>) facing Default building facing degrees
        • Else - Actions
          • Unit - Create 1 Cooperlsxl for (Owner of (Triggering unit)) at (Random point in Ent Spawn <gen>) facing Default building facing degrees
The problem is that there will be more than one cooperlsxl made.
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
First of all:

Use
  • -tags instead
  • Inside the trigger editor, click on a trigger, then above "Events", you can see the name of the trigger.
  • Right-click it, select "copy as text" and paste it on the hive.
  • Then put [trigger] (pasted text) [ /trigger] around it and voila, you've got the same result with a better quality without the problems.
  • (Also use [hidden] [ /hidden] because it's easier for the users).
  • [B]Back to your problem:[/B]
  • "Triggering unit" is the dying unit (of course, so that's right).
  • "attacking unit" isn't used for "a unit dies", since it doesn't recognize the attacker.
  • That means that the second condition is always false, so it always activates the "then"-actions
  • Also: remove the leaks.
 
Level 2
Joined
Jul 23, 2009
Messages
16
I still am having problems after reading your comment. I will keep trying to fix it until someone can help me more.
I do not understand what you mean by remove the leaks.
 
Level 2
Joined
Jul 23, 2009
Messages
16
Im sorry I didnt include the rest of it. I want it to spawn a treant when killed by a treant and spawn another cooperlsxl when killed by a infernal.



  • Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Attacked unit)) Equal to Treant
    • Actions
      • Unit - Create 1 Cooperlsxl for (Owner of (Triggering unit)) at (Random point in Ent Spawn <gen>) facing Default building facing degrees
 
I think your trigger should be like this:

Event: a unit dies.
Condition: the dying unit (or triggering unit) must be a cooperlsxl. So this condition must be included in the trigger's condition.
Actions: spawn the corresponding unit.

So, it comes up like this:
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering Unit)) equal to Cooperlsxl
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Killing unit)) Equal to Treant
      • Then - Actions
        • Unit - Create 1 Treant [...]
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Killing unit)) Equal to Infernal
          • Then - Actions
            • Unit - Create 1 Cooperlsxl [...]
          • Else - Actions
Also, never use (Dying Unit). Use (Triggering Unit) instead. They are the same in this case, but (Triggering Unit) is faster. Remember: (Triggering Unit) is not always dying unit, it depends on the event.

Remember, also, that (Attacking Unit) does not respond for (Unit dies) event. Use (Killing Unit) instead.

Lastly, to remove those point leaks, you should do:

  • Set varPoint = (Random point in Ent Spawn <gen>)
  • Unit - Create 1 Cooperlsxl for (Owner of (Triggering Unit)) at varPoint [...]
  • Custom script: call RemoveLocation( udg_varPoint )
Replace "varPoint" with the name of your variable, but DO NOT remove the "udg_" thing :p
Read the tutorial I posted before for better information ^^
 
Level 2
Joined
Jul 23, 2009
Messages
16
Does nothing when I kill treants. AntiLeak is the variable i setup as a region for the spawn point.
  • Ent Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Cooperlsxl
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Treant
        • Then - Actions
          • Unit - Create 1 Treant for (Owner of (Triggering unit)) at (Random point in AntiLeak) facing Default building facing degrees
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Infernal
            • Then - Actions
              • Unit - Create 1 Cooperlsxl for (Owner of (Triggering unit)) at (Random point in AntiLeak) facing Default building facing degrees
            • Else - Actions








Thanks but where do I put the second trigger box at. it needs a event doesnt it?
  • Remove Point Leaks
    • Events
    • Conditions
    • Actions
      • Set AntiLeak = Ent Spawn <gen>
      • Unit - Create 1 Cooperlsxl for (Owner of (Triggering unit)) at (Random point in AntiLeak) facing Default building facing degrees
      • Custom script: call RemoveLocation( udg_AntiLeak )
The custom script wont work as there are errors.



Do not worry about further help as I have abandoned this project. (for now anyways)
 
Last edited:
Status
Not open for further replies.
Top