• 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.

A problem with ability.

Status
Not open for further replies.

SpasMaster

Hosted Project: SC
Level 24
Joined
Jan 29, 2010
Messages
1,986
Hello, everyone!

I am trying to make an ability that has the following effect:

"Instantly deals moderate damage to the target and leaves a debuff on it. The debuff lasts for 8 seconds. Any damage dealt to the target while it has the debuff will accumulate. After the debuff ends, the target will take 50%/100% of the acumulated damage."

Basically the only thing that doesn't work is that no damage is dealt when the debuff is gone.

I will post triggers below and I just want to mention that only One unit will use this ability, so it doesn't need to be MUI. There is a wait action, don't freak out. The spell has 100 seconds cooldown cause it's an ultimate.

Help will be appreciated.

Triggers:
[trigger="Initially ON"]Mutilate
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Mutiliate
Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing ((150.00 x (Real((Level of Mutiliate for (Triggering unit))))) + (2.00 x (Real((Agility of (Triggering unit) (Include bonuses)))))) damage of attack type Spells and damage type Normal
Trigger - Turn on Mutiliate Damage <gen>
Wait 7.50 seconds
Trigger - Turn off Mutiliate Damage <gen>
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Target unit of ability being cast) has buff Mutilate ) Equal to True
Then - Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing ((0.50 x (Real((Level of Mutiliate for (Triggering unit))))) x Mutiliate_DamageDealt) damage of attack type Spells and damage type Normal
Set Mutiliate_DamageDealt = 0.00
Special Effect - Create a special effect attached to the origin of (Target unit of ability being cast) using Objects\Spawnmodels\Orc\OrcSmallDeathExplode\OrcSmallDeathExplode.mdl
Special Effect - Destroy (Last created special effect)
Else - Actions
[/trigger]


[trigger="Initially ON"]Mutiliate Detect
Events
Unit - A unit enters (Playable map area)
Conditions
Actions
Trigger - Add to Mutiliate Damage <gen> the event (Unit - (Entering unit) Takes damage)
[/trigger]


[trigger="Initially ON"]Mutiliate Check
Events
Map initialization
Conditions
Actions
Set Mutilate_Group = (Units in (Playable map area))
Unit Group - Pick every unit in Mutilate_Group and do (Trigger - Add to Mutiliate Damage <gen> the event (Unit - (Picked unit) Takes damage))
Custom script: call DestroyGroup(udg_Mutilate_Group)
[/trigger]


[trigger="Initially OFF"]Mutiliate Damage
Events
Conditions
And - All (Conditions) are true
Conditions
(Unit-type of (Damage source)) Equal to |c00ff3366Marauder|r
((Triggering unit) has buff Mutilate ) Equal to True
Actions
Set Mutiliate_DamageDealt = (Mutiliate_DamageDealt + (Damage taken))
[/trigger]


P.S. I will be able to respond tommorow.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
After any Wait action only (Triggering Unit) works. Target Unit of Ability Being cast returns null, so, "null" doesn't have the buff -> "null" doesn't take damage. You have to store the target unit in a variable and use that variable after the "wait".
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Other Event Responses are for triggers with multiple events... maybe specific unit events or something. Somehow I've never been in a situation where (Triggering Unit) isn't enough xD

Anyway, i'm sure this guy has the answer to your question:

4092191.jpg

 
Level 16
Joined
Dec 15, 2011
Messages
1,423
I wonder why it works like that ^^ Somehow only triggering unit is worth using, but why is it like this?

It is Target unit of ability being cast. The present progressive tense refers to an action happening at the instance we speak or in this case, a unit starts the effect of an ability. Therefore, it would work only if there is no wait. Just my guess though ^^

@OP: You will probably want to cache the repeated Triggering Unit for the sake of performance.
 
Level 5
Joined
May 6, 2013
Messages
125
It is Target unit of ability being cast. The present progressive tense refers to an action happening at the instance we speak or in this case, a unit starts the effect of an ability. Therefore, it would work only if there is no wait.

I would probably go the other way around:
As especially the Jass names (GetTriggerUnit, GetTriggerPlayer and GetTriggeringTrigger (I guess 'GetTriggerTrigger' sounded dumb while 'GetTrigger' was too general)) imply, those variables which are save to use after a wait are attributes of the trigger fireing. They are rather general and have not been created with any special event in mind. Because they are attributes of that trigger, they differ for each trigger calling these functions, and they are still valid after waits.
Now, when the actual events came, those general attributes were used, but for some events like spell-casting, they simply were not enough to deliver all the information needed. Probably because it would be overkill to give the trigger an attribute for every possible event, or because it would change the appearance of the trigger all the time, or for whatever reason, an easier approach was taken, which is to use some kind of global variable for those events. Their name does not contain 'Trigger' anymore as they do not belong to any trigger, but rather to the event itself, from which there is only one (you can register it multiple times to different triggers as the name 'RegisterEvent' suggests, but that very event is only there once, if you see it that way. Or maybe you don't see it that way, fact is, the event type gets only one global).
Now, the globals suffer from the same prolem that user defined globals suffer from, but you know that story allready.
Again, thats just a guess from my part, but it makes sense to me and is an easy way to memorize it: if there's a trigger in the name, its wait-proof.
 

SpasMaster

Hosted Project: SC
Level 24
Joined
Jan 29, 2010
Messages
1,986
After any Wait action only (Triggering Unit) works. Target Unit of Ability Being cast returns null, so, "null" doesn't have the buff -> "null" doesn't take damage. You have to store the target unit in a variable and use that variable after the "wait".

This has fixed it. Thanks for the help! +rep to everyone!

EDIT: except Doomlord. Gotta spread some in order to give you! :D
 
Status
Not open for further replies.
Top