• 🏆 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!

A Variable Doesn't Work

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hello.

I have a problem with a simple trigger where a variable doesn't work even if it should.

The map is about two ghosts which change sides every 10 to 20 seconds. When a ghost with with Command Aura is killed it will always resurrect back. When a ghost with Brilliance Aura is killed it resurrect backs when he have at least 1 mana point.

The problem is that this:

  • Set GHOST_1 = (Last created unit)
Doesn't work.

How do I fix this problem?

  • GHOST 1 DIES
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to GHOST_1
    • Actions
      • Set TempLoc = (Position of (Dying unit))
      • Unit - Create 1 Wraith for Neutral Hostile at TempLoc facing Default building facing degrees
      • Set GHOST_1 = (Last created unit)
      • Special Effect - Destroy GHOST_SE1
      • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Other\Silence\SilenceAreaBirth.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of GHOST_1 using Abilities\Spells\Orc\CommandAura\CommandAura.mdl
      • Set GHOST_SE1 = (Last created special effect)
      • Custom script: call RemoveLocation(udg_TempLoc)
 

Attachments

  • GHOSTS.w3x
    23.5 KB · Views: 34
Level 37
Joined
Mar 6, 2006
Messages
9,240
Maybe it's the periodic trigger.

  • CHANGE GHOSTS 1
    • Events
      • Time - Every (Random real number between 10.00 and 20.00) seconds of game time
    • Conditions
      • (GHOST_1 is alive) Equal to True
      • (GHOST_2 is alive) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GHOST_SIDE Equal to True
        • Then - Actions
          • Set GHOST_SIDE = False
          • Set GHOST_1 = Ghost 0000 <gen>
          • Set GHOST_2 = Ghost 0001 <gen>
          • ...
Replace those actions with these:

  • CHANGE GHOSTS 1
    • Events
      • Time - Every (Random real number between 10.00 and 20.00) seconds of game time
    • Conditions
      • (GHOST_1 is alive) Equal to True
      • (GHOST_2 is alive) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GHOST_SIDE Equal to True
        • Then - Actions
          • Set GHOST_SIDE = False
          • Set u = GHOST_1
          • Set GHOST_1 = GHOST_2
          • Set GHOST_2 = u
and in the else:

  • CHANGE GHOSTS 1
    • Events
      • Time - Every (Random real number between 10.00 and 20.00) seconds of game time
    • Conditions
      • (GHOST_1 is alive) Equal to True
      • (GHOST_2 is alive) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GHOST_SIDE Equal to True
        • Then - Actions
          • ...
        • Else - Actions
          • Set GHOST_SIDE = True
          • Set u = GHOST_2
          • Set GHOST_2 = GHOST_1
          • Set GHOST_1 = u
          • ...
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
Your trigger "GHOST 2 DIES" has the action "Set GHOST_1 = No unit". Perhaps the problem lies there.

It can't be because that's stage 2 already...

Maybe it's the periodic trigger.

  • CHANGE GHOSTS 1
    • Events
      • Time - Every (Random real number between 10.00 and 20.00) seconds of game time
    • Conditions
      • (GHOST_1 is alive) Equal to True
      • (GHOST_2 is alive) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GHOST_SIDE Equal to True
        • Then - Actions
          • Set GHOST_SIDE = False
          • Set GHOST_1 = Ghost 0000 <gen>
          • Set GHOST_2 = Ghost 0001 <gen>
          • ...
Replace those actions with these:

  • CHANGE GHOSTS 1
    • Events
      • Time - Every (Random real number between 10.00 and 20.00) seconds of game time
    • Conditions
      • (GHOST_1 is alive) Equal to True
      • (GHOST_2 is alive) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GHOST_SIDE Equal to True
        • Then - Actions
          • Set GHOST_SIDE = False
          • Set u = GHOST_1
          • Set GHOST_1 = GHOST_2
          • Set GHOST_2 = u
and in the else:

  • CHANGE GHOSTS 1
    • Events
      • Time - Every (Random real number between 10.00 and 20.00) seconds of game time
    • Conditions
      • (GHOST_1 is alive) Equal to True
      • (GHOST_2 is alive) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GHOST_SIDE Equal to True
        • Then - Actions
          • ...
        • Else - Actions
          • Set GHOST_SIDE = True
          • Set u = GHOST_2
          • Set GHOST_2 = GHOST_1
          • Set GHOST_1 = u
          • ...

YEAH! Now I understand what was my mistake. It was very simple I knew it. Once again, thanks thanks thanks. Rep for both.
 
Status
Not open for further replies.
Top