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

Causing damage to a unit with Triggers and variables.

Status
Not open for further replies.
Level 5
Joined
Jul 13, 2010
Messages
84
I'm making this trigger which when cast is supposed to pause both the target and the user and then 5 times a second for the 6 second duration the target is supposed to take damage based on the level of the ability. This is how I have it set up:

Abilityy
Events
Unit - A unit Finishes casting an ability
Conditions
(Ability being cast) Equal to Ability
Actions
Set chargetarget[TempInt] = (Target unit of ability being cast)
Unit - Pause (Triggering unit)
Unit - Pause chargetarget[TempInt]
Unit - Pause (Target unit of ability being cast)
Trigger - Turn on Attack Anim <gen>

Attack Anim
Events
Time - Every 0.20 seconds of game time
Conditions
Actions
Animation - Play Attacker 0030 <gen>'s Attack animation
Unit - Cause Attacker 0030 <gen> to damage chargetarget[TempInt], dealing (1.00 + damage[(Level of Ability for (Triggering unit))]) damage of attack type Chaos and damage type Death

chargetarget= Unit Array
TempInt= Integer

It doesn't do damage and the target doesn't freeze when the spell is cast.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Unit - A unit Finishes casting an ability
Change to A unit Starts the effect of an ability

I suggest that you save (Triggering unit) into a variable.


Unit - Pause chargetarget[TempInt]
Unit - Pause (Target unit of ability being cast)
Why do you pause the same unit ?

Unit - Cause Attacker 0030 <gen> to damage chargetarget[TempInt], dealing (1.00 + damage[(Level of Ability for (Triggering unit))]) damage of attack type Chaos and damage type Death
As I said, save the (Triggering unit) into a variable and use it here "Cause YourTriggeringUnitVariable to damage bla bla bla..."
Also, it should be "damage[(Level of Ability for YourTriggeringUnitVariable)]"

You used (Triggering unit) there, the event and the reference does not meet up (Trigger "Attack Anim")
 
Level 5
Joined
Jul 13, 2010
Messages
84
Thanks, I changed the casting part.
Well I tried Target unit of ability being cast but it didnt work
so I did a thing where i set the target unit into a variable and just repeated it, but neither work and I don't know why.
How do I trigger the damage part, or is that right?
 
Status
Not open for further replies.
Top