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

[Spell] Extending Trueshot Aura

Status
Not open for further replies.
Level 6
Joined
Sep 19, 2006
Messages
179
I thought why not make the aura regain the Priestess' health and mana(a bit)?
I did the coding myself:
  • Trueshot Aura advantage for PotM
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Priestess of the Moon
      • ((Attacking unit) belongs to an enemy of (Owner of (Attacked unit))) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Trueshot Aura(my version) for PriestessoftheMoon) Equal to 1
        • Then - Actions
          • Set TrueshotAuraValues = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TrueshotAuraValues Less than or equal to 15
            • Then - Actions
              • Unit - Set life of PriestessoftheMoon to ((Life of PriestessoftheMoon) + 20.00)
              • Unit - Set mana of PriestessoftheMoon to ((Mana of PriestessoftheMoon) + 10.00)
              • Special Effect - Create a special effect attached to the chest of PriestessoftheMoon using Abilities\Spells\Items\AIre\AIreTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Trueshot Aura(my version) for PriestessoftheMoon) Equal to 2
        • Then - Actions
          • Set TrueshotAuraValues = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TrueshotAuraValues Less than or equal to 30
            • Then - Actions
              • Unit - Set life of PriestessoftheMoon to ((Life of PriestessoftheMoon) + 40.00)
              • Unit - Set mana of PriestessoftheMoon to ((Mana of PriestessoftheMoon) + 20.00)
              • Special Effect - Create a special effect attached to the chest of PriestessoftheMoon using Abilities\Spells\Items\AIre\AIreTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Trueshot Aura(my version) for PriestessoftheMoon) Equal to 3
        • Then - Actions
          • Set TrueshotAuraValues = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TrueshotAuraValues Less than or equal to 45
            • Then - Actions
              • Unit - Set life of PriestessoftheMoon to ((Life of PriestessoftheMoon) + 60.00)
              • Unit - Set mana of PriestessoftheMoon to ((Mana of PriestessoftheMoon) + 30.00)
              • Special Effect - Create a special effect attached to the chest of PriestessoftheMoon using Abilities\Spells\Items\AIre\AIreTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
        • Else - Actions
I set PriestessoftheMoon as an Entering Unit at the start.
TrueshotAuraValues = Integer
I thoght this works, but when I tried it at the map, no effect were shows. Can anyone help me with this?
 
Level 8
Joined
Jul 10, 2018
Messages
383
The conditions are wrong i think,you can't make Unit type of Attacking unti Equal to priestess
and attacking unit belongs to an enemy of owner of attacked unit


that means Priestess is the owner of attacked unit
which doesn't make sense so i advice you to use Unit owned BY player attacked
try it if it doesn't work Reply.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
The condition works fine the way the OP wrote it, it's just logically backwards from the way most people would think about it. "Attacked unit is an enemy of owner of attacking unit" is the same thing as "Attacking unit is an enemy of owner of attacked unit". It's possible neutral hostile breaks this symmetry but I don't think it would. The condition that should be changed is actually Unit-type of... instead should just check if the attacker has the ability: Level of Trueshot Aura(my version) for (Attacking unit) greater than 0. This allows you to streamline your logic for the rest of the trigger instead of using those nasty if sequences.

