• 🏆 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] Some help with Corrosive Bolt

Status
Not open for further replies.
Level 6
Joined
Sep 19, 2006
Messages
179
I want some help with this spell. For one, I'm happy that I made a trigger that does work. Code below:
  • Coro Bolt Activation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Corrosive Bolt
      • (Level of Corrosive Bolt for Alchemist) Greater than or equal to 0
    • Actions
      • Set Alchemist = (Casting unit)
      • Set CB_AffectedUnit = (Target unit of ability being cast)
      • Set CB_Level = (Level of Corrosive Bolt for Alchemist)
      • Set CB_Damage = 100.00
      • Set CB_BonusDamage = 30.00
      • Set CB_Level3_Damage_Structure = 200.00
      • Set CB_Chance_Level3 = (Random integer number between 1 and 100)
      • Set CB_BonusEffect1 = Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
      • Set CB_BonusEffect2 = Objects\Spawnmodels\NightElf\NECancelDeath\NECancelDeath.mdl
      • Set CB_BonusEffect1_Removal = (Last created special effect)
      • Set CB_BonusEffect2_Removal = (Last created special effect)
      • -------- I specified the second condition for efficiency. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • -------- I set the damage that the spell will do against enemy units. --------
          • Unit - Cause Alchemist to damage CB_AffectedUnit, dealing (CB_Damage x (20.00 x (Real(CB_Level)))) damage of attack type Spells and damage type Normal
          • -------- Now, I set the bonus damage done to enemy units, if they have any of the 4 buffs mentioned in the Initiation part. --------
          • -------- I added the code that tells the trigger not to attack the mechanical units. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CB_AffectedUnit is Mechanical) Equal to False
              • Or - Any (Conditions) are true
                • Conditions
                  • (CB_AffectedUnit has buff Cripple) Equal to True
                  • (CB_AffectedUnit has buff Faerie Fire) Equal to True
                  • (CB_AffectedUnit has buff Purge) Equal to True
                  • (CB_AffectedUnit has buff Slow) Equal to True
            • Then - Actions
              • Unit - Cause Alchemist to damage CB_AffectedUnit, dealing (CB_BonusDamage + (20.00 x (Real(CB_Level)))) damage of attack type Spells and damage type Normal
              • -------- Now, it's time for the first special effect to show up and after that, I'll remove it. --------
              • Special Effect - Create a special effect attached to the origin of CB_AffectedUnit using CB_BonusEffect1
              • Special Effect - Destroy CB_BonusEffect1_Removal
              • -------- Now it's time to check the condition for the mechanical units and then make them take extra damage. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (CB_AffectedUnit is Mechanical) Equal to True
                  • CB_Level Greater than or equal to 2
                • Then - Actions
                  • Unit - Cause Alchemist to damage CB_AffectedUnit, dealing (CB_BonusDamage + (20.00 x (Real(CB_Level)))) damage of attack type Spells and damage type Normal
                  • -------- I apply the same special effect for mechanical units. --------
                  • Special Effect - Create a special effect attached to the origin of CB_AffectedUnit using CB_BonusEffect1
                  • Special Effect - Destroy CB_BonusEffect1_Removal
                  • -------- The trigger isn't done. Now we must check if the spell has reached level 3,... --------
                  • -------- ... if the spell has a 35% chance to deal bonus damage to enemy structures... --------
                  • -------- ... and if the spell targets an enemy structure. --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CB_Level Greater than or equal to 3
                      • (CB_AffectedUnit is A structure) Equal to True
                      • CB_Chance_Level3 Less than or equal to 35
                    • Then - Actions
                      • -------- If the conditions have been met, then it's time to cause bonus damage to enemy buildings. --------
                      • Unit - Cause Alchemist to damage CB_AffectedUnit, dealing CB_Level3_Damage_Structure damage of attack type Spells and damage type Normal
                      • -------- Now I use the 2nd special effect and after that, it's removed. --------
                      • Special Effect - Create a special effect attached to the orgin of CB_AffectedUnit using CB_BonusEffect2
                      • Special Effect - Destroy CB_BonusEffect2_Removal
                    • Else - Actions
                • Else - Actions
            • Else - Actions
        • Else - Actions
Of course, I added some comments, so that I don't forget what I'm doing. The thing that does make me go nuts is that every time I eliminate a unit, it does more damage than it normally does. The 1st level does 120 damaga and as you level up to 3, you do 160 damage. The spell does bonus damage when units with one of the 4 buffs exist. Any help here?
Edit: While I did fix the spell, by changing x to +, every time I hit a unit, it does damage instantly, instead of waiting for the projectile to interact with the unit. Any help with this?
 
Level 20
Joined
Aug 29, 2012
Messages
825
If you want to cause damage after the projectile hits, you'll need to put a wait.

The most accurate would be "Wait (Distance between (Position of Triggering unit) and (Position of Target unit of ability being cast) / [Your spell missile's speed (e.g. 800, 1000, etc)] seconds", and then trigger the damage.
Of course, store points in variables and remove them at the end of the trigger to avoid leaks, and make sure nothing else gets affected because of the wait.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
I want some help with this spell. For one, I'm happy that I made a trigger that does work. Code below:
  • Coro Bolt Activation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Corrosive Bolt
      • (Level of Corrosive Bolt for Alchemist) Greater than or equal to 0
Checking the level of ability for the unit is really pointless, if the unit casts that spell, then he has that ability, no? Else he wouldn't be able to cast it...

  • Set CB_BonusEffect1 = Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
    • Set CB_BonusEffect2 = Objects\Spawnmodels\NightElf\NECancelDeath\NECancelDeath.mdl
    • Set CB_BonusEffect1_Removal = (Last created special effect)
    • Set CB_BonusEffect2_Removal = (Last created special effect)
    • -------- I specified the second condition for efficiency. --------
I wouldn't even use more variables than you need such as strings (setting the model for the effect) but if that makes you see things clearer then fine. But just what the hell is Set CB_BonusEffect1_Removal and 2 for? You didn't create any special effects (maybe you created in an other unrelated trigger) yet so that doesn't do anything. You just have to create the special effect then right after creating it destroy it with
  • Special Effect - Destroy (Last created special effect)
.
Why do you have an empty if - condition? What does "I specified the second condition for efficiency." mean?
Before you make the first damage to the unit, you say you don't want to damage mechanical units, so you filter them out, BUT THEN you want to DAMAGE MECHANICAL UNITS when they have been filtered out of the condition, so the rest of the trigger won't fire and I am pretty confused.
Ok, being said these weird things I found in your trigger, let's break down even more your trigger into more depth.
Man, this is your main problem: if the level of ability is level 1 then the first damage will be 100 + 20 x 1 = 120 for unit A, (Keep in mind this unit A) then the bonus for units with those buffs will be 30 + 20 x 1 = 50 for unit A. This adds up to 170. Rest of the trigger doesn't fire, but still let's move on: damage for mechanical units 30 + 20 x 2 = 70 (has to be ability level 2, right?) damage for unit A, lastly, damage for structures: 200 damage for unit A.
Summing up, you're always damaging the same unit, the conditions don't magically change the unit classification or if it becomes a stucture or something else.
I still have no idea what you want to achieve and my guess is that when you did this trigger either you were very distracted or didn't know what you were doing at all, should give more info about what should the spell do more precisely.
 
Last edited:
Status
Not open for further replies.
Top