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

[Trigger] Problem with doom counter and transfer of doom

Status
Not open for further replies.
Level 1
Joined
Sep 12, 2008
Messages
5
I'm having some problems with my custom doom skill. I want it to do a countdown instead of dealing damage per second and when the timer reaches 0 the victim dies. I've solved that. But my problem is the counter itself. I have made a map where you choose your own hero. At the point where the hero spawns a timer appears as soon as the map starts. It doesn't do anything, it just counts down from 20. I want to get rid of that timer.

My second problem is that I want doom to be transferable. If a unit that has been struck by doom attacks another unit the attacked unit gets the counter (which doesn't reset).

I found the code in an other forum and tried to adapt it to my map. So if you answer PLEASE DUMB IT DOWN :crazz:

Here is the code for my doom spell. Doom_Group is a unit group. The initial value is empty.
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Curse of Doom
  • Actions
    • Unit Group - Add (Target unit of ability being cast) to Doom_Group
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • And - All (Conditions) are true
      • Conditions
    • ((Triggering unit) is in Doom_Group) Equal to True
  • Actions
    • Unit Group - Remove (Attacking unit) from Doom_Group
    • Unit Group - Add (Attacked unit) to Doom_Group
My doom spell has 3 levels, but since this trigger works fine I'll just write 1/3 of it. It goes on to check if Curse of Doom is level 2 or level 3.
Doom_Level is an integer array with the size initial value 0 and the value is 1.
  • Events
    • Unit - A unit Starts the effect of an ability
  • (Ability being cast) Equal to Curse of Doom
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Doom_Level[(Player number of (Triggering player))] Equal to 1
    • Then - Actions
      • Set DoomSecondsRemaining = 40
      • Set DoomTarget = (Target unit of ability being cast)
      • Set TempPoint = (Position of DoomTarget)
  • Trigger - Turn on (This trigger)
  • Wait until (DoomSecondsRemaining Equal to 0), checking every 1.00 seconds
  • Trigger - Turn off (This trigger)
    • Unit - Kill DoomTarget
      • Else - Actions
        • Do nothing
RemoveLocation doesn't refer to anything. Perhaps that is my problem.
  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
    • DoomSecondsRemaining Not equal to 0
  • Actions
    • Set TempPoint = (Position of DoomTarget)
    • Floating Text - Create floating text that reads (String(DoomSecondsRemaining)) at TempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 40.00%, 0.00%), and 0.00% transparency
    • Set DoomSecondsRemaining = (DoomSecondsRemaining - 1)
    • Wait 1.00 seconds
    • Floating Text - Destroy (Last created floating text)
    • Custom script: call RemoveLocation(udg_TempPoint)
You buy you own skills just like TGS so I made a trigger that counted how many times you have bought doom, so I can make the timer decrease with each level.
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Curse of Doom
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Doom_Level[(Player number of (Owner of (Triggering unit)))] Less than or equal to 2
      • Then - Actions
        • Set Doom_Level[(Player number of (Owner of (Triggering unit)))] = (Doom_Level[(Player number of (Owner of (Triggering unit)))] + 1)
      • Else - Actions
        • Do nothing
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
With this 'timer', do you mean a real timer, or the floating text appearing above the unit's head?


For your second problem, you should try adding a temp variable to save the seconds left.

  • Actions
    • Set TempTransfer = DoomSecondsRemaining
    • Unit Group - Remove (Attacking unit) from Doom_Group
    • Unit Group - Add (Attacked unit) to Doom_Group
Then load TempTransfer to the new unit (don't know the command, since I don't have WE available now)
 
Level 1
Joined
Sep 12, 2008
Messages
5
With this 'timer', do you mean a real timer, or the floating text appearing above the unit's head?

I mean the floating text appearing above the unit's head.


If you look at this picture you will see a timer in the left hand side of the picture. It counts down from 20 when the game starts and once it reaches 0 it disappears. Nothing happens when it reaches 0. It doesn't look good to have a timer there. I hope that explains it.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
If it counts down from 20, then it doesn't have anything in common with your Curse of Doom ability I assume, since that ability counts down from 40, unless you have a Melee Initialization of exactly 20 seconds.

Check all your other triggers (not just Melee Initialization) for anything containing 20 as value and see if it could have something in common with it.
 
Level 1
Joined
Sep 12, 2008
Messages
5
If it counts down from 20, then it doesn't have anything in common with your Curse of Doom ability I assume, since that ability counts down from 40, unless you have a Melee Initialization of exactly 20 seconds.

Check all your other triggers (not just Melee Initialization) for anything containing 20 as value and see if it could have something in common with it.

DoomSecondsRemaining is an integer with the initial value of 20. I tried to set the value to 0 and that caused the timer to disappear. But it created a new problem.

Perhaps you can get something from seeing the original code (the code I tried to adapt to my map). http://www.thehelper.net/forums/showthread.php?t=63307&highlight=doom
As you can see there is a permanent number where the rifleman is when I cast doom on it. It doesn't happen when I set the initial value of DoomSecondsRemaining to 20. The doom timer is 20 at level 3.
  • Curse of Doom
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Curse of Doom
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Doom_Level[(Player number of (Triggering player))] Equal to 1
        • Then - Actions
          • Set DoomSecondsRemaining = 40
          • Set DoomTarget = (Target unit of ability being cast)
          • Set TempPoint = (Position of DoomTarget)
          • Trigger - Turn on (This trigger)
          • Wait until (DoomSecondsRemaining Equal to 0), checking every 1.00 seconds
          • Trigger - Turn off (This trigger)
          • Unit - Kill DoomTarget
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Doom_Level[(Player number of (Triggering player))] Equal to 2
            • Then - Actions
              • Set DoomSecondsRemaining = 30
              • Set DoomTarget = (Target unit of ability being cast)
              • Set TempPoint = (Position of DoomTarget)
              • Trigger - Turn on (This trigger)
              • Wait until (DoomSecondsRemaining Equal to 0), checking every 1.00 seconds
              • Trigger - Turn off (This trigger)
              • Unit - Kill DoomTarget
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Doom_Level[(Player number of (Triggering player))] Equal to 3
                • Then - Actions
                  • Set DoomSecondsRemaining = 20
                  • Set DoomTarget = (Target unit of ability being cast)
                  • Set TempPoint = (Position of DoomTarget)
                  • Trigger - Turn on (This trigger)
                  • Wait until (DoomSecondsRemaining Equal to 0), checking every 1.00 seconds
                  • Trigger - Turn off (This trigger)
                  • Unit - Kill DoomTarget
                • Else - Actions
                  • Do nothing
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
The computer shouldn't even know that the variable 'DoomSecondsRemaining' exists if that variable is created for the first time when you cast Curse of Doom for the first time. If it does, you either have the trigger activated in another trigger, or you set that variable elsewhere already somewhere before.
 
Level 1
Joined
Sep 12, 2008
Messages
5
It's not activated anywhere else. I only use the variable DoomSecondsRemaining on the triggers posted in this topic
 
Status
Not open for further replies.
Top