The heal special effect may or may not appear properly because destroying an effect immediately after creating it only allows it to show its death animation, which the model you've chosen to use might not have. You can save the effect and destroy it slightly later by creating a fake local variable to hold the effect until it's ready to be removed. I did that below. I wish I could link a tutorial that explains this method in simple terms but googling doesn't find me one.

  • Trueshot Aura advantage for PotM
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Trueshot Aura(my version) for (Attacking Unit)) Greater than 0
      • ((Triggering Unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
    • Actions
      • Custom script: local effect udg_Trueshot_SFX
      • -------- The line above this MUST be the first line of the trigger -------
      • -------- Create a new SFX variable and call it whatever you like; here I've called it Trueshot_SFX --------
      • -------- If you use a different name, you need to change the line above so it matches the new name, but keep the udg_ before it --------
      • Set PriestessoftheMoon = (Attacking Unit) //Probably better to set this here unless you only have 1 of each hero in the game at any given time
      • Set Level = (Level of Trueshot Aura(my version) for PriestessoftheMoon)
      • Set TrueshotAuraValues = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TrueShotAuraValues Less than or equal to (15*Level)
        • Then - Actions
          • Unit - Set life of PriestessoftheMoon to ((Life of PriestessoftheMoon) + (20.00 x Level))
          • Unit - Set mana of PriestessoftheMoon to ((Mana of PriestessoftheMoon) + (10.00 x Level))
          • Special Effect - Create a special effect attached to the chest of PriestessoftheMoon using Abilities\Spells\Items\AIre\AIreTarget.mdl
          • Set Trueshot_SFX = (Last created special effect)
          • Wait 1.50 seconds
          • Special Effect - Destroy Trueshot_SFX
          • Set Trueshot_SFX = (no effect) //this option might or might not exist, if you can't find it just ignore this line
        • Else - Actions
Okay now that the trigger is 'optimized' we can tackle the real problem: A Unit is Attacked is ass. It's a terrible event that never fires when you think it will, can be abused, and should be removed from the game to stop tricking people like you into thinking this will work properly. What you really need to do is introduce a Damage Detection System into your map, and use that to figure out when the PotM damages an enemy. This will change the event and some of the unit references slightly but will be well worth it.
 
Level 6
Joined
Sep 19, 2006
Messages
179
I'll see if I can add that Damage Detection system into my map. Usually, when I try that, I end up with problems.
EDIT: I added the Damage Detection system into my map successfully! Got to figure out how to set the damage part.
 
Last edited:
Level 6
Joined
Sep 19, 2006
Messages
179
First of all, I really have no idea how to insert that damage detect system into my code. Second, I tried to see if the Priestess of the Moon does get the life and mana recovery, but no matter how hard I try, I'm having the result of the spell not working. Should I try to modify the TrueShotAuraValues Less than Equal to option?
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
I'm sorry, I linked you to a damage detection system that can't differentiate between attack damage (physical) and spell damage (spell). Instead of GDD you should use PDD: Physical Damage Detection for GUI v1.3.0.0 It shouldn't be that hard to switch out the triggers and delete the GDD variables you imported. There are sections in the resource post about how to implement and how to use PDD; look for the thing that says "OnDamage in GUI". Once it is properly set up, your trigger will look something like this:

  • Trueshot Aura advantage for PotM
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • (Level of Trueshot Aura(my version) for PDD_source) Greater than 0
      • ((PDD_source) belongs to an enemy of (Owner of (PDD_target))) Equal to True
      • PDD_damageType equal to PDD_Physical
    • Actions
      • Custom script: local effect udg_Trueshot_SFX
      • -------- The line above this MUST be the first line of the trigger -------
      • -------- Create a new SFX variable and call it whatever you like; here I've called it Trueshot_SFX --------
      • -------- If you use a different name, you need to change the line above so it matches the new name, but keep the udg_ before it --------
      • Set PriestessoftheMoon = PDD_source
      • Set Level = (Level of Trueshot Aura(my version) for PriestessoftheMoon)
      • Set TrueshotAuraValues = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TrueShotAuraValues Less than or equal to (15*Level)
        • Then - Actions
          • Unit - Set life of PriestessoftheMoon to ((Life of PriestessoftheMoon) + (20.00 x Level))
          • Unit - Set mana of PriestessoftheMoon to ((Mana of PriestessoftheMoon) + (10.00 x Level))
          • Special Effect - Create a special effect attached to the chest of PriestessoftheMoon using Abilities\Spells\Items\AIre\AIreTarget.mdl
          • Set Trueshot_SFX = (Last created special effect)
          • Wait 1.50 seconds
          • Special Effect - Destroy Trueshot_SFX
          • Set Trueshot_SFX = (no effect) //this option might or might not exist, if you can't find it just ignore this line
        • Else - Actions
If you try to make the above trigger and it still "doesn't work", try putting in some debug messages (Game - Display to (all players) the text "...") to see what parts of the code are running and what parts aren't. Is it failing at the conditions level? Is the random integer never less than 15*Level? Is PriestessoftheMoon properly set? etc. If you try that and still can't figure out why it's failing to work properly, post your trigger as-is here.
 
Level 6
Joined
Sep 19, 2006
Messages
179
While I think this doesn't work. every time I enter a map, every hero has firestrike as a normal spell. Any help?
 
Level 6
Joined
Sep 19, 2006
Messages
179
Thank you Pyrogasm, DTM and Light for you help, but I'll stick to the original system. While it's better for me, working with other systems seem to surpass me. I wanted to make the spell only for the Priestess of the Moon to be a bit better. At least I can make 'upped' spells.
 
Level 11
Joined
Feb 23, 2009
Messages
577
As a guy who really likes to stick within the boundaries of the world editor myself, I understand not wanting to use other people's systems.
That said, learning how to use these 2 systems will make your life 1000 times easier and will allow you to create almost any spell that you can think of flawlessly.

1) Unit Indexer (This will allow you to refer to units with ease, but you may not need this yet)

2) Damage Engine (All these do is detect when someone takes damage)


In my opinion, the easiest to use (and never had a problem with it, still use it often) is Bribe's damage detection engine.
It's short as F, works fast and well, and will allow you to understand how to use damage engines in general (so easy to use and very documented inside the demo).
 
Level 6
Joined
Sep 19, 2006
Messages
179
I decided to check Bribe's damage detection system, as that possibly prevented me from doing any major change to my map, but I can't seem to find it. It's in the spell's section, but it probably has a different name.
 
Status
Not open for further replies.
Top