• 🏆 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 my trigger (spell)

Status
Not open for further replies.
Level 3
Joined
Apr 12, 2014
Messages
23
Hi!
I'm just learning triggering spells yet, and this is a - well, let's call it a "practice-spell". Normally I would fix myself the problems, but at this time I can't even imagine what can be the problem. So, here it is:
  • mySpell
    • Events
      • Unit - A unit finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to True
    • Actions
      • Set spell_Caster = (Casting Unit)
      • Set spell_Targeted = (Targeted unit of ability being cast)
      • If (All conditions are True) then do (Then actions) else do (Else actions)
        • If - Conditions
          • (spell_Targeted has buff(level 1)) Equal to True
        • Then - Actions
          • Unit - Pause spell_Targeted
          • Unit - Pause spell_Caster
          • Wait 3.00 seconds
          • Unit - Unpause spell_Caster
          • Unit - Kill spell_Targeted
        • Else - Actions
          • If (All conditions are True) then do (Then actions) else do (Else actions)
So, as the trigger is working well until killing spell_Targeted. If I noticed well, both unit become paused, spell_Caster will be unpaused after 3 seconds, but spell_Targeted won't be killed. I have tried to unpause spell_Targeted before killing it, but neither it works.
What can be the problem? How should I fix it?
 
Level 4
Joined
Nov 27, 2012
Messages
85
Try changing the event

  • Unit - A unit finishes casting an ability
to

  • Unit - A unit starts the effects of an ability
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
The problem is that this spell is not MUI. So if more than one unit casts it at a time or if the spell_Targeted variable is overwritten then it will not kill the correct unit.

You have to make this spell MUI to fix it. Take a look at my tutorial. The chapter how to index shows you how to properly make a MUI spell. This will bring you directly to that chapter in my tutorial. http://www.hiveworkshop.com/forums/...en-using-triggers-gui-233242/#Section 2 Ch 12
 
Level 3
Joined
Apr 12, 2014
Messages
23
Hm... But I want to to detect the buff. Are there buffs right in the moment when I start an effect? I will try anyway.
 
Level 4
Joined
Nov 27, 2012
Messages
85
The problem is that this spell is not MUI. So if more than one unit casts it at a time or if the spell_Targeted variable is overwritten then it will not kill the correct unit.

You have to make this spell MUI to fix it. Take a look at my tutorial. The chapter how to index shows you how to properly make a MUI spell. This will bring you directly to that chapter in my tutorial. http://www.hiveworkshop.com/forums/...en-using-triggers-gui-233242/#Section 2 Ch 12

It doesn't need to be MUI, it's possible there will only ever be 1 instant of the spell running.

If the buff you're detecting is applied from the casted spell, I'm not sure why you need the condition, otherwise move it to the original Conditions, without the variable
 
Level 3
Joined
Apr 12, 2014
Messages
23
The problem is that this spell is not MUI. So if more than one unit casts it at a time or if the spell_Targeted variable is overwritten then it will not kill the correct unit.

You have to make this spell MUI to fix it. Take a look at my tutorial. The chapter how to index shows you how to properly make a MUI spell. This will bring you directly to that chapter in my tutorial. http://www.hiveworkshop.com/forums/...en-using-triggers-gui-233242/#Section 2 Ch 12

I see. I will remember your advice, but I don't think that is the problem right now there are only three unit on the map, so it is impossible that more unit casts the spell at the same time. Plus, this is a custom spell, and I have given it only one unit. If I'm wrong about it, or I misunderstood your statement, just tell it.
 
Level 3
Joined
Apr 12, 2014
Messages
23
If the buff you're detecting is applied from the casted spell, I'm not sure why you need the condition, otherwise move it to the original Conditions, without the variable

You mean the If,Then, Else part, don't you? Well, in the future the spell has more than 1 level, and this will detect the level of the ability (each level has different buff). The Else actions will check if the spell_Targeted has the buff level 2 etc.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
If you want to know if your trigger detects the buff or not, try to add any action under the If/Then/Else action for example use Game - Show text: The buff is detected
If it's not detected then the problem might be the condition, maybe this unit returns null , so after this detect if even there is a targeted unit because the ability has finished actually so there is no target I think.
If the unit name isn't shown , then the spell_Targeted doesn't even exist, so you should change the event , otherwise you need to store the unit somehow to use it later ^^
  • Set spell_Targeted = (Targeted unit of ability being cast)
  • Game - Show text for (All Players) Using : (Unit name of (Spell_Targeted)
 
Level 3
Joined
Apr 12, 2014
Messages
23
If you want to know if your trigger detects the buff or not, try to add any action under the If/Then/Else action for example use Game - Show text: The buff is detected
If it's not detected then the problem might be the condition, maybe this unit returns null , so after this detect if even there is a targeted unit because the ability has finished actually so there is no target I think.
If the unit name isn't shown , then the spell_Targeted doesn't even exist, so you should change the event , otherwise you need to store the unit somehow to use it later ^^
  • Set spell_Targeted = (Targeted unit of ability being cast)
  • Game - Show text for (All Players) Using : (Unit name of (Spell_Targeted)

I have tried what you say. "Maybe" you're right, there's no unit name. After that I put a Cinematic mode on under the Then - Action, and nothing has happened. In the game I checked, the buff was on the unit, so the problem must be with the spell_Targeted unit.
So, what should I change exactly? What deathismyfriend said could help?
 
Level 4
Joined
Nov 27, 2012
Messages
85
you need to use the 2 lines I provided
When a unit finishes casting an ability, there is no target. You can't detect a buff being applied in the same trigger this way either.
You need a second trigger if you insist on doing it your way
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
There is no target when a spell finishes at all. If it's necessary to apply your trigger after the spell ends, then you should somehow store the spell_Targeted when the spell starts.
Also this condition, it's weird :D
  • (Ability being cast) Equal to True
====##=====
Do you have any trigger when the spell starts ? Maybe I can give an example for how to store the spell_Targeted when the spell starts
====##=====
 
Level 3
Joined
Apr 12, 2014
Messages
23
I see. Well, I haven't got trigger when the casting starts. Now I know what the problem, and what could be a possible solution, I will try to fix it myself first, though. I will see what can I do then I write it tomorrow for you. Thanks for the help so far.
 
Level 3
Joined
Apr 12, 2014
Messages
23
I was thinking and trying, I still can't do it. I'm (almost) sure the problem is with storing the spell_Targeted unit, so if you could show me how should I do it properly, I would appreciate it.
 
Level 19
Joined
Jul 14, 2011
Messages
875
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set spell_Targeted = (Target unit of ability being cast)
Imo, if its intended just for one unit youre better of just waiting the channel time in the trigger and then doing the actions.

Also, use TriggeringUnit instead of CastingUnit.
 
Level 3
Joined
Apr 12, 2014
Messages
23
That's all? I thought it is more complicated. :) Okay, I will do it tomorrow. I hope it's ready now. Thank you all.
 
Level 3
Joined
Apr 12, 2014
Messages
23
I have already tried that, the problem wasn't that. Anyway, the problem has been solved (for a long time), so it doesn't need to propose any other idea. If you want, I will read them all, but the problem is 'dead'.
 
Status
Not open for further replies.
Top