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

Simple trigger spell won't work?

Status
Not open for further replies.
Level 11
Joined
Jun 26, 2014
Messages
497
  • Wolf Form swap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Wolf Form
    • Actions
      • Unit - Add Vampiric Aura to temp_unitwolfform
      • Unit - Set level of Vampiric Aura for temp_unitwolfform to (Level of Critical Strike for temp_unitwolfform)
      • Wait 0.30 seconds
      • Unit - Remove Critical Strike from temp_unitwolfform
  • Wolf Form swap2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Wolf Form
    • Actions
      • Unit - Add Critical Strike to temp_unitwolfform
      • Unit - Set level of Critical Strike for temp_unitwolfform to (Level of Vampiric Aura for temp_unitwolfform)
      • Wait 0.30 seconds
      • Unit - Remove Vampiric Aura from temp_unitwolfform
The 1st triggers are when the Hero is turning into a wolf and the second triggers are when he goes back to his original form. The idea is when he becomes a wolf he loses his crit chance and gains vampiric aura, also vampiric aura should be set the same level as crit chance and vice versa when he becomes human. I don't see the problem doe, why won't it work?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
It doesnt work because it both runs instantly.
It adds both critical strike and vampiric aura and then after 0.3 seconds, it removes both again.

What you have to do is make it slightly different.
Make an If/Then/Else and use as condition "Level of Critical Strike of Unit is greater than or equal to 1"
This will tell if the unit has critical strike which means that it is a human.
If that is true (Then block), you add vampiric aura and remove critical strike.
If that is false (Else block), you add critical strike and remove vampiric aura.
Also remove the waits, they do nothing.

EDIT:
Oh yes, if you are using a real transform ability, you also have to make the ability permanent to the unit.
I dont really know if the GUI action for it exists even though there is a BJ function for it, but you can make a custom script like this:
  • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A000')
Go to the object editor and find the ability you want to add.
When you found it, press [ctrl] + [d] and it will show a 4 character code in front of the name in the list.
That 4 character code must be placed between the '' tags.
Place that custom script after adding the abilities.
 
Level 11
Joined
Jun 26, 2014
Messages
497
Okay I got what I have to do BUT! What kind of condition is that? I cannot find the condition for ability level. Also I am using the Druid of Claw bear from ability so it is permament.
Edit: Found the condition but now it won't give me the Vampiric Ability, it only removes the Critical Strike one. Could the problem be because when transforming he is changing into another unit? But why would it remove the Critical Strike and not give me Vampiric Aura?
Edit2: Btw It gives me only the Vampiric Aura buff for about 2-3 seconds and then it goes away?
 
Level 11
Joined
Jun 26, 2014
Messages
497
  • Wolf Form swap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Wolf Form
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Critical Strike for temp_unitwolfform) Greater than or equal to 1
        • Then - Actions
          • Unit - Add Vampiric Aura to temp_unitwolfform
          • Unit - Set level of Vampiric Aura for temp_unitwolfform to (Level of Critical Strike for temp_unitwolfform)
          • Unit - Remove Critical Strike from temp_unitwolfform
          • Wait 0.30 seconds
          • Trigger - Turn on Wolf Form swap2 <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Wolf Form swap2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Wolf Form
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Vampiric Aura for temp_unitwolfform) Greater than or equal to 1
        • Then - Actions
          • Unit - Add Critical Strike to temp_unitwolfform
          • Unit - Set level of Critical Strike for temp_unitwolfform to (Level of Vampiric Aura for temp_unitwolfform)
          • Unit - Remove Vampiric Aura from temp_unitwolfform
          • Wait 0.30 seconds
          • Trigger - Turn on Wolf Form swap <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
What's wrong with it :/ ?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You have to make it one trigger.
Also dont use global variables that lead to a unit directly.
I suggest starting to make abilities etc MUI as much as you can.
(You still have to place the 4 character codes in there.)
  • Transform
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Bear Form
    • Actions
      • Set temp_unitwolfform = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Critical Strike for temp_unitwolfform) Greater than or equal to 1
        • Then - Actions
          • Unit - Add Vampiric Aura to temp_unitwolfform
          • Unit - Set level of Vampiric Aura for temp_unitwolfform to (Level of Critical Strike for temp_unitwolfform)
          • Custom script: call UnitMakeAbilityPermanent(udg_temp_unitwolfform, true, 'A000')
          • Unit - Remove Critical Strike from temp_unitwolfform
        • Else - Actions
          • Unit - Add Critical Strike to temp_unitwolfform
          • Unit - Set level of Critical Strike for temp_unitwolfform to (Level of Vampiric Aura for temp_unitwolfform)
          • Custom script: call UnitMakeAbilityPermanent(udg_temp_unitwolfform, true, 'A001')
          • Unit - Remove Vampiric Aura from temp_unitwolfform
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Well, the custom script is something that I dont know why it is needed :D

Anyway, when you transform your unit, your unit gets some kind of refreshed using a new object id.
That said, it will lose ALL abilities added via triggers unless they are made permanent.
So you have to call a function that makes the ability permanent after he gained it.
Because there is no GUI action to do it, you have to use a custom script.
But I dont really know why all abilities are removed... Kind of Blizzard logic.


Anyway, to your other question, when you activate the transform ability (Bear Form, Wolf Form) this trigger runs.
It will check if the unit has the ability Critical Strike (which it has from the start of the game).
If so, the caster transformed into a werewolf.
So you add vampiric aura, set its level and remove critical strike.
Because the unit is still transforming, and the abilities will be removed, you have to make it permanent as well. (Making abilities permanent should therefor be done in every single case, no matter what.)

In your trigger, it runs the first one, checks if he has critical strike, adds vampiric aura and removes critical strike, but then also runs the other trigger so the vampiric aura is immediately removed and critical strike is added.
Thats why yours didnt work.
Try to place things in the same trigger as much as possible.
If/Then/Else functions are often more usefull than multiple triggers.
 
Status
Not open for further replies.
Top